diff --git a/build.gradle b/build.gradle index feb50dd..7b3afe2 100644 --- a/build.gradle +++ b/build.gradle @@ -15,6 +15,7 @@ loom { repositories { mavenCentral() + maven { url = "https://jitpack.io" } maven { name = 'Babric' url = 'https://maven.glass-launcher.net/babric' @@ -39,6 +40,22 @@ repositories { } metadataSources { artifact() } } + ivy { + url = "https://github.com/Turnip-Labs" + patternLayout { + artifact "[organisation]/releases/download/[revision]/[module]-[revision].jar" + m2compatible = true + } + metadataSources { artifact() } + } + ivy { + url = "https://github.com/Turnip-Labs" + patternLayout { + artifact "[organisation]/releases/download/[revision]/[module]-bta-[revision].jar" + m2compatible = true + } + metadataSources { artifact() } + } ivy { url = "https://piston-data.mojang.com" patternLayout { @@ -47,6 +64,14 @@ repositories { } metadataSources { artifact() } } + ivy { + url = "https://github.com/MartinSVK12" + patternLayout { + artifact "[organisation]/releases/download/[revision]/[module]-[revision].jar" + m2compatible = true + } + metadataSources { artifact() } + } } dependencies { @@ -54,13 +79,24 @@ dependencies { mappings loom.layered() {} modRuntimeOnly "objects:client:43db9b498cb67058d2e12d394e6507722e71bb45" // https://piston-data.mojang.com/v1/objects/43db9b498cb67058d2e12d394e6507722e71bb45/client.jar - modImplementation "babric:fabric-loader:${project.loader_version}" + modImplementation "fabric-loader:fabric-loader:${project.loader_version}" // Helper library - modImplementation "bta-halplibe:halplibe:${project.halplibe_version}" + // If you do not need Halplibe you can comment this line out or delete this line + modImplementation "com.github.Turnip-Labs:bta-halplibe:${project.halplibe_version}" + + modImplementation "ModMenu:ModMenu:2.0.0" + + implementation "org.slf4j:slf4j-api:1.8.0-beta4" + implementation "org.apache.logging.log4j:log4j-slf4j18-impl:2.16.0" + + implementation 'com.google.guava:guava:30.0-jre' + implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.9' - modImplementation "org.slf4j:slf4j-api:1.8.0-beta4" - modImplementation "org.apache.logging.log4j:log4j-slf4j18-impl:2.16.0" + var log4jVersion = "2.20.0" + implementation("org.apache.logging.log4j:log4j-core:${log4jVersion}") + implementation("org.apache.logging.log4j:log4j-api:${log4jVersion}") + implementation("org.apache.logging.log4j:log4j-1.2-api:${log4jVersion}") } java { diff --git a/gradle.properties b/gradle.properties index 018cf2c..131ee40 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,15 +1,15 @@ org.gradle.jvmargs=-Xmx2G # BTA -bta_version=1.7.6.2_02 +bta_version=1.7.7.0_02 # Loader -loader_version=0.14.19-babric.1 +loader_version=0.14.19-babric.1-bta # HalpLibe -halplibe_version=1.1.4 +halplibe_version=2.1.6 # Mod -mod_version=1.1.1 +mod_version=1.2.0 mod_group=youngsditch mod_name=ancientlogistics diff --git a/src/main/java/youngsditch/ancientlogistics/AncientLogistics.java b/src/main/java/youngsditch/ancientlogistics/AncientLogistics.java index af482f4..56b70f4 100644 --- a/src/main/java/youngsditch/ancientlogistics/AncientLogistics.java +++ b/src/main/java/youngsditch/ancientlogistics/AncientLogistics.java @@ -1,7 +1,11 @@ package youngsditch.ancientlogistics; -import turniplabs.halplibe.helper.*; -import net.minecraft.src.*; +import turniplabs.halplibe.helper.BlockBuilder; +import turniplabs.halplibe.helper.ItemHelper; +import turniplabs.halplibe.helper.RecipeHelper; +import net.minecraft.client.sound.block.BlockSounds; +import net.minecraft.core.block.Block; +import net.minecraft.core.item.Item; import net.fabricmc.api.ModInitializer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -14,19 +18,19 @@ public class AncientLogistics implements ModInitializer { public static final String MOD_ID = "ancientlogistics"; public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID); public static final Config config = new Config(MOD_ID, new Properties() {{ - put("gearID", "140"); - put("gearboxID", "900"); - put("geartrommelID", "901"); - put("gearchestID", "902"); - put("reinforcedgearboxID", "903"); + put("gearID", "17000"); + put("gearboxID", "905"); + put("geartrommelID", "906"); + put("gearchestID", "907"); + put("reinforcedgearboxID", "908"); // More keys and values... }}); public static final Item gear = ItemHelper.createItem(MOD_ID, new Item(config.getInt("gearID")), "gear", "gear.png"); - public static final Block gearBlock = BlockHelper.createBlock(MOD_ID, new GearBox(config.getInt("gearboxID")), "gearbox", "gear_top.png", "gear_block.png", Block.soundMetalFootstep, 0.1f, 0.1f, 0.0f); - public static final Block reinforcedGearBlock = BlockHelper.createBlock(MOD_ID, new ReinforcedGearBox(config.getInt("reinforcedgearboxID")), "reinforcedgearbox", "gear_top.png", "reinf_gear_block.png", Block.soundMetalFootstep, 0.1f, 0.1f, 0.0f); - public static final Block gearTrommelBlock = BlockHelper.createBlock(MOD_ID, new GearTrommel(config.getInt("geartrommelID")), "geartrommel", "gear_top.png", "gear_trommel.png", Block.soundMetalFootstep, 0.1f, 0.1f, 0.0f); - public static final Block gearChestBlock = BlockHelper.createBlock(MOD_ID, new GearChestSorter(config.getInt("gearchestID")), "gearchest", "gear_top.png", "gear_chest.png", Block.soundWoodFootstep, 0.1f, 0.1f, 0.0f); + public static final Block gearBlock = new BlockBuilder(MOD_ID).setTextures("gear_block.png").setBlockSound(BlockSounds.METAL).build(new GearBox("gearbox", config.getInt("gearboxID"))); + public static final Block reinforcedGearBlock = new BlockBuilder(MOD_ID).setTextures("reinf_gear_block.png").setBlockSound(BlockSounds.WOOD).build(new ReinforcedGearBox("reinforcedgearbox", config.getInt("reinforcedgearboxID"))); + public static final Block gearTrommelBlock = new BlockBuilder(MOD_ID).setTextures("gear_trommel.png").setBlockSound(BlockSounds.METAL).build(new GearTrommel("geartrommel", config.getInt("geartrommelID"))); + public static final Block gearChestBlock = new BlockBuilder(MOD_ID).setTextures("gear_chest.png").setBlockSound(BlockSounds.WOOD).build(new GearChestSorter("gearchest", config.getInt("gearchestID"))); @Override public void onInitialize() { diff --git a/src/main/java/youngsditch/ancientlogistics/gears/GearBlock.java b/src/main/java/youngsditch/ancientlogistics/gears/GearBlock.java index 5fb2597..9a8c470 100644 --- a/src/main/java/youngsditch/ancientlogistics/gears/GearBlock.java +++ b/src/main/java/youngsditch/ancientlogistics/gears/GearBlock.java @@ -1,12 +1,13 @@ package youngsditch.ancientlogistics.gears; -import net.minecraft.src.*; +import net.minecraft.core.block.Block; +import net.minecraft.core.block.material.Material; public class GearBlock extends Block { protected static final int[][] NEIGHBORS = {{1, 0, 0}, {-1, 0, 0}, {0, 0, 1}, {0, 0, -1}}; - public GearBlock(int id) { - super(id, Material.iron); + public GearBlock(String key, int id) { + super(key, id, Material.metal); } } diff --git a/src/main/java/youngsditch/ancientlogistics/gears/GearBox.java b/src/main/java/youngsditch/ancientlogistics/gears/GearBox.java index f48cc62..44119a8 100644 --- a/src/main/java/youngsditch/ancientlogistics/gears/GearBox.java +++ b/src/main/java/youngsditch/ancientlogistics/gears/GearBox.java @@ -2,7 +2,7 @@ public class GearBox extends GearGenerator { - public GearBox(int id) { - super(id); + public GearBox(String key, int id) { + super(key, id); } } diff --git a/src/main/java/youngsditch/ancientlogistics/gears/GearChestSorter.java b/src/main/java/youngsditch/ancientlogistics/gears/GearChestSorter.java index 7b36a7a..c981047 100644 --- a/src/main/java/youngsditch/ancientlogistics/gears/GearChestSorter.java +++ b/src/main/java/youngsditch/ancientlogistics/gears/GearChestSorter.java @@ -4,14 +4,19 @@ import java.util.ArrayList; import java.util.Comparator; -import net.minecraft.src.*; +import net.minecraft.core.block.Block; +import net.minecraft.core.block.BlockChest; +import net.minecraft.core.block.entity.*; +import net.minecraft.core.entity.player.*; +import net.minecraft.core.world.World; +import net.minecraft.core.item.ItemStack; import youngsditch.ancientlogistics.AncientLogistics; import youngsditch.ancientlogistics.mixin.ChestAccessor; public class GearChestSorter extends GearUsable { - public GearChestSorter(int id) { - super(id); + public GearChestSorter(String key, int id) { + super(key, id); } class ChestWithDistance { diff --git a/src/main/java/youngsditch/ancientlogistics/gears/GearGenerator.java b/src/main/java/youngsditch/ancientlogistics/gears/GearGenerator.java index 31d787c..81e7001 100644 --- a/src/main/java/youngsditch/ancientlogistics/gears/GearGenerator.java +++ b/src/main/java/youngsditch/ancientlogistics/gears/GearGenerator.java @@ -1,6 +1,9 @@ package youngsditch.ancientlogistics.gears; -import net.minecraft.src.*; +import net.minecraft.core.entity.player.EntityPlayer; +import net.minecraft.core.world.World; +import net.minecraft.core.block.Block; +import net.minecraft.core.item.Item; import java.util.Random; @@ -8,8 +11,8 @@ public class GearGenerator extends GearBlock { private Random rand = new Random(); protected boolean canRunMultiple = false; - public GearGenerator(int id) { - super(id); + public GearGenerator(String key, int id) { + super(key, id); this.rand = new Random(); } @@ -18,7 +21,7 @@ public boolean isCovered(World world, int x, int y, int z) { } public boolean playerHasBone(EntityPlayer player) { - return player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().itemID == Item.bone.itemID; + return player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().itemID == Item.bone.id; } public boolean interactable(World world, int x, int y, int z, EntityPlayer player) { @@ -77,7 +80,7 @@ public void showWorking(World world, int x, int y, int z, EntityPlayer player) { (this.rand.nextFloat() - 0.5) / 100, (this.rand.nextFloat() - 0.5) / 100); } - player.worldObj.playSoundAtEntity(player, "mob.skeletonhurt", 0.25f, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2f + 1.0f)/2.0f); + player.world.playSoundAtEntity(player, "mob.skeletonhurt", 0.25f, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2f + 1.0f)/2.0f); } public void showNotWorking(World world, int x, int y, int z, EntityPlayer player) { @@ -96,7 +99,7 @@ public void showNotWorking(World world, int x, int y, int z, EntityPlayer player @Override public boolean blockActivated(World world, int x, int y, int z, EntityPlayer player) { - if(world.isMultiplayerAndNotHost) { + if(world.isClientSide) { return true; } @@ -140,7 +143,7 @@ public boolean blockActivated(World world, int x, int y, int z, EntityPlayer pla for (int i = 0; i < value; i++) { if (this.rand.nextInt(10) == 0) { // log break - player.worldObj.playSoundAtEntity(player, "mob.skeletonhurt", 0.5f, 1.0f); + player.world.playSoundAtEntity(player, "mob.skeletonhurt", 0.5f, 1.0f); if(playerHasBone(player) && player.getCurrentEquippedItem().stackSize > 0) { player.getCurrentEquippedItem().consumeItem(player); } diff --git a/src/main/java/youngsditch/ancientlogistics/gears/GearTrommel.java b/src/main/java/youngsditch/ancientlogistics/gears/GearTrommel.java index b551e46..044460e 100644 --- a/src/main/java/youngsditch/ancientlogistics/gears/GearTrommel.java +++ b/src/main/java/youngsditch/ancientlogistics/gears/GearTrommel.java @@ -1,12 +1,16 @@ package youngsditch.ancientlogistics.gears; import youngsditch.ancientlogistics.mixin.TrommelAccessor; -import net.minecraft.src.*; +import net.minecraft.core.block.Block; +import net.minecraft.core.block.entity.TileEntityTrommel; +import net.minecraft.core.world.World; +import net.minecraft.core.entity.player.EntityPlayer; +import net.minecraft.core.block.BlockTrommel; public class GearTrommel extends GearUsable { - public GearTrommel(int id) { - super(id); + public GearTrommel(String key, int id) { + super(key, id); } // returns true if a sieve is found diff --git a/src/main/java/youngsditch/ancientlogistics/gears/GearUsable.java b/src/main/java/youngsditch/ancientlogistics/gears/GearUsable.java index 7e20231..6e8a734 100644 --- a/src/main/java/youngsditch/ancientlogistics/gears/GearUsable.java +++ b/src/main/java/youngsditch/ancientlogistics/gears/GearUsable.java @@ -1,12 +1,14 @@ package youngsditch.ancientlogistics.gears; import java.util.ArrayList; -import net.minecraft.src.*; +import net.minecraft.core.world.World; +import net.minecraft.core.entity.player.EntityPlayer; +import net.minecraft.core.block.Block; public class GearUsable extends GearBlock { - public GearUsable(int id) { - super(id); + public GearUsable(String key, int id) { + super(key, id); } public int onGearUsed(World world, int x, int y, int z, EntityPlayer player, boolean canConnect) { diff --git a/src/main/java/youngsditch/ancientlogistics/gears/ReinforcedGearBox.java b/src/main/java/youngsditch/ancientlogistics/gears/ReinforcedGearBox.java index 096e7d0..32c84d2 100644 --- a/src/main/java/youngsditch/ancientlogistics/gears/ReinforcedGearBox.java +++ b/src/main/java/youngsditch/ancientlogistics/gears/ReinforcedGearBox.java @@ -2,8 +2,8 @@ public class ReinforcedGearBox extends GearBox { - public ReinforcedGearBox(int id) { - super(id); + public ReinforcedGearBox(String key, int id) { + super(key, id); this.canRunMultiple = true; } } diff --git a/src/main/java/youngsditch/ancientlogistics/items/Gear.java b/src/main/java/youngsditch/ancientlogistics/items/Gear.java index 046e261..1ae8b19 100644 --- a/src/main/java/youngsditch/ancientlogistics/items/Gear.java +++ b/src/main/java/youngsditch/ancientlogistics/items/Gear.java @@ -1,6 +1,6 @@ package youngsditch.ancientlogistics.items; -import net.minecraft.src.*; +import net.minecraft.core.item.Item; public class Gear extends Item { diff --git a/src/main/java/youngsditch/ancientlogistics/items/GearBone.java b/src/main/java/youngsditch/ancientlogistics/items/GearBone.java index 7650e6b..752ab08 100644 --- a/src/main/java/youngsditch/ancientlogistics/items/GearBone.java +++ b/src/main/java/youngsditch/ancientlogistics/items/GearBone.java @@ -1,6 +1,6 @@ package youngsditch.ancientlogistics.items; -import net.minecraft.src.*; +import net.minecraft.core.item.Item; public class GearBone extends Item { diff --git a/src/main/java/youngsditch/ancientlogistics/mixin/ChestAccessor.java b/src/main/java/youngsditch/ancientlogistics/mixin/ChestAccessor.java index c808abd..75657ce 100644 --- a/src/main/java/youngsditch/ancientlogistics/mixin/ChestAccessor.java +++ b/src/main/java/youngsditch/ancientlogistics/mixin/ChestAccessor.java @@ -1,6 +1,7 @@ package youngsditch.ancientlogistics.mixin; -import net.minecraft.src.*; +import net.minecraft.core.item.ItemStack; +import net.minecraft.core.block.entity.TileEntityChest; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; diff --git a/src/main/java/youngsditch/ancientlogistics/mixin/TrommelAccessor.java b/src/main/java/youngsditch/ancientlogistics/mixin/TrommelAccessor.java index 742f147..b91e924 100644 --- a/src/main/java/youngsditch/ancientlogistics/mixin/TrommelAccessor.java +++ b/src/main/java/youngsditch/ancientlogistics/mixin/TrommelAccessor.java @@ -1,6 +1,7 @@ package youngsditch.ancientlogistics.mixin; -import net.minecraft.src.*; +import net.minecraft.core.block.entity.TileEntityTrommel; +import net.minecraft.core.item.ItemStack; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; import org.spongepowered.asm.mixin.gen.Invoker;