diff --git a/build.gradle b/build.gradle index 9048fab34..a19e2dc04 100644 --- a/build.gradle +++ b/build.gradle @@ -1,11 +1,10 @@ buildscript { repositories { - maven { url = 'https://files.minecraftforge.net/maven' } - jcenter() + maven { url = 'https://maven.minecraftforge.net' } mavenCentral() } dependencies { - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true + classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true } } @@ -22,10 +21,10 @@ if (System.getenv('BUILD_NUMBER') != null) { version += "." + System.getenv('BUILD_NUMBER') } -sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' +java.toolchain.languageVersion = JavaLanguageVersion.of(8) minecraft { - mappings channel: 'snapshot', version: "${mcp_mappings}" + mappings channel: 'official', version: "${game_version}" // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') @@ -57,7 +56,8 @@ minecraft { workingDirectory project.file('run') property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' property 'forge.logging.console.level', 'debug' - args '--mod', 'actuallyadditions', '--all', '--output', file('src/generated/resources/') + args '--mod', 'actuallyadditions', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') + mods { actuallyadditions { source sourceSets.main @@ -67,9 +67,10 @@ minecraft { } } +sourceSets.main.resources { srcDir 'src/generated/resources' } + repositories { maven { - // JEI name = "Progwml6 maven" url = "https://dvs1.progwml6.com/files/maven/" } @@ -102,7 +103,7 @@ processResources { jar { group = 'artifact' manifest { - attributes(["Specification-Title" : "BuildingGadgets", + attributes(["Specification-Title" : "Actually Additions", "Specification-Version" : "1", "Implementation-Title" : project.archivesBaseName, "Implementation-Version" : project.version, diff --git a/gradle.properties b/gradle.properties index e964ecf77..e3a564838 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ mod_version=1.1.52 # Forge game_version=1.16.5 -forge_version=36.0.43 -mcp_mappings=20201028-1.16.3 +forge_version=36.2.2 + # Other mods jei_version=1.16.4:7.6.1.71 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7a3265ee9..e708b1c02 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1d5b29fbd..05679dc3c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java b/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java index aa4e5ea16..65dc35fee 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java @@ -131,7 +131,7 @@ public final class ActuallyAdditionsAPI { * @param outputTwoChance The chance of the second output (0 won't occur at all, 100 will all the time) */ public static void addCrusherRecipe(ItemStack input, ItemStack outputOne, ItemStack outputTwo, int outputTwoChance) { - CRUSHER_RECIPES.add(new CrusherRecipe(Ingredient.fromStacks(input), outputOne, outputTwo.isEmpty() + CRUSHER_RECIPES.add(new CrusherRecipe(Ingredient.of(input), outputOne, outputTwo.isEmpty() ? ItemStack.EMPTY : outputTwo, outputTwoChance)); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyTags.java b/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyTags.java index f37abcb9f..094531803 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyTags.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyTags.java @@ -12,7 +12,7 @@ public final class ActuallyTags { public static final ITag.INamedTag TINY_COALS = tag("tiny_coals"); private static ITag.INamedTag tag(String name) { - return ItemTags.makeWrapperTag(String.format("%s:%s", ActuallyAdditions.MODID, name)); + return ItemTags.bind(String.format("%s:%s", ActuallyAdditions.MODID, name)); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/CoffeeIngredient.java b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/CoffeeIngredient.java index ec1bc0ea9..704923b50 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/CoffeeIngredient.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/CoffeeIngredient.java @@ -23,7 +23,7 @@ public class CoffeeIngredient { @Deprecated public CoffeeIngredient(ItemStack input, EffectInstance[] effects, int maxAmplifier) { - this(Ingredient.fromStacks(input), maxAmplifier, effects); + this(Ingredient.of(input), maxAmplifier, effects); } public CoffeeIngredient(Ingredient input, int maxAmplifier, EffectInstance... effects) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/ColorLensChangerByDyeMeta.java b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/ColorLensChangerByDyeMeta.java index 35191da43..33ad026b5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/ColorLensChangerByDyeMeta.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/ColorLensChangerByDyeMeta.java @@ -24,8 +24,8 @@ public class ColorLensChangerByDyeMeta implements IColorLensChanger { @Override public ItemStack modifyItem(ItemStack stack, BlockState hitBlockState, BlockPos hitBlock, IAtomicReconstructor tile) { ItemStack newStack = stack.copy(); - int meta = newStack.getDamage(); - newStack.setDamage((meta + 1) % 16); + int meta = newStack.getDamageValue(); + newStack.setDamageValue((meta + 1) % 16); return newStack; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/CrusherRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/CrusherRecipe.java index b5c7e231c..1415e5ce5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/CrusherRecipe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/CrusherRecipe.java @@ -22,7 +22,7 @@ public class CrusherRecipe { @Deprecated public CrusherRecipe(ItemStack input, ItemStack outputOne, ItemStack outputTwo, int outputChance) { - this(Ingredient.fromStacks(input), outputOne, outputTwo, outputChance); + this(Ingredient.of(input), outputOne, outputTwo, outputChance); } public CrusherRecipe(Ingredient input, ItemStack outputOne, ItemStack outputTwo, int outputChance) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/EmpowererRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/EmpowererRecipe.java index 38f6d2d2a..ca8934577 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/EmpowererRecipe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/EmpowererRecipe.java @@ -32,7 +32,7 @@ public class EmpowererRecipe { @Deprecated public EmpowererRecipe(ItemStack input, ItemStack output, ItemStack modifier1, ItemStack modifier2, ItemStack modifier3, ItemStack modifier4, int energyPerStand, int time, float[] particleColor) { - this(Ingredient.fromStacks(input), output, Ingredient.fromStacks(modifier1), Ingredient.fromStacks(modifier2), Ingredient.fromStacks(modifier3), Ingredient.fromStacks(modifier4), energyPerStand, time, particleColor); + this(Ingredient.of(input), output, Ingredient.of(modifier1), Ingredient.of(modifier2), Ingredient.of(modifier3), Ingredient.of(modifier4), energyPerStand, time, particleColor); } public EmpowererRecipe(Ingredient input, ItemStack output, Ingredient modifier1, Ingredient modifier2, Ingredient modifier3, Ingredient modifier4, int energyPerStand, int time, float[] particleColor) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/LensConversionRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/LensConversionRecipe.java index 72f45e530..aa70e3252 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/LensConversionRecipe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/LensConversionRecipe.java @@ -26,7 +26,7 @@ public class LensConversionRecipe { @Deprecated public LensConversionRecipe(ItemStack input, ItemStack output, int energy, Lens type) { - this(Ingredient.fromStacks(input), output, energy, type); + this(Ingredient.of(input), output, energy, type); } public LensConversionRecipe(Ingredient input, ItemStack output, int energy, Lens type) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/data/BlockRecipeGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/data/BlockRecipeGenerator.java index 9f7f8078f..a2b888f13 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/data/BlockRecipeGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/data/BlockRecipeGenerator.java @@ -21,68 +21,68 @@ public class BlockRecipeGenerator extends RecipeProvider { } @Override - protected void registerRecipes(Consumer consumer) { + protected void buildShapelessRecipes(Consumer consumer) { //Battery Box - Recipe.shapeless(ActuallyBlocks.BATTERY_BOX.get()).ingredients(ActuallyBlocks.ENERGIZER.get(), ActuallyBlocks.ENERVATOR.get(), ActuallyItems.COIL.get()).build(consumer); + Recipe.shapeless(ActuallyBlocks.BATTERY_BOX.get()).ingredients(ActuallyBlocks.ENERGIZER.get(), ActuallyBlocks.ENERVATOR.get(), ActuallyItems.COIL.get()).save(consumer); //Farmer Recipe.shaped(ActuallyBlocks.FARMER.get()) .pattern("ISI", "SCS", "ISI") - .key('I', ActuallyBlocks.CRYSTAL_ENORI.get()) - .key('C', ActuallyBlocks.IRON_CASING.get()) - .key('S', Tags.Items.SEEDS) - .build(consumer); + .define('I', ActuallyBlocks.CRYSTAL_ENORI.get()) + .define('C', ActuallyBlocks.IRON_CASING.get()) + .define('S', Tags.Items.SEEDS) + .save(consumer); //Empowerer Recipe.shaped(ActuallyBlocks.EMPOWERER.get()) .pattern(" R ", " B ", "CDC") - .key('R', ActuallyItems.RESTONIA_CRYSTAL.get()) - .key('B', ActuallyItems.BATTERY_DOUBLE.get()) - .key('C', ActuallyBlocks.IRON_CASING.get()) - .key('D', ActuallyBlocks.DISPLAY_STAND.get()) - .build(consumer); + .define('R', ActuallyItems.RESTONIA_CRYSTAL.get()) + .define('B', ActuallyItems.BATTERY_DOUBLE.get()) + .define('C', ActuallyBlocks.IRON_CASING.get()) + .define('D', ActuallyBlocks.DISPLAY_STAND.get()) + .save(consumer); //Tiny Torch Recipe.shaped(ActuallyBlocks.TINY_TORCH.get(), 2) .pattern("C", "S") - .key('C', ActuallyTags.Items.TINY_COALS) - .key('S', Tags.Items.RODS_WOODEN) - .build(consumer, new ResourceLocation(ActuallyAdditions.MODID, "tiny_torch")); + .define('C', ActuallyTags.Items.TINY_COALS) + .define('S', Tags.Items.RODS_WOODEN) + .save(consumer, new ResourceLocation(ActuallyAdditions.MODID, "tiny_torch")); //Fireworks Box Recipe.shaped(ActuallyBlocks.FIREWORK_BOX.get()) .pattern("GFG", "SAS", "CCC") - .key('G', Tags.Items.GUNPOWDER) - .key('S', Tags.Items.RODS_WOODEN) - .key('A', ActuallyBlocks.IRON_CASING.get()) - .key('F', Items.FIREWORK_ROCKET) - .key('C', ActuallyItems.ENORI_CRYSTAL.get()) - .build(consumer); + .define('G', Tags.Items.GUNPOWDER) + .define('S', Tags.Items.RODS_WOODEN) + .define('A', ActuallyBlocks.IRON_CASING.get()) + .define('F', Items.FIREWORK_ROCKET) + .define('C', ActuallyItems.ENORI_CRYSTAL.get()) + .save(consumer); //Shock Suppressor Recipe.shaped(ActuallyBlocks.SHOCK_SUPPRESSOR.get()) .pattern("OAO", "ACA", "OAO") - .key('A', ActuallyItems.VOID_EMPOWERED_CRYSTAL.get()) - .key('O', Tags.Items.OBSIDIAN) - .key('C', ActuallyItems.COIL_ADVANCED.get()) - .build(consumer); + .define('A', ActuallyItems.VOID_EMPOWERED_CRYSTAL.get()) + .define('O', Tags.Items.OBSIDIAN) + .define('C', ActuallyItems.COIL_ADVANCED.get()) + .save(consumer); //Display Stand Recipe.shaped(ActuallyBlocks.DISPLAY_STAND.get()) .pattern(" R ", "EEE", "GGG") - .key('R', ActuallyItems.COIL_ADVANCED.get()) - .key('E', ActuallyBlocks.ETHETIC_GREEN_BLOCK.get()) - .key('G', ActuallyBlocks.ETHETIC_WHITE_BLOCK.get()) - .build(consumer); + .define('R', ActuallyItems.COIL_ADVANCED.get()) + .define('E', ActuallyBlocks.ETHETIC_GREEN_BLOCK.get()) + .define('G', ActuallyBlocks.ETHETIC_WHITE_BLOCK.get()) + .save(consumer); //Vertical Digger Recipe.shaped(ActuallyBlocks.MINER.get()) .pattern("IRI", "RCR", "IDI") - .key('R', Tags.Items.STORAGE_BLOCKS_REDSTONE) - .key('I', ActuallyBlocks.IRON_CASING.get()) - .key('C', ActuallyItems.VOID_EMPOWERED_CRYSTAL.get()) - .key('D', ActuallyItems.DRILL.get()) - .build(consumer); + .define('R', Tags.Items.STORAGE_BLOCKS_REDSTONE) + .define('I', ActuallyBlocks.IRON_CASING.get()) + .define('C', ActuallyItems.VOID_EMPOWERED_CRYSTAL.get()) + .define('D', ActuallyItems.DRILL.get()) + .save(consumer); //Black Quartz Wall Recipe.wall(ActuallyBlocks.BLACK_QUARTZ_WALL.get(), ActuallyBlocks.BLACK_QUARTZ_PILLAR_BLOCK.get(), consumer); @@ -132,14 +132,14 @@ public class BlockRecipeGenerator extends RecipeProvider { // Atomic Reconstructor Recipe.shaped(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get()) .pattern("IRI", "RCR", "IRI") - .key('R', Tags.Items.DUSTS_REDSTONE) - .key('I', Tags.Items.INGOTS_IRON) - .key('C', ActuallyBlocks.IRON_CASING.get()) - .build(consumer); + .define('R', Tags.Items.DUSTS_REDSTONE) + .define('I', Tags.Items.INGOTS_IRON) + .define('C', ActuallyBlocks.IRON_CASING.get()) + .save(consumer); } @Override - protected void saveRecipeAdvancement(DirectoryCache cache, JsonObject cache2, Path advancementJson) { + protected void saveAdvancement(DirectoryCache cache, JsonObject cache2, Path advancementJson) { //Nope... } @@ -161,15 +161,15 @@ public class BlockRecipeGenerator extends RecipeProvider { } public static void stairs(IItemProvider result, IItemProvider resource, Consumer consumer) { - Recipe.shaped(result).patternSingleKey('Q', resource, "Q ", "QQ ", "QQQ").build(consumer); + Recipe.shaped(result).patternSingleKey('Q', resource, "Q ", "QQ ", "QQQ").save(consumer); } public static void wall(IItemProvider result, IItemProvider resource, Consumer consumer) { - Recipe.shaped(result).patternSingleKey('Q', resource, "QQQ", "QQQ").build(consumer); + Recipe.shaped(result).patternSingleKey('Q', resource, "QQQ", "QQQ").save(consumer); } public static void slab(IItemProvider result, IItemProvider resource, Consumer consumer) { - Recipe.shaped(result).patternSingleKey('Q', resource, "QQQ").build(consumer); + Recipe.shaped(result).patternSingleKey('Q', resource, "QQQ").save(consumer); } private static class Shapeless extends ShapelessRecipeBuilder { @@ -182,20 +182,20 @@ public class BlockRecipeGenerator extends RecipeProvider { } public Shapeless ingredients(IItemProvider... ingredients) { - Arrays.asList(ingredients).forEach(this::addIngredient); + Arrays.asList(ingredients).forEach(this::requires); return this; } @Override - public void build(Consumer consumer) { - this.addCriterion("has_book", hasItem(ActuallyItems.ITEM_BOOKLET.get())); - super.build(consumer); + public void save(Consumer consumer) { + this.unlockedBy("has_book", has(ActuallyItems.ITEM_BOOKLET.get())); + super.save(consumer); } @Override - public void build(Consumer consumer, ResourceLocation location) { - this.addCriterion("has_book", hasItem(ActuallyItems.ITEM_BOOKLET.get())); - super.build(consumer, location); + public void save(Consumer consumer, ResourceLocation location) { + this.unlockedBy("has_book", has(ActuallyItems.ITEM_BOOKLET.get())); + super.save(consumer, location); } } @@ -209,37 +209,37 @@ public class BlockRecipeGenerator extends RecipeProvider { } public Shaped pattern(String line1, String line2, String line3) { - this.patternLine(line1); - this.patternLine(line2); - this.patternLine(line3); + this.pattern(line1); + this.pattern(line2); + this.pattern(line3); return this; } public Shaped pattern(String line1, String line2) { - this.patternLine(line1); - this.patternLine(line2); + this.pattern(line1); + this.pattern(line2); return this; } public Shaped patternSingleKey(char key, IItemProvider resource, String... lines) { - this.key(key, resource); + this.define(key, resource); for (String line : lines) { - this.patternLine(line); + this.pattern(line); } return this; } @Override - public void build(Consumer consumerIn) { - this.addCriterion("has_book", hasItem(ActuallyItems.ITEM_BOOKLET.get())); - super.build(consumerIn); + public void save(Consumer consumerIn) { + this.unlockedBy("has_book", has(ActuallyItems.ITEM_BOOKLET.get())); + super.save(consumerIn); } @Override - public void build(Consumer consumerIn, ResourceLocation id) { - this.addCriterion("has_book", hasItem(ActuallyItems.ITEM_BOOKLET.get())); - super.build(consumerIn, id); + public void save(Consumer consumerIn, ResourceLocation id) { + this.unlockedBy("has_book", has(ActuallyItems.ITEM_BOOKLET.get())); + super.save(consumerIn, id); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/data/BlockTagsGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/data/BlockTagsGenerator.java index c50c40852..75bff660f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/data/BlockTagsGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/data/BlockTagsGenerator.java @@ -15,7 +15,7 @@ public class BlockTagsGenerator extends BlockTagsProvider { } @Override - public void registerTags() { + public void addTags() { // getOrCreateBuilder(BlockTags.WALLS).add( // ActuallyBlocks.WHITE_WALL.get(), // ActuallyBlocks.GREEN_WALL.get(), @@ -31,7 +31,7 @@ public class BlockTagsGenerator extends BlockTagsProvider { * Resolves a Path for the location to save the given tag. */ @Override - protected Path makePath(ResourceLocation id) { + protected Path getPath(ResourceLocation id) { return this.generator.getOutputFolder().resolve("data/" + id.getNamespace() + "/tags/blocks/" + id.getPath() + ".json"); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/data/ItemRecipeGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/data/ItemRecipeGenerator.java index 448eb5a77..8298e2eb6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/data/ItemRecipeGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/data/ItemRecipeGenerator.java @@ -15,12 +15,12 @@ public class ItemRecipeGenerator extends RecipeProvider { } @Override - protected void registerRecipes(Consumer consumer) { - super.registerRecipes(consumer); + protected void buildShapelessRecipes(Consumer consumer) { + super.buildShapelessRecipes(consumer); } @Override - protected void saveRecipeAdvancement(DirectoryCache cache, JsonObject cache2, Path advancementJson) { + protected void saveAdvancement(DirectoryCache cache, JsonObject cache2, Path advancementJson) { //Nope... } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/data/ItemTagsGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/data/ItemTagsGenerator.java index c2cb8fd7f..926a0805d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/data/ItemTagsGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/data/ItemTagsGenerator.java @@ -16,10 +16,10 @@ public class ItemTagsGenerator extends ItemTagsProvider { } @Override - protected void registerTags() { - this.getOrCreateBuilder(ActuallyTags.Items.COFFEE_BEANS) + protected void addTags() { + this.tag(ActuallyTags.Items.COFFEE_BEANS) .add(ActuallyItems.COFFEE_BEANS.get()); - this.getOrCreateBuilder(ActuallyTags.Items.TINY_COALS) + this.tag(ActuallyTags.Items.TINY_COALS) .add(ActuallyItems.TINY_COAL.get()) .add(ActuallyItems.TINY_CHARCOAL.get()); // getOrCreateBuilder(ActuallyTags.Items.DRILLS).add( diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java b/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java index dc891769c..8d9c89e6a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java @@ -65,7 +65,7 @@ public class ActuallyAdditions { public static final ItemGroup GROUP = new ItemGroup(MODID) { @Override - public ItemStack createIcon() { + public ItemStack makeIcon() { return new ItemStack(ActuallyItems.ITEM_BOOKLET.get()); } }; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditionsClient.java b/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditionsClient.java index 8ee6b848a..92ade6c09 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditionsClient.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditionsClient.java @@ -30,32 +30,32 @@ import net.minecraftforge.fml.client.registry.ClientRegistry; public class ActuallyAdditionsClient { public static void setup() { - ScreenManager.registerFactory(ActuallyContainers.BAG_CONTAINER.get(), GuiBag::new); - ScreenManager.registerFactory(ActuallyContainers.BIO_REACTOR_CONTAINER.get(), GuiBioReactor::new); - ScreenManager.registerFactory(ActuallyContainers.BREAKER_CONTAINER.get(), GuiBreaker::new); - ScreenManager.registerFactory(ActuallyContainers.CANOLA_PRESS_CONTAINER.get(), GuiCanolaPress::new); - ScreenManager.registerFactory(ActuallyContainers.COAL_GENERATOR_CONTAINER.get(), GuiCoalGenerator::new); - ScreenManager.registerFactory(ActuallyContainers.COFFEE_MACHINE_CONTAINER.get(), GuiCoffeeMachine::new); - ScreenManager.registerFactory(ActuallyContainers.DIRECTIONAL_BREAKER_CONTAINER.get(), GuiDirectionalBreaker::new); - ScreenManager.registerFactory(ActuallyContainers.DRILL_CONTAINER.get(), GuiDrill::new); - ScreenManager.registerFactory(ActuallyContainers.DROPPER_CONTAINER.get(), GuiDropper::new); - ScreenManager.registerFactory(ActuallyContainers.ENERVATOR_CONTAINER.get(), GuiEnervator::new); - ScreenManager.registerFactory(ActuallyContainers.ENERGIZER_CONTAINER.get(), GuiEnergizer::new); - ScreenManager.registerFactory(ActuallyContainers.FARMER_CONTAINER.get(), GuiFarmer::new); - ScreenManager.registerFactory(ActuallyContainers.FEEDER_CONTAINER.get(), GuiFeeder::new); - ScreenManager.registerFactory(ActuallyContainers.FERMENTING_BARREL_CONTAINER.get(), GuiFermentingBarrel::new); - ScreenManager.registerFactory(ActuallyContainers.FILTER_CONTAINER.get(), GuiFilter::new); - ScreenManager.registerFactory(ActuallyContainers.FIREWORK_BOX_CONTAINER.get(), GuiFireworkBox::new); - ScreenManager.registerFactory(ActuallyContainers.FLUID_COLLECTOR_CONTAINER.get(), GuiFluidCollector::new); - ScreenManager.registerFactory(ActuallyContainers.FURNACE_DOUBLE_CONTAINER.get(), GuiFurnaceDouble::new); - ScreenManager.registerFactory(ActuallyContainers.GRINDER_CONTAINER.get(), GuiGrinder::new); - ScreenManager.registerFactory(ActuallyContainers.INPUTTER_CONTAINER.get(), GuiInputter::new); - ScreenManager.registerFactory(ActuallyContainers.LASER_RELAY_ITEM_WHITELIST_CONTAINER.get(), GuiLaserRelayItemWhitelist::new); - ScreenManager.registerFactory(ActuallyContainers.MINER_CONTAINER.get(), GuiMiner::new); - ScreenManager.registerFactory(ActuallyContainers.OIL_GENERATOR_CONTAINER.get(), GuiOilGenerator::new); - ScreenManager.registerFactory(ActuallyContainers.PHANTOM_PLACER_CONTAINER.get(), GuiPhantomPlacer::new); - ScreenManager.registerFactory(ActuallyContainers.RANGED_COLLECTOR_CONTAINER.get(), GuiRangedCollector::new); - ScreenManager.registerFactory(ActuallyContainers.XPSOLIDIFIER_CONTAINER.get(), GuiXPSolidifier::new); + ScreenManager.register(ActuallyContainers.BAG_CONTAINER.get(), GuiBag::new); + ScreenManager.register(ActuallyContainers.BIO_REACTOR_CONTAINER.get(), GuiBioReactor::new); + ScreenManager.register(ActuallyContainers.BREAKER_CONTAINER.get(), GuiBreaker::new); + ScreenManager.register(ActuallyContainers.CANOLA_PRESS_CONTAINER.get(), GuiCanolaPress::new); + ScreenManager.register(ActuallyContainers.COAL_GENERATOR_CONTAINER.get(), GuiCoalGenerator::new); + ScreenManager.register(ActuallyContainers.COFFEE_MACHINE_CONTAINER.get(), GuiCoffeeMachine::new); + ScreenManager.register(ActuallyContainers.DIRECTIONAL_BREAKER_CONTAINER.get(), GuiDirectionalBreaker::new); + ScreenManager.register(ActuallyContainers.DRILL_CONTAINER.get(), GuiDrill::new); + ScreenManager.register(ActuallyContainers.DROPPER_CONTAINER.get(), GuiDropper::new); + ScreenManager.register(ActuallyContainers.ENERVATOR_CONTAINER.get(), GuiEnervator::new); + ScreenManager.register(ActuallyContainers.ENERGIZER_CONTAINER.get(), GuiEnergizer::new); + ScreenManager.register(ActuallyContainers.FARMER_CONTAINER.get(), GuiFarmer::new); + ScreenManager.register(ActuallyContainers.FEEDER_CONTAINER.get(), GuiFeeder::new); + ScreenManager.register(ActuallyContainers.FERMENTING_BARREL_CONTAINER.get(), GuiFermentingBarrel::new); + ScreenManager.register(ActuallyContainers.FILTER_CONTAINER.get(), GuiFilter::new); + ScreenManager.register(ActuallyContainers.FIREWORK_BOX_CONTAINER.get(), GuiFireworkBox::new); + ScreenManager.register(ActuallyContainers.FLUID_COLLECTOR_CONTAINER.get(), GuiFluidCollector::new); + ScreenManager.register(ActuallyContainers.FURNACE_DOUBLE_CONTAINER.get(), GuiFurnaceDouble::new); + ScreenManager.register(ActuallyContainers.GRINDER_CONTAINER.get(), GuiGrinder::new); + ScreenManager.register(ActuallyContainers.INPUTTER_CONTAINER.get(), GuiInputter::new); + ScreenManager.register(ActuallyContainers.LASER_RELAY_ITEM_WHITELIST_CONTAINER.get(), GuiLaserRelayItemWhitelist::new); + ScreenManager.register(ActuallyContainers.MINER_CONTAINER.get(), GuiMiner::new); + ScreenManager.register(ActuallyContainers.OIL_GENERATOR_CONTAINER.get(), GuiOilGenerator::new); + ScreenManager.register(ActuallyContainers.PHANTOM_PLACER_CONTAINER.get(), GuiPhantomPlacer::new); + ScreenManager.register(ActuallyContainers.RANGED_COLLECTOR_CONTAINER.get(), GuiRangedCollector::new); + ScreenManager.register(ActuallyContainers.XPSOLIDIFIER_CONTAINER.get(), GuiXPSolidifier::new); // From old proxy InitEntities.initClient(); MinecraftForge.EVENT_BUS.register(new ClientEvents()); @@ -85,7 +85,7 @@ public class ActuallyAdditionsClient { public void sendBreakPacket(BlockPos pos) { ClientPlayNetHandler connection = Minecraft.getInstance().getConnection(); assert connection != null; - assert Minecraft.getInstance().objectMouseOver != null; - connection.sendPacket(new CPlayerDiggingPacket(CPlayerDiggingPacket.Action.STOP_DESTROY_BLOCK, pos, ((BlockRayTraceResult) Minecraft.getInstance().objectMouseOver).getFace())); + assert Minecraft.getInstance().hitResult != null; + connection.send(new CPlayerDiggingPacket(CPlayerDiggingPacket.Action.STOP_DESTROY_BLOCK, pos, ((BlockRayTraceResult) Minecraft.getInstance().hitResult).getDirection())); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/ActuallyBlocks.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/ActuallyBlocks.java index eabcca2df..9e9e37443 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/ActuallyBlocks.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/ActuallyBlocks.java @@ -24,7 +24,7 @@ import net.minecraftforge.registries.ForgeRegistries; public final class ActuallyBlocks { public static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, ActuallyAdditions.MODID); - public static final AbstractBlock.Properties miscBlockProperties = AbstractBlock.Properties.create(Material.ROCK).harvestLevel(1).harvestTool(ToolType.PICKAXE).hardnessAndResistance(1.5f, 10f); + public static final AbstractBlock.Properties miscBlockProperties = AbstractBlock.Properties.of(Material.STONE).harvestLevel(1).harvestTool(ToolType.PICKAXE).strength(1.5f, 10f); @Deprecated public static final RegistryObject blockMisc = BLOCKS.register("misc", () -> new Block(miscBlockProperties)); // TODO this isnt a real block? public static final RegistryObject WOOD_CASING = BLOCKS.register("wood_casing", () -> new Block(miscBlockProperties)); @@ -67,12 +67,12 @@ public final class ActuallyBlocks { public static final RegistryObject XP_SOLIDIFIER = BLOCKS.register("xp_solidifier", BlockXPSolidifier::new); public static final RegistryObject ETHETIC_GREEN_BLOCK = BLOCKS.register("ethetic_green_block", BlockGeneric::new); public static final RegistryObject ETHETIC_WHITE_BLOCK = BLOCKS.register("ethetic_white_block", BlockGeneric::new); - public static final RegistryObject ETHETIC_GREEN_STAIRS = BLOCKS.register("ethetic_green_stairs", () -> new StairsBlock(() -> ETHETIC_GREEN_BLOCK.get().getDefaultState(), AbstractBlock.Properties.from(ETHETIC_GREEN_BLOCK.get()))); - public static final RegistryObject ETHETIC_WHITE_STAIRS = BLOCKS.register("ethetic_white_stairs", () -> new StairsBlock(() -> ETHETIC_WHITE_BLOCK.get().getDefaultState(), AbstractBlock.Properties.from(ETHETIC_WHITE_BLOCK.get()))); - public static final RegistryObject ETHETIC_GREEN_SLAB = BLOCKS.register("ethetic_green_slab", () -> new SlabBlock(AbstractBlock.Properties.from(ETHETIC_GREEN_BLOCK.get()))); - public static final RegistryObject ETHETIC_WHITE_SLAB = BLOCKS.register("ethetic_white_slab", () -> new SlabBlock(AbstractBlock.Properties.from(ETHETIC_WHITE_BLOCK.get()))); - public static final RegistryObject ETHETIC_GREEN_WALL = BLOCKS.register("ethetic_green_wall", () -> new WallBlock(AbstractBlock.Properties.from(ETHETIC_GREEN_BLOCK.get()))); - public static final RegistryObject ETHETIC_WHITE_WALL = BLOCKS.register("ethetic_white_wall", () -> new WallBlock(AbstractBlock.Properties.from(ETHETIC_WHITE_BLOCK.get()))); + public static final RegistryObject ETHETIC_GREEN_STAIRS = BLOCKS.register("ethetic_green_stairs", () -> new StairsBlock(() -> ETHETIC_GREEN_BLOCK.get().defaultBlockState(), AbstractBlock.Properties.copy(ETHETIC_GREEN_BLOCK.get()))); + public static final RegistryObject ETHETIC_WHITE_STAIRS = BLOCKS.register("ethetic_white_stairs", () -> new StairsBlock(() -> ETHETIC_WHITE_BLOCK.get().defaultBlockState(), AbstractBlock.Properties.copy(ETHETIC_WHITE_BLOCK.get()))); + public static final RegistryObject ETHETIC_GREEN_SLAB = BLOCKS.register("ethetic_green_slab", () -> new SlabBlock(AbstractBlock.Properties.copy(ETHETIC_GREEN_BLOCK.get()))); + public static final RegistryObject ETHETIC_WHITE_SLAB = BLOCKS.register("ethetic_white_slab", () -> new SlabBlock(AbstractBlock.Properties.copy(ETHETIC_WHITE_BLOCK.get()))); + public static final RegistryObject ETHETIC_GREEN_WALL = BLOCKS.register("ethetic_green_wall", () -> new WallBlock(AbstractBlock.Properties.copy(ETHETIC_GREEN_BLOCK.get()))); + public static final RegistryObject ETHETIC_WHITE_WALL = BLOCKS.register("ethetic_white_wall", () -> new WallBlock(AbstractBlock.Properties.copy(ETHETIC_WHITE_BLOCK.get()))); public static final RegistryObject CRYSTAL_ENORI = BLOCKS.register("crystal_enori_block", () -> new BlockCrystal(false)); public static final RegistryObject CRYSTAL_RESTONIA = BLOCKS.register("crystal_restonia_block", () -> new BlockCrystal(false)); @@ -142,21 +142,21 @@ public final class ActuallyBlocks { public static final RegistryObject BLACK_QUARTZ_BLOCK = BLOCKS.register("black_quartz_block", BlockGeneric::new); public static final RegistryObject BLACK_QUARTZ_PILLAR_BLOCK = BLOCKS.register("black_quartz_pillar_block", BlockGeneric::new); public static final RegistryObject CHISELED_BLACK_QUARTZ_BLOCK = BLOCKS.register("chiseled_black_quartz_block", BlockGeneric::new); - public static final RegistryObject BLACK_QUARTZ_WALL = BLOCKS.register("black_quartz_wall", () -> new WallBlock(AbstractBlock.Properties.from(blockMisc.get()))); - public static final RegistryObject CHISELED_BLACK_QUARTZ_WALL = BLOCKS.register("chiseled_black_quartz_wall", () -> new WallBlock(AbstractBlock.Properties.from(blockMisc.get()))); - public static final RegistryObject BLACK_QUARTZ_PILLAR_WALL = BLOCKS.register("black_quartz_pillar_wall", () -> new WallBlock(AbstractBlock.Properties.from(blockMisc.get()))); - public static final RegistryObject BLACK_QUARTZ_STAIR = BLOCKS.register("black_quartz_stair", () -> new StairsBlock(() -> blockMisc.get().getDefaultState(), AbstractBlock.Properties.from(blockMisc.get()))); - public static final RegistryObject CHISELED_BLACK_QUARTZ_STAIR = BLOCKS.register("chiseled_black_quartz_stair", () -> new StairsBlock(() -> blockMisc.get().getDefaultState(), AbstractBlock.Properties.from(blockMisc.get()))); - public static final RegistryObject BLACK_QUARTZ_PILLAR_STAIR = BLOCKS.register("black_quartz_pillar_stair", () -> new StairsBlock(() -> blockMisc.get().getDefaultState(), AbstractBlock.Properties.from(blockMisc.get()))); - public static final RegistryObject BLACK_QUARTZ_SLAB = BLOCKS.register("black_quartz_slab", () -> new SlabBlock(AbstractBlock.Properties.from(blockMisc.get()))); - public static final RegistryObject CHISELED_BLACK_QUARTZ_SLAB = BLOCKS.register("chiseled_black_quartz_slab", () -> new SlabBlock(AbstractBlock.Properties.from(blockMisc.get()))); - public static final RegistryObject BLACK_QUARTZ_PILLAR_SLAB = BLOCKS.register("black_quartz_pillar_slab", () -> new SlabBlock(AbstractBlock.Properties.from(blockMisc.get()))); + public static final RegistryObject BLACK_QUARTZ_WALL = BLOCKS.register("black_quartz_wall", () -> new WallBlock(AbstractBlock.Properties.copy(blockMisc.get()))); + public static final RegistryObject CHISELED_BLACK_QUARTZ_WALL = BLOCKS.register("chiseled_black_quartz_wall", () -> new WallBlock(AbstractBlock.Properties.copy(blockMisc.get()))); + public static final RegistryObject BLACK_QUARTZ_PILLAR_WALL = BLOCKS.register("black_quartz_pillar_wall", () -> new WallBlock(AbstractBlock.Properties.copy(blockMisc.get()))); + public static final RegistryObject BLACK_QUARTZ_STAIR = BLOCKS.register("black_quartz_stair", () -> new StairsBlock(() -> blockMisc.get().defaultBlockState(), AbstractBlock.Properties.copy(blockMisc.get()))); + public static final RegistryObject CHISELED_BLACK_QUARTZ_STAIR = BLOCKS.register("chiseled_black_quartz_stair", () -> new StairsBlock(() -> blockMisc.get().defaultBlockState(), AbstractBlock.Properties.copy(blockMisc.get()))); + public static final RegistryObject BLACK_QUARTZ_PILLAR_STAIR = BLOCKS.register("black_quartz_pillar_stair", () -> new StairsBlock(() -> blockMisc.get().defaultBlockState(), AbstractBlock.Properties.copy(blockMisc.get()))); + public static final RegistryObject BLACK_QUARTZ_SLAB = BLOCKS.register("black_quartz_slab", () -> new SlabBlock(AbstractBlock.Properties.copy(blockMisc.get()))); + public static final RegistryObject CHISELED_BLACK_QUARTZ_SLAB = BLOCKS.register("chiseled_black_quartz_slab", () -> new SlabBlock(AbstractBlock.Properties.copy(blockMisc.get()))); + public static final RegistryObject BLACK_QUARTZ_PILLAR_SLAB = BLOCKS.register("black_quartz_pillar_slab", () -> new SlabBlock(AbstractBlock.Properties.copy(blockMisc.get()))); public static AbstractBlock.Properties defaultPickProps(int harvestLevel, float hardness, float resistance) { - return AbstractBlock.Properties.create(Material.ROCK).harvestLevel(harvestLevel).harvestTool(ToolType.PICKAXE).hardnessAndResistance(hardness, resistance).sound(SoundType.STONE); + return AbstractBlock.Properties.of(Material.STONE).harvestLevel(harvestLevel).harvestTool(ToolType.PICKAXE).strength(hardness, resistance).sound(SoundType.STONE); } public static AbstractBlock.Properties defaultPickProps(int harvestLevel) { - return AbstractBlock.Properties.create(Material.ROCK).harvestLevel(harvestLevel).harvestTool(ToolType.PICKAXE).hardnessAndResistance(1.5F, 10.0F).sound(SoundType.STONE); + return AbstractBlock.Properties.of(Material.STONE).harvestLevel(harvestLevel).harvestTool(ToolType.PICKAXE).strength(1.5F, 10.0F).sound(SoundType.STONE); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java index 7ded42037..a16240dbb 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java @@ -55,13 +55,13 @@ public class BlockAtomicReconstructor extends FullyDirectionalBlock.Container im } @Override - public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { - ItemStack heldItem = player.getHeldItem(hand); + public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { + ItemStack heldItem = player.getItemInHand(hand); if (this.tryToggleRedstone(world, pos, player)) { return ActionResultType.PASS; } - if (!world.isRemote) { - TileEntityAtomicReconstructor reconstructor = (TileEntityAtomicReconstructor) world.getTileEntity(pos); + if (!world.isClientSide) { + TileEntityAtomicReconstructor reconstructor = (TileEntityAtomicReconstructor) world.getBlockEntity(pos); if (reconstructor != null) { if (StackUtil.isValid(heldItem)) { Item item = heldItem.getItem(); @@ -69,17 +69,17 @@ public class BlockAtomicReconstructor extends FullyDirectionalBlock.Container im ItemStack toPut = heldItem.copy(); toPut.setCount(1); reconstructor.inv.setStackInSlot(0, toPut); - player.inventory.decrStackSize(player.inventory.currentItem, 1); + player.inventory.removeItem(player.inventory.selected, 1); } //Shush, don't tell anyone! else if (ConfigIntValues.ELEVEN.getValue() == 11 && item == Items.MUSIC_DISC_11) { reconstructor.counter++; - reconstructor.markDirty(); + reconstructor.setChanged(); } } else { ItemStack slot = reconstructor.inv.getStackInSlot(0); if (StackUtil.isValid(slot)) { - player.setHeldItem(hand, slot.copy()); + player.setItemInHand(hand, slot.copy()); reconstructor.inv.setStackInSlot(0, StackUtil.getEmpty()); } } @@ -90,7 +90,7 @@ public class BlockAtomicReconstructor extends FullyDirectionalBlock.Container im @Nullable @Override - public TileEntity createNewTileEntity(IBlockReader worldIn) { + public TileEntity newBlockEntity(IBlockReader worldIn) { return new TileEntityAtomicReconstructor(); } @@ -101,22 +101,22 @@ public class BlockAtomicReconstructor extends FullyDirectionalBlock.Container im @Override @OnlyIn(Dist.CLIENT) public void displayHud(MatrixStack matrices, Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult rayCast, MainWindow resolution) { - if (!(rayCast instanceof BlockRayTraceResult) || minecraft.world == null) { + if (!(rayCast instanceof BlockRayTraceResult) || minecraft.level == null) { return; } - TileEntity tile = minecraft.world.getTileEntity(((BlockRayTraceResult) rayCast).getPos()); + TileEntity tile = minecraft.level.getBlockEntity(((BlockRayTraceResult) rayCast).getBlockPos()); if (tile instanceof TileEntityAtomicReconstructor) { ItemStack slot = ((TileEntityAtomicReconstructor) tile).inv.getStackInSlot(0); ITextComponent strg; if (!StackUtil.isValid(slot)) { strg = Lang.trans("info", "nolens"); } else { - strg = slot.getItem().getDisplayName(slot); + strg = slot.getItem().getName(slot); - AssetUtil.renderStackToGui(slot, resolution.getScaledWidth() / 2 + 15, resolution.getScaledHeight() / 2 - 19, 1F); + AssetUtil.renderStackToGui(slot, resolution.getGuiScaledWidth() / 2 + 15, resolution.getGuiScaledHeight() / 2 - 19, 1F); } - minecraft.fontRenderer.drawStringWithShadow(matrices, strg.copyRaw().mergeStyle(TextFormatting.YELLOW).mergeStyle(TextFormatting.ITALIC).getString(), resolution.getScaledWidth() / 2 + 35, resolution.getScaledHeight() / 2f - 15, StringUtil.DECIMAL_COLOR_WHITE); + minecraft.font.drawShadow(matrices, strg.plainCopy().withStyle(TextFormatting.YELLOW).withStyle(TextFormatting.ITALIC).getString(), resolution.getGuiScaledWidth() / 2 + 35, resolution.getGuiScaledHeight() / 2f - 15, StringUtil.DECIMAL_COLOR_WHITE); } } @@ -159,13 +159,13 @@ public class BlockAtomicReconstructor extends FullyDirectionalBlock.Container im // } @Override - public boolean hasComparatorInputOverride(BlockState state) { + public boolean hasAnalogOutputSignal(BlockState state) { return true; } @Override - public int getComparatorInputOverride(BlockState blockState, World world, BlockPos pos) { - TileEntity t = world.getTileEntity(pos); + public int getAnalogOutputSignal(BlockState blockState, World world, BlockPos pos) { + TileEntity t = world.getBlockEntity(pos); int i = 0; if (t instanceof TileEntityAtomicReconstructor) { i = ((TileEntityAtomicReconstructor) t).getEnergy(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBatteryBox.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBatteryBox.java index 7feb16e4e..f87f381d9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBatteryBox.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBatteryBox.java @@ -40,27 +40,27 @@ public class BlockBatteryBox extends BlockContainerBase { @Nullable @Override - public TileEntity createNewTileEntity(IBlockReader worldIn) { + public TileEntity newBlockEntity(IBlockReader worldIn) { return new TileEntityBatteryBox(); } @Override - public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { - TileEntity tile = world.getTileEntity(pos); + public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { + TileEntity tile = world.getBlockEntity(pos); if (tile instanceof TileEntityBatteryBox) { TileEntityBatteryBox box = (TileEntityBatteryBox) tile; - ItemStack stack = player.getHeldItem(hand); + ItemStack stack = player.getItemInHand(hand); if (StackUtil.isValid(stack)) { if (stack.getItem() instanceof ItemBattery && !StackUtil.isValid(box.inv.getStackInSlot(0))) { box.inv.setStackInSlot(0, stack.copy()); - player.setHeldItem(hand, StackUtil.getEmpty()); + player.setItemInHand(hand, StackUtil.getEmpty()); return ActionResultType.SUCCESS; } } else { ItemStack inSlot = box.inv.getStackInSlot(0); if (StackUtil.isValid(inSlot)) { - player.setHeldItem(hand, inSlot.copy()); + player.setItemInHand(hand, inSlot.copy()); box.inv.setStackInSlot(0, StackUtil.getEmpty()); return ActionResultType.SUCCESS; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBioReactor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBioReactor.java index 0ebd86a8b..93b734507 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBioReactor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBioReactor.java @@ -29,12 +29,12 @@ public class BlockBioReactor extends BlockContainerBase { } @Override - public TileEntity createNewTileEntity(IBlockReader worldIn) { + public TileEntity newBlockEntity(IBlockReader worldIn) { return new TileEntityBioReactor(); } @Override - public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { + public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { return this.openGui(world, player, pos, TileEntityBioReactor.class); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBreaker.java index ff1c35008..e4fe36d99 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBreaker.java @@ -36,14 +36,14 @@ public class BlockBreaker extends FullyDirectionalBlock.Container { @Nullable @Override - public TileEntity createNewTileEntity(IBlockReader world) { + public TileEntity newBlockEntity(IBlockReader world) { return this.isPlacer ? new TileEntityPlacer() : new TileEntityBreaker(); } @Override - public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { + public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { if (this.tryToggleRedstone(world, pos, player)) { return ActionResultType.PASS; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCanolaPress.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCanolaPress.java index f1e0ed401..0fee818aa 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCanolaPress.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCanolaPress.java @@ -41,14 +41,14 @@ public class BlockCanolaPress extends BlockContainerBase { @Nullable @Override - public TileEntity createNewTileEntity(IBlockReader world) { + public TileEntity newBlockEntity(IBlockReader world) { return new TileEntityCanolaPress(); } @Override - public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { - if (!world.isRemote) { - TileEntityCanolaPress tile = (TileEntityCanolaPress) world.getTileEntity(pos); + public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { + if (!world.isClientSide) { + TileEntityCanolaPress tile = (TileEntityCanolaPress) world.getBlockEntity(pos); if (tile != null) { if (!this.tryUseItemOnTank(player, hand, tile.tank)) { NetworkHooks.openGui((ServerPlayerEntity) player, tile, pos); @@ -56,7 +56,7 @@ public class BlockCanolaPress extends BlockContainerBase { } return ActionResultType.PASS; } - return super.onBlockActivated(state, world, pos, player, hand, hit); + return super.use(state, world, pos, player, hand, hit); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoalGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoalGenerator.java index d456e0bad..8e3ff03f5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoalGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoalGenerator.java @@ -30,17 +30,17 @@ import java.util.Random; public class BlockCoalGenerator extends DirectionalBlock.Container { public BlockCoalGenerator() { - super(ActuallyBlocks.defaultPickProps(0).tickRandomly()); + super(ActuallyBlocks.defaultPickProps(0).randomTicks()); } @Override - public TileEntity createNewTileEntity(IBlockReader worldIn) { + public TileEntity newBlockEntity(IBlockReader worldIn) { return new TileEntityCoalGenerator(); } @Override public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { - TileEntity tile = world.getTileEntity(pos); + TileEntity tile = world.getBlockEntity(pos); if (tile instanceof TileEntityCoalGenerator) { if (((TileEntityCoalGenerator) tile).currentBurnTime > 0) { for (int i = 0; i < 5; i++) { @@ -51,13 +51,13 @@ public class BlockCoalGenerator extends DirectionalBlock.Container { } @Override - public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { + public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { return this.openGui(world, player, pos, TileEntityCoalGenerator.class); } @Override public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - switch (state.get(FACING)) { + switch (state.getValue(FACING)) { case EAST: return Shapes.CoalGeneratorShapes.EAST; case SOUTH: diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoffeeMachine.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoffeeMachine.java index 1cd4a4d6a..58ded65fa 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoffeeMachine.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoffeeMachine.java @@ -34,9 +34,9 @@ public class BlockCoffeeMachine extends DirectionalBlock.Container { } @Override - public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { - if (!world.isRemote) { - TileEntityCoffeeMachine tile = (TileEntityCoffeeMachine) world.getTileEntity(pos); + public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { + if (!world.isClientSide) { + TileEntityCoffeeMachine tile = (TileEntityCoffeeMachine) world.getBlockEntity(pos); if (tile != null) { if (!this.tryUseItemOnTank(player, hand, tile.tank)) { NetworkHooks.openGui((ServerPlayerEntity) player, tile, pos); @@ -44,18 +44,18 @@ public class BlockCoffeeMachine extends DirectionalBlock.Container { } return ActionResultType.PASS; } - return super.onBlockActivated(state, world, pos, player, hand, hit); + return super.use(state, world, pos, player, hand, hit); } @Nullable @Override - public TileEntity createNewTileEntity(IBlockReader worldIn) { + public TileEntity newBlockEntity(IBlockReader worldIn) { return new TileEntityCoffeeMachine(); } @Override public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - switch (state.get(FACING)) { + switch (state.getValue(FACING)) { case EAST: return Shapes.CoffeeMachineShapes.EAST; case SOUTH: diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java index f1651161f..e09446cfd 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java @@ -34,6 +34,8 @@ import net.minecraftforge.common.util.Constants; import java.util.HashMap; import java.util.function.Supplier; +import net.minecraft.block.AbstractBlock.Properties; + public class BlockColoredLamp extends BlockBase { private static final HashMap> COLOR_TO_LAMP = new HashMap>() {{ this.put(DyeColor.WHITE, ActuallyBlocks.LAMP_WHITE); @@ -57,22 +59,22 @@ public class BlockColoredLamp extends BlockBase { private static final BooleanProperty LIT = BlockStateProperties.LIT; public BlockColoredLamp() { - super(Properties.create(Material.REDSTONE_LIGHT).hardnessAndResistance(0.5F, 3.0F).harvestTool(ToolType.PICKAXE).harvestLevel(0)); - this.setDefaultState(this.stateContainer.getBaseState().with(LIT, false)); + super(Properties.of(Material.BUILDABLE_GLASS).strength(0.5F, 3.0F).harvestTool(ToolType.PICKAXE).harvestLevel(0)); + this.registerDefaultState(this.stateDefinition.any().setValue(LIT, false)); } @Override - protected void fillStateContainer(StateContainer.Builder builder) { + protected void createBlockStateDefinition(StateContainer.Builder builder) { builder.add(LIT); } // TODO: [port][test] validate this rework works @Override - public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { - ItemStack stack = player.getHeldItem(hand); + public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { + ItemStack stack = player.getItemInHand(hand); //Turning On if (hand == Hand.MAIN_HAND && stack.isEmpty()) { - world.setBlockState(pos, this.getDefaultState().with(LIT, !state.get(LIT)), Constants.BlockFlags.NO_RERENDER); + world.setBlock(pos, this.defaultBlockState().setValue(LIT, !state.getValue(LIT)), Constants.BlockFlags.NO_RERENDER); return ActionResultType.PASS; } @@ -83,19 +85,19 @@ public class BlockColoredLamp extends BlockBase { } Block newColor = COLOR_TO_LAMP.get(color).get(); - if (!world.isRemote) { - world.setBlockState(pos, newColor.getDefaultState().with(LIT, state.get(LIT)), 2); + if (!world.isClientSide) { + world.setBlock(pos, newColor.defaultBlockState().setValue(LIT, state.getValue(LIT)), 2); if (!player.isCreative()) { - player.inventory.decrStackSize(player.inventory.currentItem, 1); + player.inventory.removeItem(player.inventory.selected, 1); } } } - return super.onBlockActivated(state, world, pos, player, hand, hit); + return super.use(state, world, pos, player, hand, hit); } @Override public int getLightValue(BlockState state, IBlockReader world, BlockPos pos) { - return state.get(LIT) + return state.getValue(LIT) ? 15 : 0; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystalCluster.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystalCluster.java index 9a5dcf093..aa471a57f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystalCluster.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystalCluster.java @@ -20,12 +20,14 @@ import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.world.IBlockReader; +import net.minecraft.block.AbstractBlock.Properties; + public class BlockCrystalCluster extends FullyDirectionalBlock { private final TheCrystals crystal; public BlockCrystalCluster(TheCrystals crystal) { - super(Properties.create(Material.GLASS).hardnessAndResistance(0.25F, 1.0F).sound(SoundType.GLASS).setLightLevel(state -> 7)); + super(Properties.of(Material.GLASS).strength(0.25F, 1.0F).sound(SoundType.GLASS).lightLevel(state -> 7)); this.crystal = crystal; // this.setLightOpacity(1); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDirectionalBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDirectionalBreaker.java index f2a5e1344..6a70cbd9c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDirectionalBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDirectionalBreaker.java @@ -31,12 +31,12 @@ public class BlockDirectionalBreaker extends FullyDirectionalBlock.Container { } @Override - public TileEntity createNewTileEntity(IBlockReader worldIn) { + public TileEntity newBlockEntity(IBlockReader worldIn) { return new TileEntityDirectionalBreaker(); } @Override - public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { + public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { if (this.tryToggleRedstone(world, pos, player)) { return ActionResultType.PASS; } @@ -46,7 +46,7 @@ public class BlockDirectionalBreaker extends FullyDirectionalBlock.Container { @Override public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - switch (state.get(FACING)) { + switch (state.getValue(FACING)) { case UP: return Shapes.DirectionalBlockBreakerShapes.SHAPE_U; case DOWN: diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDisplayStand.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDisplayStand.java index 909b01887..2a5200ab9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDisplayStand.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDisplayStand.java @@ -37,15 +37,15 @@ public class BlockDisplayStand extends BlockContainerBase { @Nullable @Override - public TileEntity createNewTileEntity(IBlockReader worldIn) { + public TileEntity newBlockEntity(IBlockReader worldIn) { return new TileEntityDisplayStand(); } @Override - public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { - ItemStack heldItem = player.getHeldItem(hand); - if (!world.isRemote) { - TileEntityDisplayStand stand = (TileEntityDisplayStand) world.getTileEntity(pos); + public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { + ItemStack heldItem = player.getItemInHand(hand); + if (!world.isClientSide) { + TileEntityDisplayStand stand = (TileEntityDisplayStand) world.getBlockEntity(pos); if (stand != null) { ItemStack display = stand.inv.getStackInSlot(0); if (StackUtil.isValid(heldItem)) { @@ -69,7 +69,7 @@ public class BlockDisplayStand extends BlockContainerBase { } } else { if (StackUtil.isValid(display)) { - player.setHeldItem(hand, display.copy()); + player.setItemInHand(hand, display.copy()); stand.inv.setStackInSlot(0, StackUtil.getEmpty()); return ActionResultType.PASS; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDropper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDropper.java index 5218f3a0a..cfdd6591d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDropper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDropper.java @@ -29,12 +29,12 @@ public class BlockDropper extends FullyDirectionalBlock.Container { } @Override - public TileEntity createNewTileEntity(IBlockReader worldIn) { + public TileEntity newBlockEntity(IBlockReader worldIn) { return new TileEntityDropper(); } @Override - public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { + public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { if (this.tryToggleRedstone(world, pos, player)) { return ActionResultType.PASS; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockEmpowerer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockEmpowerer.java index f94fdb930..67eac1f29 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockEmpowerer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockEmpowerer.java @@ -36,15 +36,15 @@ public class BlockEmpowerer extends BlockContainerBase { @Nullable @Override - public TileEntity createNewTileEntity(IBlockReader worldIn) { + public TileEntity newBlockEntity(IBlockReader worldIn) { return new TileEntityEmpowerer(); } @Override - public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { - ItemStack heldItem = player.getHeldItem(hand); - if (!world.isRemote) { - TileEntityEmpowerer empowerer = (TileEntityEmpowerer) world.getTileEntity(pos); + public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { + ItemStack heldItem = player.getItemInHand(hand); + if (!world.isClientSide) { + TileEntityEmpowerer empowerer = (TileEntityEmpowerer) world.getBlockEntity(pos); if (empowerer != null) { ItemStack stackThere = empowerer.inv.getStackInSlot(0); if (StackUtil.isValid(heldItem)) { @@ -59,7 +59,7 @@ public class BlockEmpowerer extends BlockContainerBase { } else if (ItemUtil.canBeStacked(heldItem, stackThere)) { int maxTransfer = Math.min(stackThere.getCount(), heldItem.getMaxStackSize() - heldItem.getCount()); if (maxTransfer > 0) { - player.setHeldItem(hand, StackUtil.grow(heldItem, maxTransfer)); + player.setItemInHand(hand, StackUtil.grow(heldItem, maxTransfer)); ItemStack newStackThere = stackThere.copy(); newStackThere = StackUtil.shrink(newStackThere, maxTransfer); empowerer.inv.setStackInSlot(0, newStackThere); @@ -68,7 +68,7 @@ public class BlockEmpowerer extends BlockContainerBase { } } else { if (StackUtil.isValid(stackThere)) { - player.setHeldItem(hand, stackThere.copy()); + player.setItemInHand(hand, stackThere.copy()); empowerer.inv.setStackInSlot(0, StackUtil.getEmpty()); return ActionResultType.PASS; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockEnergizer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockEnergizer.java index b57a2179e..46a233ad8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockEnergizer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockEnergizer.java @@ -34,14 +34,14 @@ public class BlockEnergizer extends BlockContainerBase { } @Override - public TileEntity createNewTileEntity(IBlockReader worldIn) { + public TileEntity newBlockEntity(IBlockReader worldIn) { return this.isEnergizer ? new TileEntityEnergizer() : new TileEntityEnervator(); } @Override - public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { + public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { if (this.isEnergizer) { return this.openGui(world, player, pos, TileEntityEnergizer.class); } else { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFarmer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFarmer.java index 1e3d21a20..cca939004 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFarmer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFarmer.java @@ -31,18 +31,18 @@ public class BlockFarmer extends DirectionalBlock.Container { } @Override - public TileEntity createNewTileEntity(IBlockReader worldIn) { + public TileEntity newBlockEntity(IBlockReader worldIn) { return new TileEntityFarmer(); } @Override - public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { + public ActionResultType use(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { return this.openGui(worldIn, player, pos, TileEntityFarmer.class); } @Override public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - switch (state.get(FACING)) { + switch (state.getValue(FACING)) { case EAST: return Shapes.FarmerShapes.SHAPE_E; case SOUTH: diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFeeder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFeeder.java index c47aeb693..b9f8cc823 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFeeder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFeeder.java @@ -31,12 +31,12 @@ public class BlockFeeder extends BlockContainerBase { } @Override - public TileEntity createNewTileEntity(IBlockReader worldIn) { + public TileEntity newBlockEntity(IBlockReader worldIn) { return new TileEntityFeeder(); } @Override - public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { + public ActionResultType use(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { return this.openGui(worldIn, player, pos, TileEntityFeeder.class); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFermentingBarrel.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFermentingBarrel.java index d3fcaf857..589c8cd5c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFermentingBarrel.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFermentingBarrel.java @@ -29,21 +29,23 @@ import net.minecraft.world.World; import net.minecraftforge.common.ToolType; import net.minecraftforge.fml.network.NetworkHooks; +import net.minecraft.block.AbstractBlock.Properties; + public class BlockFermentingBarrel extends BlockContainerBase { public BlockFermentingBarrel() { - super(Properties.create(Material.WOOD).harvestTool(ToolType.AXE).harvestLevel(0).hardnessAndResistance(0.5F, 5.0F).sound(SoundType.WOOD)); + super(Properties.of(Material.WOOD).harvestTool(ToolType.AXE).harvestLevel(0).strength(0.5F, 5.0F).sound(SoundType.WOOD)); } @Override - public TileEntity createNewTileEntity(IBlockReader worldIn) { + public TileEntity newBlockEntity(IBlockReader worldIn) { return new TileEntityFermentingBarrel(); } @Override - public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { - if (!world.isRemote) { - TileEntityFermentingBarrel press = (TileEntityFermentingBarrel) world.getTileEntity(pos); + public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { + if (!world.isClientSide) { + TileEntityFermentingBarrel press = (TileEntityFermentingBarrel) world.getBlockEntity(pos); if (press != null) { if (!this.tryUseItemOnTank(player, hand, press.canolaTank) && !this.tryUseItemOnTank(player, hand, press.oilTank)) { NetworkHooks.openGui((ServerPlayerEntity) player, press, pos); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFireworkBox.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFireworkBox.java index f83fc884e..fb020c90f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFireworkBox.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFireworkBox.java @@ -30,7 +30,7 @@ public class BlockFireworkBox extends BlockContainerBase { } @Override - public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { + public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { if (this.tryToggleRedstone(world, pos, player)) { return ActionResultType.PASS; } @@ -39,7 +39,7 @@ public class BlockFireworkBox extends BlockContainerBase { } @Override - public TileEntity createNewTileEntity(IBlockReader worldIn) { + public TileEntity newBlockEntity(IBlockReader worldIn) { return new TileEntityFireworkBox(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFluidCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFluidCollector.java index d0f5a5824..6cad1b252 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFluidCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFluidCollector.java @@ -34,14 +34,14 @@ public class BlockFluidCollector extends FullyDirectionalBlock.Container { } @Override - public TileEntity createNewTileEntity(IBlockReader worldIn) { + public TileEntity newBlockEntity(IBlockReader worldIn) { return this.isPlacer ? new TileEntityFluidPlacer() : new TileEntityFluidCollector(); } @Override - public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { + public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { if (this.tryToggleRedstone(world, pos, player)) { return ActionResultType.PASS; } @@ -51,7 +51,7 @@ public class BlockFluidCollector extends FullyDirectionalBlock.Container { @Override public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - switch (state.get(FACING)) { + switch (state.getValue(FACING)) { case UP: return Shapes.FluidCollectorShapes.SHAPE_U; case DOWN: diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceDouble.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceDouble.java index dcbc23629..86cd6e771 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceDouble.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceDouble.java @@ -38,21 +38,21 @@ import java.util.Random; public class BlockFurnaceDouble extends BlockContainerBase { public BlockFurnaceDouble() { // TODO: [port] confirm this is correct for light level... Might not be reactive. - super(ActuallyBlocks.defaultPickProps(0).tickRandomly().setLightLevel(state -> state.get(LIT) + super(ActuallyBlocks.defaultPickProps(0).randomTicks().lightLevel(state -> state.getValue(LIT) ? 12 : 0)); - this.setDefaultState(this.stateContainer.getBaseState().with(HORIZONTAL_FACING, Direction.NORTH).with(LIT, false)); + this.registerDefaultState(this.stateDefinition.any().setValue(HORIZONTAL_FACING, Direction.NORTH).setValue(LIT, false)); } @Override - public TileEntity createNewTileEntity(IBlockReader worldIn) { + public TileEntity newBlockEntity(IBlockReader worldIn) { return new TileEntityFurnaceDouble(); } @Override public void randomTick(BlockState state, ServerWorld worldIn, BlockPos pos, Random random) { - if (state.get(LIT)) { + if (state.getValue(LIT)) { for (int i = 0; i < 5; i++) { worldIn.addParticle(ParticleTypes.SMOKE, (double) pos.getX() + 0.5F, (double) pos.getY() + 1.0F, (double) pos.getZ() + 0.5F, 0.0D, 0.0D, 0.0D); } @@ -60,17 +60,17 @@ public class BlockFurnaceDouble extends BlockContainerBase { } @Override - public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { + public ActionResultType use(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { return this.openGui(worldIn, player, pos, TileEntityFurnaceDouble.class); } @Override public BlockState getStateForPlacement(BlockItemUseContext context) { - return this.getDefaultState().with(HORIZONTAL_FACING, context.getNearestLookingDirection().getOpposite()).with(LIT, false); + return this.defaultBlockState().setValue(HORIZONTAL_FACING, context.getNearestLookingDirection().getOpposite()).setValue(LIT, false); } @Override - protected void fillStateContainer(StateContainer.Builder builder) { + protected void createBlockStateDefinition(StateContainer.Builder builder) { builder.add(LIT).add(HORIZONTAL_FACING); } @@ -91,7 +91,7 @@ public class BlockFurnaceDouble extends BlockContainerBase { @Override public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - switch (state.get(HORIZONTAL_FACING)) { + switch (state.getValue(HORIZONTAL_FACING)) { case EAST: return Shapes.FurnaceDoubleShapes.SHAPE_E; case SOUTH: diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGreenhouseGlass.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGreenhouseGlass.java index 043c80ab9..c9c4fe92c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGreenhouseGlass.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGreenhouseGlass.java @@ -27,7 +27,7 @@ import java.util.Random; public class BlockGreenhouseGlass extends BlockBase { public BlockGreenhouseGlass() { - super(ActuallyBlocks.defaultPickProps(0, 0.5F, 10.0F).sound(SoundType.GLASS).tickRandomly()); + super(ActuallyBlocks.defaultPickProps(0, 0.5F, 10.0F).sound(SoundType.GLASS).randomTicks()); } @@ -44,16 +44,16 @@ public class BlockGreenhouseGlass extends BlockBase { @Override - public BlockRenderType getRenderType(BlockState state) { + public BlockRenderType getRenderShape(BlockState state) { return BlockRenderType.INVISIBLE; } @Override public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random rand) { - if (world.isRemote) { + if (world.isClientSide) { return; } - if (world.canBlockSeeSky(pos) && world.isDaytime()) { + if (world.canSeeSkyFromBelowWater(pos) && world.isDay()) { Triple trip = this.firstBlock(world, pos); boolean once = false; if (trip != null) { @@ -61,31 +61,31 @@ public class BlockGreenhouseGlass extends BlockBase { BlockState growState = i == 0 ? trip.getMiddle() : world.getBlockState(trip.getLeft()); - if (growState.getBlock() == trip.getRight() && trip.getRight().canGrow(world, trip.getLeft(), growState, false)) { - trip.getRight().grow(world, rand, trip.getLeft(), growState); + if (growState.getBlock() == trip.getRight() && trip.getRight().isValidBonemealTarget(world, trip.getLeft(), growState, false)) { + trip.getRight().performBonemeal(world, rand, trip.getLeft(), growState); once = true; } } } if (once) { - world.playEvent(2005, trip.getMiddle().isOpaqueCube(world, trip.getLeft()) - ? trip.getLeft().up() + world.levelEvent(2005, trip.getMiddle().isSolidRender(world, trip.getLeft()) + ? trip.getLeft().above() : trip.getLeft(), 0); } } } public Triple firstBlock(World world, BlockPos glassPos) { - BlockPos.Mutable mut = new BlockPos(glassPos).toMutable(); + BlockPos.Mutable mut = new BlockPos(glassPos).mutable(); while (true) { - mut.setPos(mut.getX(), mut.getY() - 1, mut.getZ()); + mut.set(mut.getX(), mut.getY() - 1, mut.getZ()); if (mut.getY() < 0) { return null; } BlockState state = world.getBlockState(mut); - if (state.isOpaqueCube(world, mut) || state.getBlock() instanceof IGrowable || state.getBlock() == this) { + if (state.isSolidRender(world, mut) || state.getBlock() instanceof IGrowable || state.getBlock() == this) { if (state.getBlock() instanceof IGrowable) { - return Triple.of(mut.toImmutable(), state, (IGrowable) state.getBlock()); + return Triple.of(mut.immutable(), state, (IGrowable) state.getBlock()); } else { return null; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGrinder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGrinder.java index 22aae61c3..983280ed7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGrinder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGrinder.java @@ -41,13 +41,13 @@ public class BlockGrinder extends BlockContainerBase { private final boolean isDouble; public BlockGrinder(boolean isDouble) { - super(ActuallyBlocks.defaultPickProps(0).tickRandomly()); + super(ActuallyBlocks.defaultPickProps(0).randomTicks()); this.isDouble = isDouble; - this.setDefaultState(this.stateContainer.getBaseState().with(HORIZONTAL_FACING, Direction.NORTH).with(LIT, false)); + this.registerDefaultState(this.stateDefinition.any().setValue(HORIZONTAL_FACING, Direction.NORTH).setValue(LIT, false)); } @Override - public TileEntity createNewTileEntity(IBlockReader worldIn) { + public TileEntity newBlockEntity(IBlockReader worldIn) { return this.isDouble ? new TileEntityGrinderDouble() : new TileEntityGrinder(); @@ -55,7 +55,7 @@ public class BlockGrinder extends BlockContainerBase { @Override public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random rand) { - if (state.get(BlockStateProperties.LIT)) { + if (state.getValue(BlockStateProperties.LIT)) { for (int i = 0; i < 5; i++) { double xRand = rand.nextDouble() / 0.75D - 0.5D; double zRand = rand.nextDouble() / 0.75D - 0.5D; @@ -66,7 +66,7 @@ public class BlockGrinder extends BlockContainerBase { } @Override - public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { + public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { if (this.isDouble) { return this.openGui(world, player, pos, TileEntityGrinderDouble.class); } @@ -76,24 +76,24 @@ public class BlockGrinder extends BlockContainerBase { @Override public BlockState getStateForPlacement(BlockItemUseContext context) { - return this.getDefaultState().with(HORIZONTAL_FACING, context.getNearestLookingDirection().getOpposite()).with(LIT, false); + return this.defaultBlockState().setValue(HORIZONTAL_FACING, context.getNearestLookingDirection().getOpposite()).setValue(LIT, false); } @Override - protected void fillStateContainer(StateContainer.Builder builder) { + protected void createBlockStateDefinition(StateContainer.Builder builder) { builder.add(LIT).add(HORIZONTAL_FACING); } @Override public int getLightValue(BlockState state, IBlockReader world, BlockPos pos) { - return state.get(LIT) + return state.getValue(LIT) ? 12 : 0; } @Override public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - switch (state.get(HORIZONTAL_FACING)) { + switch (state.getValue(HORIZONTAL_FACING)) { case EAST: return Shapes.GrinderShapes.SHAPE_E; case SOUTH: diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockHeatCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockHeatCollector.java index c5218d3b3..3df53bb6c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockHeatCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockHeatCollector.java @@ -25,7 +25,7 @@ public class BlockHeatCollector extends BlockContainerBase { } @Override - public TileEntity createNewTileEntity(IBlockReader worldIn) { + public TileEntity newBlockEntity(IBlockReader worldIn) { return new TileEntityHeatCollector(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockInputter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockInputter.java index c4fed6298..0ad41bf76 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockInputter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockInputter.java @@ -30,19 +30,19 @@ public class BlockInputter extends BlockContainerBase { public final boolean isAdvanced; public BlockInputter(boolean isAdvanced) { - super(ActuallyBlocks.defaultPickProps(0).tickRandomly()); + super(ActuallyBlocks.defaultPickProps(0).randomTicks()); this.isAdvanced = isAdvanced; } @Override - public TileEntity createNewTileEntity(IBlockReader worldIn) { + public TileEntity newBlockEntity(IBlockReader worldIn) { return this.isAdvanced ? new TileEntityInputterAdvanced() : new TileEntityInputter(); } @Override - public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { + public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { if (this.isAdvanced) { return this.openGui(world, player, pos, TileEntityInputterAdvanced.class); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemViewer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemViewer.java index 1c8ea4754..4e9e8cced 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemViewer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemViewer.java @@ -25,7 +25,7 @@ public class BlockItemViewer extends BlockContainerBase { } @Override - public TileEntity createNewTileEntity(IBlockReader worldIn) { + public TileEntity newBlockEntity(IBlockReader worldIn) { return new TileEntityItemViewer(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemViewerHopping.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemViewerHopping.java index f5e98360c..6692c108f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemViewerHopping.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemViewerHopping.java @@ -29,7 +29,7 @@ public class BlockItemViewerHopping extends BlockItemViewer { } @Override - public TileEntity createNewTileEntity(IBlockReader worldIn) { + public TileEntity newBlockEntity(IBlockReader worldIn) { return new TileEntityItemViewerHopping(); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLampPowerer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLampPowerer.java index 85f42bbf2..3271ea54c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLampPowerer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLampPowerer.java @@ -37,15 +37,15 @@ public class BlockLampPowerer extends FullyDirectionalBlock { } @Override - public void onBlockAdded(BlockState state, World world, BlockPos pos, BlockState oldState, boolean isMoving) { + public void onPlace(BlockState state, World world, BlockPos pos, BlockState oldState, boolean isMoving) { this.updateLamp(world, pos); } private void updateLamp(World world, BlockPos pos) { - if (!world.isRemote) { + if (!world.isClientSide) { BlockState state = world.getBlockState(pos); - BlockPos coords = pos.offset(WorldUtil.getDirectionByPistonRotation(state)); - this.updateLampsAtPos(world, coords, world.getRedstonePowerFromNeighbors(pos) > 0, new ArrayList<>()); + BlockPos coords = pos.relative(WorldUtil.getDirectionByPistonRotation(state)); + this.updateLampsAtPos(world, coords, world.getBestNeighborSignal(pos) > 0, new ArrayList<>()); } } @@ -53,12 +53,12 @@ public class BlockLampPowerer extends FullyDirectionalBlock { BlockState state = world.getBlockState(pos); Block block = state.getBlock(); if (block instanceof BlockColoredLamp) { - if (state.get(BlockStateProperties.LIT) && !powered) { - world.setBlockState(pos, state.with(BlockStateProperties.LIT, false)); + if (state.getValue(BlockStateProperties.LIT) && !powered) { + world.setBlockAndUpdate(pos, state.setValue(BlockStateProperties.LIT, false)); } - if (!state.get(BlockStateProperties.LIT) && powered) { - world.setBlockState(pos, state.with(BlockStateProperties.LIT, true)); + if (!state.getValue(BlockStateProperties.LIT) && powered) { + world.setBlockAndUpdate(pos, state.setValue(BlockStateProperties.LIT, true)); } this.updateSurrounding(world, pos, powered, updatedAlready); @@ -67,7 +67,7 @@ public class BlockLampPowerer extends FullyDirectionalBlock { private void updateSurrounding(World world, BlockPos pos, boolean powered, List updatedAlready) { for (Direction side : Direction.values()) { - BlockPos offset = pos.offset(side); + BlockPos offset = pos.relative(side); if (!updatedAlready.contains(offset)) { updatedAlready.add(pos); this.updateLampsAtPos(world, offset, powered, updatedAlready); @@ -77,7 +77,7 @@ public class BlockLampPowerer extends FullyDirectionalBlock { @Override public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - switch (state.get(FACING)) { + switch (state.getValue(FACING)) { case EAST: return Shapes.LampPowererShapes.SHAPE_E; case SOUTH: diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java index 901ff8eba..cddc55b8e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java @@ -83,9 +83,9 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements // } @Override - public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { - ItemStack stack = player.getHeldItem(hand); - TileEntity tile = world.getTileEntity(pos); + public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { + ItemStack stack = player.getItemInHand(hand); + TileEntity tile = world.getBlockEntity(pos); if (tile instanceof TileEntityLaserRelay) { TileEntityLaserRelay relay = (TileEntityLaserRelay) tile; @@ -93,7 +93,7 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements if (stack.getItem() instanceof ItemLaserWrench) { return ActionResultType.FAIL; } else if (stack.getItem() == ConfigValues.itemCompassConfigurator) { - if (!world.isRemote) { + if (!world.isClientSide) { relay.onCompassAction(player); Network network = relay.getNetwork(); @@ -101,7 +101,7 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements network.changeAmount++; } - relay.markDirty(); + relay.setChanged(); relay.sendUpdate(); } @@ -109,9 +109,9 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements } else if (stack.getItem() instanceof ItemLaserRelayUpgrade) { ItemStack inRelay = relay.inv.getStackInSlot(0); if (!StackUtil.isValid(inRelay)) { - if (!world.isRemote) { + if (!world.isClientSide) { if (!player.isCreative()) { - player.setHeldItem(hand, StackUtil.shrink(stack, 1)); + player.setItemInHand(hand, StackUtil.shrink(stack, 1)); } ItemStack set = stack.copy(); @@ -124,14 +124,14 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements } } - if (player.isSneaking()) { + if (player.isShiftKeyDown()) { ItemStack inRelay = relay.inv.getStackInSlot(0).copy(); if (StackUtil.isValid(inRelay)) { - if (!world.isRemote) { + if (!world.isClientSide) { relay.inv.setStackInSlot(0, StackUtil.getEmpty()); - if (!player.inventory.addItemStackToInventory(inRelay)) { - player.entityDropItem(inRelay, 0); + if (!player.inventory.add(inRelay)) { + player.spawnAtLocation(inRelay, 0); } } return ActionResultType.PASS; @@ -146,7 +146,7 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements } @Override - public TileEntity createNewTileEntity(IBlockReader world) { + public TileEntity newBlockEntity(IBlockReader world) { switch (this.type) { case ITEM: return new TileEntityLaserRelayItem(); @@ -170,27 +170,27 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements return; } - BlockPos pos = ((BlockRayTraceResult) rayCast).getPos(); - if (minecraft.world != null) { + BlockPos pos = ((BlockRayTraceResult) rayCast).getBlockPos(); + if (minecraft.level != null) { boolean wearing = ItemEngineerGoggles.isWearing(player); if (wearing || StackUtil.isValid(stack)) { boolean compass = stack.getItem() == ConfigValues.itemCompassConfigurator; if (wearing || compass || stack.getItem() instanceof ItemLaserWrench) { - TileEntity tile = minecraft.world.getTileEntity(pos); + TileEntity tile = minecraft.level.getBlockEntity(pos); if (tile instanceof TileEntityLaserRelay) { TileEntityLaserRelay relay = (TileEntityLaserRelay) tile; String strg = relay.getExtraDisplayString(); - minecraft.fontRenderer.drawStringWithShadow(matrices, strg, resolution.getScaledWidth() / 2f + 5, resolution.getScaledHeight() / 2f + 5, StringUtil.DECIMAL_COLOR_WHITE); + minecraft.font.drawShadow(matrices, strg, resolution.getGuiScaledWidth() / 2f + 5, resolution.getGuiScaledHeight() / 2f + 5, StringUtil.DECIMAL_COLOR_WHITE); String expl; if (compass) { expl = relay.getCompassDisplayString(); } else { - expl = TextFormatting.GRAY.toString() + TextFormatting.ITALIC + StringUtil.localizeFormatted("info." + ActuallyAdditions.MODID + ".laserRelay.mode.noCompasss", StringUtil.localize(ConfigValues.itemCompassConfigurator.getTranslationKey() + ".name")); + expl = TextFormatting.GRAY.toString() + TextFormatting.ITALIC + StringUtil.localizeFormatted("info." + ActuallyAdditions.MODID + ".laserRelay.mode.noCompasss", StringUtil.localize(ConfigValues.itemCompassConfigurator.getDescriptionId() + ".name")); } - StringUtil.drawSplitString(minecraft.fontRenderer, expl, resolution.getScaledWidth() / 2 + 5, resolution.getScaledHeight() / 2 + 15, Integer.MAX_VALUE, StringUtil.DECIMAL_COLOR_WHITE, true); + StringUtil.drawSplitString(minecraft.font, expl, resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 15, Integer.MAX_VALUE, StringUtil.DECIMAL_COLOR_WHITE, true); } } } @@ -198,8 +198,8 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements } @Override - public void onReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean isMoving) { - super.onReplaced(state, world, pos, newState, isMoving); + public void onRemove(BlockState state, World world, BlockPos pos, BlockState newState, boolean isMoving) { + super.onRemove(state, world, pos, newState, isMoving); if (state != newState) { ActuallyAdditionsAPI.connectionHandler.removeRelayFromNetwork(pos, world); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLavaFactoryController.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLavaFactoryController.java index 5177ba816..dc8f14c9a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLavaFactoryController.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLavaFactoryController.java @@ -38,7 +38,7 @@ public class BlockLavaFactoryController extends DirectionalBlock.Container imple } @Override - public TileEntity createNewTileEntity(IBlockReader worldIn) { + public TileEntity newBlockEntity(IBlockReader worldIn) { return new TileEntityLavaFactoryController(); } @@ -49,20 +49,20 @@ public class BlockLavaFactoryController extends DirectionalBlock.Container imple return; } - TileEntityLavaFactoryController factory = (TileEntityLavaFactoryController) minecraft.world.getTileEntity(((BlockRayTraceResult) rayCast).getPos()); + TileEntityLavaFactoryController factory = (TileEntityLavaFactoryController) minecraft.level.getBlockEntity(((BlockRayTraceResult) rayCast).getBlockPos()); if (factory != null) { int state = factory.isMultiblock(); if (state == TileEntityLavaFactoryController.NOT_MULTI) { - StringUtil.drawSplitString(minecraft.fontRenderer, StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".factory.notPart.desc"), resolution.getScaledWidth() / 2 + 5, resolution.getScaledHeight() / 2 + 5, 200, StringUtil.DECIMAL_COLOR_WHITE, true); + StringUtil.drawSplitString(minecraft.font, StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".factory.notPart.desc"), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 5, 200, StringUtil.DECIMAL_COLOR_WHITE, true); } else if (state == TileEntityLavaFactoryController.HAS_AIR || state == TileEntityLavaFactoryController.HAS_LAVA) { - StringUtil.drawSplitString(minecraft.fontRenderer, StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".factory.works.desc"), resolution.getScaledWidth() / 2 + 5, resolution.getScaledHeight() / 2 + 5, 200, StringUtil.DECIMAL_COLOR_WHITE, true); + StringUtil.drawSplitString(minecraft.font, StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".factory.works.desc"), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 5, 200, StringUtil.DECIMAL_COLOR_WHITE, true); } } } @Override public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - switch (state.get(FACING)) { + switch (state.getValue(FACING)) { case EAST: return Shapes.LavaFactoryShapes.SHAPE_E; case SOUTH: diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLeafGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLeafGenerator.java index 22fecd5a1..5f2007192 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLeafGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLeafGenerator.java @@ -22,20 +22,22 @@ import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.world.IBlockReader; import net.minecraftforge.common.ToolType; +import net.minecraft.block.AbstractBlock.Properties; + public class BlockLeafGenerator extends DirectionalBlock.Container { public BlockLeafGenerator() { - super(Properties.create(Material.IRON).hardnessAndResistance(5.0F, 10.0F).harvestTool(ToolType.PICKAXE).harvestLevel(0).hardnessAndResistance(5.0F, 10.0F).sound(SoundType.METAL)); + super(Properties.of(Material.METAL).strength(5.0F, 10.0F).harvestTool(ToolType.PICKAXE).harvestLevel(0).strength(5.0F, 10.0F).sound(SoundType.METAL)); } @Override - public TileEntity createNewTileEntity(IBlockReader worldIn) { + public TileEntity newBlockEntity(IBlockReader worldIn) { return new TileEntityLeafGenerator(); } @Override public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - switch (state.get(FACING)) { + switch (state.getValue(FACING)) { case EAST: return Shapes.LeafGeneratorShapes.SHAPE_E; case SOUTH: diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java index a873756cc..2794298fa 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java @@ -33,18 +33,18 @@ import java.util.Random; public class BlockOilGenerator extends DirectionalBlock.Container { public BlockOilGenerator() { - super(ActuallyBlocks.defaultPickProps(0).tickRandomly()); + super(ActuallyBlocks.defaultPickProps(0).randomTicks()); } @Override - public TileEntity createNewTileEntity(IBlockReader worldIn) { + public TileEntity newBlockEntity(IBlockReader worldIn) { return new TileEntityOilGenerator(); } // TODO: Move all of these over to the client version @Override public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { - TileEntity tile = world.getTileEntity(pos); + TileEntity tile = world.getBlockEntity(pos); if (tile instanceof TileEntityOilGenerator) { if (((TileEntityOilGenerator) tile).currentBurnTime > 0) { for (int i = 0; i < 5; i++) { @@ -55,9 +55,9 @@ public class BlockOilGenerator extends DirectionalBlock.Container { } @Override - public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { - if (!world.isRemote) { - TileEntityOilGenerator generator = (TileEntityOilGenerator) world.getTileEntity(pos); + public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { + if (!world.isClientSide) { + TileEntityOilGenerator generator = (TileEntityOilGenerator) world.getBlockEntity(pos); if (generator != null) { if (!this.tryUseItemOnTank(player, hand, generator.tank)) { NetworkHooks.openGui((ServerPlayerEntity) player, generator, pos); @@ -70,7 +70,7 @@ public class BlockOilGenerator extends DirectionalBlock.Container { @Override public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - switch (state.get(FACING)) { + switch (state.getValue(FACING)) { case EAST: return Shapes.OilGeneratorShapes.SHAPE_E; case SOUTH: diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantom.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantom.java index cf45c8125..6d9f6a4f8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantom.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantom.java @@ -52,14 +52,14 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay { } @Override - public boolean canProvidePower(BlockState state) { + public boolean isSignalSource(BlockState state) { return this.type == Type.REDSTONEFACE; } @Override - public int getWeakPower(BlockState blockState, IBlockReader world, BlockPos pos, Direction side) { + public int getSignal(BlockState blockState, IBlockReader world, BlockPos pos, Direction side) { if (this.type == Type.REDSTONEFACE) { - TileEntity tile = world.getTileEntity(pos); + TileEntity tile = world.getBlockEntity(pos); if (tile instanceof TileEntityPhantomRedstoneface) { return ((TileEntityPhantomRedstoneface) tile).providesWeak[side.ordinal()]; } @@ -68,9 +68,9 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay { } @Override - public int getStrongPower(BlockState blockState, IBlockReader world, BlockPos pos, Direction side) { + public int getDirectSignal(BlockState blockState, IBlockReader world, BlockPos pos, Direction side) { if (this.type == Type.REDSTONEFACE) { - TileEntity tile = world.getTileEntity(pos); + TileEntity tile = world.getBlockEntity(pos); if (tile instanceof TileEntityPhantomRedstoneface) { return ((TileEntityPhantomRedstoneface) tile).providesStrong[side.ordinal()]; } @@ -84,7 +84,7 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay { } @Override - public TileEntity createNewTileEntity(IBlockReader worldIn) { + public TileEntity newBlockEntity(IBlockReader worldIn) { switch (this.type) { case PLACER: return new TileEntityPhantomPlacer(); @@ -103,13 +103,13 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay { // TODO: [port] validate this works @Override - public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { + public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { if (this.tryToggleRedstone(world, pos, player)) { return ActionResultType.PASS; } - if (!world.isRemote) { - TileEntity tile = world.getTileEntity(pos); + if (!world.isClientSide) { + TileEntity tile = world.getBlockEntity(pos); if (tile instanceof IPhantomTile && ((IPhantomTile) tile).getGuiID() != -1) { NetworkHooks.openGui((ServerPlayerEntity) player, (INamedContainerProvider) tile, pos); } @@ -125,27 +125,27 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay { if (!(rayCast instanceof BlockRayTraceResult)) { return; } - BlockPos pos = ((BlockRayTraceResult) rayCast).getPos(); - TileEntity tile = minecraft.world.getTileEntity(pos); + BlockPos pos = ((BlockRayTraceResult) rayCast).getBlockPos(); + TileEntity tile = minecraft.level.getBlockEntity(pos); if (tile != null) { if (tile instanceof IPhantomTile) { IPhantomTile phantom = (IPhantomTile) tile; - minecraft.fontRenderer.drawStringWithShadow(matrices, TextFormatting.GOLD + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".blockPhantomRange.desc") + ": " + phantom.getRange(), resolution.getScaledWidth() / 2 + 5, resolution.getScaledHeight() / 2 - 40, StringUtil.DECIMAL_COLOR_WHITE); + minecraft.font.drawShadow(matrices, TextFormatting.GOLD + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".blockPhantomRange.desc") + ": " + phantom.getRange(), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 - 40, StringUtil.DECIMAL_COLOR_WHITE); if (phantom.hasBoundPosition()) { int distance = MathHelper.ceil(new Vector3d(pos.getX(), pos.getY(), pos.getZ()).distanceTo(new Vector3d(phantom.getBoundPosition().getX(), phantom.getBoundPosition().getY(), phantom.getBoundPosition().getZ()))); - BlockState state = minecraft.world.getBlockState(phantom.getBoundPosition()); + BlockState state = minecraft.level.getBlockState(phantom.getBoundPosition()); Block block = state.getBlock(); - Item item = Item.getItemFromBlock(block); - String name = item.getDisplayName(new ItemStack(block)).getString(); - StringUtil.drawSplitString(minecraft.fontRenderer, StringUtil.localizeFormatted("tooltip." + ActuallyAdditions.MODID + ".phantom.blockInfo.desc", name, phantom.getBoundPosition().getX(), phantom.getBoundPosition().getY(), phantom.getBoundPosition().getZ(), distance), resolution.getScaledWidth() / 2 + 5, resolution.getScaledHeight() / 2 - 30, 200, StringUtil.DECIMAL_COLOR_WHITE, true); + Item item = Item.byBlock(block); + String name = item.getName(new ItemStack(block)).getString(); + StringUtil.drawSplitString(minecraft.font, StringUtil.localizeFormatted("tooltip." + ActuallyAdditions.MODID + ".phantom.blockInfo.desc", name, phantom.getBoundPosition().getX(), phantom.getBoundPosition().getY(), phantom.getBoundPosition().getZ(), distance), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 - 30, 200, StringUtil.DECIMAL_COLOR_WHITE, true); if (phantom.isBoundThingInRange()) { - StringUtil.drawSplitString(minecraft.fontRenderer, TextFormatting.DARK_GREEN + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".phantom.connectedRange.desc"), resolution.getScaledWidth() / 2 + 5, resolution.getScaledHeight() / 2 + 25, 200, StringUtil.DECIMAL_COLOR_WHITE, true); + StringUtil.drawSplitString(minecraft.font, TextFormatting.DARK_GREEN + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".phantom.connectedRange.desc"), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 25, 200, StringUtil.DECIMAL_COLOR_WHITE, true); } else { - StringUtil.drawSplitString(minecraft.fontRenderer, TextFormatting.DARK_RED + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".phantom.connectedNoRange.desc"), resolution.getScaledWidth() / 2 + 5, resolution.getScaledHeight() / 2 + 25, 200, StringUtil.DECIMAL_COLOR_WHITE, true); + StringUtil.drawSplitString(minecraft.font, TextFormatting.DARK_RED + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".phantom.connectedNoRange.desc"), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 25, 200, StringUtil.DECIMAL_COLOR_WHITE, true); } } else { - minecraft.fontRenderer.drawStringWithShadow(matrices, TextFormatting.RED + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".phantom.notConnected.desc"), resolution.getScaledWidth() / 2 + 5, resolution.getScaledHeight() / 2 + 25, StringUtil.DECIMAL_COLOR_WHITE); + minecraft.font.drawShadow(matrices, TextFormatting.RED + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".phantom.notConnected.desc"), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 25, StringUtil.DECIMAL_COLOR_WHITE); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantomBooster.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantomBooster.java index 3ead08a2f..1de69d4f3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantomBooster.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantomBooster.java @@ -26,7 +26,7 @@ public class BlockPhantomBooster extends BlockContainerBase { } @Override - public TileEntity createNewTileEntity(IBlockReader world) { + public TileEntity newBlockEntity(IBlockReader world) { return new TileEntityPhantomBooster(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPlayerInterface.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPlayerInterface.java index 446b5c9e6..519350a6a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPlayerInterface.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPlayerInterface.java @@ -39,24 +39,24 @@ public class BlockPlayerInterface extends BlockContainerBase implements IHudDisp } @Override - public TileEntity createNewTileEntity(IBlockReader worldIn) { + public TileEntity newBlockEntity(IBlockReader worldIn) { return new TileEntityPlayerInterface(); } @Override - public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, LivingEntity player, ItemStack stack) { - TileEntity tile = world.getTileEntity(pos); + public void setPlacedBy(World world, BlockPos pos, BlockState state, LivingEntity player, ItemStack stack) { + TileEntity tile = world.getBlockEntity(pos); if (tile instanceof TileEntityPlayerInterface) { TileEntityPlayerInterface face = (TileEntityPlayerInterface) tile; if (face.connectedPlayer == null) { - face.connectedPlayer = player.getUniqueID(); + face.connectedPlayer = player.getUUID(); face.playerName = player.getName().getString(); - face.markDirty(); + face.setChanged(); face.sendUpdate(); } } - super.onBlockPlacedBy(world, pos, state, player, stack); + super.setPlacedBy(world, pos, state, player, stack); } @Override @@ -66,15 +66,15 @@ public class BlockPlayerInterface extends BlockContainerBase implements IHudDisp return; } - TileEntity tile = minecraft.world.getTileEntity(((BlockRayTraceResult) rayCast).getPos()); + TileEntity tile = minecraft.level.getBlockEntity(((BlockRayTraceResult) rayCast).getBlockPos()); if (tile != null) { if (tile instanceof TileEntityPlayerInterface) { TileEntityPlayerInterface face = (TileEntityPlayerInterface) tile; String name = face.playerName == null ? "Unknown" : face.playerName; - minecraft.fontRenderer.drawStringWithShadow(matrices, "Bound to: " + TextFormatting.RED + name, resolution.getScaledWidth() / 2f + 5, resolution.getScaledHeight() / 2f + 5, StringUtil.DECIMAL_COLOR_WHITE); - minecraft.fontRenderer.drawStringWithShadow(matrices, "UUID: " + TextFormatting.DARK_GREEN + face.connectedPlayer, resolution.getScaledWidth() / 2f + 5, resolution.getScaledHeight() / 2f + 15, StringUtil.DECIMAL_COLOR_WHITE); + minecraft.font.drawShadow(matrices, "Bound to: " + TextFormatting.RED + name, resolution.getGuiScaledWidth() / 2f + 5, resolution.getGuiScaledHeight() / 2f + 5, StringUtil.DECIMAL_COLOR_WHITE); + minecraft.font.drawShadow(matrices, "UUID: " + TextFormatting.DARK_GREEN + face.connectedPlayer, resolution.getGuiScaledWidth() / 2f + 5, resolution.getGuiScaledHeight() / 2f + 15, StringUtil.DECIMAL_COLOR_WHITE); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockRangedCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockRangedCollector.java index 9d45a4ec7..913ab40e0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockRangedCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockRangedCollector.java @@ -31,12 +31,12 @@ public class BlockRangedCollector extends BlockContainerBase { } @Override - public TileEntity createNewTileEntity(IBlockReader worldIn) { + public TileEntity newBlockEntity(IBlockReader worldIn) { return new TileEntityRangedCollector(); } @Override - public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { + public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { if (this.tryToggleRedstone(world, pos, player)) { return ActionResultType.PASS; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockShockSuppressor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockShockSuppressor.java index a337ec522..2bdd8741d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockShockSuppressor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockShockSuppressor.java @@ -38,7 +38,7 @@ public class BlockShockSuppressor extends BlockContainerBase { @SubscribeEvent public void onExplosion(ExplosionEvent.Detonate event) { World world = event.getWorld(); - if (!world.isRemote) { + if (!world.isClientSide) { List affectedBlocks = event.getAffectedBlocks(); List affectedEntities = event.getAffectedEntities(); @@ -47,18 +47,18 @@ public class BlockShockSuppressor extends BlockContainerBase { for (TileEntityShockSuppressor suppressor : TileEntityShockSuppressor.SUPPRESSORS) { if (!suppressor.isRedstonePowered) { - BlockPos supPos = suppressor.getPos(); + BlockPos supPos = suppressor.getBlockPos(); List entitiesToRemove = new ArrayList<>(); List posesToRemove = new ArrayList<>(); for (BlockPos pos : affectedBlocks) { - if (pos.distanceSq(supPos) <= rangeSq) { + if (pos.distSqr(supPos) <= rangeSq) { posesToRemove.add(pos); } } for (Entity entity : affectedEntities) { - if (entity.getPositionVec().squareDistanceTo(supPos.getX(), supPos.getY(), supPos.getZ()) <= rangeSq) { + if (entity.position().distanceToSqr(supPos.getX(), supPos.getY(), supPos.getZ()) <= rangeSq) { entitiesToRemove.add(entity); } } @@ -88,7 +88,7 @@ public class BlockShockSuppressor extends BlockContainerBase { } @Override - public TileEntity createNewTileEntity(IBlockReader worldIn) { + public TileEntity newBlockEntity(IBlockReader worldIn) { return new TileEntityShockSuppressor(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTinyTorch.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTinyTorch.java index 13519b662..83c951b72 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTinyTorch.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTinyTorch.java @@ -17,6 +17,8 @@ import net.minecraft.util.math.AxisAlignedBB; //Copied from BlockTorch. //I have no idea what all of this means. +import net.minecraft.block.AbstractBlock.Properties; + public class BlockTinyTorch extends BlockBase { //Thanks to xdjackiexd for these. @@ -28,7 +30,7 @@ public class BlockTinyTorch extends BlockBase { private static final AxisAlignedBB TORCH_EAST_AABB = new AxisAlignedBB(0.0D, 0.25D, 0.4375D, 0.1875D, 0.5625D, 0.5625D); public BlockTinyTorch() { - super(Properties.create(Material.MISCELLANEOUS).sound(SoundType.WOOD).hardnessAndResistance(0.0F, 0.8F)); + super(Properties.of(Material.DECORATION).sound(SoundType.WOOD).strength(0.0F, 0.8F)); // TorchBlock // this.setDefaultState(this.blockState.getBaseState().withProperty(BlockTorch.FACING, Direction.UP)); // this.setTickRandomly(true); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockVerticalDigger.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockVerticalDigger.java index 0f834752f..8073ec183 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockVerticalDigger.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockVerticalDigger.java @@ -40,12 +40,12 @@ public class BlockVerticalDigger extends DirectionalBlock.Container implements I } @Override - public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { + public ActionResultType use(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { return this.openGui(worldIn, player, pos, TileEntityMiner.class); } @Override - public TileEntity createNewTileEntity(IBlockReader world) { + public TileEntity newBlockEntity(IBlockReader world) { return new TileEntityMiner(); } @@ -55,21 +55,21 @@ public class BlockVerticalDigger extends DirectionalBlock.Container implements I if (!(rayCast instanceof BlockRayTraceResult)) { return; } - TileEntity tile = minecraft.world.getTileEntity(((BlockRayTraceResult) rayCast).getPos()); + TileEntity tile = minecraft.level.getBlockEntity(((BlockRayTraceResult) rayCast).getBlockPos()); if (tile instanceof TileEntityMiner) { TileEntityMiner miner = (TileEntityMiner) tile; String info = miner.checkY == 0 ? "Done Mining!" : miner.checkY == -1 ? "Calculating positions..." - : "Mining at " + (miner.getPos().getX() + miner.checkX) + ", " + miner.checkY + ", " + (miner.getPos().getZ() + miner.checkZ) + "."; - minecraft.fontRenderer.drawStringWithShadow(matrices, info, resolution.getScaledWidth() / 2f + 5, resolution.getScaledHeight() / 2f - 20, StringUtil.DECIMAL_COLOR_WHITE); + : "Mining at " + (miner.getBlockPos().getX() + miner.checkX) + ", " + miner.checkY + ", " + (miner.getBlockPos().getZ() + miner.checkZ) + "."; + minecraft.font.drawShadow(matrices, info, resolution.getGuiScaledWidth() / 2f + 5, resolution.getGuiScaledHeight() / 2f - 20, StringUtil.DECIMAL_COLOR_WHITE); } } @Override public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - switch (state.get(FACING)) { + switch (state.getValue(FACING)) { case NORTH: return Shapes.MinerShapes.SHAPE_N; case EAST: diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWildPlant.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWildPlant.java index 3171c323f..577ffd50d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWildPlant.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWildPlant.java @@ -14,13 +14,15 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBushBase; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; +import net.minecraft.block.AbstractBlock.Properties; + public class BlockWildPlant extends BlockBushBase { // public static final TheWildPlants[] ALL_WILD_PLANTS = TheWildPlants.values(); // public static final PropertyEnum TYPE = PropertyEnum.create("type", TheWildPlants.class); public BlockWildPlant() { - super(Properties.create(Material.PLANTS).sound(SoundType.PLANT).harvestLevel(0).hardnessAndResistance(0, 0)); + super(Properties.of(Material.PLANT).sound(SoundType.GRASS).harvestLevel(0).strength(0, 0)); // this.setSoundType(SoundType.PLANT); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockXPSolidifier.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockXPSolidifier.java index 3beb6827c..c72c4fe46 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockXPSolidifier.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockXPSolidifier.java @@ -30,12 +30,12 @@ public class BlockXPSolidifier extends DirectionalBlock.Container { } @Override - public TileEntity createNewTileEntity(IBlockReader worldIn) { + public TileEntity newBlockEntity(IBlockReader worldIn) { return new TileEntityXPSolidifier(); } @Override - public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { + public ActionResultType use(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { return this.openGui(worldIn, player, pos, TileEntityXPSolidifier.class); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/Shapes.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/Shapes.java index c454fb23c..a1f5fb9d2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/Shapes.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/Shapes.java @@ -9,109 +9,109 @@ import java.util.Optional; import java.util.stream.Stream; public class Shapes { - static final VoxelShape CANOLA_PRESS_SHAPE = Stream.of(Block.makeCuboidShape(13, 0, 1, 15, 15.5, 3), Block.makeCuboidShape(2, 0, 2, 14, 6, 14), Block.makeCuboidShape(2, 10, 2, 14, 15, 14), Block.makeCuboidShape(3, 6, 3, 13, 10, 13), Block.makeCuboidShape(1, 0, 1, 3, 15.5, 3), Block.makeCuboidShape(1, 0, 13, 3, 15.5, 15), Block.makeCuboidShape(13, 0, 13, 15, 15.5, 15), Block.makeCuboidShape(0.9, 0, 0.9, 3.1, 0.5, 3.1), Block.makeCuboidShape(0.9, 0, 12.9, 3.1, 0.5, 15.1), Block.makeCuboidShape(0.9, 5, 12.9, 3.1, 6.5, 15.1), Block.makeCuboidShape(0.9, 5, 0.9, 3.1, 6.5, 3.1), Block.makeCuboidShape(12.9, 5, 12.9, 15.1, 6.5, 15.1), Block.makeCuboidShape(12.9, 5, 0.9, 15.1, 6.5, 3.1), Block.makeCuboidShape(0.9, 9.5, 12.9, 3.1, 11, 15.1), Block.makeCuboidShape(0.9, 9.5, 0.9, 3.1, 11, 3.1), Block.makeCuboidShape(12.9, 9.5, 12.9, 15.1, 11, 15.1), Block.makeCuboidShape(12.9, 9.5, 0.9, 15.1, 11, 3.1), Block.makeCuboidShape(12.9, 0, 0.9, 15.1, 0.5, 3.1), Block.makeCuboidShape(12.9, 0, 12.9, 15.1, 0.5, 15.1), Block.makeCuboidShape(12.9, 15.5, 0.9, 15.1, 16, 3.1), Block.makeCuboidShape(12.9, 15.5, 12.9, 15.1, 16, 15.1), Block.makeCuboidShape(0.9, 15.5, 0.9, 3.1, 16, 3.1), Block.makeCuboidShape(0.9, 15.5, 12.9, 3.1, 16, 15.1)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape CRYSTAL_CLUSTER_SHAPE = Stream.of(Block.makeCuboidShape(5, 4, 5, 10, 19, 10), Block.makeCuboidShape(4, 0, 4, 11, 5, 11), Block.makeCuboidShape(3, 0, 3, 5, 4, 5), Block.makeCuboidShape(10, 0, 3, 12, 2, 5), Block.makeCuboidShape(12, 0, 4, 13, 1, 5), Block.makeCuboidShape(11, 0, 5, 12, 1, 6), Block.makeCuboidShape(10, 0, 10, 12, 3, 12), Block.makeCuboidShape(3, 0, 10, 5, 1, 12), Block.makeCuboidShape(9, 0, 3, 10, 3, 4), Block.makeCuboidShape(8, 0, 2, 11, 1, 4), Block.makeCuboidShape(4, 0, 2, 5, 2, 3), Block.makeCuboidShape(5, 0, 3, 7, 1, 4), Block.makeCuboidShape(2, 0, 4, 4, 1, 6), Block.makeCuboidShape(3, 0, 5, 4, 3, 6.5), Block.makeCuboidShape(3, 0, 9, 4, 2, 10), Block.makeCuboidShape(2, 0, 8, 4, 1, 10), Block.makeCuboidShape(5, 0, 11, 7, 2, 13), Block.makeCuboidShape(7, 0, 11, 11, 1, 13), Block.makeCuboidShape(10, 0, 9, 13, 1, 11), Block.makeCuboidShape(11, 0, 7, 12, 3, 9)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape DISPLAY_STAND_SHAPE = Stream.of(Block.makeCuboidShape(1, 7, 0, 15, 8, 1), Block.makeCuboidShape(0, 0, 0, 16, 1, 16), Block.makeCuboidShape(1, 1, 1, 15, 7, 15), Block.makeCuboidShape(6, 7, 6, 10, 9, 10), Block.makeCuboidShape(0, 1, 0, 1, 7, 1), Block.makeCuboidShape(15, 1, 0, 16, 7, 1), Block.makeCuboidShape(15, 1, 15, 16, 7, 16), Block.makeCuboidShape(0, 1, 15, 1, 7, 16), Block.makeCuboidShape(0, 7, 0, 1, 8, 16), Block.makeCuboidShape(15, 7, 0, 16, 8, 16), Block.makeCuboidShape(1, 7, 15, 15, 8, 16), Block.makeCuboidShape(5, 7, 5, 6, 9, 6), Block.makeCuboidShape(5, 7, 10, 6, 9, 11), Block.makeCuboidShape(10, 7, 10, 11, 9, 11), Block.makeCuboidShape(10, 7, 5, 11, 9, 6)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape EMPOWERER_SHAPE = Stream.of(Block.makeCuboidShape(0, 0, 0, 16, 1, 16), Block.makeCuboidShape(1, 1, 1, 15, 6, 15), Block.makeCuboidShape(1, 6, 1, 15, 7, 15), Block.makeCuboidShape(0, 7, 0, 16, 8, 1), Block.makeCuboidShape(0, 7, 15, 16, 8, 16), Block.makeCuboidShape(0, 7, 1, 1, 8, 15), Block.makeCuboidShape(15, 7, 1, 16, 8, 15), Block.makeCuboidShape(4, 7, 4, 12, 9, 12), Block.makeCuboidShape(0, 1, 0, 1, 7, 1), Block.makeCuboidShape(15, 1, 0, 16, 7, 1), Block.makeCuboidShape(15, 1, 15, 16, 7, 16), Block.makeCuboidShape(0, 1, 15, 1, 7, 16), Block.makeCuboidShape(3, 7, 4, 4, 8, 5), Block.makeCuboidShape(3, 7, 11, 4, 8, 12), Block.makeCuboidShape(4, 7, 12, 5, 8, 13), Block.makeCuboidShape(11, 7, 12, 12, 8, 13), Block.makeCuboidShape(12, 7, 11, 13, 8, 12), Block.makeCuboidShape(12, 7, 4, 13, 8, 5), Block.makeCuboidShape(11, 7, 3, 12, 8, 4), Block.makeCuboidShape(4, 7, 3, 5, 8, 4)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape ENERGIZER_SHAPE = Stream.of(Block.makeCuboidShape(0, 15, 0, 1, 16, 16), Block.makeCuboidShape(15, 15, 0, 16, 16, 16), Block.makeCuboidShape(1, 15, 0, 15, 16, 1), Block.makeCuboidShape(1, 15, 15, 15, 16, 16), Block.makeCuboidShape(1, 0, 15, 15, 1, 16), Block.makeCuboidShape(1, 0, 0, 15, 1, 1), Block.makeCuboidShape(15, 0, 0, 16, 1, 16), Block.makeCuboidShape(0, 0, 0, 1, 1, 16), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(1, 14, 1, 15, 15, 15), Block.makeCuboidShape(1, 1, 1, 15, 2, 15), Block.makeCuboidShape(14, 2, 1, 15, 14, 15), Block.makeCuboidShape(1, 2, 1, 2, 14, 15), Block.makeCuboidShape(2, 2, 14, 14, 14, 15), Block.makeCuboidShape(2, 2, 1, 14, 14, 2), Block.makeCuboidShape(9, 3, 0, 13, 4, 1), Block.makeCuboidShape(3, 3, 15, 7, 4, 16), Block.makeCuboidShape(9, 12, 0, 13, 13, 1), Block.makeCuboidShape(3, 12, 15, 7, 13, 16), Block.makeCuboidShape(10, 4, 0, 12, 12, 1), Block.makeCuboidShape(4, 4, 15, 6, 12, 16), Block.makeCuboidShape(0, 3, 3, 1, 4, 7), Block.makeCuboidShape(15, 3, 9, 16, 4, 13), Block.makeCuboidShape(0, 12, 3, 1, 13, 7), Block.makeCuboidShape(15, 12, 9, 16, 13, 13), Block.makeCuboidShape(0, 4, 4, 1, 12, 6), Block.makeCuboidShape(15, 4, 10, 16, 12, 12)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape BARREL_SHAPE = Stream.of(Block.makeCuboidShape(0, 12, 0, 16, 14, 1), Block.makeCuboidShape(1, 0.5, 1, 15, 15, 15), Block.makeCuboidShape(0, 2, 15, 16, 4, 16), Block.makeCuboidShape(0, 7, 15, 16, 9, 16), Block.makeCuboidShape(0, 12, 15, 16, 14, 16), Block.makeCuboidShape(0, 2, 0, 16, 4, 1), Block.makeCuboidShape(0, 7, 0, 16, 9, 1), Block.makeCuboidShape(0, 2, 1, 1, 4, 15), Block.makeCuboidShape(0, 7, 1, 1, 9, 15), Block.makeCuboidShape(0, 12, 1, 1, 14, 15), Block.makeCuboidShape(15, 12, 1, 16, 14, 15), Block.makeCuboidShape(15, 7, 1, 16, 9, 15), Block.makeCuboidShape(15, 2, 1, 16, 4, 15), Block.makeCuboidShape(7, 0, 0.5, 9, 16, 1.5), Block.makeCuboidShape(0.5, 0, 7, 1.5, 16, 9), Block.makeCuboidShape(7, 0, 14.5, 9, 16, 15.5), Block.makeCuboidShape(14.5, 0, 7, 15.5, 16, 9), Block.makeCuboidShape(2, 0, 0.5, 5, 16, 1.5), Block.makeCuboidShape(0.5, 0, 11, 1.5, 16, 14), Block.makeCuboidShape(2, 0, 14.5, 5, 16, 15.5), Block.makeCuboidShape(14.5, 0, 11, 15.5, 16, 14), Block.makeCuboidShape(11, 0, 0.5, 14, 16, 1.5), Block.makeCuboidShape(0.5, 0, 2, 1.5, 16, 5), Block.makeCuboidShape(11, 0, 14.5, 14, 16, 15.5), Block.makeCuboidShape(14.5, 0, 2, 15.5, 16, 5), Block.makeCuboidShape(4, 15, 7, 6, 15.3, 9), Block.makeCuboidShape(2, 15, 4, 3, 15.3, 12), Block.makeCuboidShape(4, 15, 13, 12, 15.3, 14), Block.makeCuboidShape(4, 15, 2, 12, 15.3, 3), Block.makeCuboidShape(13, 15, 4, 14, 15.3, 12), Block.makeCuboidShape(3, 15, 3, 4, 15.3, 4), Block.makeCuboidShape(3, 15, 12, 4, 15.3, 13), Block.makeCuboidShape(12, 15, 3, 13, 15.3, 4), Block.makeCuboidShape(12, 15, 12, 13, 15.3, 13)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape FIREWORKS_BOX_SHAPE = Stream.of(Block.makeCuboidShape(0, 0, 0, 1, 1, 16), Block.makeCuboidShape(1, 0, 15, 15, 1, 16), Block.makeCuboidShape(15, 0, 0, 16, 1, 16), Block.makeCuboidShape(1, 0, 0, 15, 1, 1), Block.makeCuboidShape(0, 15, 0, 1, 16, 16), Block.makeCuboidShape(15, 15, 0, 16, 16, 16), Block.makeCuboidShape(1, 15, 0, 15, 16, 1), Block.makeCuboidShape(1, 15, 15, 15, 16, 16), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(10, 14, 9, 12, 15, 10), Block.makeCuboidShape(7, 14, 9, 9, 15, 10), Block.makeCuboidShape(4, 14, 9, 6, 15, 10), Block.makeCuboidShape(10, 14, 6, 12, 15, 7), Block.makeCuboidShape(7, 14, 6, 9, 15, 7), Block.makeCuboidShape(4, 14, 6, 6, 15, 7), Block.makeCuboidShape(6, 14, 4, 7, 15, 12), Block.makeCuboidShape(9, 14, 4, 10, 15, 12), Block.makeCuboidShape(4, 14, 12, 12, 15, 14), Block.makeCuboidShape(4, 14, 2, 12, 15, 4), Block.makeCuboidShape(12, 14, 2, 14, 15, 14), Block.makeCuboidShape(2, 14, 2, 4, 15, 14), Block.makeCuboidShape(2, 13, 2, 14, 14, 14), Block.makeCuboidShape(2, 0, 2, 14, 1, 14), Block.makeCuboidShape(1, 0, 2, 2, 15, 14), Block.makeCuboidShape(14, 0, 2, 15, 15, 14), Block.makeCuboidShape(1, 0, 1, 15, 15, 2), Block.makeCuboidShape(1, 0, 14, 15, 15, 15)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape GLASS_SHAPE = Stream.of(Block.makeCuboidShape(15, 0, 1, 16, 1, 15), Block.makeCuboidShape(1, 1, 1, 15, 15, 15), Block.makeCuboidShape(0, 0, 0, 16, 1, 1), Block.makeCuboidShape(0, 0, 15, 16, 1, 16), Block.makeCuboidShape(0, 15, 0, 16, 16, 1), Block.makeCuboidShape(0, 15, 15, 16, 16, 16), Block.makeCuboidShape(0, 0, 1, 1, 1, 15), Block.makeCuboidShape(0, 15, 1, 1, 16, 15), Block.makeCuboidShape(15, 15, 1, 16, 16, 15), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape HEAT_COLLECTOR_SHAPE = Stream.of(Block.makeCuboidShape(0, 0, 0, 1, 1, 16), Block.makeCuboidShape(1, 0, 15, 15, 1, 16), Block.makeCuboidShape(15, 0, 0, 16, 1, 16), Block.makeCuboidShape(1, 0, 0, 15, 1, 1), Block.makeCuboidShape(0, 15, 0, 1, 16, 16), Block.makeCuboidShape(15, 15, 0, 16, 16, 16), Block.makeCuboidShape(1, 15, 0, 15, 16, 1), Block.makeCuboidShape(1, 15, 15, 15, 16, 16), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(4, 13, 4, 12, 14, 12), Block.makeCuboidShape(11, 14, 4, 12, 15, 5), Block.makeCuboidShape(4, 14, 4, 5, 15, 5), Block.makeCuboidShape(4, 14, 11, 5, 15, 12), Block.makeCuboidShape(11, 14, 11, 12, 15, 12), Block.makeCuboidShape(15, 11, 4, 16, 12, 12), Block.makeCuboidShape(15, 5, 4, 16, 6, 12), Block.makeCuboidShape(15, 7, 4, 16, 8, 12), Block.makeCuboidShape(15, 9, 4, 16, 10, 12), Block.makeCuboidShape(4, 11, 15, 12, 12, 16), Block.makeCuboidShape(4, 9, 15, 12, 10, 16), Block.makeCuboidShape(4, 7, 15, 12, 8, 16), Block.makeCuboidShape(4, 5, 15, 12, 6, 16), Block.makeCuboidShape(0, 11, 4, 1, 12, 12), Block.makeCuboidShape(0, 5, 4, 1, 6, 12), Block.makeCuboidShape(0, 7, 4, 1, 8, 12), Block.makeCuboidShape(0, 9, 4, 1, 10, 12), Block.makeCuboidShape(4, 11, 0, 12, 12, 1), Block.makeCuboidShape(4, 9, 0, 12, 10, 1), Block.makeCuboidShape(4, 7, 0, 12, 8, 1), Block.makeCuboidShape(4, 5, 0, 12, 6, 1), Block.makeCuboidShape(2, 14, 2, 4, 15, 14), Block.makeCuboidShape(4, 14, 2, 12, 15, 4), Block.makeCuboidShape(4, 14, 12, 12, 15, 14), Block.makeCuboidShape(12, 14, 2, 14, 15, 14), Block.makeCuboidShape(2, 0, 2, 14, 1, 14), Block.makeCuboidShape(1, 0, 2, 2, 15, 14), Block.makeCuboidShape(14, 0, 2, 15, 15, 14), Block.makeCuboidShape(1, 0, 1, 15, 15, 2), Block.makeCuboidShape(1, 0, 14, 15, 15, 15)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape ITEM_VIEWER_SHAPE = Stream.of(Block.makeCuboidShape(15, 0, 1, 16, 1, 15), Block.makeCuboidShape(1, 1, 1, 15, 15, 15), Block.makeCuboidShape(0, 0, 0, 16, 1, 1), Block.makeCuboidShape(0, 0, 15, 16, 1, 16), Block.makeCuboidShape(0, 15, 0, 16, 16, 1), Block.makeCuboidShape(0, 15, 15, 16, 16, 16), Block.makeCuboidShape(0, 0, 1, 1, 1, 15), Block.makeCuboidShape(0, 15, 1, 1, 16, 15), Block.makeCuboidShape(15, 15, 1, 16, 16, 15), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape HOPPING_ITEM_VIEWER_SHAPE = Stream.of(Block.makeCuboidShape(0, 10, 0, 16, 11, 16), Block.makeCuboidShape(1, 11, 1, 2, 15, 15), Block.makeCuboidShape(14, 11, 1, 15, 15, 15), Block.makeCuboidShape(2, 11, 1, 14, 15, 2), Block.makeCuboidShape(2, 11, 14, 14, 15, 15), Block.makeCuboidShape(4, 4, 4, 12, 10, 12), Block.makeCuboidShape(6, 0, 6, 10, 4, 10), Block.makeCuboidShape(0, 15, 0, 16, 16, 1), Block.makeCuboidShape(0, 15, 15, 16, 16, 16), Block.makeCuboidShape(15, 15, 1, 16, 16, 15), Block.makeCuboidShape(0, 15, 1, 1, 16, 15), Block.makeCuboidShape(0, 11, 0, 1, 15, 1), Block.makeCuboidShape(0, 11, 15, 1, 15, 16), Block.makeCuboidShape(15, 11, 15, 16, 15, 16), Block.makeCuboidShape(15, 11, 0, 16, 15, 1)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape BOOSTER_SHAPE = Stream.of(Block.makeCuboidShape(5, 12, 12, 11, 13, 13), Block.makeCuboidShape(6, 0, 6, 10, 16, 10), Block.makeCuboidShape(5, 2, 5, 11, 3, 11), Block.makeCuboidShape(5, 4, 12, 11, 5, 13), Block.makeCuboidShape(5, 6, 12, 11, 7, 13), Block.makeCuboidShape(5, 8, 12, 11, 9, 13), Block.makeCuboidShape(5, 10, 12, 11, 11, 13), Block.makeCuboidShape(5, 4, 3, 11, 5, 4), Block.makeCuboidShape(5, 6, 3, 11, 7, 4), Block.makeCuboidShape(5, 8, 3, 11, 9, 4), Block.makeCuboidShape(5, 10, 3, 11, 11, 4), Block.makeCuboidShape(5, 12, 3, 11, 13, 4), Block.makeCuboidShape(3, 4, 5, 4, 5, 11), Block.makeCuboidShape(3, 6, 5, 4, 7, 11), Block.makeCuboidShape(3, 8, 5, 4, 9, 11), Block.makeCuboidShape(3, 10, 5, 4, 11, 11), Block.makeCuboidShape(3, 12, 5, 4, 13, 11), Block.makeCuboidShape(12, 4, 5, 13, 5, 11), Block.makeCuboidShape(12, 6, 5, 13, 7, 11), Block.makeCuboidShape(12, 8, 5, 13, 9, 11), Block.makeCuboidShape(12, 10, 5, 13, 11, 11), Block.makeCuboidShape(12, 12, 5, 13, 13, 11), Block.makeCuboidShape(5, 14, 5, 11, 15, 11), Block.makeCuboidShape(4, 4, 11, 5, 5, 12), Block.makeCuboidShape(4, 6, 11, 5, 7, 12), Block.makeCuboidShape(4, 8, 11, 5, 9, 12), Block.makeCuboidShape(4, 10, 11, 5, 11, 12), Block.makeCuboidShape(4, 12, 11, 5, 13, 12), Block.makeCuboidShape(4, 4, 4, 5, 5, 5), Block.makeCuboidShape(4, 6, 4, 5, 7, 5), Block.makeCuboidShape(4, 8, 4, 5, 9, 5), Block.makeCuboidShape(4, 10, 4, 5, 11, 5), Block.makeCuboidShape(4, 12, 4, 5, 13, 5), Block.makeCuboidShape(11, 4, 4, 12, 5, 5), Block.makeCuboidShape(11, 6, 4, 12, 7, 5), Block.makeCuboidShape(11, 8, 4, 12, 9, 5), Block.makeCuboidShape(11, 10, 4, 12, 11, 5), Block.makeCuboidShape(11, 12, 4, 12, 13, 5), Block.makeCuboidShape(11, 4, 11, 12, 5, 12), Block.makeCuboidShape(11, 6, 11, 12, 7, 12), Block.makeCuboidShape(11, 8, 11, 12, 9, 12), Block.makeCuboidShape(11, 10, 11, 12, 11, 12), Block.makeCuboidShape(11, 12, 11, 12, 13, 12)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape PLAYER_INTERFACE_SHAPE = Stream.of(Block.makeCuboidShape(15, 0, 1, 16, 1, 15), Block.makeCuboidShape(1, 1, 1, 15, 15, 15), Block.makeCuboidShape(0, 0, 0, 16, 1, 1), Block.makeCuboidShape(0, 0, 15, 16, 1, 16), Block.makeCuboidShape(0, 15, 0, 16, 16, 1), Block.makeCuboidShape(0, 15, 15, 16, 16, 16), Block.makeCuboidShape(0, 0, 1, 1, 1, 15), Block.makeCuboidShape(0, 15, 1, 1, 16, 15), Block.makeCuboidShape(15, 15, 1, 16, 16, 15), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape COLLECTOR_SHAPE = Stream.of(Block.makeCuboidShape(0, 0, 0, 1, 1, 16), Block.makeCuboidShape(1, 0, 15, 15, 1, 16), Block.makeCuboidShape(15, 0, 0, 16, 1, 16), Block.makeCuboidShape(1, 0, 0, 15, 1, 1), Block.makeCuboidShape(0, 15, 0, 1, 16, 16), Block.makeCuboidShape(15, 15, 0, 16, 16, 16), Block.makeCuboidShape(1, 15, 0, 15, 16, 1), Block.makeCuboidShape(1, 15, 15, 15, 16, 16), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(1, 1, 4, 2, 4, 12), Block.makeCuboidShape(14, 1, 4, 15, 4, 12), Block.makeCuboidShape(4, 1, 1, 12, 4, 2), Block.makeCuboidShape(4, 1, 14, 12, 4, 15), Block.makeCuboidShape(4, 14, 12, 12, 15, 14), Block.makeCuboidShape(1, 12, 4, 2, 15, 12), Block.makeCuboidShape(14, 12, 4, 15, 15, 12), Block.makeCuboidShape(4, 12, 1, 12, 15, 2), Block.makeCuboidShape(4, 12, 14, 12, 15, 15), Block.makeCuboidShape(4, 14, 2, 12, 15, 4), Block.makeCuboidShape(1, 1, 12, 2, 15, 14), Block.makeCuboidShape(14, 1, 2, 15, 15, 4), Block.makeCuboidShape(1, 1, 1, 4, 15, 2), Block.makeCuboidShape(12, 1, 14, 15, 15, 15), Block.makeCuboidShape(12, 14, 2, 14, 15, 14), Block.makeCuboidShape(1, 1, 2, 2, 15, 4), Block.makeCuboidShape(14, 1, 12, 15, 15, 14), Block.makeCuboidShape(12, 1, 1, 15, 15, 2), Block.makeCuboidShape(1, 1, 14, 4, 15, 15), Block.makeCuboidShape(2, 14, 2, 4, 15, 14), Block.makeCuboidShape(2, 2, 2, 14, 14, 14), Block.makeCuboidShape(1, 0, 1, 15, 1, 15)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SUPPRESSOR_SHAPE = Stream.of(Block.makeCuboidShape(15, 15, 0, 16, 16, 16), Block.makeCuboidShape(0, 0, 0, 1, 1, 16), Block.makeCuboidShape(1, 0, 15, 15, 1, 16), Block.makeCuboidShape(15, 0, 0, 16, 1, 16), Block.makeCuboidShape(1, 0, 0, 15, 1, 1), Block.makeCuboidShape(0, 15, 0, 1, 16, 16), Block.makeCuboidShape(1, 15, 0, 15, 16, 1), Block.makeCuboidShape(1, 15, 15, 15, 16, 16), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(1, 14, 1, 15, 15, 15), Block.makeCuboidShape(1, 1, 1, 15, 2, 15), Block.makeCuboidShape(9, 13, 9, 13, 16, 13), Block.makeCuboidShape(9, 2, 9, 13, 3, 13), Block.makeCuboidShape(3, 13, 9, 7, 16, 13), Block.makeCuboidShape(3, 2, 9, 7, 3, 13), Block.makeCuboidShape(9, 13, 3, 13, 16, 7), Block.makeCuboidShape(9, 2, 3, 13, 3, 7), Block.makeCuboidShape(3, 13, 3, 7, 16, 7), Block.makeCuboidShape(3, 2, 3, 7, 3, 7), Block.makeCuboidShape(4, 3, 10, 6, 13, 12), Block.makeCuboidShape(10, 3, 10, 12, 13, 12), Block.makeCuboidShape(10, 3, 4, 12, 13, 6), Block.makeCuboidShape(4, 3, 4, 6, 13, 6)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape RELAY_SHAPE = Stream.of(Block.makeCuboidShape(6, 4, 6, 7, 6, 7), Block.makeCuboidShape(1, 0, 1, 15, 1, 15), Block.makeCuboidShape(4, 2, 4, 12, 4, 12), Block.makeCuboidShape(9, 4, 9, 10, 6, 10), Block.makeCuboidShape(6, 4, 9, 7, 6, 10), Block.makeCuboidShape(3, 1, 12, 4, 5, 13), Block.makeCuboidShape(12, 1, 12, 13, 5, 13), Block.makeCuboidShape(3, 1, 3, 4, 5, 4), Block.makeCuboidShape(12, 1, 3, 13, 5, 4), Block.makeCuboidShape(3, 4, 4, 4, 5, 12), Block.makeCuboidShape(3, 1, 4, 4, 2, 12), Block.makeCuboidShape(12, 4, 4, 13, 5, 12), Block.makeCuboidShape(12, 1, 4, 13, 2, 12), Block.makeCuboidShape(4, 4, 12, 12, 5, 13), Block.makeCuboidShape(4, 4, 3, 12, 5, 4), Block.makeCuboidShape(4, 1, 12, 12, 2, 13), Block.makeCuboidShape(4, 1, 3, 12, 2, 4), Block.makeCuboidShape(9, 4, 6, 10, 6, 7), Block.makeCuboidShape(7, 4, 7, 9, 6, 9), Block.makeCuboidShape(7, 6, 7, 9, 10, 9), Block.makeCuboidShape(6.5, 5, 7, 7, 6, 9), Block.makeCuboidShape(6.5, 7, 7, 7, 7.5, 9), Block.makeCuboidShape(6.5, 9, 7, 7, 9.5, 9), Block.makeCuboidShape(9, 5, 7, 9.5, 6, 9), Block.makeCuboidShape(9, 7, 7, 9.5, 7.5, 9), Block.makeCuboidShape(9, 9, 7, 9.5, 9.5, 9), Block.makeCuboidShape(7, 5, 6.5, 9, 6, 7), Block.makeCuboidShape(7, 7, 6.5, 9, 7.5, 7), Block.makeCuboidShape(7, 9, 6.5, 9, 9.5, 7), Block.makeCuboidShape(7, 5, 9, 9, 6, 9.5), Block.makeCuboidShape(7, 7, 9, 9, 7.5, 9.5), Block.makeCuboidShape(7, 9, 9, 9, 9.5, 9.5)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape CANOLA_PRESS_SHAPE = Stream.of(Block.box(13, 0, 1, 15, 15.5, 3), Block.box(2, 0, 2, 14, 6, 14), Block.box(2, 10, 2, 14, 15, 14), Block.box(3, 6, 3, 13, 10, 13), Block.box(1, 0, 1, 3, 15.5, 3), Block.box(1, 0, 13, 3, 15.5, 15), Block.box(13, 0, 13, 15, 15.5, 15), Block.box(0.9, 0, 0.9, 3.1, 0.5, 3.1), Block.box(0.9, 0, 12.9, 3.1, 0.5, 15.1), Block.box(0.9, 5, 12.9, 3.1, 6.5, 15.1), Block.box(0.9, 5, 0.9, 3.1, 6.5, 3.1), Block.box(12.9, 5, 12.9, 15.1, 6.5, 15.1), Block.box(12.9, 5, 0.9, 15.1, 6.5, 3.1), Block.box(0.9, 9.5, 12.9, 3.1, 11, 15.1), Block.box(0.9, 9.5, 0.9, 3.1, 11, 3.1), Block.box(12.9, 9.5, 12.9, 15.1, 11, 15.1), Block.box(12.9, 9.5, 0.9, 15.1, 11, 3.1), Block.box(12.9, 0, 0.9, 15.1, 0.5, 3.1), Block.box(12.9, 0, 12.9, 15.1, 0.5, 15.1), Block.box(12.9, 15.5, 0.9, 15.1, 16, 3.1), Block.box(12.9, 15.5, 12.9, 15.1, 16, 15.1), Block.box(0.9, 15.5, 0.9, 3.1, 16, 3.1), Block.box(0.9, 15.5, 12.9, 3.1, 16, 15.1)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape CRYSTAL_CLUSTER_SHAPE = Stream.of(Block.box(5, 4, 5, 10, 19, 10), Block.box(4, 0, 4, 11, 5, 11), Block.box(3, 0, 3, 5, 4, 5), Block.box(10, 0, 3, 12, 2, 5), Block.box(12, 0, 4, 13, 1, 5), Block.box(11, 0, 5, 12, 1, 6), Block.box(10, 0, 10, 12, 3, 12), Block.box(3, 0, 10, 5, 1, 12), Block.box(9, 0, 3, 10, 3, 4), Block.box(8, 0, 2, 11, 1, 4), Block.box(4, 0, 2, 5, 2, 3), Block.box(5, 0, 3, 7, 1, 4), Block.box(2, 0, 4, 4, 1, 6), Block.box(3, 0, 5, 4, 3, 6.5), Block.box(3, 0, 9, 4, 2, 10), Block.box(2, 0, 8, 4, 1, 10), Block.box(5, 0, 11, 7, 2, 13), Block.box(7, 0, 11, 11, 1, 13), Block.box(10, 0, 9, 13, 1, 11), Block.box(11, 0, 7, 12, 3, 9)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape DISPLAY_STAND_SHAPE = Stream.of(Block.box(1, 7, 0, 15, 8, 1), Block.box(0, 0, 0, 16, 1, 16), Block.box(1, 1, 1, 15, 7, 15), Block.box(6, 7, 6, 10, 9, 10), Block.box(0, 1, 0, 1, 7, 1), Block.box(15, 1, 0, 16, 7, 1), Block.box(15, 1, 15, 16, 7, 16), Block.box(0, 1, 15, 1, 7, 16), Block.box(0, 7, 0, 1, 8, 16), Block.box(15, 7, 0, 16, 8, 16), Block.box(1, 7, 15, 15, 8, 16), Block.box(5, 7, 5, 6, 9, 6), Block.box(5, 7, 10, 6, 9, 11), Block.box(10, 7, 10, 11, 9, 11), Block.box(10, 7, 5, 11, 9, 6)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape EMPOWERER_SHAPE = Stream.of(Block.box(0, 0, 0, 16, 1, 16), Block.box(1, 1, 1, 15, 6, 15), Block.box(1, 6, 1, 15, 7, 15), Block.box(0, 7, 0, 16, 8, 1), Block.box(0, 7, 15, 16, 8, 16), Block.box(0, 7, 1, 1, 8, 15), Block.box(15, 7, 1, 16, 8, 15), Block.box(4, 7, 4, 12, 9, 12), Block.box(0, 1, 0, 1, 7, 1), Block.box(15, 1, 0, 16, 7, 1), Block.box(15, 1, 15, 16, 7, 16), Block.box(0, 1, 15, 1, 7, 16), Block.box(3, 7, 4, 4, 8, 5), Block.box(3, 7, 11, 4, 8, 12), Block.box(4, 7, 12, 5, 8, 13), Block.box(11, 7, 12, 12, 8, 13), Block.box(12, 7, 11, 13, 8, 12), Block.box(12, 7, 4, 13, 8, 5), Block.box(11, 7, 3, 12, 8, 4), Block.box(4, 7, 3, 5, 8, 4)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape ENERGIZER_SHAPE = Stream.of(Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(15, 0, 0, 16, 1, 16), Block.box(0, 0, 0, 1, 1, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(1, 14, 1, 15, 15, 15), Block.box(1, 1, 1, 15, 2, 15), Block.box(14, 2, 1, 15, 14, 15), Block.box(1, 2, 1, 2, 14, 15), Block.box(2, 2, 14, 14, 14, 15), Block.box(2, 2, 1, 14, 14, 2), Block.box(9, 3, 0, 13, 4, 1), Block.box(3, 3, 15, 7, 4, 16), Block.box(9, 12, 0, 13, 13, 1), Block.box(3, 12, 15, 7, 13, 16), Block.box(10, 4, 0, 12, 12, 1), Block.box(4, 4, 15, 6, 12, 16), Block.box(0, 3, 3, 1, 4, 7), Block.box(15, 3, 9, 16, 4, 13), Block.box(0, 12, 3, 1, 13, 7), Block.box(15, 12, 9, 16, 13, 13), Block.box(0, 4, 4, 1, 12, 6), Block.box(15, 4, 10, 16, 12, 12)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape BARREL_SHAPE = Stream.of(Block.box(0, 12, 0, 16, 14, 1), Block.box(1, 0.5, 1, 15, 15, 15), Block.box(0, 2, 15, 16, 4, 16), Block.box(0, 7, 15, 16, 9, 16), Block.box(0, 12, 15, 16, 14, 16), Block.box(0, 2, 0, 16, 4, 1), Block.box(0, 7, 0, 16, 9, 1), Block.box(0, 2, 1, 1, 4, 15), Block.box(0, 7, 1, 1, 9, 15), Block.box(0, 12, 1, 1, 14, 15), Block.box(15, 12, 1, 16, 14, 15), Block.box(15, 7, 1, 16, 9, 15), Block.box(15, 2, 1, 16, 4, 15), Block.box(7, 0, 0.5, 9, 16, 1.5), Block.box(0.5, 0, 7, 1.5, 16, 9), Block.box(7, 0, 14.5, 9, 16, 15.5), Block.box(14.5, 0, 7, 15.5, 16, 9), Block.box(2, 0, 0.5, 5, 16, 1.5), Block.box(0.5, 0, 11, 1.5, 16, 14), Block.box(2, 0, 14.5, 5, 16, 15.5), Block.box(14.5, 0, 11, 15.5, 16, 14), Block.box(11, 0, 0.5, 14, 16, 1.5), Block.box(0.5, 0, 2, 1.5, 16, 5), Block.box(11, 0, 14.5, 14, 16, 15.5), Block.box(14.5, 0, 2, 15.5, 16, 5), Block.box(4, 15, 7, 6, 15.3, 9), Block.box(2, 15, 4, 3, 15.3, 12), Block.box(4, 15, 13, 12, 15.3, 14), Block.box(4, 15, 2, 12, 15.3, 3), Block.box(13, 15, 4, 14, 15.3, 12), Block.box(3, 15, 3, 4, 15.3, 4), Block.box(3, 15, 12, 4, 15.3, 13), Block.box(12, 15, 3, 13, 15.3, 4), Block.box(12, 15, 12, 13, 15.3, 13)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape FIREWORKS_BOX_SHAPE = Stream.of(Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(10, 14, 9, 12, 15, 10), Block.box(7, 14, 9, 9, 15, 10), Block.box(4, 14, 9, 6, 15, 10), Block.box(10, 14, 6, 12, 15, 7), Block.box(7, 14, 6, 9, 15, 7), Block.box(4, 14, 6, 6, 15, 7), Block.box(6, 14, 4, 7, 15, 12), Block.box(9, 14, 4, 10, 15, 12), Block.box(4, 14, 12, 12, 15, 14), Block.box(4, 14, 2, 12, 15, 4), Block.box(12, 14, 2, 14, 15, 14), Block.box(2, 14, 2, 4, 15, 14), Block.box(2, 13, 2, 14, 14, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(1, 0, 2, 2, 15, 14), Block.box(14, 0, 2, 15, 15, 14), Block.box(1, 0, 1, 15, 15, 2), Block.box(1, 0, 14, 15, 15, 15)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape GLASS_SHAPE = Stream.of(Block.box(15, 0, 1, 16, 1, 15), Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape HEAT_COLLECTOR_SHAPE = Stream.of(Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(4, 13, 4, 12, 14, 12), Block.box(11, 14, 4, 12, 15, 5), Block.box(4, 14, 4, 5, 15, 5), Block.box(4, 14, 11, 5, 15, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(15, 11, 4, 16, 12, 12), Block.box(15, 5, 4, 16, 6, 12), Block.box(15, 7, 4, 16, 8, 12), Block.box(15, 9, 4, 16, 10, 12), Block.box(4, 11, 15, 12, 12, 16), Block.box(4, 9, 15, 12, 10, 16), Block.box(4, 7, 15, 12, 8, 16), Block.box(4, 5, 15, 12, 6, 16), Block.box(0, 11, 4, 1, 12, 12), Block.box(0, 5, 4, 1, 6, 12), Block.box(0, 7, 4, 1, 8, 12), Block.box(0, 9, 4, 1, 10, 12), Block.box(4, 11, 0, 12, 12, 1), Block.box(4, 9, 0, 12, 10, 1), Block.box(4, 7, 0, 12, 8, 1), Block.box(4, 5, 0, 12, 6, 1), Block.box(2, 14, 2, 4, 15, 14), Block.box(4, 14, 2, 12, 15, 4), Block.box(4, 14, 12, 12, 15, 14), Block.box(12, 14, 2, 14, 15, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(1, 0, 2, 2, 15, 14), Block.box(14, 0, 2, 15, 15, 14), Block.box(1, 0, 1, 15, 15, 2), Block.box(1, 0, 14, 15, 15, 15)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape ITEM_VIEWER_SHAPE = Stream.of(Block.box(15, 0, 1, 16, 1, 15), Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape HOPPING_ITEM_VIEWER_SHAPE = Stream.of(Block.box(0, 10, 0, 16, 11, 16), Block.box(1, 11, 1, 2, 15, 15), Block.box(14, 11, 1, 15, 15, 15), Block.box(2, 11, 1, 14, 15, 2), Block.box(2, 11, 14, 14, 15, 15), Block.box(4, 4, 4, 12, 10, 12), Block.box(6, 0, 6, 10, 4, 10), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 11, 0, 1, 15, 1), Block.box(0, 11, 15, 1, 15, 16), Block.box(15, 11, 15, 16, 15, 16), Block.box(15, 11, 0, 16, 15, 1)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape BOOSTER_SHAPE = Stream.of(Block.box(5, 12, 12, 11, 13, 13), Block.box(6, 0, 6, 10, 16, 10), Block.box(5, 2, 5, 11, 3, 11), Block.box(5, 4, 12, 11, 5, 13), Block.box(5, 6, 12, 11, 7, 13), Block.box(5, 8, 12, 11, 9, 13), Block.box(5, 10, 12, 11, 11, 13), Block.box(5, 4, 3, 11, 5, 4), Block.box(5, 6, 3, 11, 7, 4), Block.box(5, 8, 3, 11, 9, 4), Block.box(5, 10, 3, 11, 11, 4), Block.box(5, 12, 3, 11, 13, 4), Block.box(3, 4, 5, 4, 5, 11), Block.box(3, 6, 5, 4, 7, 11), Block.box(3, 8, 5, 4, 9, 11), Block.box(3, 10, 5, 4, 11, 11), Block.box(3, 12, 5, 4, 13, 11), Block.box(12, 4, 5, 13, 5, 11), Block.box(12, 6, 5, 13, 7, 11), Block.box(12, 8, 5, 13, 9, 11), Block.box(12, 10, 5, 13, 11, 11), Block.box(12, 12, 5, 13, 13, 11), Block.box(5, 14, 5, 11, 15, 11), Block.box(4, 4, 11, 5, 5, 12), Block.box(4, 6, 11, 5, 7, 12), Block.box(4, 8, 11, 5, 9, 12), Block.box(4, 10, 11, 5, 11, 12), Block.box(4, 12, 11, 5, 13, 12), Block.box(4, 4, 4, 5, 5, 5), Block.box(4, 6, 4, 5, 7, 5), Block.box(4, 8, 4, 5, 9, 5), Block.box(4, 10, 4, 5, 11, 5), Block.box(4, 12, 4, 5, 13, 5), Block.box(11, 4, 4, 12, 5, 5), Block.box(11, 6, 4, 12, 7, 5), Block.box(11, 8, 4, 12, 9, 5), Block.box(11, 10, 4, 12, 11, 5), Block.box(11, 12, 4, 12, 13, 5), Block.box(11, 4, 11, 12, 5, 12), Block.box(11, 6, 11, 12, 7, 12), Block.box(11, 8, 11, 12, 9, 12), Block.box(11, 10, 11, 12, 11, 12), Block.box(11, 12, 11, 12, 13, 12)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape PLAYER_INTERFACE_SHAPE = Stream.of(Block.box(15, 0, 1, 16, 1, 15), Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape COLLECTOR_SHAPE = Stream.of(Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(1, 1, 4, 2, 4, 12), Block.box(14, 1, 4, 15, 4, 12), Block.box(4, 1, 1, 12, 4, 2), Block.box(4, 1, 14, 12, 4, 15), Block.box(4, 14, 12, 12, 15, 14), Block.box(1, 12, 4, 2, 15, 12), Block.box(14, 12, 4, 15, 15, 12), Block.box(4, 12, 1, 12, 15, 2), Block.box(4, 12, 14, 12, 15, 15), Block.box(4, 14, 2, 12, 15, 4), Block.box(1, 1, 12, 2, 15, 14), Block.box(14, 1, 2, 15, 15, 4), Block.box(1, 1, 1, 4, 15, 2), Block.box(12, 1, 14, 15, 15, 15), Block.box(12, 14, 2, 14, 15, 14), Block.box(1, 1, 2, 2, 15, 4), Block.box(14, 1, 12, 15, 15, 14), Block.box(12, 1, 1, 15, 15, 2), Block.box(1, 1, 14, 4, 15, 15), Block.box(2, 14, 2, 4, 15, 14), Block.box(2, 2, 2, 14, 14, 14), Block.box(1, 0, 1, 15, 1, 15)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SUPPRESSOR_SHAPE = Stream.of(Block.box(15, 15, 0, 16, 16, 16), Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 15, 0, 1, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(1, 14, 1, 15, 15, 15), Block.box(1, 1, 1, 15, 2, 15), Block.box(9, 13, 9, 13, 16, 13), Block.box(9, 2, 9, 13, 3, 13), Block.box(3, 13, 9, 7, 16, 13), Block.box(3, 2, 9, 7, 3, 13), Block.box(9, 13, 3, 13, 16, 7), Block.box(9, 2, 3, 13, 3, 7), Block.box(3, 13, 3, 7, 16, 7), Block.box(3, 2, 3, 7, 3, 7), Block.box(4, 3, 10, 6, 13, 12), Block.box(10, 3, 10, 12, 13, 12), Block.box(10, 3, 4, 12, 13, 6), Block.box(4, 3, 4, 6, 13, 6)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape RELAY_SHAPE = Stream.of(Block.box(6, 4, 6, 7, 6, 7), Block.box(1, 0, 1, 15, 1, 15), Block.box(4, 2, 4, 12, 4, 12), Block.box(9, 4, 9, 10, 6, 10), Block.box(6, 4, 9, 7, 6, 10), Block.box(3, 1, 12, 4, 5, 13), Block.box(12, 1, 12, 13, 5, 13), Block.box(3, 1, 3, 4, 5, 4), Block.box(12, 1, 3, 13, 5, 4), Block.box(3, 4, 4, 4, 5, 12), Block.box(3, 1, 4, 4, 2, 12), Block.box(12, 4, 4, 13, 5, 12), Block.box(12, 1, 4, 13, 2, 12), Block.box(4, 4, 12, 12, 5, 13), Block.box(4, 4, 3, 12, 5, 4), Block.box(4, 1, 12, 12, 2, 13), Block.box(4, 1, 3, 12, 2, 4), Block.box(9, 4, 6, 10, 6, 7), Block.box(7, 4, 7, 9, 6, 9), Block.box(7, 6, 7, 9, 10, 9), Block.box(6.5, 5, 7, 7, 6, 9), Block.box(6.5, 7, 7, 7, 7.5, 9), Block.box(6.5, 9, 7, 7, 9.5, 9), Block.box(9, 5, 7, 9.5, 6, 9), Block.box(9, 7, 7, 9.5, 7.5, 9), Block.box(9, 9, 7, 9.5, 9.5, 9), Block.box(7, 5, 6.5, 9, 6, 7), Block.box(7, 7, 6.5, 9, 7.5, 7), Block.box(7, 9, 6.5, 9, 9.5, 7), Block.box(7, 5, 9, 9, 6, 9.5), Block.box(7, 7, 9, 9, 7.5, 9.5), Block.box(7, 9, 9, 9, 9.5, 9.5)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); static final class CoalGeneratorShapes { - static final VoxelShape NORTH = Stream.of(Block.makeCuboidShape(0, 15, 0, 1, 16, 16), Block.makeCuboidShape(15, 15, 0, 16, 16, 16), Block.makeCuboidShape(1, 15, 0, 15, 16, 1), Block.makeCuboidShape(1, 15, 15, 15, 16, 16), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(2, 0, 2, 14, 1, 14), Block.makeCuboidShape(5, 14, 6, 11, 15, 7), Block.makeCuboidShape(5, 14, 8, 11, 15, 9), Block.makeCuboidShape(5, 14, 10, 11, 15, 14), Block.makeCuboidShape(5, 14, 2, 11, 15, 5), Block.makeCuboidShape(11, 14, 2, 14, 15, 14), Block.makeCuboidShape(2, 14, 2, 5, 15, 14), Block.makeCuboidShape(1, 0, 2, 2, 15, 14), Block.makeCuboidShape(14, 0, 2, 15, 15, 14), Block.makeCuboidShape(1, 0, 14, 15, 15, 15), Block.makeCuboidShape(3, 11, 0, 13, 12, 1), Block.makeCuboidShape(5, 3, 1, 6, 8, 2), Block.makeCuboidShape(10, 3, 1, 11, 8, 2), Block.makeCuboidShape(3, 8, 1, 13, 15, 2), Block.makeCuboidShape(3, 0, 1, 13, 3, 2), Block.makeCuboidShape(1, 0, 1, 3, 15, 2), Block.makeCuboidShape(13, 0, 1, 15, 15, 2), Block.makeCuboidShape(5, 13, 5, 11, 14, 10), Block.makeCuboidShape(2, 3, 2, 14, 8, 3), Block.makeCuboidShape(0, 0, 15, 1, 1, 16), Block.makeCuboidShape(15, 0, 15, 16, 1, 16), Block.makeCuboidShape(15, 0, 0, 16, 1, 1), Block.makeCuboidShape(0, 0, 0, 1, 1, 1)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape EAST = Stream.of(Block.makeCuboidShape(0, 15, 0, 16, 16, 1), Block.makeCuboidShape(0, 15, 15, 16, 16, 16), Block.makeCuboidShape(15, 15, 1, 16, 16, 15), Block.makeCuboidShape(0, 15, 1, 1, 16, 15), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(2, 0, 2, 14, 1, 14), Block.makeCuboidShape(9, 14, 5, 10, 15, 11), Block.makeCuboidShape(7, 14, 5, 8, 15, 11), Block.makeCuboidShape(2, 14, 5, 6, 15, 11), Block.makeCuboidShape(11, 14, 5, 14, 15, 11), Block.makeCuboidShape(2, 14, 11, 14, 15, 14), Block.makeCuboidShape(2, 14, 2, 14, 15, 5), Block.makeCuboidShape(2, 0, 1, 14, 15, 2), Block.makeCuboidShape(2, 0, 14, 14, 15, 15), Block.makeCuboidShape(1, 0, 1, 2, 15, 15), Block.makeCuboidShape(15, 11, 3, 16, 12, 13), Block.makeCuboidShape(14, 3, 5, 15, 8, 6), Block.makeCuboidShape(14, 3, 10, 15, 8, 11), Block.makeCuboidShape(14, 8, 3, 15, 15, 13), Block.makeCuboidShape(14, 0, 3, 15, 3, 13), Block.makeCuboidShape(14, 0, 1, 15, 15, 3), Block.makeCuboidShape(14, 0, 13, 15, 15, 15), Block.makeCuboidShape(6, 13, 5, 11, 14, 11), Block.makeCuboidShape(13, 3, 2, 14, 8, 14), Block.makeCuboidShape(0, 0, 0, 1, 1, 1), Block.makeCuboidShape(0, 0, 15, 1, 1, 16), Block.makeCuboidShape(15, 0, 15, 16, 1, 16), Block.makeCuboidShape(15, 0, 0, 16, 1, 1)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SOUTH = Stream.of(Block.makeCuboidShape(15, 15, 0, 16, 16, 16), Block.makeCuboidShape(0, 15, 0, 1, 16, 16), Block.makeCuboidShape(1, 15, 15, 15, 16, 16), Block.makeCuboidShape(1, 15, 0, 15, 16, 1), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(2, 0, 2, 14, 1, 14), Block.makeCuboidShape(5, 14, 9, 11, 15, 10), Block.makeCuboidShape(5, 14, 7, 11, 15, 8), Block.makeCuboidShape(5, 14, 2, 11, 15, 6), Block.makeCuboidShape(5, 14, 11, 11, 15, 14), Block.makeCuboidShape(2, 14, 2, 5, 15, 14), Block.makeCuboidShape(11, 14, 2, 14, 15, 14), Block.makeCuboidShape(14, 0, 2, 15, 15, 14), Block.makeCuboidShape(1, 0, 2, 2, 15, 14), Block.makeCuboidShape(1, 0, 1, 15, 15, 2), Block.makeCuboidShape(3, 11, 15, 13, 12, 16), Block.makeCuboidShape(10, 3, 14, 11, 8, 15), Block.makeCuboidShape(5, 3, 14, 6, 8, 15), Block.makeCuboidShape(3, 8, 14, 13, 15, 15), Block.makeCuboidShape(3, 0, 14, 13, 3, 15), Block.makeCuboidShape(13, 0, 14, 15, 15, 15), Block.makeCuboidShape(1, 0, 14, 3, 15, 15), Block.makeCuboidShape(5, 13, 6, 11, 14, 11), Block.makeCuboidShape(2, 3, 13, 14, 8, 14), Block.makeCuboidShape(15, 0, 0, 16, 1, 1), Block.makeCuboidShape(0, 0, 0, 1, 1, 1), Block.makeCuboidShape(0, 0, 15, 1, 1, 16), Block.makeCuboidShape(15, 0, 15, 16, 1, 16)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape WEST = Stream.of(Block.makeCuboidShape(0, 15, 15, 16, 16, 16), Block.makeCuboidShape(0, 15, 0, 16, 16, 1), Block.makeCuboidShape(0, 15, 1, 1, 16, 15), Block.makeCuboidShape(15, 15, 1, 16, 16, 15), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(2, 0, 2, 14, 1, 14), Block.makeCuboidShape(6, 14, 5, 7, 15, 11), Block.makeCuboidShape(8, 14, 5, 9, 15, 11), Block.makeCuboidShape(10, 14, 5, 14, 15, 11), Block.makeCuboidShape(2, 14, 5, 5, 15, 11), Block.makeCuboidShape(2, 14, 2, 14, 15, 5), Block.makeCuboidShape(2, 14, 11, 14, 15, 14), Block.makeCuboidShape(2, 0, 14, 14, 15, 15), Block.makeCuboidShape(2, 0, 1, 14, 15, 2), Block.makeCuboidShape(14, 0, 1, 15, 15, 15), Block.makeCuboidShape(0, 11, 3, 1, 12, 13), Block.makeCuboidShape(1, 3, 10, 2, 8, 11), Block.makeCuboidShape(1, 3, 5, 2, 8, 6), Block.makeCuboidShape(1, 8, 3, 2, 15, 13), Block.makeCuboidShape(1, 0, 3, 2, 3, 13), Block.makeCuboidShape(1, 0, 13, 2, 15, 15), Block.makeCuboidShape(1, 0, 1, 2, 15, 3), Block.makeCuboidShape(5, 13, 5, 10, 14, 11), Block.makeCuboidShape(2, 3, 2, 3, 8, 14), Block.makeCuboidShape(15, 0, 15, 16, 1, 16), Block.makeCuboidShape(15, 0, 0, 16, 1, 1), Block.makeCuboidShape(0, 0, 0, 1, 1, 1), Block.makeCuboidShape(0, 0, 15, 1, 1, 16)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape NORTH = Stream.of(Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(2, 0, 2, 14, 1, 14), Block.box(5, 14, 6, 11, 15, 7), Block.box(5, 14, 8, 11, 15, 9), Block.box(5, 14, 10, 11, 15, 14), Block.box(5, 14, 2, 11, 15, 5), Block.box(11, 14, 2, 14, 15, 14), Block.box(2, 14, 2, 5, 15, 14), Block.box(1, 0, 2, 2, 15, 14), Block.box(14, 0, 2, 15, 15, 14), Block.box(1, 0, 14, 15, 15, 15), Block.box(3, 11, 0, 13, 12, 1), Block.box(5, 3, 1, 6, 8, 2), Block.box(10, 3, 1, 11, 8, 2), Block.box(3, 8, 1, 13, 15, 2), Block.box(3, 0, 1, 13, 3, 2), Block.box(1, 0, 1, 3, 15, 2), Block.box(13, 0, 1, 15, 15, 2), Block.box(5, 13, 5, 11, 14, 10), Block.box(2, 3, 2, 14, 8, 3), Block.box(0, 0, 15, 1, 1, 16), Block.box(15, 0, 15, 16, 1, 16), Block.box(15, 0, 0, 16, 1, 1), Block.box(0, 0, 0, 1, 1, 1)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape EAST = Stream.of(Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(2, 0, 2, 14, 1, 14), Block.box(9, 14, 5, 10, 15, 11), Block.box(7, 14, 5, 8, 15, 11), Block.box(2, 14, 5, 6, 15, 11), Block.box(11, 14, 5, 14, 15, 11), Block.box(2, 14, 11, 14, 15, 14), Block.box(2, 14, 2, 14, 15, 5), Block.box(2, 0, 1, 14, 15, 2), Block.box(2, 0, 14, 14, 15, 15), Block.box(1, 0, 1, 2, 15, 15), Block.box(15, 11, 3, 16, 12, 13), Block.box(14, 3, 5, 15, 8, 6), Block.box(14, 3, 10, 15, 8, 11), Block.box(14, 8, 3, 15, 15, 13), Block.box(14, 0, 3, 15, 3, 13), Block.box(14, 0, 1, 15, 15, 3), Block.box(14, 0, 13, 15, 15, 15), Block.box(6, 13, 5, 11, 14, 11), Block.box(13, 3, 2, 14, 8, 14), Block.box(0, 0, 0, 1, 1, 1), Block.box(0, 0, 15, 1, 1, 16), Block.box(15, 0, 15, 16, 1, 16), Block.box(15, 0, 0, 16, 1, 1)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SOUTH = Stream.of(Block.box(15, 15, 0, 16, 16, 16), Block.box(0, 15, 0, 1, 16, 16), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(2, 0, 2, 14, 1, 14), Block.box(5, 14, 9, 11, 15, 10), Block.box(5, 14, 7, 11, 15, 8), Block.box(5, 14, 2, 11, 15, 6), Block.box(5, 14, 11, 11, 15, 14), Block.box(2, 14, 2, 5, 15, 14), Block.box(11, 14, 2, 14, 15, 14), Block.box(14, 0, 2, 15, 15, 14), Block.box(1, 0, 2, 2, 15, 14), Block.box(1, 0, 1, 15, 15, 2), Block.box(3, 11, 15, 13, 12, 16), Block.box(10, 3, 14, 11, 8, 15), Block.box(5, 3, 14, 6, 8, 15), Block.box(3, 8, 14, 13, 15, 15), Block.box(3, 0, 14, 13, 3, 15), Block.box(13, 0, 14, 15, 15, 15), Block.box(1, 0, 14, 3, 15, 15), Block.box(5, 13, 6, 11, 14, 11), Block.box(2, 3, 13, 14, 8, 14), Block.box(15, 0, 0, 16, 1, 1), Block.box(0, 0, 0, 1, 1, 1), Block.box(0, 0, 15, 1, 1, 16), Block.box(15, 0, 15, 16, 1, 16)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape WEST = Stream.of(Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(2, 0, 2, 14, 1, 14), Block.box(6, 14, 5, 7, 15, 11), Block.box(8, 14, 5, 9, 15, 11), Block.box(10, 14, 5, 14, 15, 11), Block.box(2, 14, 5, 5, 15, 11), Block.box(2, 14, 2, 14, 15, 5), Block.box(2, 14, 11, 14, 15, 14), Block.box(2, 0, 14, 14, 15, 15), Block.box(2, 0, 1, 14, 15, 2), Block.box(14, 0, 1, 15, 15, 15), Block.box(0, 11, 3, 1, 12, 13), Block.box(1, 3, 10, 2, 8, 11), Block.box(1, 3, 5, 2, 8, 6), Block.box(1, 8, 3, 2, 15, 13), Block.box(1, 0, 3, 2, 3, 13), Block.box(1, 0, 13, 2, 15, 15), Block.box(1, 0, 1, 2, 15, 3), Block.box(5, 13, 5, 10, 14, 11), Block.box(2, 3, 2, 3, 8, 14), Block.box(15, 0, 15, 16, 1, 16), Block.box(15, 0, 0, 16, 1, 1), Block.box(0, 0, 0, 1, 1, 1), Block.box(0, 0, 15, 1, 1, 16)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); } static class CoffeeMachineShapes { - static final VoxelShape NORTH = Stream.of(Block.makeCuboidShape(8, 11, 7, 13, 14, 8), Block.makeCuboidShape(1, 0, 1, 15, 1, 15), Block.makeCuboidShape(7, 1, 8, 14, 9, 14), Block.makeCuboidShape(6, 9, 3, 15, 11, 15), Block.makeCuboidShape(8, 11, 8, 13, 13, 13), Block.makeCuboidShape(10, 8, 3.5, 11, 9, 4.5), Block.makeCuboidShape(9, 1, 2, 12, 2, 5), Block.makeCuboidShape(9, 2, 5, 12, 7, 6), Block.makeCuboidShape(9, 2, 1, 12, 7, 2), Block.makeCuboidShape(12, 2, 2, 13, 7, 5), Block.makeCuboidShape(8, 2, 2, 9, 7, 5), Block.makeCuboidShape(13, 2, 3, 14, 3, 4), Block.makeCuboidShape(13, 5, 3, 14, 6, 4), Block.makeCuboidShape(14, 3, 3, 15, 5, 4), Block.makeCuboidShape(13, 10.2, 4.2, 14, 11.2, 5.2), Block.makeCuboidShape(11, 10.2, 4.2, 12, 11.2, 5.2), Block.makeCuboidShape(13, 11, 7, 14, 14, 14), Block.makeCuboidShape(7, 11, 7, 8, 14, 14), Block.makeCuboidShape(8, 11, 13, 13, 14, 14), Block.makeCuboidShape(14, 1, 14, 15, 9, 15), Block.makeCuboidShape(6, 1, 14, 7, 9, 15), Block.makeCuboidShape(14, 1, 7, 15, 9, 8), Block.makeCuboidShape(6, 1, 7, 7, 9, 8), Block.makeCuboidShape(6.8, 1.9, 11.9, 7, 3.1, 13.1), Block.makeCuboidShape(6.8, 1.9, 9.9, 7, 3.1, 11.1), Block.makeCuboidShape(3, 3, 10, 4, 5, 11), Block.makeCuboidShape(2.9, 4.8, 9.9, 4.1, 5, 11.1), Block.makeCuboidShape(2.9, 4.8, 11.9, 4.1, 5, 13.1), Block.makeCuboidShape(3, 2, 12, 7, 3, 13), Block.makeCuboidShape(3, 2, 10, 7, 3, 11), Block.makeCuboidShape(3, 3, 12, 4, 5, 13), Block.makeCuboidShape(2, 5, 9, 5, 11, 14), Block.makeCuboidShape(2, 11, 11, 4, 12, 13), Block.makeCuboidShape(1, 1, 11, 2, 12, 13)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape EAST = Stream.of(Block.makeCuboidShape(8, 11, 8, 9, 14, 13), Block.makeCuboidShape(1, 0, 1, 15, 1, 15), Block.makeCuboidShape(2, 1, 7, 8, 9, 14), Block.makeCuboidShape(1, 9, 6, 13, 11, 15), Block.makeCuboidShape(3, 11, 8, 8, 13, 13), Block.makeCuboidShape(11.5, 8, 10, 12.5, 9, 11), Block.makeCuboidShape(11, 1, 9, 14, 2, 12), Block.makeCuboidShape(10, 2, 9, 11, 7, 12), Block.makeCuboidShape(14, 2, 9, 15, 7, 12), Block.makeCuboidShape(11, 2, 12, 14, 7, 13), Block.makeCuboidShape(11, 2, 8, 14, 7, 9), Block.makeCuboidShape(12, 2, 13, 13, 3, 14), Block.makeCuboidShape(12, 5, 13, 13, 6, 14), Block.makeCuboidShape(12, 3, 14, 13, 5, 15), Block.makeCuboidShape(10.8, 10.2, 13, 11.8, 11.2, 14), Block.makeCuboidShape(10.8, 10.2, 11, 11.8, 11.2, 12), Block.makeCuboidShape(2, 11, 13, 9, 14, 14), Block.makeCuboidShape(2, 11, 7, 9, 14, 8), Block.makeCuboidShape(2, 11, 8, 3, 14, 13), Block.makeCuboidShape(1, 1, 14, 2, 9, 15), Block.makeCuboidShape(1, 1, 6, 2, 9, 7), Block.makeCuboidShape(8, 1, 14, 9, 9, 15), Block.makeCuboidShape(8, 1, 6, 9, 9, 7), Block.makeCuboidShape(2.9000000000000004, 1.9, 6.8, 4.1, 3.1, 7), Block.makeCuboidShape(4.9, 1.9, 6.8, 6.1, 3.1, 7), Block.makeCuboidShape(5, 3, 3, 6, 5, 4), Block.makeCuboidShape(4.9, 4.8, 2.9000000000000004, 6.1, 5, 4.1), Block.makeCuboidShape(2.9000000000000004, 4.8, 2.9000000000000004, 4.1, 5, 4.1), Block.makeCuboidShape(3, 2, 3, 4, 3, 7), Block.makeCuboidShape(5, 2, 3, 6, 3, 7), Block.makeCuboidShape(3, 3, 3, 4, 5, 4), Block.makeCuboidShape(2, 5, 2, 7, 11, 5), Block.makeCuboidShape(3, 11, 2, 5, 12, 4), Block.makeCuboidShape(3, 1, 1, 5, 12, 2)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SOUTH = Stream.of(Block.makeCuboidShape(3, 11, 8, 8, 14, 9), Block.makeCuboidShape(1, 0, 1, 15, 1, 15), Block.makeCuboidShape(2, 1, 2, 9, 9, 8), Block.makeCuboidShape(1, 9, 1, 10, 11, 13), Block.makeCuboidShape(3, 11, 3, 8, 13, 8), Block.makeCuboidShape(5, 8, 11.5, 6, 9, 12.5), Block.makeCuboidShape(4, 1, 11, 7, 2, 14), Block.makeCuboidShape(4, 2, 10, 7, 7, 11), Block.makeCuboidShape(4, 2, 14, 7, 7, 15), Block.makeCuboidShape(3, 2, 11, 4, 7, 14), Block.makeCuboidShape(7, 2, 11, 8, 7, 14), Block.makeCuboidShape(2, 2, 12, 3, 3, 13), Block.makeCuboidShape(2, 5, 12, 3, 6, 13), Block.makeCuboidShape(1, 3, 12, 2, 5, 13), Block.makeCuboidShape(2, 10.2, 10.8, 3, 11.2, 11.8), Block.makeCuboidShape(4, 10.2, 10.8, 5, 11.2, 11.8), Block.makeCuboidShape(2, 11, 2, 3, 14, 9), Block.makeCuboidShape(8, 11, 2, 9, 14, 9), Block.makeCuboidShape(3, 11, 2, 8, 14, 3), Block.makeCuboidShape(1, 1, 1, 2, 9, 2), Block.makeCuboidShape(9, 1, 1, 10, 9, 2), Block.makeCuboidShape(1, 1, 8, 2, 9, 9), Block.makeCuboidShape(9, 1, 8, 10, 9, 9), Block.makeCuboidShape(9, 1.9, 2.9000000000000004, 9.2, 3.1, 4.1), Block.makeCuboidShape(9, 1.9, 4.9, 9.2, 3.1, 6.1), Block.makeCuboidShape(12, 3, 5, 13, 5, 6), Block.makeCuboidShape(11.9, 4.8, 4.9, 13.1, 5, 6.1), Block.makeCuboidShape(11.9, 4.8, 2.9000000000000004, 13.1, 5, 4.1), Block.makeCuboidShape(9, 2, 3, 13, 3, 4), Block.makeCuboidShape(9, 2, 5, 13, 3, 6), Block.makeCuboidShape(12, 3, 3, 13, 5, 4), Block.makeCuboidShape(11, 5, 2, 14, 11, 7), Block.makeCuboidShape(12, 11, 3, 14, 12, 5), Block.makeCuboidShape(14, 1, 3, 15, 12, 5)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape WEST = Stream.of(Block.makeCuboidShape(7, 11, 3, 8, 14, 8), Block.makeCuboidShape(1, 0, 1, 15, 1, 15), Block.makeCuboidShape(8, 1, 2, 14, 9, 9), Block.makeCuboidShape(3, 9, 1, 15, 11, 10), Block.makeCuboidShape(8, 11, 3, 13, 13, 8), Block.makeCuboidShape(3.5, 8, 5, 4.5, 9, 6), Block.makeCuboidShape(2, 1, 4, 5, 2, 7), Block.makeCuboidShape(5, 2, 4, 6, 7, 7), Block.makeCuboidShape(1, 2, 4, 2, 7, 7), Block.makeCuboidShape(2, 2, 3, 5, 7, 4), Block.makeCuboidShape(2, 2, 7, 5, 7, 8), Block.makeCuboidShape(3, 2, 2, 4, 3, 3), Block.makeCuboidShape(3, 5, 2, 4, 6, 3), Block.makeCuboidShape(3, 3, 1, 4, 5, 2), Block.makeCuboidShape(4.199999999999999, 10.2, 2, 5.199999999999999, 11.2, 3), Block.makeCuboidShape(4.199999999999999, 10.2, 4, 5.199999999999999, 11.2, 5), Block.makeCuboidShape(7, 11, 2, 14, 14, 3), Block.makeCuboidShape(7, 11, 8, 14, 14, 9), Block.makeCuboidShape(13, 11, 3, 14, 14, 8), Block.makeCuboidShape(14, 1, 1, 15, 9, 2), Block.makeCuboidShape(14, 1, 9, 15, 9, 10), Block.makeCuboidShape(7, 1, 1, 8, 9, 2), Block.makeCuboidShape(7, 1, 9, 8, 9, 10), Block.makeCuboidShape(11.9, 1.9, 9, 13.1, 3.1, 9.2), Block.makeCuboidShape(9.9, 1.9, 9, 11.1, 3.1, 9.2), Block.makeCuboidShape(10, 3, 12, 11, 5, 13), Block.makeCuboidShape(9.9, 4.8, 11.9, 11.1, 5, 13.1), Block.makeCuboidShape(11.9, 4.8, 11.9, 13.1, 5, 13.1), Block.makeCuboidShape(12, 2, 9, 13, 3, 13), Block.makeCuboidShape(10, 2, 9, 11, 3, 13), Block.makeCuboidShape(12, 3, 12, 13, 5, 13), Block.makeCuboidShape(9, 5, 11, 14, 11, 14), Block.makeCuboidShape(11, 11, 12, 13, 12, 14), Block.makeCuboidShape(11, 1, 14, 13, 12, 15)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape NORTH = Stream.of(Block.box(8, 11, 7, 13, 14, 8), Block.box(1, 0, 1, 15, 1, 15), Block.box(7, 1, 8, 14, 9, 14), Block.box(6, 9, 3, 15, 11, 15), Block.box(8, 11, 8, 13, 13, 13), Block.box(10, 8, 3.5, 11, 9, 4.5), Block.box(9, 1, 2, 12, 2, 5), Block.box(9, 2, 5, 12, 7, 6), Block.box(9, 2, 1, 12, 7, 2), Block.box(12, 2, 2, 13, 7, 5), Block.box(8, 2, 2, 9, 7, 5), Block.box(13, 2, 3, 14, 3, 4), Block.box(13, 5, 3, 14, 6, 4), Block.box(14, 3, 3, 15, 5, 4), Block.box(13, 10.2, 4.2, 14, 11.2, 5.2), Block.box(11, 10.2, 4.2, 12, 11.2, 5.2), Block.box(13, 11, 7, 14, 14, 14), Block.box(7, 11, 7, 8, 14, 14), Block.box(8, 11, 13, 13, 14, 14), Block.box(14, 1, 14, 15, 9, 15), Block.box(6, 1, 14, 7, 9, 15), Block.box(14, 1, 7, 15, 9, 8), Block.box(6, 1, 7, 7, 9, 8), Block.box(6.8, 1.9, 11.9, 7, 3.1, 13.1), Block.box(6.8, 1.9, 9.9, 7, 3.1, 11.1), Block.box(3, 3, 10, 4, 5, 11), Block.box(2.9, 4.8, 9.9, 4.1, 5, 11.1), Block.box(2.9, 4.8, 11.9, 4.1, 5, 13.1), Block.box(3, 2, 12, 7, 3, 13), Block.box(3, 2, 10, 7, 3, 11), Block.box(3, 3, 12, 4, 5, 13), Block.box(2, 5, 9, 5, 11, 14), Block.box(2, 11, 11, 4, 12, 13), Block.box(1, 1, 11, 2, 12, 13)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape EAST = Stream.of(Block.box(8, 11, 8, 9, 14, 13), Block.box(1, 0, 1, 15, 1, 15), Block.box(2, 1, 7, 8, 9, 14), Block.box(1, 9, 6, 13, 11, 15), Block.box(3, 11, 8, 8, 13, 13), Block.box(11.5, 8, 10, 12.5, 9, 11), Block.box(11, 1, 9, 14, 2, 12), Block.box(10, 2, 9, 11, 7, 12), Block.box(14, 2, 9, 15, 7, 12), Block.box(11, 2, 12, 14, 7, 13), Block.box(11, 2, 8, 14, 7, 9), Block.box(12, 2, 13, 13, 3, 14), Block.box(12, 5, 13, 13, 6, 14), Block.box(12, 3, 14, 13, 5, 15), Block.box(10.8, 10.2, 13, 11.8, 11.2, 14), Block.box(10.8, 10.2, 11, 11.8, 11.2, 12), Block.box(2, 11, 13, 9, 14, 14), Block.box(2, 11, 7, 9, 14, 8), Block.box(2, 11, 8, 3, 14, 13), Block.box(1, 1, 14, 2, 9, 15), Block.box(1, 1, 6, 2, 9, 7), Block.box(8, 1, 14, 9, 9, 15), Block.box(8, 1, 6, 9, 9, 7), Block.box(2.9000000000000004, 1.9, 6.8, 4.1, 3.1, 7), Block.box(4.9, 1.9, 6.8, 6.1, 3.1, 7), Block.box(5, 3, 3, 6, 5, 4), Block.box(4.9, 4.8, 2.9000000000000004, 6.1, 5, 4.1), Block.box(2.9000000000000004, 4.8, 2.9000000000000004, 4.1, 5, 4.1), Block.box(3, 2, 3, 4, 3, 7), Block.box(5, 2, 3, 6, 3, 7), Block.box(3, 3, 3, 4, 5, 4), Block.box(2, 5, 2, 7, 11, 5), Block.box(3, 11, 2, 5, 12, 4), Block.box(3, 1, 1, 5, 12, 2)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SOUTH = Stream.of(Block.box(3, 11, 8, 8, 14, 9), Block.box(1, 0, 1, 15, 1, 15), Block.box(2, 1, 2, 9, 9, 8), Block.box(1, 9, 1, 10, 11, 13), Block.box(3, 11, 3, 8, 13, 8), Block.box(5, 8, 11.5, 6, 9, 12.5), Block.box(4, 1, 11, 7, 2, 14), Block.box(4, 2, 10, 7, 7, 11), Block.box(4, 2, 14, 7, 7, 15), Block.box(3, 2, 11, 4, 7, 14), Block.box(7, 2, 11, 8, 7, 14), Block.box(2, 2, 12, 3, 3, 13), Block.box(2, 5, 12, 3, 6, 13), Block.box(1, 3, 12, 2, 5, 13), Block.box(2, 10.2, 10.8, 3, 11.2, 11.8), Block.box(4, 10.2, 10.8, 5, 11.2, 11.8), Block.box(2, 11, 2, 3, 14, 9), Block.box(8, 11, 2, 9, 14, 9), Block.box(3, 11, 2, 8, 14, 3), Block.box(1, 1, 1, 2, 9, 2), Block.box(9, 1, 1, 10, 9, 2), Block.box(1, 1, 8, 2, 9, 9), Block.box(9, 1, 8, 10, 9, 9), Block.box(9, 1.9, 2.9000000000000004, 9.2, 3.1, 4.1), Block.box(9, 1.9, 4.9, 9.2, 3.1, 6.1), Block.box(12, 3, 5, 13, 5, 6), Block.box(11.9, 4.8, 4.9, 13.1, 5, 6.1), Block.box(11.9, 4.8, 2.9000000000000004, 13.1, 5, 4.1), Block.box(9, 2, 3, 13, 3, 4), Block.box(9, 2, 5, 13, 3, 6), Block.box(12, 3, 3, 13, 5, 4), Block.box(11, 5, 2, 14, 11, 7), Block.box(12, 11, 3, 14, 12, 5), Block.box(14, 1, 3, 15, 12, 5)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape WEST = Stream.of(Block.box(7, 11, 3, 8, 14, 8), Block.box(1, 0, 1, 15, 1, 15), Block.box(8, 1, 2, 14, 9, 9), Block.box(3, 9, 1, 15, 11, 10), Block.box(8, 11, 3, 13, 13, 8), Block.box(3.5, 8, 5, 4.5, 9, 6), Block.box(2, 1, 4, 5, 2, 7), Block.box(5, 2, 4, 6, 7, 7), Block.box(1, 2, 4, 2, 7, 7), Block.box(2, 2, 3, 5, 7, 4), Block.box(2, 2, 7, 5, 7, 8), Block.box(3, 2, 2, 4, 3, 3), Block.box(3, 5, 2, 4, 6, 3), Block.box(3, 3, 1, 4, 5, 2), Block.box(4.199999999999999, 10.2, 2, 5.199999999999999, 11.2, 3), Block.box(4.199999999999999, 10.2, 4, 5.199999999999999, 11.2, 5), Block.box(7, 11, 2, 14, 14, 3), Block.box(7, 11, 8, 14, 14, 9), Block.box(13, 11, 3, 14, 14, 8), Block.box(14, 1, 1, 15, 9, 2), Block.box(14, 1, 9, 15, 9, 10), Block.box(7, 1, 1, 8, 9, 2), Block.box(7, 1, 9, 8, 9, 10), Block.box(11.9, 1.9, 9, 13.1, 3.1, 9.2), Block.box(9.9, 1.9, 9, 11.1, 3.1, 9.2), Block.box(10, 3, 12, 11, 5, 13), Block.box(9.9, 4.8, 11.9, 11.1, 5, 13.1), Block.box(11.9, 4.8, 11.9, 13.1, 5, 13.1), Block.box(12, 2, 9, 13, 3, 13), Block.box(10, 2, 9, 11, 3, 13), Block.box(12, 3, 12, 13, 5, 13), Block.box(9, 5, 11, 14, 11, 14), Block.box(11, 11, 12, 13, 12, 14), Block.box(11, 1, 14, 13, 12, 15)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); } static class DirectionalBlockBreakerShapes { - static final VoxelShape SHAPE_U = Stream.of(Block.makeCuboidShape(1, 1, 1, 15, 15, 15), Block.makeCuboidShape(0, 15, 15, 16, 16, 16), Block.makeCuboidShape(0, 15, 0, 16, 16, 1), Block.makeCuboidShape(0, 0, 15, 16, 1, 16), Block.makeCuboidShape(0, 0, 0, 16, 1, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 15, 1, 1, 16, 15), Block.makeCuboidShape(0, 0, 1, 1, 1, 15), Block.makeCuboidShape(15, 0, 1, 16, 1, 15), Block.makeCuboidShape(15, 15, 1, 16, 16, 15), Block.makeCuboidShape(15, 3, 9, 16, 13, 13), Block.makeCuboidShape(15, 3, 3, 16, 13, 7), Block.makeCuboidShape(0, 3, 9, 1, 13, 13), Block.makeCuboidShape(0, 3, 3, 1, 13, 7), Block.makeCuboidShape(5, 15, 5, 11, 16, 11), Block.makeCuboidShape(3, 15, 6, 5, 16, 10), Block.makeCuboidShape(11, 15, 6, 13, 16, 10)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_D = Stream.of(Block.makeCuboidShape(1, 1, 1, 15, 15, 15), Block.makeCuboidShape(0, 0, 0, 16, 1, 1), Block.makeCuboidShape(0, 0, 15, 16, 1, 16), Block.makeCuboidShape(0, 15, 0, 16, 16, 1), Block.makeCuboidShape(0, 15, 15, 16, 16, 16), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(0, 0, 1, 1, 1, 15), Block.makeCuboidShape(0, 15, 1, 1, 16, 15), Block.makeCuboidShape(15, 15, 1, 16, 16, 15), Block.makeCuboidShape(15, 0, 1, 16, 1, 15), Block.makeCuboidShape(15, 3, 3, 16, 13, 7), Block.makeCuboidShape(15, 3, 9, 16, 13, 13), Block.makeCuboidShape(0, 3, 3, 1, 13, 7), Block.makeCuboidShape(0, 3, 9, 1, 13, 13), Block.makeCuboidShape(5, 0, 5, 11, 1, 11), Block.makeCuboidShape(3, 0, 6, 5, 1, 10), Block.makeCuboidShape(11, 0, 6, 13, 1, 10)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_N = Stream.of(Block.makeCuboidShape(1, 1, 1, 15, 15, 15), Block.makeCuboidShape(0, 15, 0, 16, 16, 1), Block.makeCuboidShape(0, 0, 0, 16, 1, 1), Block.makeCuboidShape(0, 15, 15, 16, 16, 16), Block.makeCuboidShape(0, 0, 15, 16, 1, 16), Block.makeCuboidShape(0, 15, 1, 1, 16, 15), Block.makeCuboidShape(0, 0, 1, 1, 1, 15), Block.makeCuboidShape(15, 15, 1, 16, 16, 15), Block.makeCuboidShape(15, 0, 1, 16, 1, 15), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(15, 9, 3, 16, 13, 13), Block.makeCuboidShape(15, 3, 3, 16, 7, 13), Block.makeCuboidShape(0, 9, 3, 1, 13, 13), Block.makeCuboidShape(0, 3, 3, 1, 7, 13), Block.makeCuboidShape(5, 5, 0, 11, 11, 1), Block.makeCuboidShape(3, 6, 0, 5, 10, 1), Block.makeCuboidShape(11, 6, 0, 13, 10, 1)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_E = Stream.of(Block.makeCuboidShape(1, 1, 1, 15, 15, 15), Block.makeCuboidShape(15, 15, 0, 16, 16, 16), Block.makeCuboidShape(15, 0, 0, 16, 1, 16), Block.makeCuboidShape(0, 15, 0, 1, 16, 16), Block.makeCuboidShape(0, 0, 0, 1, 1, 16), Block.makeCuboidShape(1, 15, 0, 15, 16, 1), Block.makeCuboidShape(1, 0, 0, 15, 1, 1), Block.makeCuboidShape(1, 15, 15, 15, 16, 16), Block.makeCuboidShape(1, 0, 15, 15, 1, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(3, 9, 15, 13, 13, 16), Block.makeCuboidShape(3, 3, 15, 13, 7, 16), Block.makeCuboidShape(3, 9, 0, 13, 13, 1), Block.makeCuboidShape(3, 3, 0, 13, 7, 1), Block.makeCuboidShape(15, 5, 5, 16, 11, 11), Block.makeCuboidShape(15, 6, 3, 16, 10, 5), Block.makeCuboidShape(15, 6, 11, 16, 10, 13)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_S = Stream.of(Block.makeCuboidShape(1, 1, 1, 15, 15, 15), Block.makeCuboidShape(0, 15, 15, 16, 16, 16), Block.makeCuboidShape(0, 0, 15, 16, 1, 16), Block.makeCuboidShape(0, 15, 0, 16, 16, 1), Block.makeCuboidShape(0, 0, 0, 16, 1, 1), Block.makeCuboidShape(15, 15, 1, 16, 16, 15), Block.makeCuboidShape(15, 0, 1, 16, 1, 15), Block.makeCuboidShape(0, 15, 1, 1, 16, 15), Block.makeCuboidShape(0, 0, 1, 1, 1, 15), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(0, 9, 3, 1, 13, 13), Block.makeCuboidShape(0, 3, 3, 1, 7, 13), Block.makeCuboidShape(15, 9, 3, 16, 13, 13), Block.makeCuboidShape(15, 3, 3, 16, 7, 13), Block.makeCuboidShape(5, 5, 15, 11, 11, 16), Block.makeCuboidShape(11, 6, 15, 13, 10, 16), Block.makeCuboidShape(3, 6, 15, 5, 10, 16)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_W = Stream.of(Block.makeCuboidShape(1, 1, 1, 15, 15, 15), Block.makeCuboidShape(0, 15, 0, 1, 16, 16), Block.makeCuboidShape(0, 0, 0, 1, 1, 16), Block.makeCuboidShape(15, 15, 0, 16, 16, 16), Block.makeCuboidShape(15, 0, 0, 16, 1, 16), Block.makeCuboidShape(1, 15, 15, 15, 16, 16), Block.makeCuboidShape(1, 0, 15, 15, 1, 16), Block.makeCuboidShape(1, 15, 0, 15, 16, 1), Block.makeCuboidShape(1, 0, 0, 15, 1, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(3, 9, 0, 13, 13, 1), Block.makeCuboidShape(3, 3, 0, 13, 7, 1), Block.makeCuboidShape(3, 9, 15, 13, 13, 16), Block.makeCuboidShape(3, 3, 15, 13, 7, 16), Block.makeCuboidShape(0, 5, 5, 1, 11, 11), Block.makeCuboidShape(0, 6, 11, 1, 10, 13), Block.makeCuboidShape(0, 6, 3, 1, 10, 5)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_U = Stream.of(Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(0, 1, 0, 1, 15, 1), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 0, 1, 1, 1, 15), Block.box(15, 0, 1, 16, 1, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 3, 9, 16, 13, 13), Block.box(15, 3, 3, 16, 13, 7), Block.box(0, 3, 9, 1, 13, 13), Block.box(0, 3, 3, 1, 13, 7), Block.box(5, 15, 5, 11, 16, 11), Block.box(3, 15, 6, 5, 16, 10), Block.box(11, 15, 6, 13, 16, 10)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_D = Stream.of(Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(15, 1, 15, 16, 15, 16), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 0, 1, 16, 1, 15), Block.box(15, 3, 3, 16, 13, 7), Block.box(15, 3, 9, 16, 13, 13), Block.box(0, 3, 3, 1, 13, 7), Block.box(0, 3, 9, 1, 13, 13), Block.box(5, 0, 5, 11, 1, 11), Block.box(3, 0, 6, 5, 1, 10), Block.box(11, 0, 6, 13, 1, 10)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_N = Stream.of(Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 0, 1, 1, 1, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(15, 9, 3, 16, 13, 13), Block.box(15, 3, 3, 16, 7, 13), Block.box(0, 9, 3, 1, 13, 13), Block.box(0, 3, 3, 1, 7, 13), Block.box(5, 5, 0, 11, 11, 1), Block.box(3, 6, 0, 5, 10, 1), Block.box(11, 6, 0, 13, 10, 1)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_E = Stream.of(Block.box(1, 1, 1, 15, 15, 15), Block.box(15, 15, 0, 16, 16, 16), Block.box(15, 0, 0, 16, 1, 16), Block.box(0, 15, 0, 1, 16, 16), Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 0, 0, 15, 1, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(3, 9, 15, 13, 13, 16), Block.box(3, 3, 15, 13, 7, 16), Block.box(3, 9, 0, 13, 13, 1), Block.box(3, 3, 0, 13, 7, 1), Block.box(15, 5, 5, 16, 11, 11), Block.box(15, 6, 3, 16, 10, 5), Block.box(15, 6, 11, 16, 10, 13)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_S = Stream.of(Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 0, 0, 16, 1, 1), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 0, 1, 1, 1, 15), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(0, 9, 3, 1, 13, 13), Block.box(0, 3, 3, 1, 7, 13), Block.box(15, 9, 3, 16, 13, 13), Block.box(15, 3, 3, 16, 7, 13), Block.box(5, 5, 15, 11, 11, 16), Block.box(11, 6, 15, 13, 10, 16), Block.box(3, 6, 15, 5, 10, 16)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_W = Stream.of(Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 15, 0, 1, 16, 16), Block.box(0, 0, 0, 1, 1, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(3, 9, 0, 13, 13, 1), Block.box(3, 3, 0, 13, 7, 1), Block.box(3, 9, 15, 13, 13, 16), Block.box(3, 3, 15, 13, 7, 16), Block.box(0, 5, 5, 1, 11, 11), Block.box(0, 6, 11, 1, 10, 13), Block.box(0, 6, 3, 1, 10, 5)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); } static class FarmerShapes { - static final VoxelShape SHAPE_N = Stream.of(Block.makeCuboidShape(11, 14, 4, 12, 15, 5), Block.makeCuboidShape(0, 0, 0, 1, 1, 16), Block.makeCuboidShape(1, 0, 15, 15, 1, 16), Block.makeCuboidShape(15, 0, 0, 16, 1, 16), Block.makeCuboidShape(1, 0, 0, 15, 1, 1), Block.makeCuboidShape(0, 15, 0, 1, 16, 16), Block.makeCuboidShape(15, 15, 0, 16, 16, 16), Block.makeCuboidShape(1, 15, 0, 15, 16, 1), Block.makeCuboidShape(1, 15, 15, 15, 16, 16), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(4, 11, 4, 12, 12, 12), Block.makeCuboidShape(4, 14, 4, 5, 15, 5), Block.makeCuboidShape(3, 12, 5, 4, 14, 11), Block.makeCuboidShape(12, 12, 5, 13, 14, 11), Block.makeCuboidShape(5, 12, 3, 11, 14, 4), Block.makeCuboidShape(5, 12, 12, 11, 14, 13), Block.makeCuboidShape(11, 12, 11, 12, 14, 12), Block.makeCuboidShape(11, 12, 4, 12, 14, 5), Block.makeCuboidShape(4, 12, 4, 5, 14, 5), Block.makeCuboidShape(4, 12, 11, 5, 14, 12), Block.makeCuboidShape(4, 14, 11, 5, 15, 12), Block.makeCuboidShape(11, 14, 11, 12, 15, 12), Block.makeCuboidShape(2, 14, 2, 4, 15, 14), Block.makeCuboidShape(4, 14, 2, 12, 15, 4), Block.makeCuboidShape(4, 14, 12, 12, 15, 14), Block.makeCuboidShape(12, 14, 2, 14, 15, 14), Block.makeCuboidShape(2, 0, 2, 14, 1, 14), Block.makeCuboidShape(1, 0, 2, 2, 15, 14), Block.makeCuboidShape(14, 0, 2, 15, 15, 14), Block.makeCuboidShape(1, 0, 1, 5, 15, 2), Block.makeCuboidShape(5, 5, 2, 11, 11, 3), Block.makeCuboidShape(5, 0, 1, 11, 5, 2), Block.makeCuboidShape(5, 11, 1, 11, 15, 2), Block.makeCuboidShape(11, 0, 1, 15, 15, 2), Block.makeCuboidShape(1, 0, 14, 15, 15, 15)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_E = Stream.of(Block.makeCuboidShape(11, 14, 11, 12, 15, 12), Block.makeCuboidShape(0, 0, 0, 16, 1, 1), Block.makeCuboidShape(0, 0, 1, 1, 1, 15), Block.makeCuboidShape(0, 0, 15, 16, 1, 16), Block.makeCuboidShape(15, 0, 1, 16, 1, 15), Block.makeCuboidShape(0, 15, 0, 16, 16, 1), Block.makeCuboidShape(0, 15, 15, 16, 16, 16), Block.makeCuboidShape(15, 15, 1, 16, 16, 15), Block.makeCuboidShape(0, 15, 1, 1, 16, 15), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(4, 11, 4, 12, 12, 12), Block.makeCuboidShape(11, 14, 4, 12, 15, 5), Block.makeCuboidShape(5, 12, 3, 11, 14, 4), Block.makeCuboidShape(5, 12, 12, 11, 14, 13), Block.makeCuboidShape(12, 12, 5, 13, 14, 11), Block.makeCuboidShape(3, 12, 5, 4, 14, 11), Block.makeCuboidShape(4, 12, 11, 5, 14, 12), Block.makeCuboidShape(11, 12, 11, 12, 14, 12), Block.makeCuboidShape(11, 12, 4, 12, 14, 5), Block.makeCuboidShape(4, 12, 4, 5, 14, 5), Block.makeCuboidShape(4, 14, 4, 5, 15, 5), Block.makeCuboidShape(4, 14, 11, 5, 15, 12), Block.makeCuboidShape(2, 14, 2, 14, 15, 4), Block.makeCuboidShape(12, 14, 4, 14, 15, 12), Block.makeCuboidShape(2, 14, 4, 4, 15, 12), Block.makeCuboidShape(2, 14, 12, 14, 15, 14), Block.makeCuboidShape(2, 0, 2, 14, 1, 14), Block.makeCuboidShape(2, 0, 1, 14, 15, 2), Block.makeCuboidShape(2, 0, 14, 14, 15, 15), Block.makeCuboidShape(14, 0, 1, 15, 15, 5), Block.makeCuboidShape(13, 5, 5, 14, 11, 11), Block.makeCuboidShape(14, 0, 5, 15, 5, 11), Block.makeCuboidShape(14, 11, 5, 15, 15, 11), Block.makeCuboidShape(14, 0, 11, 15, 15, 15), Block.makeCuboidShape(1, 0, 1, 2, 15, 15)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_S = Stream.of(Block.makeCuboidShape(4, 14, 11, 5, 15, 12), Block.makeCuboidShape(15, 0, 0, 16, 1, 16), Block.makeCuboidShape(1, 0, 0, 15, 1, 1), Block.makeCuboidShape(0, 0, 0, 1, 1, 16), Block.makeCuboidShape(1, 0, 15, 15, 1, 16), Block.makeCuboidShape(15, 15, 0, 16, 16, 16), Block.makeCuboidShape(0, 15, 0, 1, 16, 16), Block.makeCuboidShape(1, 15, 15, 15, 16, 16), Block.makeCuboidShape(1, 15, 0, 15, 16, 1), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(4, 11, 4, 12, 12, 12), Block.makeCuboidShape(11, 14, 11, 12, 15, 12), Block.makeCuboidShape(12, 12, 5, 13, 14, 11), Block.makeCuboidShape(3, 12, 5, 4, 14, 11), Block.makeCuboidShape(5, 12, 12, 11, 14, 13), Block.makeCuboidShape(5, 12, 3, 11, 14, 4), Block.makeCuboidShape(4, 12, 4, 5, 14, 5), Block.makeCuboidShape(4, 12, 11, 5, 14, 12), Block.makeCuboidShape(11, 12, 11, 12, 14, 12), Block.makeCuboidShape(11, 12, 4, 12, 14, 5), Block.makeCuboidShape(11, 14, 4, 12, 15, 5), Block.makeCuboidShape(4, 14, 4, 5, 15, 5), Block.makeCuboidShape(12, 14, 2, 14, 15, 14), Block.makeCuboidShape(4, 14, 12, 12, 15, 14), Block.makeCuboidShape(4, 14, 2, 12, 15, 4), Block.makeCuboidShape(2, 14, 2, 4, 15, 14), Block.makeCuboidShape(2, 0, 2, 14, 1, 14), Block.makeCuboidShape(14, 0, 2, 15, 15, 14), Block.makeCuboidShape(1, 0, 2, 2, 15, 14), Block.makeCuboidShape(11, 0, 14, 15, 15, 15), Block.makeCuboidShape(5, 5, 13, 11, 11, 14), Block.makeCuboidShape(5, 0, 14, 11, 5, 15), Block.makeCuboidShape(5, 11, 14, 11, 15, 15), Block.makeCuboidShape(1, 0, 14, 5, 15, 15), Block.makeCuboidShape(1, 0, 1, 15, 15, 2)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_W = Stream.of(Block.makeCuboidShape(4, 14, 4, 5, 15, 5), Block.makeCuboidShape(0, 0, 15, 16, 1, 16), Block.makeCuboidShape(15, 0, 1, 16, 1, 15), Block.makeCuboidShape(0, 0, 0, 16, 1, 1), Block.makeCuboidShape(0, 0, 1, 1, 1, 15), Block.makeCuboidShape(0, 15, 15, 16, 16, 16), Block.makeCuboidShape(0, 15, 0, 16, 16, 1), Block.makeCuboidShape(0, 15, 1, 1, 16, 15), Block.makeCuboidShape(15, 15, 1, 16, 16, 15), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(4, 11, 4, 12, 12, 12), Block.makeCuboidShape(4, 14, 11, 5, 15, 12), Block.makeCuboidShape(5, 12, 12, 11, 14, 13), Block.makeCuboidShape(5, 12, 3, 11, 14, 4), Block.makeCuboidShape(3, 12, 5, 4, 14, 11), Block.makeCuboidShape(12, 12, 5, 13, 14, 11), Block.makeCuboidShape(11, 12, 4, 12, 14, 5), Block.makeCuboidShape(4, 12, 4, 5, 14, 5), Block.makeCuboidShape(4, 12, 11, 5, 14, 12), Block.makeCuboidShape(11, 12, 11, 12, 14, 12), Block.makeCuboidShape(11, 14, 11, 12, 15, 12), Block.makeCuboidShape(11, 14, 4, 12, 15, 5), Block.makeCuboidShape(2, 14, 12, 14, 15, 14), Block.makeCuboidShape(2, 14, 4, 4, 15, 12), Block.makeCuboidShape(12, 14, 4, 14, 15, 12), Block.makeCuboidShape(2, 14, 2, 14, 15, 4), Block.makeCuboidShape(2, 0, 2, 14, 1, 14), Block.makeCuboidShape(2, 0, 14, 14, 15, 15), Block.makeCuboidShape(2, 0, 1, 14, 15, 2), Block.makeCuboidShape(1, 0, 11, 2, 15, 15), Block.makeCuboidShape(2, 5, 5, 3, 11, 11), Block.makeCuboidShape(1, 0, 5, 2, 5, 11), Block.makeCuboidShape(1, 11, 5, 2, 15, 11), Block.makeCuboidShape(1, 0, 1, 2, 15, 5), Block.makeCuboidShape(14, 0, 1, 15, 15, 15)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_N = Stream.of(Block.box(11, 14, 4, 12, 15, 5), Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(4, 11, 4, 12, 12, 12), Block.box(4, 14, 4, 5, 15, 5), Block.box(3, 12, 5, 4, 14, 11), Block.box(12, 12, 5, 13, 14, 11), Block.box(5, 12, 3, 11, 14, 4), Block.box(5, 12, 12, 11, 14, 13), Block.box(11, 12, 11, 12, 14, 12), Block.box(11, 12, 4, 12, 14, 5), Block.box(4, 12, 4, 5, 14, 5), Block.box(4, 12, 11, 5, 14, 12), Block.box(4, 14, 11, 5, 15, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(2, 14, 2, 4, 15, 14), Block.box(4, 14, 2, 12, 15, 4), Block.box(4, 14, 12, 12, 15, 14), Block.box(12, 14, 2, 14, 15, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(1, 0, 2, 2, 15, 14), Block.box(14, 0, 2, 15, 15, 14), Block.box(1, 0, 1, 5, 15, 2), Block.box(5, 5, 2, 11, 11, 3), Block.box(5, 0, 1, 11, 5, 2), Block.box(5, 11, 1, 11, 15, 2), Block.box(11, 0, 1, 15, 15, 2), Block.box(1, 0, 14, 15, 15, 15)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_E = Stream.of(Block.box(11, 14, 11, 12, 15, 12), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 0, 15, 16, 1, 16), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(4, 11, 4, 12, 12, 12), Block.box(11, 14, 4, 12, 15, 5), Block.box(5, 12, 3, 11, 14, 4), Block.box(5, 12, 12, 11, 14, 13), Block.box(12, 12, 5, 13, 14, 11), Block.box(3, 12, 5, 4, 14, 11), Block.box(4, 12, 11, 5, 14, 12), Block.box(11, 12, 11, 12, 14, 12), Block.box(11, 12, 4, 12, 14, 5), Block.box(4, 12, 4, 5, 14, 5), Block.box(4, 14, 4, 5, 15, 5), Block.box(4, 14, 11, 5, 15, 12), Block.box(2, 14, 2, 14, 15, 4), Block.box(12, 14, 4, 14, 15, 12), Block.box(2, 14, 4, 4, 15, 12), Block.box(2, 14, 12, 14, 15, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(2, 0, 1, 14, 15, 2), Block.box(2, 0, 14, 14, 15, 15), Block.box(14, 0, 1, 15, 15, 5), Block.box(13, 5, 5, 14, 11, 11), Block.box(14, 0, 5, 15, 5, 11), Block.box(14, 11, 5, 15, 15, 11), Block.box(14, 0, 11, 15, 15, 15), Block.box(1, 0, 1, 2, 15, 15)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_S = Stream.of(Block.box(4, 14, 11, 5, 15, 12), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(0, 15, 0, 1, 16, 16), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(4, 11, 4, 12, 12, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(12, 12, 5, 13, 14, 11), Block.box(3, 12, 5, 4, 14, 11), Block.box(5, 12, 12, 11, 14, 13), Block.box(5, 12, 3, 11, 14, 4), Block.box(4, 12, 4, 5, 14, 5), Block.box(4, 12, 11, 5, 14, 12), Block.box(11, 12, 11, 12, 14, 12), Block.box(11, 12, 4, 12, 14, 5), Block.box(11, 14, 4, 12, 15, 5), Block.box(4, 14, 4, 5, 15, 5), Block.box(12, 14, 2, 14, 15, 14), Block.box(4, 14, 12, 12, 15, 14), Block.box(4, 14, 2, 12, 15, 4), Block.box(2, 14, 2, 4, 15, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(14, 0, 2, 15, 15, 14), Block.box(1, 0, 2, 2, 15, 14), Block.box(11, 0, 14, 15, 15, 15), Block.box(5, 5, 13, 11, 11, 14), Block.box(5, 0, 14, 11, 5, 15), Block.box(5, 11, 14, 11, 15, 15), Block.box(1, 0, 14, 5, 15, 15), Block.box(1, 0, 1, 15, 15, 2)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_W = Stream.of(Block.box(4, 14, 4, 5, 15, 5), Block.box(0, 0, 15, 16, 1, 16), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(4, 11, 4, 12, 12, 12), Block.box(4, 14, 11, 5, 15, 12), Block.box(5, 12, 12, 11, 14, 13), Block.box(5, 12, 3, 11, 14, 4), Block.box(3, 12, 5, 4, 14, 11), Block.box(12, 12, 5, 13, 14, 11), Block.box(11, 12, 4, 12, 14, 5), Block.box(4, 12, 4, 5, 14, 5), Block.box(4, 12, 11, 5, 14, 12), Block.box(11, 12, 11, 12, 14, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(11, 14, 4, 12, 15, 5), Block.box(2, 14, 12, 14, 15, 14), Block.box(2, 14, 4, 4, 15, 12), Block.box(12, 14, 4, 14, 15, 12), Block.box(2, 14, 2, 14, 15, 4), Block.box(2, 0, 2, 14, 1, 14), Block.box(2, 0, 14, 14, 15, 15), Block.box(2, 0, 1, 14, 15, 2), Block.box(1, 0, 11, 2, 15, 15), Block.box(2, 5, 5, 3, 11, 11), Block.box(1, 0, 5, 2, 5, 11), Block.box(1, 11, 5, 2, 15, 11), Block.box(1, 0, 1, 2, 15, 5), Block.box(14, 0, 1, 15, 15, 15)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); } static class FluidCollectorShapes { - static final VoxelShape SHAPE_U = Stream.of(Block.makeCuboidShape(1, 1, 1, 15, 15, 15), Block.makeCuboidShape(0, 15, 15, 16, 16, 16), Block.makeCuboidShape(0, 15, 0, 16, 16, 1), Block.makeCuboidShape(0, 0, 15, 16, 1, 16), Block.makeCuboidShape(0, 0, 0, 16, 1, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 15, 1, 1, 16, 15), Block.makeCuboidShape(0, 0, 1, 1, 1, 15), Block.makeCuboidShape(15, 0, 1, 16, 1, 15), Block.makeCuboidShape(15, 15, 1, 16, 16, 15), Block.makeCuboidShape(15, 3, 6, 16, 13, 10), Block.makeCuboidShape(0, 3, 6, 1, 13, 10), Block.makeCuboidShape(5, 15, 5, 11, 16, 11), Block.makeCuboidShape(3, 15, 6, 5, 16, 10), Block.makeCuboidShape(11, 15, 6, 13, 16, 10), Block.makeCuboidShape(6, 15, 11, 10, 16, 13), Block.makeCuboidShape(6, 15, 3, 10, 16, 5)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_D = Stream.of(Block.makeCuboidShape(1, 1, 1, 15, 15, 15), Block.makeCuboidShape(0, 0, 0, 16, 1, 1), Block.makeCuboidShape(0, 0, 15, 16, 1, 16), Block.makeCuboidShape(0, 15, 0, 16, 16, 1), Block.makeCuboidShape(0, 15, 15, 16, 16, 16), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(0, 0, 1, 1, 1, 15), Block.makeCuboidShape(0, 15, 1, 1, 16, 15), Block.makeCuboidShape(15, 15, 1, 16, 16, 15), Block.makeCuboidShape(15, 0, 1, 16, 1, 15), Block.makeCuboidShape(15, 3, 6, 16, 13, 10), Block.makeCuboidShape(0, 3, 6, 1, 13, 10), Block.makeCuboidShape(5, 0, 5, 11, 1, 11), Block.makeCuboidShape(3, 0, 6, 5, 1, 10), Block.makeCuboidShape(11, 0, 6, 13, 1, 10), Block.makeCuboidShape(6, 0, 3, 10, 1, 5), Block.makeCuboidShape(6, 0, 11, 10, 1, 13)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_N = Stream.of(Block.makeCuboidShape(1, 1, 1, 15, 15, 15), Block.makeCuboidShape(0, 15, 0, 16, 16, 1), Block.makeCuboidShape(0, 0, 0, 16, 1, 1), Block.makeCuboidShape(0, 15, 15, 16, 16, 16), Block.makeCuboidShape(0, 0, 15, 16, 1, 16), Block.makeCuboidShape(0, 15, 1, 1, 16, 15), Block.makeCuboidShape(0, 0, 1, 1, 1, 15), Block.makeCuboidShape(15, 15, 1, 16, 16, 15), Block.makeCuboidShape(15, 0, 1, 16, 1, 15), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(15, 6, 3, 16, 10, 13), Block.makeCuboidShape(0, 6, 3, 1, 10, 13), Block.makeCuboidShape(5, 5, 0, 11, 11, 1), Block.makeCuboidShape(3, 6, 0, 5, 10, 1), Block.makeCuboidShape(11, 6, 0, 13, 10, 1), Block.makeCuboidShape(6, 11, 0, 10, 13, 1), Block.makeCuboidShape(6, 3, 0, 10, 5, 1)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_E = Stream.of(Block.makeCuboidShape(1, 1, 1, 15, 15, 15), Block.makeCuboidShape(15, 15, 0, 16, 16, 16), Block.makeCuboidShape(15, 0, 0, 16, 1, 16), Block.makeCuboidShape(0, 15, 0, 1, 16, 16), Block.makeCuboidShape(0, 0, 0, 1, 1, 16), Block.makeCuboidShape(1, 15, 0, 15, 16, 1), Block.makeCuboidShape(1, 0, 0, 15, 1, 1), Block.makeCuboidShape(1, 15, 15, 15, 16, 16), Block.makeCuboidShape(1, 0, 15, 15, 1, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(3, 6, 15, 13, 10, 16), Block.makeCuboidShape(3, 6, 0, 13, 10, 1), Block.makeCuboidShape(15, 5, 5, 16, 11, 11), Block.makeCuboidShape(15, 6, 3, 16, 10, 5), Block.makeCuboidShape(15, 6, 11, 16, 10, 13), Block.makeCuboidShape(15, 11, 6, 16, 13, 10), Block.makeCuboidShape(15, 3, 6, 16, 5, 10)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_S = Stream.of(Block.makeCuboidShape(1, 1, 1, 15, 15, 15), Block.makeCuboidShape(0, 15, 15, 16, 16, 16), Block.makeCuboidShape(0, 0, 15, 16, 1, 16), Block.makeCuboidShape(0, 15, 0, 16, 16, 1), Block.makeCuboidShape(0, 0, 0, 16, 1, 1), Block.makeCuboidShape(15, 15, 1, 16, 16, 15), Block.makeCuboidShape(15, 0, 1, 16, 1, 15), Block.makeCuboidShape(0, 15, 1, 1, 16, 15), Block.makeCuboidShape(0, 0, 1, 1, 1, 15), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(0, 6, 3, 1, 10, 13), Block.makeCuboidShape(15, 6, 3, 16, 10, 13), Block.makeCuboidShape(5, 5, 15, 11, 11, 16), Block.makeCuboidShape(11, 6, 15, 13, 10, 16), Block.makeCuboidShape(3, 6, 15, 5, 10, 16), Block.makeCuboidShape(6, 11, 15, 10, 13, 16), Block.makeCuboidShape(6, 3, 15, 10, 5, 16)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_W = Stream.of(Block.makeCuboidShape(1, 1, 1, 15, 15, 15), Block.makeCuboidShape(0, 15, 0, 1, 16, 16), Block.makeCuboidShape(0, 0, 0, 1, 1, 16), Block.makeCuboidShape(15, 15, 0, 16, 16, 16), Block.makeCuboidShape(15, 0, 0, 16, 1, 16), Block.makeCuboidShape(1, 15, 15, 15, 16, 16), Block.makeCuboidShape(1, 0, 15, 15, 1, 16), Block.makeCuboidShape(1, 15, 0, 15, 16, 1), Block.makeCuboidShape(1, 0, 0, 15, 1, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(3, 6, 0, 13, 10, 1), Block.makeCuboidShape(3, 6, 15, 13, 10, 16), Block.makeCuboidShape(0, 5, 5, 1, 11, 11), Block.makeCuboidShape(0, 6, 11, 1, 10, 13), Block.makeCuboidShape(0, 6, 3, 1, 10, 5), Block.makeCuboidShape(0, 11, 6, 1, 13, 10), Block.makeCuboidShape(0, 3, 6, 1, 5, 10)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_U = Stream.of(Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(0, 1, 0, 1, 15, 1), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 0, 1, 1, 1, 15), Block.box(15, 0, 1, 16, 1, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 3, 6, 16, 13, 10), Block.box(0, 3, 6, 1, 13, 10), Block.box(5, 15, 5, 11, 16, 11), Block.box(3, 15, 6, 5, 16, 10), Block.box(11, 15, 6, 13, 16, 10), Block.box(6, 15, 11, 10, 16, 13), Block.box(6, 15, 3, 10, 16, 5)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_D = Stream.of(Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(15, 1, 15, 16, 15, 16), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 0, 1, 16, 1, 15), Block.box(15, 3, 6, 16, 13, 10), Block.box(0, 3, 6, 1, 13, 10), Block.box(5, 0, 5, 11, 1, 11), Block.box(3, 0, 6, 5, 1, 10), Block.box(11, 0, 6, 13, 1, 10), Block.box(6, 0, 3, 10, 1, 5), Block.box(6, 0, 11, 10, 1, 13)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_N = Stream.of(Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 0, 1, 1, 1, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(15, 6, 3, 16, 10, 13), Block.box(0, 6, 3, 1, 10, 13), Block.box(5, 5, 0, 11, 11, 1), Block.box(3, 6, 0, 5, 10, 1), Block.box(11, 6, 0, 13, 10, 1), Block.box(6, 11, 0, 10, 13, 1), Block.box(6, 3, 0, 10, 5, 1)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_E = Stream.of(Block.box(1, 1, 1, 15, 15, 15), Block.box(15, 15, 0, 16, 16, 16), Block.box(15, 0, 0, 16, 1, 16), Block.box(0, 15, 0, 1, 16, 16), Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 0, 0, 15, 1, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(3, 6, 15, 13, 10, 16), Block.box(3, 6, 0, 13, 10, 1), Block.box(15, 5, 5, 16, 11, 11), Block.box(15, 6, 3, 16, 10, 5), Block.box(15, 6, 11, 16, 10, 13), Block.box(15, 11, 6, 16, 13, 10), Block.box(15, 3, 6, 16, 5, 10)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_S = Stream.of(Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 0, 0, 16, 1, 1), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 0, 1, 1, 1, 15), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(0, 6, 3, 1, 10, 13), Block.box(15, 6, 3, 16, 10, 13), Block.box(5, 5, 15, 11, 11, 16), Block.box(11, 6, 15, 13, 10, 16), Block.box(3, 6, 15, 5, 10, 16), Block.box(6, 11, 15, 10, 13, 16), Block.box(6, 3, 15, 10, 5, 16)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_W = Stream.of(Block.box(1, 1, 1, 15, 15, 15), Block.box(0, 15, 0, 1, 16, 16), Block.box(0, 0, 0, 1, 1, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(3, 6, 0, 13, 10, 1), Block.box(3, 6, 15, 13, 10, 16), Block.box(0, 5, 5, 1, 11, 11), Block.box(0, 6, 11, 1, 10, 13), Block.box(0, 6, 3, 1, 10, 5), Block.box(0, 11, 6, 1, 13, 10), Block.box(0, 3, 6, 1, 5, 10)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); } static class FurnaceDoubleShapes { - static final VoxelShape SHAPE_N = Stream.of(Block.makeCuboidShape(15, 15, 0, 16, 16, 16), Block.makeCuboidShape(0, 15, 0, 1, 16, 16), Block.makeCuboidShape(1, 15, 0, 15, 16, 1), Block.makeCuboidShape(1, 15, 15, 15, 16, 16), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 0, 0, 16, 1, 16), Block.makeCuboidShape(5, 14, 6, 11, 15, 7), Block.makeCuboidShape(5, 14, 8, 11, 15, 9), Block.makeCuboidShape(5, 14, 10, 11, 15, 14), Block.makeCuboidShape(5, 14, 2, 11, 15, 5), Block.makeCuboidShape(11, 14, 2, 14, 15, 14), Block.makeCuboidShape(2, 14, 2, 5, 15, 14), Block.makeCuboidShape(1, 1, 2, 2, 15, 14), Block.makeCuboidShape(14, 1, 2, 15, 15, 14), Block.makeCuboidShape(1, 1, 14, 15, 15, 15), Block.makeCuboidShape(7, 3, 1, 9, 7, 2), Block.makeCuboidShape(3, 7, 1, 13, 15, 2), Block.makeCuboidShape(3, 1, 1, 13, 3, 2), Block.makeCuboidShape(1, 1, 1, 3, 15, 2), Block.makeCuboidShape(13, 1, 1, 15, 15, 2), Block.makeCuboidShape(5, 13, 5, 11, 14, 10), Block.makeCuboidShape(2, 3, 2, 14, 8, 3)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_E = Stream.of(Block.makeCuboidShape(0, 15, 15, 16, 16, 16), Block.makeCuboidShape(0, 15, 0, 16, 16, 1), Block.makeCuboidShape(15, 15, 1, 16, 16, 15), Block.makeCuboidShape(0, 15, 1, 1, 16, 15), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 0, 0, 16, 1, 16), Block.makeCuboidShape(9, 14, 5, 10, 15, 11), Block.makeCuboidShape(7, 14, 5, 8, 15, 11), Block.makeCuboidShape(2, 14, 5, 6, 15, 11), Block.makeCuboidShape(11, 14, 5, 14, 15, 11), Block.makeCuboidShape(2, 14, 11, 14, 15, 14), Block.makeCuboidShape(2, 14, 2, 14, 15, 5), Block.makeCuboidShape(2, 1, 1, 14, 15, 2), Block.makeCuboidShape(2, 1, 14, 14, 15, 15), Block.makeCuboidShape(1, 1, 1, 2, 15, 15), Block.makeCuboidShape(14, 3, 7, 15, 7, 9), Block.makeCuboidShape(14, 7, 3, 15, 15, 13), Block.makeCuboidShape(14, 1, 3, 15, 3, 13), Block.makeCuboidShape(14, 1, 1, 15, 15, 3), Block.makeCuboidShape(14, 1, 13, 15, 15, 15), Block.makeCuboidShape(6, 13, 5, 11, 14, 11), Block.makeCuboidShape(13, 3, 2, 14, 8, 14)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_S = Stream.of(Block.makeCuboidShape(0, 15, 0, 1, 16, 16), Block.makeCuboidShape(15, 15, 0, 16, 16, 16), Block.makeCuboidShape(1, 15, 15, 15, 16, 16), Block.makeCuboidShape(1, 15, 0, 15, 16, 1), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(0, 0, 0, 16, 1, 16), Block.makeCuboidShape(5, 14, 9, 11, 15, 10), Block.makeCuboidShape(5, 14, 7, 11, 15, 8), Block.makeCuboidShape(5, 14, 2, 11, 15, 6), Block.makeCuboidShape(5, 14, 11, 11, 15, 14), Block.makeCuboidShape(2, 14, 2, 5, 15, 14), Block.makeCuboidShape(11, 14, 2, 14, 15, 14), Block.makeCuboidShape(14, 1, 2, 15, 15, 14), Block.makeCuboidShape(1, 1, 2, 2, 15, 14), Block.makeCuboidShape(1, 1, 1, 15, 15, 2), Block.makeCuboidShape(7, 3, 14, 9, 7, 15), Block.makeCuboidShape(3, 7, 14, 13, 15, 15), Block.makeCuboidShape(3, 1, 14, 13, 3, 15), Block.makeCuboidShape(13, 1, 14, 15, 15, 15), Block.makeCuboidShape(1, 1, 14, 3, 15, 15), Block.makeCuboidShape(5, 13, 6, 11, 14, 11), Block.makeCuboidShape(2, 3, 13, 14, 8, 14)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_W = Stream.of(Block.makeCuboidShape(0, 15, 0, 16, 16, 1), Block.makeCuboidShape(0, 15, 15, 16, 16, 16), Block.makeCuboidShape(0, 15, 1, 1, 16, 15), Block.makeCuboidShape(15, 15, 1, 16, 16, 15), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(0, 0, 0, 16, 1, 16), Block.makeCuboidShape(6, 14, 5, 7, 15, 11), Block.makeCuboidShape(8, 14, 5, 9, 15, 11), Block.makeCuboidShape(10, 14, 5, 14, 15, 11), Block.makeCuboidShape(2, 14, 5, 5, 15, 11), Block.makeCuboidShape(2, 14, 2, 14, 15, 5), Block.makeCuboidShape(2, 14, 11, 14, 15, 14), Block.makeCuboidShape(2, 1, 14, 14, 15, 15), Block.makeCuboidShape(2, 1, 1, 14, 15, 2), Block.makeCuboidShape(14, 1, 1, 15, 15, 15), Block.makeCuboidShape(1, 3, 7, 2, 7, 9), Block.makeCuboidShape(1, 7, 3, 2, 15, 13), Block.makeCuboidShape(1, 1, 3, 2, 3, 13), Block.makeCuboidShape(1, 1, 13, 2, 15, 15), Block.makeCuboidShape(1, 1, 1, 2, 15, 3), Block.makeCuboidShape(5, 13, 5, 10, 14, 11), Block.makeCuboidShape(2, 3, 2, 3, 8, 14)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_N = Stream.of(Block.box(15, 15, 0, 16, 16, 16), Block.box(0, 15, 0, 1, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 0, 0, 16, 1, 16), Block.box(5, 14, 6, 11, 15, 7), Block.box(5, 14, 8, 11, 15, 9), Block.box(5, 14, 10, 11, 15, 14), Block.box(5, 14, 2, 11, 15, 5), Block.box(11, 14, 2, 14, 15, 14), Block.box(2, 14, 2, 5, 15, 14), Block.box(1, 1, 2, 2, 15, 14), Block.box(14, 1, 2, 15, 15, 14), Block.box(1, 1, 14, 15, 15, 15), Block.box(7, 3, 1, 9, 7, 2), Block.box(3, 7, 1, 13, 15, 2), Block.box(3, 1, 1, 13, 3, 2), Block.box(1, 1, 1, 3, 15, 2), Block.box(13, 1, 1, 15, 15, 2), Block.box(5, 13, 5, 11, 14, 10), Block.box(2, 3, 2, 14, 8, 3)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_E = Stream.of(Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 0, 0, 16, 1, 16), Block.box(9, 14, 5, 10, 15, 11), Block.box(7, 14, 5, 8, 15, 11), Block.box(2, 14, 5, 6, 15, 11), Block.box(11, 14, 5, 14, 15, 11), Block.box(2, 14, 11, 14, 15, 14), Block.box(2, 14, 2, 14, 15, 5), Block.box(2, 1, 1, 14, 15, 2), Block.box(2, 1, 14, 14, 15, 15), Block.box(1, 1, 1, 2, 15, 15), Block.box(14, 3, 7, 15, 7, 9), Block.box(14, 7, 3, 15, 15, 13), Block.box(14, 1, 3, 15, 3, 13), Block.box(14, 1, 1, 15, 15, 3), Block.box(14, 1, 13, 15, 15, 15), Block.box(6, 13, 5, 11, 14, 11), Block.box(13, 3, 2, 14, 8, 14)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_S = Stream.of(Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(0, 0, 0, 16, 1, 16), Block.box(5, 14, 9, 11, 15, 10), Block.box(5, 14, 7, 11, 15, 8), Block.box(5, 14, 2, 11, 15, 6), Block.box(5, 14, 11, 11, 15, 14), Block.box(2, 14, 2, 5, 15, 14), Block.box(11, 14, 2, 14, 15, 14), Block.box(14, 1, 2, 15, 15, 14), Block.box(1, 1, 2, 2, 15, 14), Block.box(1, 1, 1, 15, 15, 2), Block.box(7, 3, 14, 9, 7, 15), Block.box(3, 7, 14, 13, 15, 15), Block.box(3, 1, 14, 13, 3, 15), Block.box(13, 1, 14, 15, 15, 15), Block.box(1, 1, 14, 3, 15, 15), Block.box(5, 13, 6, 11, 14, 11), Block.box(2, 3, 13, 14, 8, 14)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_W = Stream.of(Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(0, 0, 0, 16, 1, 16), Block.box(6, 14, 5, 7, 15, 11), Block.box(8, 14, 5, 9, 15, 11), Block.box(10, 14, 5, 14, 15, 11), Block.box(2, 14, 5, 5, 15, 11), Block.box(2, 14, 2, 14, 15, 5), Block.box(2, 14, 11, 14, 15, 14), Block.box(2, 1, 14, 14, 15, 15), Block.box(2, 1, 1, 14, 15, 2), Block.box(14, 1, 1, 15, 15, 15), Block.box(1, 3, 7, 2, 7, 9), Block.box(1, 7, 3, 2, 15, 13), Block.box(1, 1, 3, 2, 3, 13), Block.box(1, 1, 13, 2, 15, 15), Block.box(1, 1, 1, 2, 15, 3), Block.box(5, 13, 5, 10, 14, 11), Block.box(2, 3, 2, 3, 8, 14)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); } static final class GrinderShapes { - static final VoxelShape SHAPE_N = Stream.of(Block.makeCuboidShape(0, 0, 0, 1, 1, 16), Block.makeCuboidShape(14, 12, 4, 15, 15, 12), Block.makeCuboidShape(1, 0, 4, 2, 4, 12), Block.makeCuboidShape(14, 0, 4, 15, 4, 12), Block.makeCuboidShape(4, 13, 4, 12, 14, 12), Block.makeCuboidShape(11, 14, 4, 12, 15, 5), Block.makeCuboidShape(4, 14, 4, 5, 15, 5), Block.makeCuboidShape(3, 12, 5, 4, 14, 11), Block.makeCuboidShape(12, 12, 5, 13, 14, 11), Block.makeCuboidShape(5, 12, 3, 11, 14, 4), Block.makeCuboidShape(5, 12, 12, 11, 14, 13), Block.makeCuboidShape(11, 12, 11, 12, 14, 12), Block.makeCuboidShape(11, 12, 4, 12, 14, 5), Block.makeCuboidShape(4, 12, 4, 5, 14, 5), Block.makeCuboidShape(4, 12, 11, 5, 14, 12), Block.makeCuboidShape(4, 14, 11, 5, 15, 12), Block.makeCuboidShape(11, 14, 11, 12, 15, 12), Block.makeCuboidShape(2, 14, 2, 4, 15, 14), Block.makeCuboidShape(4, 14, 2, 12, 15, 4), Block.makeCuboidShape(4, 14, 12, 12, 15, 14), Block.makeCuboidShape(12, 14, 2, 14, 15, 14), Block.makeCuboidShape(2, 0, 2, 14, 1, 14), Block.makeCuboidShape(1, 0, 2, 2, 15, 4), Block.makeCuboidShape(14, 0, 2, 15, 15, 4), Block.makeCuboidShape(1, 0, 12, 2, 15, 14), Block.makeCuboidShape(14, 0, 12, 15, 15, 14), Block.makeCuboidShape(1, 0, 1, 15, 15, 2), Block.makeCuboidShape(1, 0, 14, 15, 15, 15), Block.makeCuboidShape(13, 4, 4, 14, 12, 12), Block.makeCuboidShape(2, 4, 4, 3, 12, 12), Block.makeCuboidShape(3, 8, 0, 6, 10, 1), Block.makeCuboidShape(1, 0, 15, 15, 1, 16), Block.makeCuboidShape(15, 0, 0, 16, 1, 16), Block.makeCuboidShape(1, 0, 0, 15, 1, 1), Block.makeCuboidShape(1, 12, 4, 2, 15, 12), Block.makeCuboidShape(0, 15, 0, 1, 16, 16), Block.makeCuboidShape(15, 15, 0, 16, 16, 16), Block.makeCuboidShape(1, 15, 0, 15, 16, 1), Block.makeCuboidShape(1, 15, 15, 15, 16, 16), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_E = Stream.of(Block.makeCuboidShape(0, 0, 0, 16, 1, 1), Block.makeCuboidShape(4, 12, 14, 12, 15, 15), Block.makeCuboidShape(4, 0, 1, 12, 4, 2), Block.makeCuboidShape(4, 0, 14, 12, 4, 15), Block.makeCuboidShape(4, 13, 4, 12, 14, 12), Block.makeCuboidShape(11, 14, 11, 12, 15, 12), Block.makeCuboidShape(11, 14, 4, 12, 15, 5), Block.makeCuboidShape(5, 12, 3, 11, 14, 4), Block.makeCuboidShape(5, 12, 12, 11, 14, 13), Block.makeCuboidShape(12, 12, 5, 13, 14, 11), Block.makeCuboidShape(3, 12, 5, 4, 14, 11), Block.makeCuboidShape(4, 12, 11, 5, 14, 12), Block.makeCuboidShape(11, 12, 11, 12, 14, 12), Block.makeCuboidShape(11, 12, 4, 12, 14, 5), Block.makeCuboidShape(4, 12, 4, 5, 14, 5), Block.makeCuboidShape(4, 14, 4, 5, 15, 5), Block.makeCuboidShape(4, 14, 11, 5, 15, 12), Block.makeCuboidShape(2, 14, 2, 14, 15, 4), Block.makeCuboidShape(12, 14, 4, 14, 15, 12), Block.makeCuboidShape(2, 14, 4, 4, 15, 12), Block.makeCuboidShape(2, 14, 12, 14, 15, 14), Block.makeCuboidShape(2, 0, 2, 14, 1, 14), Block.makeCuboidShape(12, 0, 1, 14, 15, 2), Block.makeCuboidShape(12, 0, 14, 14, 15, 15), Block.makeCuboidShape(2, 0, 1, 4, 15, 2), Block.makeCuboidShape(2, 0, 14, 4, 15, 15), Block.makeCuboidShape(14, 0, 1, 15, 15, 15), Block.makeCuboidShape(1, 0, 1, 2, 15, 15), Block.makeCuboidShape(4, 4, 13, 12, 12, 14), Block.makeCuboidShape(4, 4, 2, 12, 12, 3), Block.makeCuboidShape(15, 8, 3, 16, 10, 6), Block.makeCuboidShape(0, 0, 1, 1, 1, 15), Block.makeCuboidShape(0, 0, 15, 16, 1, 16), Block.makeCuboidShape(15, 0, 1, 16, 1, 15), Block.makeCuboidShape(4, 12, 1, 12, 15, 2), Block.makeCuboidShape(0, 15, 0, 16, 16, 1), Block.makeCuboidShape(0, 15, 15, 16, 16, 16), Block.makeCuboidShape(15, 15, 1, 16, 16, 15), Block.makeCuboidShape(0, 15, 1, 1, 16, 15), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_S = Stream.of(Block.makeCuboidShape(15, 0, 0, 16, 1, 16), Block.makeCuboidShape(1, 12, 4, 2, 15, 12), Block.makeCuboidShape(14, 0, 4, 15, 4, 12), Block.makeCuboidShape(1, 0, 4, 2, 4, 12), Block.makeCuboidShape(4, 13, 4, 12, 14, 12), Block.makeCuboidShape(4, 14, 11, 5, 15, 12), Block.makeCuboidShape(11, 14, 11, 12, 15, 12), Block.makeCuboidShape(12, 12, 5, 13, 14, 11), Block.makeCuboidShape(3, 12, 5, 4, 14, 11), Block.makeCuboidShape(5, 12, 12, 11, 14, 13), Block.makeCuboidShape(5, 12, 3, 11, 14, 4), Block.makeCuboidShape(4, 12, 4, 5, 14, 5), Block.makeCuboidShape(4, 12, 11, 5, 14, 12), Block.makeCuboidShape(11, 12, 11, 12, 14, 12), Block.makeCuboidShape(11, 12, 4, 12, 14, 5), Block.makeCuboidShape(11, 14, 4, 12, 15, 5), Block.makeCuboidShape(4, 14, 4, 5, 15, 5), Block.makeCuboidShape(12, 14, 2, 14, 15, 14), Block.makeCuboidShape(4, 14, 12, 12, 15, 14), Block.makeCuboidShape(4, 14, 2, 12, 15, 4), Block.makeCuboidShape(2, 14, 2, 4, 15, 14), Block.makeCuboidShape(2, 0, 2, 14, 1, 14), Block.makeCuboidShape(14, 0, 12, 15, 15, 14), Block.makeCuboidShape(1, 0, 12, 2, 15, 14), Block.makeCuboidShape(14, 0, 2, 15, 15, 4), Block.makeCuboidShape(1, 0, 2, 2, 15, 4), Block.makeCuboidShape(1, 0, 14, 15, 15, 15), Block.makeCuboidShape(1, 0, 1, 15, 15, 2), Block.makeCuboidShape(2, 4, 4, 3, 12, 12), Block.makeCuboidShape(13, 4, 4, 14, 12, 12), Block.makeCuboidShape(10, 8, 15, 13, 10, 16), Block.makeCuboidShape(1, 0, 0, 15, 1, 1), Block.makeCuboidShape(0, 0, 0, 1, 1, 16), Block.makeCuboidShape(1, 0, 15, 15, 1, 16), Block.makeCuboidShape(14, 12, 4, 15, 15, 12), Block.makeCuboidShape(15, 15, 0, 16, 16, 16), Block.makeCuboidShape(0, 15, 0, 1, 16, 16), Block.makeCuboidShape(1, 15, 15, 15, 16, 16), Block.makeCuboidShape(1, 15, 0, 15, 16, 1), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_W = Stream.of(Block.makeCuboidShape(0, 0, 15, 16, 1, 16), Block.makeCuboidShape(4, 12, 1, 12, 15, 2), Block.makeCuboidShape(4, 0, 14, 12, 4, 15), Block.makeCuboidShape(4, 0, 1, 12, 4, 2), Block.makeCuboidShape(4, 13, 4, 12, 14, 12), Block.makeCuboidShape(4, 14, 4, 5, 15, 5), Block.makeCuboidShape(4, 14, 11, 5, 15, 12), Block.makeCuboidShape(5, 12, 12, 11, 14, 13), Block.makeCuboidShape(5, 12, 3, 11, 14, 4), Block.makeCuboidShape(3, 12, 5, 4, 14, 11), Block.makeCuboidShape(12, 12, 5, 13, 14, 11), Block.makeCuboidShape(11, 12, 4, 12, 14, 5), Block.makeCuboidShape(4, 12, 4, 5, 14, 5), Block.makeCuboidShape(4, 12, 11, 5, 14, 12), Block.makeCuboidShape(11, 12, 11, 12, 14, 12), Block.makeCuboidShape(11, 14, 11, 12, 15, 12), Block.makeCuboidShape(11, 14, 4, 12, 15, 5), Block.makeCuboidShape(2, 14, 12, 14, 15, 14), Block.makeCuboidShape(2, 14, 4, 4, 15, 12), Block.makeCuboidShape(12, 14, 4, 14, 15, 12), Block.makeCuboidShape(2, 14, 2, 14, 15, 4), Block.makeCuboidShape(2, 0, 2, 14, 1, 14), Block.makeCuboidShape(2, 0, 14, 4, 15, 15), Block.makeCuboidShape(2, 0, 1, 4, 15, 2), Block.makeCuboidShape(12, 0, 14, 14, 15, 15), Block.makeCuboidShape(12, 0, 1, 14, 15, 2), Block.makeCuboidShape(1, 0, 1, 2, 15, 15), Block.makeCuboidShape(14, 0, 1, 15, 15, 15), Block.makeCuboidShape(4, 4, 2, 12, 12, 3), Block.makeCuboidShape(4, 4, 13, 12, 12, 14), Block.makeCuboidShape(0, 8, 10, 1, 10, 13), Block.makeCuboidShape(15, 0, 1, 16, 1, 15), Block.makeCuboidShape(0, 0, 0, 16, 1, 1), Block.makeCuboidShape(0, 0, 1, 1, 1, 15), Block.makeCuboidShape(4, 12, 14, 12, 15, 15), Block.makeCuboidShape(0, 15, 15, 16, 16, 16), Block.makeCuboidShape(0, 15, 0, 16, 16, 1), Block.makeCuboidShape(0, 15, 1, 1, 16, 15), Block.makeCuboidShape(15, 15, 1, 16, 16, 15), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_N = Stream.of(Block.box(0, 0, 0, 1, 1, 16), Block.box(14, 12, 4, 15, 15, 12), Block.box(1, 0, 4, 2, 4, 12), Block.box(14, 0, 4, 15, 4, 12), Block.box(4, 13, 4, 12, 14, 12), Block.box(11, 14, 4, 12, 15, 5), Block.box(4, 14, 4, 5, 15, 5), Block.box(3, 12, 5, 4, 14, 11), Block.box(12, 12, 5, 13, 14, 11), Block.box(5, 12, 3, 11, 14, 4), Block.box(5, 12, 12, 11, 14, 13), Block.box(11, 12, 11, 12, 14, 12), Block.box(11, 12, 4, 12, 14, 5), Block.box(4, 12, 4, 5, 14, 5), Block.box(4, 12, 11, 5, 14, 12), Block.box(4, 14, 11, 5, 15, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(2, 14, 2, 4, 15, 14), Block.box(4, 14, 2, 12, 15, 4), Block.box(4, 14, 12, 12, 15, 14), Block.box(12, 14, 2, 14, 15, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(1, 0, 2, 2, 15, 4), Block.box(14, 0, 2, 15, 15, 4), Block.box(1, 0, 12, 2, 15, 14), Block.box(14, 0, 12, 15, 15, 14), Block.box(1, 0, 1, 15, 15, 2), Block.box(1, 0, 14, 15, 15, 15), Block.box(13, 4, 4, 14, 12, 12), Block.box(2, 4, 4, 3, 12, 12), Block.box(3, 8, 0, 6, 10, 1), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(1, 12, 4, 2, 15, 12), Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_E = Stream.of(Block.box(0, 0, 0, 16, 1, 1), Block.box(4, 12, 14, 12, 15, 15), Block.box(4, 0, 1, 12, 4, 2), Block.box(4, 0, 14, 12, 4, 15), Block.box(4, 13, 4, 12, 14, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(11, 14, 4, 12, 15, 5), Block.box(5, 12, 3, 11, 14, 4), Block.box(5, 12, 12, 11, 14, 13), Block.box(12, 12, 5, 13, 14, 11), Block.box(3, 12, 5, 4, 14, 11), Block.box(4, 12, 11, 5, 14, 12), Block.box(11, 12, 11, 12, 14, 12), Block.box(11, 12, 4, 12, 14, 5), Block.box(4, 12, 4, 5, 14, 5), Block.box(4, 14, 4, 5, 15, 5), Block.box(4, 14, 11, 5, 15, 12), Block.box(2, 14, 2, 14, 15, 4), Block.box(12, 14, 4, 14, 15, 12), Block.box(2, 14, 4, 4, 15, 12), Block.box(2, 14, 12, 14, 15, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(12, 0, 1, 14, 15, 2), Block.box(12, 0, 14, 14, 15, 15), Block.box(2, 0, 1, 4, 15, 2), Block.box(2, 0, 14, 4, 15, 15), Block.box(14, 0, 1, 15, 15, 15), Block.box(1, 0, 1, 2, 15, 15), Block.box(4, 4, 13, 12, 12, 14), Block.box(4, 4, 2, 12, 12, 3), Block.box(15, 8, 3, 16, 10, 6), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 0, 15, 16, 1, 16), Block.box(15, 0, 1, 16, 1, 15), Block.box(4, 12, 1, 12, 15, 2), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_S = Stream.of(Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 12, 4, 2, 15, 12), Block.box(14, 0, 4, 15, 4, 12), Block.box(1, 0, 4, 2, 4, 12), Block.box(4, 13, 4, 12, 14, 12), Block.box(4, 14, 11, 5, 15, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(12, 12, 5, 13, 14, 11), Block.box(3, 12, 5, 4, 14, 11), Block.box(5, 12, 12, 11, 14, 13), Block.box(5, 12, 3, 11, 14, 4), Block.box(4, 12, 4, 5, 14, 5), Block.box(4, 12, 11, 5, 14, 12), Block.box(11, 12, 11, 12, 14, 12), Block.box(11, 12, 4, 12, 14, 5), Block.box(11, 14, 4, 12, 15, 5), Block.box(4, 14, 4, 5, 15, 5), Block.box(12, 14, 2, 14, 15, 14), Block.box(4, 14, 12, 12, 15, 14), Block.box(4, 14, 2, 12, 15, 4), Block.box(2, 14, 2, 4, 15, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(14, 0, 12, 15, 15, 14), Block.box(1, 0, 12, 2, 15, 14), Block.box(14, 0, 2, 15, 15, 4), Block.box(1, 0, 2, 2, 15, 4), Block.box(1, 0, 14, 15, 15, 15), Block.box(1, 0, 1, 15, 15, 2), Block.box(2, 4, 4, 3, 12, 12), Block.box(13, 4, 4, 14, 12, 12), Block.box(10, 8, 15, 13, 10, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(14, 12, 4, 15, 15, 12), Block.box(15, 15, 0, 16, 16, 16), Block.box(0, 15, 0, 1, 16, 16), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_W = Stream.of(Block.box(0, 0, 15, 16, 1, 16), Block.box(4, 12, 1, 12, 15, 2), Block.box(4, 0, 14, 12, 4, 15), Block.box(4, 0, 1, 12, 4, 2), Block.box(4, 13, 4, 12, 14, 12), Block.box(4, 14, 4, 5, 15, 5), Block.box(4, 14, 11, 5, 15, 12), Block.box(5, 12, 12, 11, 14, 13), Block.box(5, 12, 3, 11, 14, 4), Block.box(3, 12, 5, 4, 14, 11), Block.box(12, 12, 5, 13, 14, 11), Block.box(11, 12, 4, 12, 14, 5), Block.box(4, 12, 4, 5, 14, 5), Block.box(4, 12, 11, 5, 14, 12), Block.box(11, 12, 11, 12, 14, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(11, 14, 4, 12, 15, 5), Block.box(2, 14, 12, 14, 15, 14), Block.box(2, 14, 4, 4, 15, 12), Block.box(12, 14, 4, 14, 15, 12), Block.box(2, 14, 2, 14, 15, 4), Block.box(2, 0, 2, 14, 1, 14), Block.box(2, 0, 14, 4, 15, 15), Block.box(2, 0, 1, 4, 15, 2), Block.box(12, 0, 14, 14, 15, 15), Block.box(12, 0, 1, 14, 15, 2), Block.box(1, 0, 1, 2, 15, 15), Block.box(14, 0, 1, 15, 15, 15), Block.box(4, 4, 2, 12, 12, 3), Block.box(4, 4, 13, 12, 12, 14), Block.box(0, 8, 10, 1, 10, 13), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 0, 1, 1, 1, 15), Block.box(4, 12, 14, 12, 15, 15), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); } static final class LampPowererShapes { - static final VoxelShape SHAPE_N = Stream.of(Block.makeCuboidShape(0, 0, 0, 1, 1, 16), Block.makeCuboidShape(0, 15, 0, 1, 16, 16), Block.makeCuboidShape(15, 15, 0, 16, 16, 16), Block.makeCuboidShape(1, 15, 0, 15, 16, 1), Block.makeCuboidShape(1, 15, 15, 15, 16, 16), Block.makeCuboidShape(1, 0, 15, 15, 1, 16), Block.makeCuboidShape(1, 0, 0, 15, 1, 1), Block.makeCuboidShape(15, 0, 0, 16, 1, 16), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(3, 3, 15, 13, 13, 16), Block.makeCuboidShape(1, 14, 1, 15, 15, 15), Block.makeCuboidShape(1, 1, 1, 15, 2, 15), Block.makeCuboidShape(14, 2, 1, 15, 14, 15), Block.makeCuboidShape(1, 2, 1, 2, 14, 15), Block.makeCuboidShape(2, 2, 14, 14, 14, 15), Block.makeCuboidShape(2, 2, 1, 14, 14, 2), Block.makeCuboidShape(0, 7, 7, 1, 9, 10), Block.makeCuboidShape(15, 7, 6, 16, 9, 9)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_E = Stream.of(Block.makeCuboidShape(0, 0, 0, 16, 1, 1), Block.makeCuboidShape(0, 15, 0, 16, 16, 1), Block.makeCuboidShape(0, 15, 15, 16, 16, 16), Block.makeCuboidShape(15, 15, 1, 16, 16, 15), Block.makeCuboidShape(0, 15, 1, 1, 16, 15), Block.makeCuboidShape(0, 0, 1, 1, 1, 15), Block.makeCuboidShape(15, 0, 1, 16, 1, 15), Block.makeCuboidShape(0, 0, 15, 16, 1, 16), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 3, 3, 1, 13, 13), Block.makeCuboidShape(1, 14, 1, 15, 15, 15), Block.makeCuboidShape(1, 1, 1, 15, 2, 15), Block.makeCuboidShape(1, 2, 14, 15, 14, 15), Block.makeCuboidShape(1, 2, 1, 15, 14, 2), Block.makeCuboidShape(1, 2, 2, 2, 14, 14), Block.makeCuboidShape(14, 2, 2, 15, 14, 14), Block.makeCuboidShape(6, 7, 0, 9, 9, 1), Block.makeCuboidShape(7, 7, 15, 10, 9, 16)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_S = Stream.of(Block.makeCuboidShape(15, 0, 0, 16, 1, 16), Block.makeCuboidShape(15, 15, 0, 16, 16, 16), Block.makeCuboidShape(0, 15, 0, 1, 16, 16), Block.makeCuboidShape(1, 15, 15, 15, 16, 16), Block.makeCuboidShape(1, 15, 0, 15, 16, 1), Block.makeCuboidShape(1, 0, 0, 15, 1, 1), Block.makeCuboidShape(1, 0, 15, 15, 1, 16), Block.makeCuboidShape(0, 0, 0, 1, 1, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(3, 3, 0, 13, 13, 1), Block.makeCuboidShape(1, 14, 1, 15, 15, 15), Block.makeCuboidShape(1, 1, 1, 15, 2, 15), Block.makeCuboidShape(1, 2, 1, 2, 14, 15), Block.makeCuboidShape(14, 2, 1, 15, 14, 15), Block.makeCuboidShape(2, 2, 1, 14, 14, 2), Block.makeCuboidShape(2, 2, 14, 14, 14, 15), Block.makeCuboidShape(15, 7, 6, 16, 9, 9), Block.makeCuboidShape(0, 7, 7, 1, 9, 10)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_W = Stream.of(Block.makeCuboidShape(0, 0, 15, 16, 1, 16), Block.makeCuboidShape(0, 15, 15, 16, 16, 16), Block.makeCuboidShape(0, 15, 0, 16, 16, 1), Block.makeCuboidShape(0, 15, 1, 1, 16, 15), Block.makeCuboidShape(15, 15, 1, 16, 16, 15), Block.makeCuboidShape(15, 0, 1, 16, 1, 15), Block.makeCuboidShape(0, 0, 1, 1, 1, 15), Block.makeCuboidShape(0, 0, 0, 16, 1, 1), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 3, 3, 16, 13, 13), Block.makeCuboidShape(1, 14, 1, 15, 15, 15), Block.makeCuboidShape(1, 1, 1, 15, 2, 15), Block.makeCuboidShape(1, 2, 1, 15, 14, 2), Block.makeCuboidShape(1, 2, 14, 15, 14, 15), Block.makeCuboidShape(14, 2, 2, 15, 14, 14), Block.makeCuboidShape(1, 2, 2, 2, 14, 14), Block.makeCuboidShape(7, 7, 15, 10, 9, 16), Block.makeCuboidShape(6, 7, 0, 9, 9, 1)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_N = Stream.of(Block.box(0, 0, 0, 1, 1, 16), Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(15, 0, 0, 16, 1, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(3, 3, 15, 13, 13, 16), Block.box(1, 14, 1, 15, 15, 15), Block.box(1, 1, 1, 15, 2, 15), Block.box(14, 2, 1, 15, 14, 15), Block.box(1, 2, 1, 2, 14, 15), Block.box(2, 2, 14, 14, 14, 15), Block.box(2, 2, 1, 14, 14, 2), Block.box(0, 7, 7, 1, 9, 10), Block.box(15, 7, 6, 16, 9, 9)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_E = Stream.of(Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 0, 1, 1, 1, 15), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 3, 3, 1, 13, 13), Block.box(1, 14, 1, 15, 15, 15), Block.box(1, 1, 1, 15, 2, 15), Block.box(1, 2, 14, 15, 14, 15), Block.box(1, 2, 1, 15, 14, 2), Block.box(1, 2, 2, 2, 14, 14), Block.box(14, 2, 2, 15, 14, 14), Block.box(6, 7, 0, 9, 9, 1), Block.box(7, 7, 15, 10, 9, 16)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_S = Stream.of(Block.box(15, 0, 0, 16, 1, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(0, 15, 0, 1, 16, 16), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 0, 0, 15, 1, 1), Block.box(1, 0, 15, 15, 1, 16), Block.box(0, 0, 0, 1, 1, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(3, 3, 0, 13, 13, 1), Block.box(1, 14, 1, 15, 15, 15), Block.box(1, 1, 1, 15, 2, 15), Block.box(1, 2, 1, 2, 14, 15), Block.box(14, 2, 1, 15, 14, 15), Block.box(2, 2, 1, 14, 14, 2), Block.box(2, 2, 14, 14, 14, 15), Block.box(15, 7, 6, 16, 9, 9), Block.box(0, 7, 7, 1, 9, 10)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_W = Stream.of(Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 0, 0, 16, 1, 1), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 3, 3, 16, 13, 13), Block.box(1, 14, 1, 15, 15, 15), Block.box(1, 1, 1, 15, 2, 15), Block.box(1, 2, 1, 15, 14, 2), Block.box(1, 2, 14, 15, 14, 15), Block.box(14, 2, 2, 15, 14, 14), Block.box(1, 2, 2, 2, 14, 14), Block.box(7, 7, 15, 10, 9, 16), Block.box(6, 7, 0, 9, 9, 1)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); } static final class OilGeneratorShapes { - static final VoxelShape SHAPE_N = Stream.of(Block.makeCuboidShape(4, 3, 1.5, 12, 4, 2), Block.makeCuboidShape(0, 15, 0, 1, 16, 16), Block.makeCuboidShape(15, 15, 0, 16, 16, 16), Block.makeCuboidShape(1, 15, 0, 15, 16, 1), Block.makeCuboidShape(1, 15, 15, 15, 16, 16), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(12, 3, 1, 13, 4, 2), Block.makeCuboidShape(3, 3, 1, 4, 4, 2), Block.makeCuboidShape(3, 7, 1, 4, 8, 2), Block.makeCuboidShape(12, 7, 1, 13, 8, 2), Block.makeCuboidShape(4, 10, 0.5, 6, 11, 1), Block.makeCuboidShape(4, 13, 0.5, 6, 14, 1), Block.makeCuboidShape(3, 11, 0.5, 4, 13, 1), Block.makeCuboidShape(6, 11, 0.5, 7, 13, 1), Block.makeCuboidShape(4, 11, 0, 6, 13, 1), Block.makeCuboidShape(5, 5, 1.5, 6, 6, 2), Block.makeCuboidShape(6, 4, 1.5, 7, 5, 2), Block.makeCuboidShape(10, 5, 1.5, 11, 6, 2), Block.makeCuboidShape(9, 6, 1.5, 10, 7, 2), Block.makeCuboidShape(4, 7, 1.5, 12, 8, 2), Block.makeCuboidShape(3, 4, 1.5, 4, 7, 2), Block.makeCuboidShape(12, 4, 1.5, 13, 7, 2), Block.makeCuboidShape(2, 0, 2, 14, 1, 14), Block.makeCuboidShape(5, 14, 6, 11, 15, 7), Block.makeCuboidShape(5, 14, 8, 11, 15, 9), Block.makeCuboidShape(5, 14, 10, 11, 15, 14), Block.makeCuboidShape(5, 14, 2, 11, 15, 5), Block.makeCuboidShape(11, 14, 2, 14, 15, 14), Block.makeCuboidShape(2, 14, 2, 5, 15, 14), Block.makeCuboidShape(1, 0, 2, 2, 15, 14), Block.makeCuboidShape(14, 0, 2, 15, 15, 14), Block.makeCuboidShape(1, 0, 14, 15, 15, 15), Block.makeCuboidShape(3, 8, 1, 13, 15, 2), Block.makeCuboidShape(3, 0, 1, 13, 3, 2), Block.makeCuboidShape(1, 0, 1, 3, 15, 2), Block.makeCuboidShape(13, 0, 1, 15, 15, 2), Block.makeCuboidShape(5, 13, 5, 11, 14, 10), Block.makeCuboidShape(2, 3, 2, 14, 8, 3), Block.makeCuboidShape(0, 0, 15, 1, 1, 16), Block.makeCuboidShape(15, 0, 15, 16, 1, 16), Block.makeCuboidShape(15, 0, 0, 16, 1, 1), Block.makeCuboidShape(0, 0, 0, 1, 1, 1)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_E = Stream.of(Block.makeCuboidShape(0, 15, 0, 16, 16, 1), Block.makeCuboidShape(0, 15, 15, 16, 16, 16), Block.makeCuboidShape(15, 15, 1, 16, 16, 15), Block.makeCuboidShape(0, 15, 1, 1, 16, 15), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(14, 3, 12, 15, 4, 13), Block.makeCuboidShape(14, 3, 3, 15, 4, 4), Block.makeCuboidShape(14, 7, 3, 15, 8, 4), Block.makeCuboidShape(14, 7, 12, 15, 8, 13), Block.makeCuboidShape(15, 10, 4, 15.5, 11, 6), Block.makeCuboidShape(15, 13, 4, 15.5, 14, 6), Block.makeCuboidShape(15, 11, 3, 15.5, 13, 4), Block.makeCuboidShape(15, 11, 6, 15.5, 13, 7), Block.makeCuboidShape(15, 11, 4, 16, 13, 6), Block.makeCuboidShape(14, 5, 5, 14.5, 6, 6), Block.makeCuboidShape(14, 4, 6, 14.5, 5, 7), Block.makeCuboidShape(14, 5, 10, 14.5, 6, 11), Block.makeCuboidShape(14, 6, 9, 14.5, 7, 10), Block.makeCuboidShape(14, 3, 4, 14.5, 4, 12), Block.makeCuboidShape(14, 7, 4, 14.5, 8, 12), Block.makeCuboidShape(14, 4, 3, 14.5, 7, 4), Block.makeCuboidShape(14, 4, 12, 14.5, 7, 13), Block.makeCuboidShape(2, 0, 2, 14, 1, 14), Block.makeCuboidShape(9, 14, 5, 10, 15, 11), Block.makeCuboidShape(7, 14, 5, 8, 15, 11), Block.makeCuboidShape(2, 14, 5, 6, 15, 11), Block.makeCuboidShape(11, 14, 5, 14, 15, 11), Block.makeCuboidShape(2, 14, 11, 14, 15, 14), Block.makeCuboidShape(2, 14, 2, 14, 15, 5), Block.makeCuboidShape(2, 0, 1, 14, 15, 2), Block.makeCuboidShape(2, 0, 14, 14, 15, 15), Block.makeCuboidShape(1, 0, 1, 2, 15, 15), Block.makeCuboidShape(14, 8, 3, 15, 15, 13), Block.makeCuboidShape(14, 0, 3, 15, 3, 13), Block.makeCuboidShape(14, 0, 1, 15, 15, 3), Block.makeCuboidShape(14, 0, 13, 15, 15, 15), Block.makeCuboidShape(6, 13, 5, 11, 14, 11), Block.makeCuboidShape(13, 3, 2, 14, 8, 14), Block.makeCuboidShape(0, 0, 0, 1, 1, 1), Block.makeCuboidShape(0, 0, 15, 1, 1, 16), Block.makeCuboidShape(15, 0, 15, 16, 1, 16), Block.makeCuboidShape(15, 0, 0, 16, 1, 1)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_S = Stream.of(Block.makeCuboidShape(15, 15, 0, 16, 16, 16), Block.makeCuboidShape(0, 15, 0, 1, 16, 16), Block.makeCuboidShape(1, 15, 15, 15, 16, 16), Block.makeCuboidShape(1, 15, 0, 15, 16, 1), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(3, 3, 14, 4, 4, 15), Block.makeCuboidShape(12, 3, 14, 13, 4, 15), Block.makeCuboidShape(12, 7, 14, 13, 8, 15), Block.makeCuboidShape(3, 7, 14, 4, 8, 15), Block.makeCuboidShape(10, 10, 15, 12, 11, 15.5), Block.makeCuboidShape(10, 13, 15, 12, 14, 15.5), Block.makeCuboidShape(12, 11, 15, 13, 13, 15.5), Block.makeCuboidShape(9, 11, 15, 10, 13, 15.5), Block.makeCuboidShape(10, 11, 15, 12, 13, 16), Block.makeCuboidShape(10, 5, 14, 11, 6, 14.5), Block.makeCuboidShape(9, 4, 14, 10, 5, 14.5), Block.makeCuboidShape(5, 5, 14, 6, 6, 14.5), Block.makeCuboidShape(6, 6, 14, 7, 7, 14.5), Block.makeCuboidShape(4, 3, 14, 12, 4, 14.5), Block.makeCuboidShape(4, 7, 14, 12, 8, 14.5), Block.makeCuboidShape(12, 4, 14, 13, 7, 14.5), Block.makeCuboidShape(3, 4, 14, 4, 7, 14.5), Block.makeCuboidShape(2, 0, 2, 14, 1, 14), Block.makeCuboidShape(5, 14, 9, 11, 15, 10), Block.makeCuboidShape(5, 14, 7, 11, 15, 8), Block.makeCuboidShape(5, 14, 2, 11, 15, 6), Block.makeCuboidShape(5, 14, 11, 11, 15, 14), Block.makeCuboidShape(2, 14, 2, 5, 15, 14), Block.makeCuboidShape(11, 14, 2, 14, 15, 14), Block.makeCuboidShape(14, 0, 2, 15, 15, 14), Block.makeCuboidShape(1, 0, 2, 2, 15, 14), Block.makeCuboidShape(1, 0, 1, 15, 15, 2), Block.makeCuboidShape(3, 8, 14, 13, 15, 15), Block.makeCuboidShape(3, 0, 14, 13, 3, 15), Block.makeCuboidShape(13, 0, 14, 15, 15, 15), Block.makeCuboidShape(1, 0, 14, 3, 15, 15), Block.makeCuboidShape(5, 13, 6, 11, 14, 11), Block.makeCuboidShape(2, 3, 13, 14, 8, 14), Block.makeCuboidShape(15, 0, 0, 16, 1, 1), Block.makeCuboidShape(0, 0, 0, 1, 1, 1), Block.makeCuboidShape(0, 0, 15, 1, 1, 16), Block.makeCuboidShape(15, 0, 15, 16, 1, 16)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_W = Stream.of(Block.makeCuboidShape(0, 15, 15, 16, 16, 16), Block.makeCuboidShape(0, 15, 0, 16, 16, 1), Block.makeCuboidShape(0, 15, 1, 1, 16, 15), Block.makeCuboidShape(15, 15, 1, 16, 16, 15), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(1, 3, 3, 2, 4, 4), Block.makeCuboidShape(1, 3, 12, 2, 4, 13), Block.makeCuboidShape(1, 7, 12, 2, 8, 13), Block.makeCuboidShape(1, 7, 3, 2, 8, 4), Block.makeCuboidShape(0.5, 10, 10, 1, 11, 12), Block.makeCuboidShape(0.5, 13, 10, 1, 14, 12), Block.makeCuboidShape(0.5, 11, 12, 1, 13, 13), Block.makeCuboidShape(0.5, 11, 9, 1, 13, 10), Block.makeCuboidShape(0, 11, 10, 1, 13, 12), Block.makeCuboidShape(1.5, 5, 10, 2, 6, 11), Block.makeCuboidShape(1.5, 4, 9, 2, 5, 10), Block.makeCuboidShape(1.5, 5, 5, 2, 6, 6), Block.makeCuboidShape(1.5, 6, 6, 2, 7, 7), Block.makeCuboidShape(1.5, 3, 4, 2, 4, 12), Block.makeCuboidShape(1.5, 7, 4, 2, 8, 12), Block.makeCuboidShape(1.5, 4, 12, 2, 7, 13), Block.makeCuboidShape(1.5, 4, 3, 2, 7, 4), Block.makeCuboidShape(2, 0, 2, 14, 1, 14), Block.makeCuboidShape(6, 14, 5, 7, 15, 11), Block.makeCuboidShape(8, 14, 5, 9, 15, 11), Block.makeCuboidShape(10, 14, 5, 14, 15, 11), Block.makeCuboidShape(2, 14, 5, 5, 15, 11), Block.makeCuboidShape(2, 14, 2, 14, 15, 5), Block.makeCuboidShape(2, 14, 11, 14, 15, 14), Block.makeCuboidShape(2, 0, 14, 14, 15, 15), Block.makeCuboidShape(2, 0, 1, 14, 15, 2), Block.makeCuboidShape(14, 0, 1, 15, 15, 15), Block.makeCuboidShape(1, 8, 3, 2, 15, 13), Block.makeCuboidShape(1, 0, 3, 2, 3, 13), Block.makeCuboidShape(1, 0, 13, 2, 15, 15), Block.makeCuboidShape(1, 0, 1, 2, 15, 3), Block.makeCuboidShape(5, 13, 5, 10, 14, 11), Block.makeCuboidShape(2, 3, 2, 3, 8, 14), Block.makeCuboidShape(15, 0, 15, 16, 1, 16), Block.makeCuboidShape(15, 0, 0, 16, 1, 1), Block.makeCuboidShape(0, 0, 0, 1, 1, 1), Block.makeCuboidShape(0, 0, 15, 1, 1, 16)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_N = Stream.of(Block.box(4, 3, 1.5, 12, 4, 2), Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(12, 3, 1, 13, 4, 2), Block.box(3, 3, 1, 4, 4, 2), Block.box(3, 7, 1, 4, 8, 2), Block.box(12, 7, 1, 13, 8, 2), Block.box(4, 10, 0.5, 6, 11, 1), Block.box(4, 13, 0.5, 6, 14, 1), Block.box(3, 11, 0.5, 4, 13, 1), Block.box(6, 11, 0.5, 7, 13, 1), Block.box(4, 11, 0, 6, 13, 1), Block.box(5, 5, 1.5, 6, 6, 2), Block.box(6, 4, 1.5, 7, 5, 2), Block.box(10, 5, 1.5, 11, 6, 2), Block.box(9, 6, 1.5, 10, 7, 2), Block.box(4, 7, 1.5, 12, 8, 2), Block.box(3, 4, 1.5, 4, 7, 2), Block.box(12, 4, 1.5, 13, 7, 2), Block.box(2, 0, 2, 14, 1, 14), Block.box(5, 14, 6, 11, 15, 7), Block.box(5, 14, 8, 11, 15, 9), Block.box(5, 14, 10, 11, 15, 14), Block.box(5, 14, 2, 11, 15, 5), Block.box(11, 14, 2, 14, 15, 14), Block.box(2, 14, 2, 5, 15, 14), Block.box(1, 0, 2, 2, 15, 14), Block.box(14, 0, 2, 15, 15, 14), Block.box(1, 0, 14, 15, 15, 15), Block.box(3, 8, 1, 13, 15, 2), Block.box(3, 0, 1, 13, 3, 2), Block.box(1, 0, 1, 3, 15, 2), Block.box(13, 0, 1, 15, 15, 2), Block.box(5, 13, 5, 11, 14, 10), Block.box(2, 3, 2, 14, 8, 3), Block.box(0, 0, 15, 1, 1, 16), Block.box(15, 0, 15, 16, 1, 16), Block.box(15, 0, 0, 16, 1, 1), Block.box(0, 0, 0, 1, 1, 1)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_E = Stream.of(Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(14, 3, 12, 15, 4, 13), Block.box(14, 3, 3, 15, 4, 4), Block.box(14, 7, 3, 15, 8, 4), Block.box(14, 7, 12, 15, 8, 13), Block.box(15, 10, 4, 15.5, 11, 6), Block.box(15, 13, 4, 15.5, 14, 6), Block.box(15, 11, 3, 15.5, 13, 4), Block.box(15, 11, 6, 15.5, 13, 7), Block.box(15, 11, 4, 16, 13, 6), Block.box(14, 5, 5, 14.5, 6, 6), Block.box(14, 4, 6, 14.5, 5, 7), Block.box(14, 5, 10, 14.5, 6, 11), Block.box(14, 6, 9, 14.5, 7, 10), Block.box(14, 3, 4, 14.5, 4, 12), Block.box(14, 7, 4, 14.5, 8, 12), Block.box(14, 4, 3, 14.5, 7, 4), Block.box(14, 4, 12, 14.5, 7, 13), Block.box(2, 0, 2, 14, 1, 14), Block.box(9, 14, 5, 10, 15, 11), Block.box(7, 14, 5, 8, 15, 11), Block.box(2, 14, 5, 6, 15, 11), Block.box(11, 14, 5, 14, 15, 11), Block.box(2, 14, 11, 14, 15, 14), Block.box(2, 14, 2, 14, 15, 5), Block.box(2, 0, 1, 14, 15, 2), Block.box(2, 0, 14, 14, 15, 15), Block.box(1, 0, 1, 2, 15, 15), Block.box(14, 8, 3, 15, 15, 13), Block.box(14, 0, 3, 15, 3, 13), Block.box(14, 0, 1, 15, 15, 3), Block.box(14, 0, 13, 15, 15, 15), Block.box(6, 13, 5, 11, 14, 11), Block.box(13, 3, 2, 14, 8, 14), Block.box(0, 0, 0, 1, 1, 1), Block.box(0, 0, 15, 1, 1, 16), Block.box(15, 0, 15, 16, 1, 16), Block.box(15, 0, 0, 16, 1, 1)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_S = Stream.of(Block.box(15, 15, 0, 16, 16, 16), Block.box(0, 15, 0, 1, 16, 16), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(3, 3, 14, 4, 4, 15), Block.box(12, 3, 14, 13, 4, 15), Block.box(12, 7, 14, 13, 8, 15), Block.box(3, 7, 14, 4, 8, 15), Block.box(10, 10, 15, 12, 11, 15.5), Block.box(10, 13, 15, 12, 14, 15.5), Block.box(12, 11, 15, 13, 13, 15.5), Block.box(9, 11, 15, 10, 13, 15.5), Block.box(10, 11, 15, 12, 13, 16), Block.box(10, 5, 14, 11, 6, 14.5), Block.box(9, 4, 14, 10, 5, 14.5), Block.box(5, 5, 14, 6, 6, 14.5), Block.box(6, 6, 14, 7, 7, 14.5), Block.box(4, 3, 14, 12, 4, 14.5), Block.box(4, 7, 14, 12, 8, 14.5), Block.box(12, 4, 14, 13, 7, 14.5), Block.box(3, 4, 14, 4, 7, 14.5), Block.box(2, 0, 2, 14, 1, 14), Block.box(5, 14, 9, 11, 15, 10), Block.box(5, 14, 7, 11, 15, 8), Block.box(5, 14, 2, 11, 15, 6), Block.box(5, 14, 11, 11, 15, 14), Block.box(2, 14, 2, 5, 15, 14), Block.box(11, 14, 2, 14, 15, 14), Block.box(14, 0, 2, 15, 15, 14), Block.box(1, 0, 2, 2, 15, 14), Block.box(1, 0, 1, 15, 15, 2), Block.box(3, 8, 14, 13, 15, 15), Block.box(3, 0, 14, 13, 3, 15), Block.box(13, 0, 14, 15, 15, 15), Block.box(1, 0, 14, 3, 15, 15), Block.box(5, 13, 6, 11, 14, 11), Block.box(2, 3, 13, 14, 8, 14), Block.box(15, 0, 0, 16, 1, 1), Block.box(0, 0, 0, 1, 1, 1), Block.box(0, 0, 15, 1, 1, 16), Block.box(15, 0, 15, 16, 1, 16)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_W = Stream.of(Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(1, 3, 3, 2, 4, 4), Block.box(1, 3, 12, 2, 4, 13), Block.box(1, 7, 12, 2, 8, 13), Block.box(1, 7, 3, 2, 8, 4), Block.box(0.5, 10, 10, 1, 11, 12), Block.box(0.5, 13, 10, 1, 14, 12), Block.box(0.5, 11, 12, 1, 13, 13), Block.box(0.5, 11, 9, 1, 13, 10), Block.box(0, 11, 10, 1, 13, 12), Block.box(1.5, 5, 10, 2, 6, 11), Block.box(1.5, 4, 9, 2, 5, 10), Block.box(1.5, 5, 5, 2, 6, 6), Block.box(1.5, 6, 6, 2, 7, 7), Block.box(1.5, 3, 4, 2, 4, 12), Block.box(1.5, 7, 4, 2, 8, 12), Block.box(1.5, 4, 12, 2, 7, 13), Block.box(1.5, 4, 3, 2, 7, 4), Block.box(2, 0, 2, 14, 1, 14), Block.box(6, 14, 5, 7, 15, 11), Block.box(8, 14, 5, 9, 15, 11), Block.box(10, 14, 5, 14, 15, 11), Block.box(2, 14, 5, 5, 15, 11), Block.box(2, 14, 2, 14, 15, 5), Block.box(2, 14, 11, 14, 15, 14), Block.box(2, 0, 14, 14, 15, 15), Block.box(2, 0, 1, 14, 15, 2), Block.box(14, 0, 1, 15, 15, 15), Block.box(1, 8, 3, 2, 15, 13), Block.box(1, 0, 3, 2, 3, 13), Block.box(1, 0, 13, 2, 15, 15), Block.box(1, 0, 1, 2, 15, 3), Block.box(5, 13, 5, 10, 14, 11), Block.box(2, 3, 2, 3, 8, 14), Block.box(15, 0, 15, 16, 1, 16), Block.box(15, 0, 0, 16, 1, 1), Block.box(0, 0, 0, 1, 1, 1), Block.box(0, 0, 15, 1, 1, 16)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); } static final class MinerShapes { - static final VoxelShape SHAPE_N = Stream.of(Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(0, 0, 0, 1, 1, 16), Block.makeCuboidShape(1, 0, 15, 15, 1, 16), Block.makeCuboidShape(15, 0, 0, 16, 1, 16), Block.makeCuboidShape(1, 0, 0, 15, 1, 1), Block.makeCuboidShape(0, 15, 0, 1, 16, 16), Block.makeCuboidShape(15, 15, 0, 16, 16, 16), Block.makeCuboidShape(1, 15, 0, 15, 16, 1), Block.makeCuboidShape(1, 15, 15, 15, 16, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(15, 3, 3, 16, 13, 13), Block.makeCuboidShape(0, 3, 3, 1, 13, 13), Block.makeCuboidShape(4, 11, 4, 12, 12, 12), Block.makeCuboidShape(11, 14, 4, 12, 15, 5), Block.makeCuboidShape(4, 14, 4, 5, 15, 5), Block.makeCuboidShape(3, 12, 5, 4, 14, 11), Block.makeCuboidShape(12, 12, 5, 13, 14, 11), Block.makeCuboidShape(5, 12, 3, 11, 14, 4), Block.makeCuboidShape(5, 12, 12, 11, 14, 13), Block.makeCuboidShape(11, 12, 11, 12, 14, 12), Block.makeCuboidShape(11, 12, 4, 12, 14, 5), Block.makeCuboidShape(4, 12, 4, 5, 14, 5), Block.makeCuboidShape(4, 12, 11, 5, 14, 12), Block.makeCuboidShape(4, 14, 11, 5, 15, 12), Block.makeCuboidShape(11, 14, 11, 12, 15, 12), Block.makeCuboidShape(2, 14, 2, 4, 15, 14), Block.makeCuboidShape(4, 14, 2, 12, 15, 4), Block.makeCuboidShape(4, 14, 12, 12, 15, 14), Block.makeCuboidShape(12, 14, 2, 14, 15, 14), Block.makeCuboidShape(2, 0, 2, 14, 1, 14), Block.makeCuboidShape(1, 0, 2, 2, 15, 14), Block.makeCuboidShape(14, 0, 2, 15, 15, 14), Block.makeCuboidShape(1, 0, 1, 15, 15, 2), Block.makeCuboidShape(1, 0, 14, 15, 15, 15)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_E = Stream.of(Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 0, 0, 16, 1, 1), Block.makeCuboidShape(0, 0, 1, 1, 1, 15), Block.makeCuboidShape(0, 0, 15, 16, 1, 16), Block.makeCuboidShape(15, 0, 1, 16, 1, 15), Block.makeCuboidShape(0, 15, 0, 16, 16, 1), Block.makeCuboidShape(0, 15, 15, 16, 16, 16), Block.makeCuboidShape(15, 15, 1, 16, 16, 15), Block.makeCuboidShape(0, 15, 1, 1, 16, 15), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(3, 3, 15, 13, 13, 16), Block.makeCuboidShape(3, 3, 0, 13, 13, 1), Block.makeCuboidShape(4, 11, 4, 12, 12, 12), Block.makeCuboidShape(11, 14, 11, 12, 15, 12), Block.makeCuboidShape(11, 14, 4, 12, 15, 5), Block.makeCuboidShape(5, 12, 3, 11, 14, 4), Block.makeCuboidShape(5, 12, 12, 11, 14, 13), Block.makeCuboidShape(12, 12, 5, 13, 14, 11), Block.makeCuboidShape(3, 12, 5, 4, 14, 11), Block.makeCuboidShape(4, 12, 11, 5, 14, 12), Block.makeCuboidShape(11, 12, 11, 12, 14, 12), Block.makeCuboidShape(11, 12, 4, 12, 14, 5), Block.makeCuboidShape(4, 12, 4, 5, 14, 5), Block.makeCuboidShape(4, 14, 4, 5, 15, 5), Block.makeCuboidShape(4, 14, 11, 5, 15, 12), Block.makeCuboidShape(2, 14, 2, 14, 15, 4), Block.makeCuboidShape(12, 14, 4, 14, 15, 12), Block.makeCuboidShape(2, 14, 4, 4, 15, 12), Block.makeCuboidShape(2, 14, 12, 14, 15, 14), Block.makeCuboidShape(2, 0, 2, 14, 1, 14), Block.makeCuboidShape(2, 0, 1, 14, 15, 2), Block.makeCuboidShape(2, 0, 14, 14, 15, 15), Block.makeCuboidShape(14, 0, 1, 15, 15, 15), Block.makeCuboidShape(1, 0, 1, 2, 15, 15)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_S = Stream.of(Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(15, 0, 0, 16, 1, 16), Block.makeCuboidShape(1, 0, 0, 15, 1, 1), Block.makeCuboidShape(0, 0, 0, 1, 1, 16), Block.makeCuboidShape(1, 0, 15, 15, 1, 16), Block.makeCuboidShape(15, 15, 0, 16, 16, 16), Block.makeCuboidShape(0, 15, 0, 1, 16, 16), Block.makeCuboidShape(1, 15, 15, 15, 16, 16), Block.makeCuboidShape(1, 15, 0, 15, 16, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(0, 3, 3, 1, 13, 13), Block.makeCuboidShape(15, 3, 3, 16, 13, 13), Block.makeCuboidShape(4, 11, 4, 12, 12, 12), Block.makeCuboidShape(4, 14, 11, 5, 15, 12), Block.makeCuboidShape(11, 14, 11, 12, 15, 12), Block.makeCuboidShape(12, 12, 5, 13, 14, 11), Block.makeCuboidShape(3, 12, 5, 4, 14, 11), Block.makeCuboidShape(5, 12, 12, 11, 14, 13), Block.makeCuboidShape(5, 12, 3, 11, 14, 4), Block.makeCuboidShape(4, 12, 4, 5, 14, 5), Block.makeCuboidShape(4, 12, 11, 5, 14, 12), Block.makeCuboidShape(11, 12, 11, 12, 14, 12), Block.makeCuboidShape(11, 12, 4, 12, 14, 5), Block.makeCuboidShape(11, 14, 4, 12, 15, 5), Block.makeCuboidShape(4, 14, 4, 5, 15, 5), Block.makeCuboidShape(12, 14, 2, 14, 15, 14), Block.makeCuboidShape(4, 14, 12, 12, 15, 14), Block.makeCuboidShape(4, 14, 2, 12, 15, 4), Block.makeCuboidShape(2, 14, 2, 4, 15, 14), Block.makeCuboidShape(2, 0, 2, 14, 1, 14), Block.makeCuboidShape(14, 0, 2, 15, 15, 14), Block.makeCuboidShape(1, 0, 2, 2, 15, 14), Block.makeCuboidShape(1, 0, 14, 15, 15, 15), Block.makeCuboidShape(1, 0, 1, 15, 15, 2)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_W = Stream.of(Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(0, 0, 15, 16, 1, 16), Block.makeCuboidShape(15, 0, 1, 16, 1, 15), Block.makeCuboidShape(0, 0, 0, 16, 1, 1), Block.makeCuboidShape(0, 0, 1, 1, 1, 15), Block.makeCuboidShape(0, 15, 15, 16, 16, 16), Block.makeCuboidShape(0, 15, 0, 16, 16, 1), Block.makeCuboidShape(0, 15, 1, 1, 16, 15), Block.makeCuboidShape(15, 15, 1, 16, 16, 15), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(3, 3, 0, 13, 13, 1), Block.makeCuboidShape(3, 3, 15, 13, 13, 16), Block.makeCuboidShape(4, 11, 4, 12, 12, 12), Block.makeCuboidShape(4, 14, 4, 5, 15, 5), Block.makeCuboidShape(4, 14, 11, 5, 15, 12), Block.makeCuboidShape(5, 12, 12, 11, 14, 13), Block.makeCuboidShape(5, 12, 3, 11, 14, 4), Block.makeCuboidShape(3, 12, 5, 4, 14, 11), Block.makeCuboidShape(12, 12, 5, 13, 14, 11), Block.makeCuboidShape(11, 12, 4, 12, 14, 5), Block.makeCuboidShape(4, 12, 4, 5, 14, 5), Block.makeCuboidShape(4, 12, 11, 5, 14, 12), Block.makeCuboidShape(11, 12, 11, 12, 14, 12), Block.makeCuboidShape(11, 14, 11, 12, 15, 12), Block.makeCuboidShape(11, 14, 4, 12, 15, 5), Block.makeCuboidShape(2, 14, 12, 14, 15, 14), Block.makeCuboidShape(2, 14, 4, 4, 15, 12), Block.makeCuboidShape(12, 14, 4, 14, 15, 12), Block.makeCuboidShape(2, 14, 2, 14, 15, 4), Block.makeCuboidShape(2, 0, 2, 14, 1, 14), Block.makeCuboidShape(2, 0, 14, 14, 15, 15), Block.makeCuboidShape(2, 0, 1, 14, 15, 2), Block.makeCuboidShape(1, 0, 1, 2, 15, 15), Block.makeCuboidShape(14, 0, 1, 15, 15, 15)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_N = Stream.of(Block.box(0, 1, 15, 1, 15, 16), Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(15, 3, 3, 16, 13, 13), Block.box(0, 3, 3, 1, 13, 13), Block.box(4, 11, 4, 12, 12, 12), Block.box(11, 14, 4, 12, 15, 5), Block.box(4, 14, 4, 5, 15, 5), Block.box(3, 12, 5, 4, 14, 11), Block.box(12, 12, 5, 13, 14, 11), Block.box(5, 12, 3, 11, 14, 4), Block.box(5, 12, 12, 11, 14, 13), Block.box(11, 12, 11, 12, 14, 12), Block.box(11, 12, 4, 12, 14, 5), Block.box(4, 12, 4, 5, 14, 5), Block.box(4, 12, 11, 5, 14, 12), Block.box(4, 14, 11, 5, 15, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(2, 14, 2, 4, 15, 14), Block.box(4, 14, 2, 12, 15, 4), Block.box(4, 14, 12, 12, 15, 14), Block.box(12, 14, 2, 14, 15, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(1, 0, 2, 2, 15, 14), Block.box(14, 0, 2, 15, 15, 14), Block.box(1, 0, 1, 15, 15, 2), Block.box(1, 0, 14, 15, 15, 15)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_E = Stream.of(Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 0, 15, 16, 1, 16), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(3, 3, 15, 13, 13, 16), Block.box(3, 3, 0, 13, 13, 1), Block.box(4, 11, 4, 12, 12, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(11, 14, 4, 12, 15, 5), Block.box(5, 12, 3, 11, 14, 4), Block.box(5, 12, 12, 11, 14, 13), Block.box(12, 12, 5, 13, 14, 11), Block.box(3, 12, 5, 4, 14, 11), Block.box(4, 12, 11, 5, 14, 12), Block.box(11, 12, 11, 12, 14, 12), Block.box(11, 12, 4, 12, 14, 5), Block.box(4, 12, 4, 5, 14, 5), Block.box(4, 14, 4, 5, 15, 5), Block.box(4, 14, 11, 5, 15, 12), Block.box(2, 14, 2, 14, 15, 4), Block.box(12, 14, 4, 14, 15, 12), Block.box(2, 14, 4, 4, 15, 12), Block.box(2, 14, 12, 14, 15, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(2, 0, 1, 14, 15, 2), Block.box(2, 0, 14, 14, 15, 15), Block.box(14, 0, 1, 15, 15, 15), Block.box(1, 0, 1, 2, 15, 15)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_S = Stream.of(Block.box(15, 1, 0, 16, 15, 1), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(0, 15, 0, 1, 16, 16), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(0, 3, 3, 1, 13, 13), Block.box(15, 3, 3, 16, 13, 13), Block.box(4, 11, 4, 12, 12, 12), Block.box(4, 14, 11, 5, 15, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(12, 12, 5, 13, 14, 11), Block.box(3, 12, 5, 4, 14, 11), Block.box(5, 12, 12, 11, 14, 13), Block.box(5, 12, 3, 11, 14, 4), Block.box(4, 12, 4, 5, 14, 5), Block.box(4, 12, 11, 5, 14, 12), Block.box(11, 12, 11, 12, 14, 12), Block.box(11, 12, 4, 12, 14, 5), Block.box(11, 14, 4, 12, 15, 5), Block.box(4, 14, 4, 5, 15, 5), Block.box(12, 14, 2, 14, 15, 14), Block.box(4, 14, 12, 12, 15, 14), Block.box(4, 14, 2, 12, 15, 4), Block.box(2, 14, 2, 4, 15, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(14, 0, 2, 15, 15, 14), Block.box(1, 0, 2, 2, 15, 14), Block.box(1, 0, 14, 15, 15, 15), Block.box(1, 0, 1, 15, 15, 2)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_W = Stream.of(Block.box(15, 1, 15, 16, 15, 16), Block.box(0, 0, 15, 16, 1, 16), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(3, 3, 0, 13, 13, 1), Block.box(3, 3, 15, 13, 13, 16), Block.box(4, 11, 4, 12, 12, 12), Block.box(4, 14, 4, 5, 15, 5), Block.box(4, 14, 11, 5, 15, 12), Block.box(5, 12, 12, 11, 14, 13), Block.box(5, 12, 3, 11, 14, 4), Block.box(3, 12, 5, 4, 14, 11), Block.box(12, 12, 5, 13, 14, 11), Block.box(11, 12, 4, 12, 14, 5), Block.box(4, 12, 4, 5, 14, 5), Block.box(4, 12, 11, 5, 14, 12), Block.box(11, 12, 11, 12, 14, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(11, 14, 4, 12, 15, 5), Block.box(2, 14, 12, 14, 15, 14), Block.box(2, 14, 4, 4, 15, 12), Block.box(12, 14, 4, 14, 15, 12), Block.box(2, 14, 2, 14, 15, 4), Block.box(2, 0, 2, 14, 1, 14), Block.box(2, 0, 14, 14, 15, 15), Block.box(2, 0, 1, 14, 15, 2), Block.box(1, 0, 1, 2, 15, 15), Block.box(14, 0, 1, 15, 15, 15)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); } static final class LeafGeneratorShapes { - static final VoxelShape SHAPE_N = Stream.of(Block.makeCuboidShape(1, 0, 14, 15, 15, 15), Block.makeCuboidShape(15, 0, 0, 16, 1, 16), Block.makeCuboidShape(1, 0, 0, 15, 1, 1), Block.makeCuboidShape(0, 0, 0, 1, 1, 16), Block.makeCuboidShape(1, 0, 15, 15, 1, 16), Block.makeCuboidShape(15, 15, 0, 16, 16, 16), Block.makeCuboidShape(0, 15, 0, 1, 16, 16), Block.makeCuboidShape(1, 15, 15, 15, 16, 16), Block.makeCuboidShape(1, 15, 0, 15, 16, 1), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(5, 11, 0, 11, 12, 1), Block.makeCuboidShape(0, 11, 5, 1, 12, 11), Block.makeCuboidShape(15, 11, 5, 16, 12, 11), Block.makeCuboidShape(5, 4, 0, 11, 5, 1), Block.makeCuboidShape(0, 4, 5, 1, 5, 11), Block.makeCuboidShape(15, 4, 5, 16, 5, 11), Block.makeCuboidShape(4, 4, 0, 5, 12, 1), Block.makeCuboidShape(0, 4, 4, 1, 12, 5), Block.makeCuboidShape(15, 4, 4, 16, 12, 5), Block.makeCuboidShape(11, 4, 0, 12, 12, 1), Block.makeCuboidShape(0, 4, 11, 1, 12, 12), Block.makeCuboidShape(15, 4, 11, 16, 12, 12), Block.makeCuboidShape(4, 13, 4, 12, 14, 12), Block.makeCuboidShape(4, 14, 11, 5, 15, 12), Block.makeCuboidShape(11, 14, 11, 12, 15, 12), Block.makeCuboidShape(11, 14, 4, 12, 15, 5), Block.makeCuboidShape(4, 14, 4, 5, 15, 5), Block.makeCuboidShape(12, 14, 2, 14, 15, 14), Block.makeCuboidShape(4, 14, 12, 12, 15, 14), Block.makeCuboidShape(4, 14, 2, 12, 15, 4), Block.makeCuboidShape(2, 14, 2, 4, 15, 14), Block.makeCuboidShape(2, 0, 2, 14, 1, 14), Block.makeCuboidShape(1, 0, 1, 15, 15, 2), Block.makeCuboidShape(1, 0, 2, 2, 5, 14), Block.makeCuboidShape(2, 1, 2, 3, 14, 14), Block.makeCuboidShape(1, 11, 2, 2, 15, 14), Block.makeCuboidShape(1, 5, 2, 2, 11, 5), Block.makeCuboidShape(1, 5, 11, 2, 11, 14), Block.makeCuboidShape(13, 1, 2, 14, 14, 14), Block.makeCuboidShape(14, 11, 2, 15, 15, 14), Block.makeCuboidShape(14, 5, 11, 15, 11, 14), Block.makeCuboidShape(14, 5, 2, 15, 11, 5), Block.makeCuboidShape(14, 0, 2, 15, 5, 14)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_E = Stream.of(Block.makeCuboidShape(1, 0, 1, 2, 15, 15), Block.makeCuboidShape(0, 0, 15, 16, 1, 16), Block.makeCuboidShape(15, 0, 1, 16, 1, 15), Block.makeCuboidShape(0, 0, 0, 16, 1, 1), Block.makeCuboidShape(0, 0, 1, 1, 1, 15), Block.makeCuboidShape(0, 15, 15, 16, 16, 16), Block.makeCuboidShape(0, 15, 0, 16, 16, 1), Block.makeCuboidShape(0, 15, 1, 1, 16, 15), Block.makeCuboidShape(15, 15, 1, 16, 16, 15), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 11, 5, 16, 12, 11), Block.makeCuboidShape(5, 11, 0, 11, 12, 1), Block.makeCuboidShape(5, 11, 15, 11, 12, 16), Block.makeCuboidShape(15, 4, 5, 16, 5, 11), Block.makeCuboidShape(5, 4, 0, 11, 5, 1), Block.makeCuboidShape(5, 4, 15, 11, 5, 16), Block.makeCuboidShape(15, 4, 4, 16, 12, 5), Block.makeCuboidShape(11, 4, 0, 12, 12, 1), Block.makeCuboidShape(11, 4, 15, 12, 12, 16), Block.makeCuboidShape(15, 4, 11, 16, 12, 12), Block.makeCuboidShape(4, 4, 0, 5, 12, 1), Block.makeCuboidShape(4, 4, 15, 5, 12, 16), Block.makeCuboidShape(4, 13, 4, 12, 14, 12), Block.makeCuboidShape(4, 14, 4, 5, 15, 5), Block.makeCuboidShape(4, 14, 11, 5, 15, 12), Block.makeCuboidShape(11, 14, 11, 12, 15, 12), Block.makeCuboidShape(11, 14, 4, 12, 15, 5), Block.makeCuboidShape(2, 14, 12, 14, 15, 14), Block.makeCuboidShape(2, 14, 4, 4, 15, 12), Block.makeCuboidShape(12, 14, 4, 14, 15, 12), Block.makeCuboidShape(2, 14, 2, 14, 15, 4), Block.makeCuboidShape(2, 0, 2, 14, 1, 14), Block.makeCuboidShape(14, 0, 1, 15, 15, 15), Block.makeCuboidShape(2, 0, 1, 14, 5, 2), Block.makeCuboidShape(2, 1, 2, 14, 14, 3), Block.makeCuboidShape(2, 11, 1, 14, 15, 2), Block.makeCuboidShape(11, 5, 1, 14, 11, 2), Block.makeCuboidShape(2, 5, 1, 5, 11, 2), Block.makeCuboidShape(2, 1, 13, 14, 14, 14), Block.makeCuboidShape(2, 11, 14, 14, 15, 15), Block.makeCuboidShape(2, 5, 14, 5, 11, 15), Block.makeCuboidShape(11, 5, 14, 14, 11, 15), Block.makeCuboidShape(2, 0, 14, 14, 5, 15)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_S = Stream.of(Block.makeCuboidShape(1, 0, 1, 15, 15, 2), Block.makeCuboidShape(0, 0, 0, 1, 1, 16), Block.makeCuboidShape(1, 0, 15, 15, 1, 16), Block.makeCuboidShape(15, 0, 0, 16, 1, 16), Block.makeCuboidShape(1, 0, 0, 15, 1, 1), Block.makeCuboidShape(0, 15, 0, 1, 16, 16), Block.makeCuboidShape(15, 15, 0, 16, 16, 16), Block.makeCuboidShape(1, 15, 0, 15, 16, 1), Block.makeCuboidShape(1, 15, 15, 15, 16, 16), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(5, 11, 15, 11, 12, 16), Block.makeCuboidShape(15, 11, 5, 16, 12, 11), Block.makeCuboidShape(0, 11, 5, 1, 12, 11), Block.makeCuboidShape(5, 4, 15, 11, 5, 16), Block.makeCuboidShape(15, 4, 5, 16, 5, 11), Block.makeCuboidShape(0, 4, 5, 1, 5, 11), Block.makeCuboidShape(11, 4, 15, 12, 12, 16), Block.makeCuboidShape(15, 4, 11, 16, 12, 12), Block.makeCuboidShape(0, 4, 11, 1, 12, 12), Block.makeCuboidShape(4, 4, 15, 5, 12, 16), Block.makeCuboidShape(15, 4, 4, 16, 12, 5), Block.makeCuboidShape(0, 4, 4, 1, 12, 5), Block.makeCuboidShape(4, 13, 4, 12, 14, 12), Block.makeCuboidShape(11, 14, 4, 12, 15, 5), Block.makeCuboidShape(4, 14, 4, 5, 15, 5), Block.makeCuboidShape(4, 14, 11, 5, 15, 12), Block.makeCuboidShape(11, 14, 11, 12, 15, 12), Block.makeCuboidShape(2, 14, 2, 4, 15, 14), Block.makeCuboidShape(4, 14, 2, 12, 15, 4), Block.makeCuboidShape(4, 14, 12, 12, 15, 14), Block.makeCuboidShape(12, 14, 2, 14, 15, 14), Block.makeCuboidShape(2, 0, 2, 14, 1, 14), Block.makeCuboidShape(1, 0, 14, 15, 15, 15), Block.makeCuboidShape(14, 0, 2, 15, 5, 14), Block.makeCuboidShape(13, 1, 2, 14, 14, 14), Block.makeCuboidShape(14, 11, 2, 15, 15, 14), Block.makeCuboidShape(14, 5, 11, 15, 11, 14), Block.makeCuboidShape(14, 5, 2, 15, 11, 5), Block.makeCuboidShape(2, 1, 2, 3, 14, 14), Block.makeCuboidShape(1, 11, 2, 2, 15, 14), Block.makeCuboidShape(1, 5, 2, 2, 11, 5), Block.makeCuboidShape(1, 5, 11, 2, 11, 14), Block.makeCuboidShape(1, 0, 2, 2, 5, 14)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_W = Stream.of(Block.makeCuboidShape(14, 0, 1, 15, 15, 15), Block.makeCuboidShape(0, 0, 0, 16, 1, 1), Block.makeCuboidShape(0, 0, 1, 1, 1, 15), Block.makeCuboidShape(0, 0, 15, 16, 1, 16), Block.makeCuboidShape(15, 0, 1, 16, 1, 15), Block.makeCuboidShape(0, 15, 0, 16, 16, 1), Block.makeCuboidShape(0, 15, 15, 16, 16, 16), Block.makeCuboidShape(15, 15, 1, 16, 16, 15), Block.makeCuboidShape(0, 15, 1, 1, 16, 15), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 11, 5, 1, 12, 11), Block.makeCuboidShape(5, 11, 15, 11, 12, 16), Block.makeCuboidShape(5, 11, 0, 11, 12, 1), Block.makeCuboidShape(0, 4, 5, 1, 5, 11), Block.makeCuboidShape(5, 4, 15, 11, 5, 16), Block.makeCuboidShape(5, 4, 0, 11, 5, 1), Block.makeCuboidShape(0, 4, 11, 1, 12, 12), Block.makeCuboidShape(4, 4, 15, 5, 12, 16), Block.makeCuboidShape(4, 4, 0, 5, 12, 1), Block.makeCuboidShape(0, 4, 4, 1, 12, 5), Block.makeCuboidShape(11, 4, 15, 12, 12, 16), Block.makeCuboidShape(11, 4, 0, 12, 12, 1), Block.makeCuboidShape(4, 13, 4, 12, 14, 12), Block.makeCuboidShape(11, 14, 11, 12, 15, 12), Block.makeCuboidShape(11, 14, 4, 12, 15, 5), Block.makeCuboidShape(4, 14, 4, 5, 15, 5), Block.makeCuboidShape(4, 14, 11, 5, 15, 12), Block.makeCuboidShape(2, 14, 2, 14, 15, 4), Block.makeCuboidShape(12, 14, 4, 14, 15, 12), Block.makeCuboidShape(2, 14, 4, 4, 15, 12), Block.makeCuboidShape(2, 14, 12, 14, 15, 14), Block.makeCuboidShape(2, 0, 2, 14, 1, 14), Block.makeCuboidShape(1, 0, 1, 2, 15, 15), Block.makeCuboidShape(2, 0, 14, 14, 5, 15), Block.makeCuboidShape(2, 1, 13, 14, 14, 14), Block.makeCuboidShape(2, 11, 14, 14, 15, 15), Block.makeCuboidShape(2, 5, 14, 5, 11, 15), Block.makeCuboidShape(11, 5, 14, 14, 11, 15), Block.makeCuboidShape(2, 1, 2, 14, 14, 3), Block.makeCuboidShape(2, 11, 1, 14, 15, 2), Block.makeCuboidShape(11, 5, 1, 14, 11, 2), Block.makeCuboidShape(2, 5, 1, 5, 11, 2), Block.makeCuboidShape(2, 0, 1, 14, 5, 2)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_N = Stream.of(Block.box(1, 0, 14, 15, 15, 15), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(0, 15, 0, 1, 16, 16), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(5, 11, 0, 11, 12, 1), Block.box(0, 11, 5, 1, 12, 11), Block.box(15, 11, 5, 16, 12, 11), Block.box(5, 4, 0, 11, 5, 1), Block.box(0, 4, 5, 1, 5, 11), Block.box(15, 4, 5, 16, 5, 11), Block.box(4, 4, 0, 5, 12, 1), Block.box(0, 4, 4, 1, 12, 5), Block.box(15, 4, 4, 16, 12, 5), Block.box(11, 4, 0, 12, 12, 1), Block.box(0, 4, 11, 1, 12, 12), Block.box(15, 4, 11, 16, 12, 12), Block.box(4, 13, 4, 12, 14, 12), Block.box(4, 14, 11, 5, 15, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(11, 14, 4, 12, 15, 5), Block.box(4, 14, 4, 5, 15, 5), Block.box(12, 14, 2, 14, 15, 14), Block.box(4, 14, 12, 12, 15, 14), Block.box(4, 14, 2, 12, 15, 4), Block.box(2, 14, 2, 4, 15, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(1, 0, 1, 15, 15, 2), Block.box(1, 0, 2, 2, 5, 14), Block.box(2, 1, 2, 3, 14, 14), Block.box(1, 11, 2, 2, 15, 14), Block.box(1, 5, 2, 2, 11, 5), Block.box(1, 5, 11, 2, 11, 14), Block.box(13, 1, 2, 14, 14, 14), Block.box(14, 11, 2, 15, 15, 14), Block.box(14, 5, 11, 15, 11, 14), Block.box(14, 5, 2, 15, 11, 5), Block.box(14, 0, 2, 15, 5, 14)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_E = Stream.of(Block.box(1, 0, 1, 2, 15, 15), Block.box(0, 0, 15, 16, 1, 16), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 11, 5, 16, 12, 11), Block.box(5, 11, 0, 11, 12, 1), Block.box(5, 11, 15, 11, 12, 16), Block.box(15, 4, 5, 16, 5, 11), Block.box(5, 4, 0, 11, 5, 1), Block.box(5, 4, 15, 11, 5, 16), Block.box(15, 4, 4, 16, 12, 5), Block.box(11, 4, 0, 12, 12, 1), Block.box(11, 4, 15, 12, 12, 16), Block.box(15, 4, 11, 16, 12, 12), Block.box(4, 4, 0, 5, 12, 1), Block.box(4, 4, 15, 5, 12, 16), Block.box(4, 13, 4, 12, 14, 12), Block.box(4, 14, 4, 5, 15, 5), Block.box(4, 14, 11, 5, 15, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(11, 14, 4, 12, 15, 5), Block.box(2, 14, 12, 14, 15, 14), Block.box(2, 14, 4, 4, 15, 12), Block.box(12, 14, 4, 14, 15, 12), Block.box(2, 14, 2, 14, 15, 4), Block.box(2, 0, 2, 14, 1, 14), Block.box(14, 0, 1, 15, 15, 15), Block.box(2, 0, 1, 14, 5, 2), Block.box(2, 1, 2, 14, 14, 3), Block.box(2, 11, 1, 14, 15, 2), Block.box(11, 5, 1, 14, 11, 2), Block.box(2, 5, 1, 5, 11, 2), Block.box(2, 1, 13, 14, 14, 14), Block.box(2, 11, 14, 14, 15, 15), Block.box(2, 5, 14, 5, 11, 15), Block.box(11, 5, 14, 14, 11, 15), Block.box(2, 0, 14, 14, 5, 15)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_S = Stream.of(Block.box(1, 0, 1, 15, 15, 2), Block.box(0, 0, 0, 1, 1, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(15, 0, 0, 16, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(5, 11, 15, 11, 12, 16), Block.box(15, 11, 5, 16, 12, 11), Block.box(0, 11, 5, 1, 12, 11), Block.box(5, 4, 15, 11, 5, 16), Block.box(15, 4, 5, 16, 5, 11), Block.box(0, 4, 5, 1, 5, 11), Block.box(11, 4, 15, 12, 12, 16), Block.box(15, 4, 11, 16, 12, 12), Block.box(0, 4, 11, 1, 12, 12), Block.box(4, 4, 15, 5, 12, 16), Block.box(15, 4, 4, 16, 12, 5), Block.box(0, 4, 4, 1, 12, 5), Block.box(4, 13, 4, 12, 14, 12), Block.box(11, 14, 4, 12, 15, 5), Block.box(4, 14, 4, 5, 15, 5), Block.box(4, 14, 11, 5, 15, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(2, 14, 2, 4, 15, 14), Block.box(4, 14, 2, 12, 15, 4), Block.box(4, 14, 12, 12, 15, 14), Block.box(12, 14, 2, 14, 15, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(1, 0, 14, 15, 15, 15), Block.box(14, 0, 2, 15, 5, 14), Block.box(13, 1, 2, 14, 14, 14), Block.box(14, 11, 2, 15, 15, 14), Block.box(14, 5, 11, 15, 11, 14), Block.box(14, 5, 2, 15, 11, 5), Block.box(2, 1, 2, 3, 14, 14), Block.box(1, 11, 2, 2, 15, 14), Block.box(1, 5, 2, 2, 11, 5), Block.box(1, 5, 11, 2, 11, 14), Block.box(1, 0, 2, 2, 5, 14)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_W = Stream.of(Block.box(14, 0, 1, 15, 15, 15), Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 0, 15, 16, 1, 16), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 11, 5, 1, 12, 11), Block.box(5, 11, 15, 11, 12, 16), Block.box(5, 11, 0, 11, 12, 1), Block.box(0, 4, 5, 1, 5, 11), Block.box(5, 4, 15, 11, 5, 16), Block.box(5, 4, 0, 11, 5, 1), Block.box(0, 4, 11, 1, 12, 12), Block.box(4, 4, 15, 5, 12, 16), Block.box(4, 4, 0, 5, 12, 1), Block.box(0, 4, 4, 1, 12, 5), Block.box(11, 4, 15, 12, 12, 16), Block.box(11, 4, 0, 12, 12, 1), Block.box(4, 13, 4, 12, 14, 12), Block.box(11, 14, 11, 12, 15, 12), Block.box(11, 14, 4, 12, 15, 5), Block.box(4, 14, 4, 5, 15, 5), Block.box(4, 14, 11, 5, 15, 12), Block.box(2, 14, 2, 14, 15, 4), Block.box(12, 14, 4, 14, 15, 12), Block.box(2, 14, 4, 4, 15, 12), Block.box(2, 14, 12, 14, 15, 14), Block.box(2, 0, 2, 14, 1, 14), Block.box(1, 0, 1, 2, 15, 15), Block.box(2, 0, 14, 14, 5, 15), Block.box(2, 1, 13, 14, 14, 14), Block.box(2, 11, 14, 14, 15, 15), Block.box(2, 5, 14, 5, 11, 15), Block.box(11, 5, 14, 14, 11, 15), Block.box(2, 1, 2, 14, 14, 3), Block.box(2, 11, 1, 14, 15, 2), Block.box(11, 5, 1, 14, 11, 2), Block.box(2, 5, 1, 5, 11, 2), Block.box(2, 0, 1, 14, 5, 2)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); } static final class LavaFactoryShapes { - static final VoxelShape SHAPE_N = Stream.of(Block.makeCuboidShape(0, 0, 0, 1, 1, 16), Block.makeCuboidShape(0, 15, 0, 1, 16, 16), Block.makeCuboidShape(15, 15, 0, 16, 16, 16), Block.makeCuboidShape(1, 15, 0, 15, 16, 1), Block.makeCuboidShape(1, 15, 15, 15, 16, 16), Block.makeCuboidShape(1, 0, 15, 15, 1, 16), Block.makeCuboidShape(1, 0, 0, 15, 1, 1), Block.makeCuboidShape(15, 0, 0, 16, 1, 16), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(12, 15, 5, 13, 16, 11), Block.makeCuboidShape(3, 15, 5, 4, 16, 11), Block.makeCuboidShape(11, 14, 11, 12, 16, 12), Block.makeCuboidShape(11, 14, 4, 12, 16, 5), Block.makeCuboidShape(4, 14, 11, 5, 16, 12), Block.makeCuboidShape(4, 14, 4, 5, 16, 5), Block.makeCuboidShape(4, 13, 4, 12, 14, 12), Block.makeCuboidShape(4, 14, 12, 12, 15, 15), Block.makeCuboidShape(4, 14, 1, 12, 15, 4), Block.makeCuboidShape(1, 14, 1, 4, 15, 15), Block.makeCuboidShape(12, 14, 1, 15, 15, 15), Block.makeCuboidShape(1, 1, 1, 15, 2, 15), Block.makeCuboidShape(14, 2, 1, 15, 14, 15), Block.makeCuboidShape(1, 2, 1, 2, 14, 15), Block.makeCuboidShape(2, 2, 14, 14, 14, 15), Block.makeCuboidShape(2, 2, 1, 14, 14, 2), Block.makeCuboidShape(5, 15, 3, 11, 16, 4), Block.makeCuboidShape(5, 15, 12, 11, 16, 13)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_E = Stream.of(Block.makeCuboidShape(0, 0, 0, 16, 1, 1), Block.makeCuboidShape(0, 15, 0, 16, 16, 1), Block.makeCuboidShape(0, 15, 15, 16, 16, 16), Block.makeCuboidShape(15, 15, 1, 16, 16, 15), Block.makeCuboidShape(0, 15, 1, 1, 16, 15), Block.makeCuboidShape(0, 0, 1, 1, 1, 15), Block.makeCuboidShape(15, 0, 1, 16, 1, 15), Block.makeCuboidShape(0, 0, 15, 16, 1, 16), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(5, 15, 12, 11, 16, 13), Block.makeCuboidShape(5, 15, 3, 11, 16, 4), Block.makeCuboidShape(4, 14, 11, 5, 16, 12), Block.makeCuboidShape(11, 14, 11, 12, 16, 12), Block.makeCuboidShape(4, 14, 4, 5, 16, 5), Block.makeCuboidShape(11, 14, 4, 12, 16, 5), Block.makeCuboidShape(4, 13, 4, 12, 14, 12), Block.makeCuboidShape(1, 14, 4, 4, 15, 12), Block.makeCuboidShape(12, 14, 4, 15, 15, 12), Block.makeCuboidShape(1, 14, 1, 15, 15, 4), Block.makeCuboidShape(1, 14, 12, 15, 15, 15), Block.makeCuboidShape(1, 1, 1, 15, 2, 15), Block.makeCuboidShape(1, 2, 14, 15, 14, 15), Block.makeCuboidShape(1, 2, 1, 15, 14, 2), Block.makeCuboidShape(1, 2, 2, 2, 14, 14), Block.makeCuboidShape(14, 2, 2, 15, 14, 14), Block.makeCuboidShape(12, 15, 5, 13, 16, 11), Block.makeCuboidShape(3, 15, 5, 4, 16, 11)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_S = Stream.of(Block.makeCuboidShape(15, 0, 0, 16, 1, 16), Block.makeCuboidShape(15, 15, 0, 16, 16, 16), Block.makeCuboidShape(0, 15, 0, 1, 16, 16), Block.makeCuboidShape(1, 15, 15, 15, 16, 16), Block.makeCuboidShape(1, 15, 0, 15, 16, 1), Block.makeCuboidShape(1, 0, 0, 15, 1, 1), Block.makeCuboidShape(1, 0, 15, 15, 1, 16), Block.makeCuboidShape(0, 0, 0, 1, 1, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(3, 15, 5, 4, 16, 11), Block.makeCuboidShape(12, 15, 5, 13, 16, 11), Block.makeCuboidShape(4, 14, 4, 5, 16, 5), Block.makeCuboidShape(4, 14, 11, 5, 16, 12), Block.makeCuboidShape(11, 14, 4, 12, 16, 5), Block.makeCuboidShape(11, 14, 11, 12, 16, 12), Block.makeCuboidShape(4, 13, 4, 12, 14, 12), Block.makeCuboidShape(4, 14, 1, 12, 15, 4), Block.makeCuboidShape(4, 14, 12, 12, 15, 15), Block.makeCuboidShape(12, 14, 1, 15, 15, 15), Block.makeCuboidShape(1, 14, 1, 4, 15, 15), Block.makeCuboidShape(1, 1, 1, 15, 2, 15), Block.makeCuboidShape(1, 2, 1, 2, 14, 15), Block.makeCuboidShape(14, 2, 1, 15, 14, 15), Block.makeCuboidShape(2, 2, 1, 14, 14, 2), Block.makeCuboidShape(2, 2, 14, 14, 14, 15), Block.makeCuboidShape(5, 15, 12, 11, 16, 13), Block.makeCuboidShape(5, 15, 3, 11, 16, 4)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); - static final VoxelShape SHAPE_W = Stream.of(Block.makeCuboidShape(0, 0, 15, 16, 1, 16), Block.makeCuboidShape(0, 15, 15, 16, 16, 16), Block.makeCuboidShape(0, 15, 0, 16, 16, 1), Block.makeCuboidShape(0, 15, 1, 1, 16, 15), Block.makeCuboidShape(15, 15, 1, 16, 16, 15), Block.makeCuboidShape(15, 0, 1, 16, 1, 15), Block.makeCuboidShape(0, 0, 1, 1, 1, 15), Block.makeCuboidShape(0, 0, 0, 16, 1, 1), Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(5, 15, 3, 11, 16, 4), Block.makeCuboidShape(5, 15, 12, 11, 16, 13), Block.makeCuboidShape(11, 14, 4, 12, 16, 5), Block.makeCuboidShape(4, 14, 4, 5, 16, 5), Block.makeCuboidShape(11, 14, 11, 12, 16, 12), Block.makeCuboidShape(4, 14, 11, 5, 16, 12), Block.makeCuboidShape(4, 13, 4, 12, 14, 12), Block.makeCuboidShape(12, 14, 4, 15, 15, 12), Block.makeCuboidShape(1, 14, 4, 4, 15, 12), Block.makeCuboidShape(1, 14, 12, 15, 15, 15), Block.makeCuboidShape(1, 14, 1, 15, 15, 4), Block.makeCuboidShape(1, 1, 1, 15, 2, 15), Block.makeCuboidShape(1, 2, 1, 15, 14, 2), Block.makeCuboidShape(1, 2, 14, 15, 14, 15), Block.makeCuboidShape(14, 2, 2, 15, 14, 14), Block.makeCuboidShape(1, 2, 2, 2, 14, 14), Block.makeCuboidShape(3, 15, 5, 4, 16, 11), Block.makeCuboidShape(12, 15, 5, 13, 16, 11)).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_N = Stream.of(Block.box(0, 0, 0, 1, 1, 16), Block.box(0, 15, 0, 1, 16, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 0, 15, 15, 1, 16), Block.box(1, 0, 0, 15, 1, 1), Block.box(15, 0, 0, 16, 1, 16), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(12, 15, 5, 13, 16, 11), Block.box(3, 15, 5, 4, 16, 11), Block.box(11, 14, 11, 12, 16, 12), Block.box(11, 14, 4, 12, 16, 5), Block.box(4, 14, 11, 5, 16, 12), Block.box(4, 14, 4, 5, 16, 5), Block.box(4, 13, 4, 12, 14, 12), Block.box(4, 14, 12, 12, 15, 15), Block.box(4, 14, 1, 12, 15, 4), Block.box(1, 14, 1, 4, 15, 15), Block.box(12, 14, 1, 15, 15, 15), Block.box(1, 1, 1, 15, 2, 15), Block.box(14, 2, 1, 15, 14, 15), Block.box(1, 2, 1, 2, 14, 15), Block.box(2, 2, 14, 14, 14, 15), Block.box(2, 2, 1, 14, 14, 2), Block.box(5, 15, 3, 11, 16, 4), Block.box(5, 15, 12, 11, 16, 13)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_E = Stream.of(Block.box(0, 0, 0, 16, 1, 1), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 15, 16, 16, 16), Block.box(15, 15, 1, 16, 16, 15), Block.box(0, 15, 1, 1, 16, 15), Block.box(0, 0, 1, 1, 1, 15), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(5, 15, 12, 11, 16, 13), Block.box(5, 15, 3, 11, 16, 4), Block.box(4, 14, 11, 5, 16, 12), Block.box(11, 14, 11, 12, 16, 12), Block.box(4, 14, 4, 5, 16, 5), Block.box(11, 14, 4, 12, 16, 5), Block.box(4, 13, 4, 12, 14, 12), Block.box(1, 14, 4, 4, 15, 12), Block.box(12, 14, 4, 15, 15, 12), Block.box(1, 14, 1, 15, 15, 4), Block.box(1, 14, 12, 15, 15, 15), Block.box(1, 1, 1, 15, 2, 15), Block.box(1, 2, 14, 15, 14, 15), Block.box(1, 2, 1, 15, 14, 2), Block.box(1, 2, 2, 2, 14, 14), Block.box(14, 2, 2, 15, 14, 14), Block.box(12, 15, 5, 13, 16, 11), Block.box(3, 15, 5, 4, 16, 11)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_S = Stream.of(Block.box(15, 0, 0, 16, 1, 16), Block.box(15, 15, 0, 16, 16, 16), Block.box(0, 15, 0, 1, 16, 16), Block.box(1, 15, 15, 15, 16, 16), Block.box(1, 15, 0, 15, 16, 1), Block.box(1, 0, 0, 15, 1, 1), Block.box(1, 0, 15, 15, 1, 16), Block.box(0, 0, 0, 1, 1, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(15, 1, 15, 16, 15, 16), Block.box(3, 15, 5, 4, 16, 11), Block.box(12, 15, 5, 13, 16, 11), Block.box(4, 14, 4, 5, 16, 5), Block.box(4, 14, 11, 5, 16, 12), Block.box(11, 14, 4, 12, 16, 5), Block.box(11, 14, 11, 12, 16, 12), Block.box(4, 13, 4, 12, 14, 12), Block.box(4, 14, 1, 12, 15, 4), Block.box(4, 14, 12, 12, 15, 15), Block.box(12, 14, 1, 15, 15, 15), Block.box(1, 14, 1, 4, 15, 15), Block.box(1, 1, 1, 15, 2, 15), Block.box(1, 2, 1, 2, 14, 15), Block.box(14, 2, 1, 15, 14, 15), Block.box(2, 2, 1, 14, 14, 2), Block.box(2, 2, 14, 14, 14, 15), Block.box(5, 15, 12, 11, 16, 13), Block.box(5, 15, 3, 11, 16, 4)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); + static final VoxelShape SHAPE_W = Stream.of(Block.box(0, 0, 15, 16, 1, 16), Block.box(0, 15, 15, 16, 16, 16), Block.box(0, 15, 0, 16, 16, 1), Block.box(0, 15, 1, 1, 16, 15), Block.box(15, 15, 1, 16, 16, 15), Block.box(15, 0, 1, 16, 1, 15), Block.box(0, 0, 1, 1, 1, 15), Block.box(0, 0, 0, 16, 1, 1), Block.box(15, 1, 15, 16, 15, 16), Block.box(15, 1, 0, 16, 15, 1), Block.box(0, 1, 0, 1, 15, 1), Block.box(0, 1, 15, 1, 15, 16), Block.box(5, 15, 3, 11, 16, 4), Block.box(5, 15, 12, 11, 16, 13), Block.box(11, 14, 4, 12, 16, 5), Block.box(4, 14, 4, 5, 16, 5), Block.box(11, 14, 11, 12, 16, 12), Block.box(4, 14, 11, 5, 16, 12), Block.box(4, 13, 4, 12, 14, 12), Block.box(12, 14, 4, 15, 15, 12), Block.box(1, 14, 4, 4, 15, 12), Block.box(1, 14, 12, 15, 15, 15), Block.box(1, 14, 1, 15, 15, 4), Block.box(1, 1, 1, 15, 2, 15), Block.box(1, 2, 1, 15, 14, 2), Block.box(1, 2, 14, 15, 14, 15), Block.box(14, 2, 2, 15, 14, 14), Block.box(1, 2, 2, 2, 14, 14), Block.box(3, 15, 5, 4, 16, 11), Block.box(12, 15, 5, 13, 16, 11)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get(); } public static final VoxelShape FEEDER_SHAPE = ShapeBuilder.get() @@ -138,7 +138,7 @@ public class Shapes { Stream.Builder shapes = Stream.builder(); public ShapeBuilder add(double x1, double y1, double z1, double x2, double y2, double z2) { - this.shapes.add(Block.makeCuboidShape(x1, y1, z1, x2, y2, z2)); + this.shapes.add(Block.box(x1, y1, z1, x2, y2, z2)); return this; } @@ -147,7 +147,7 @@ public class Shapes { } public Optional standardReduceBuild() { - return this.shapes.build().reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)); + return this.shapes.build().reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)); } public static ShapeBuilder get() { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBase.java index 19887840a..372573806 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBase.java @@ -14,13 +14,15 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import net.minecraft.block.Block; import net.minecraft.item.Item; +import net.minecraft.block.AbstractBlock.Properties; + public class BlockBase extends Block { public BlockBase(Properties properties) { super(properties); } protected ItemBlockBase getItemBlock() { - return new ItemBlockBase(this, new Item.Properties().group(ActuallyAdditions.GROUP)); + return new ItemBlockBase(this, new Item.Properties().tab(ActuallyAdditions.GROUP)); } public boolean shouldAddCreative() { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBushBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBushBase.java index 2d13af2a0..709f9dcba 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBushBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBushBase.java @@ -13,8 +13,10 @@ package de.ellpeck.actuallyadditions.mod.blocks.base; import net.minecraft.block.BushBlock; import net.minecraft.block.SoundType; +import net.minecraft.block.AbstractBlock.Properties; + public class BlockBushBase extends BushBlock { public BlockBushBase(Properties properties) { - super(properties.sound(SoundType.PLANT)); + super(properties.sound(SoundType.GRASS)); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java index 2ecf36fa8..255074253 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java @@ -42,14 +42,16 @@ import net.minecraftforge.fml.network.NetworkHooks; import javax.annotation.Nullable; import java.util.Random; +import net.minecraft.block.AbstractBlock.Properties; + public abstract class BlockContainerBase extends ContainerBlock { public BlockContainerBase(Properties properties) { super(properties); } public ActionResultType openGui(World world, PlayerEntity player, BlockPos pos, Class expectedInstance) { - if (!world.isRemote) { - TileEntity tile = world.getTileEntity(pos); + if (!world.isClientSide) { + TileEntity tile = world.getBlockEntity(pos); if (tile != null && tile.getClass().isInstance(expectedInstance)) { NetworkHooks.openGui((ServerPlayerEntity) player, (INamedContainerProvider) tile, pos); } @@ -60,8 +62,8 @@ public abstract class BlockContainerBase extends ContainerBlock { } private void dropInventory(World world, BlockPos position) { - if (!world.isRemote) { - TileEntity aTile = world.getTileEntity(position); + if (!world.isClientSide) { + TileEntity aTile = world.getBlockEntity(position); if (aTile instanceof TileEntityInventoryBase) { TileEntityInventoryBase tile = (TileEntityInventoryBase) aTile; if (tile.inv.getSlots() > 0) { @@ -79,24 +81,24 @@ public abstract class BlockContainerBase extends ContainerBlock { return; } - float dX = world.rand.nextFloat() * 0.8F + 0.1F; - float dY = world.rand.nextFloat() * 0.8F + 0.1F; - float dZ = world.rand.nextFloat() * 0.8F + 0.1F; + float dX = world.random.nextFloat() * 0.8F + 0.1F; + float dY = world.random.nextFloat() * 0.8F + 0.1F; + float dZ = world.random.nextFloat() * 0.8F + 0.1F; ItemEntity entityItem = new ItemEntity(world, pos.getX() + dX, pos.getY() + dY, pos.getZ() + dZ, stack.copy()); float factor = 0.05F; - entityItem.addVelocity(world.rand.nextGaussian() * factor, world.rand.nextGaussian() * factor + 0.2F, world.rand.nextGaussian() * factor); - world.addEntity(entityItem); + entityItem.push(world.random.nextGaussian() * factor, world.random.nextGaussian() * factor + 0.2F, world.random.nextGaussian() * factor); + world.addFreshEntity(entityItem); } public boolean tryToggleRedstone(World world, BlockPos pos, PlayerEntity player) { - ItemStack stack = player.getHeldItemMainhand(); + ItemStack stack = player.getMainHandItem(); if (StackUtil.isValid(stack) && stack.getItem() == ConfigValues.itemRedstoneTorchConfigurator) { - TileEntity tile = world.getTileEntity(pos); + TileEntity tile = world.getBlockEntity(pos); if (tile instanceof TileEntityBase) { TileEntityBase base = (TileEntityBase) tile; - if (!world.isRemote && base.isRedstoneToggle()) { + if (!world.isClientSide && base.isRedstoneToggle()) { base.isPulseMode = !base.isPulseMode; - base.markDirty(); + base.setChanged(); base.sendUpdate(); } return true; @@ -107,8 +109,8 @@ public abstract class BlockContainerBase extends ContainerBlock { @Override public void tick(BlockState state, ServerWorld world, BlockPos pos, Random rand) { - if (!world.isRemote) { - TileEntity tile = world.getTileEntity(pos); + if (!world.isClientSide) { + TileEntity tile = world.getBlockEntity(pos); if (tile instanceof TileEntityBase) { TileEntityBase base = (TileEntityBase) tile; if (base.respondsToPulses()) { @@ -121,7 +123,7 @@ public abstract class BlockContainerBase extends ContainerBlock { public void neighborsChangedCustom(World world, BlockPos pos) { this.updateRedstoneState(world, pos); - TileEntity tile = world.getTileEntity(pos); + TileEntity tile = world.getBlockEntity(pos); if (tile instanceof TileEntityBase) { TileEntityBase base = (TileEntityBase) tile; if (base.shouldSaveDataOnChangeOrWorldStart()) { @@ -144,11 +146,11 @@ public abstract class BlockContainerBase extends ContainerBlock { } public void updateRedstoneState(World world, BlockPos pos) { - if (!world.isRemote) { - TileEntity tile = world.getTileEntity(pos); + if (!world.isClientSide) { + TileEntity tile = world.getBlockEntity(pos); if (tile instanceof TileEntityBase) { TileEntityBase base = (TileEntityBase) tile; - boolean powered = world.getRedstonePowerFromNeighbors(pos) > 0; + boolean powered = world.getBestNeighborSignal(pos) > 0; boolean wasPowered = base.isRedstonePowered; if (powered && !wasPowered) { if (base.respondsToPulses()) { @@ -164,20 +166,20 @@ public abstract class BlockContainerBase extends ContainerBlock { } protected boolean tryUseItemOnTank(PlayerEntity player, Hand hand, FluidTank tank) { - ItemStack heldItem = player.getHeldItem(hand); + ItemStack heldItem = player.getItemInHand(hand); return StackUtil.isValid(heldItem) && FluidUtil.interactWithFluidHandler(player, hand, tank); } @Override - public void onBlockAdded(BlockState state, World worldIn, BlockPos pos, BlockState oldState, boolean isMoving) { + public void onPlace(BlockState state, World worldIn, BlockPos pos, BlockState oldState, boolean isMoving) { this.updateRedstoneState(worldIn, pos); } @Override - public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) { + public void setPlacedBy(World world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) { if (stack.hasTag()) { - TileEntity tile = world.getTileEntity(pos); + TileEntity tile = world.getBlockEntity(pos); if (tile instanceof TileEntityBase) { TileEntityBase base = (TileEntityBase) tile; CompoundNBT compound = stack.getOrCreateTag().getCompound("Data"); @@ -187,23 +189,23 @@ public abstract class BlockContainerBase extends ContainerBlock { } @Override - public void onBlockHarvested(World world, BlockPos pos, BlockState state, PlayerEntity player) { + public void playerWillDestroy(World world, BlockPos pos, BlockState state, PlayerEntity player) { if (!player.isCreative()) { - TileEntity tile = world.getTileEntity(pos); + TileEntity tile = world.getBlockEntity(pos); if (tile instanceof TileEntityBase && ((TileEntityBase) tile).stopFromDropping) { - player.sendStatusMessage(new TranslationTextComponent("info." + ActuallyAdditions.MODID + ".machineBroke").mergeStyle(TextFormatting.RED), false); + player.displayClientMessage(new TranslationTextComponent("info." + ActuallyAdditions.MODID + ".machineBroke").withStyle(TextFormatting.RED), false); } } } @Override - public boolean hasComparatorInputOverride(BlockState state) { + public boolean hasAnalogOutputSignal(BlockState state) { return true; } @Override - public int getComparatorInputOverride(BlockState state, World world, BlockPos pos) { - TileEntity tile = world.getTileEntity(pos); + public int getAnalogOutputSignal(BlockState state, World world, BlockPos pos) { + TileEntity tile = world.getBlockEntity(pos); if (tile instanceof TileEntityBase) { return ((TileEntityBase) tile).getComparatorStrength(); } @@ -265,13 +267,13 @@ public abstract class BlockContainerBase extends ContainerBlock { @Override - public void onReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean isMoving) { + public void onRemove(BlockState state, World world, BlockPos pos, BlockState newState, boolean isMoving) { if (state != newState) { if (this.shouldDropInventory(world, pos)) { this.dropInventory(world, pos); } } - super.onReplaced(state, world, pos, newState, isMoving); + super.onRemove(state, world, pos, newState, isMoving); } public boolean shouldDropInventory(World world, BlockPos pos) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockPlant.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockPlant.java index 9f76f1b07..0db570bc4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockPlant.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockPlant.java @@ -33,13 +33,15 @@ import net.minecraftforge.items.ItemHandlerHelper; import java.util.List; // CROP BLOCK DEFAULTS TO 7 YEARS OF AGE. +import net.minecraft.block.AbstractBlock.Properties; + public class BlockPlant extends CropsBlock { public Item seedItem; // Stolen from potato for now // PotatoBlock(AbstractBlock.Properties.create(Material.PLANTS).doesNotBlockMovement().tickRandomly().zeroHardnessAndResistance().sound(SoundType.CROP))); public BlockPlant(Item seedItem) { - super(Properties.create(Material.PLANTS).doesNotBlockMovement().tickRandomly().zeroHardnessAndResistance().sound(SoundType.CROP)); + super(Properties.of(Material.PLANT).noCollission().randomTicks().instabreak().sound(SoundType.CROP)); this.seedItem = seedItem; } @@ -65,12 +67,12 @@ public class BlockPlant extends CropsBlock { @Override - public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { + public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { if (this.getAge(state) < 7) { return ActionResultType.PASS; } - if (!world.isRemote) { + if (!world.isClientSide) { List drops = Block.getDrops(state, (ServerWorld) world, pos, null); boolean deductedSeedSize = false; for (ItemStack drop : drops) { @@ -85,14 +87,14 @@ public class BlockPlant extends CropsBlock { } } - world.setBlockState(pos, this.getDefaultState().with(AGE, 0)); + world.setBlockAndUpdate(pos, this.defaultBlockState().setValue(AGE, 0)); } - return super.onBlockActivated(state, world, pos, player, handIn, hit); + return super.use(state, world, pos, player, handIn, hit); } @Override - protected IItemProvider getSeedsItem() { + protected IItemProvider getBaseSeedId() { return this.seedItem; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/DirectionalBlock.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/DirectionalBlock.java index 3952b8109..4832ad49b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/DirectionalBlock.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/DirectionalBlock.java @@ -8,6 +8,8 @@ import net.minecraft.state.StateContainer; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.Direction; +import net.minecraft.block.AbstractBlock.Properties; + /** * Wrapper for Directional block states extending from our base blocks. It's not super nice but it'll do. */ @@ -34,16 +36,16 @@ public abstract class DirectionalBlock extends BlockBase { public Container(Properties properties) { super(properties); - this.setDefaultState(this.stateContainer.getBaseState().with(FACING, Direction.NORTH)); + this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH)); } @Override public BlockState getStateForPlacement(BlockItemUseContext context) { - return this.getDefaultState().with(FACING, context.getNearestLookingDirection().getOpposite()); + return this.defaultBlockState().setValue(FACING, context.getNearestLookingDirection().getOpposite()); } @Override - protected void fillStateContainer(StateContainer.Builder builder) { + protected void createBlockStateDefinition(StateContainer.Builder builder) { builder.add(FACING); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/FullyDirectionalBlock.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/FullyDirectionalBlock.java index 9cd34f472..d0f2aea06 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/FullyDirectionalBlock.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/FullyDirectionalBlock.java @@ -8,6 +8,8 @@ import net.minecraft.state.StateContainer; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.Direction; +import net.minecraft.block.AbstractBlock.Properties; + /** * Wrapper for Fully Direction block states extending from our base blocks. It's not super nice but it'll do. */ @@ -16,17 +18,17 @@ public abstract class FullyDirectionalBlock extends BlockBase { public FullyDirectionalBlock(Properties properties) { super(properties); - this.setDefaultState(this.stateContainer.getBaseState().with(FACING, Direction.NORTH)); + this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH)); } @Override public BlockState getStateForPlacement(BlockItemUseContext context) { - return this.getDefaultState().with(FACING, context.getNearestLookingDirection().getOpposite()); + return this.defaultBlockState().setValue(FACING, context.getNearestLookingDirection().getOpposite()); } @Override - protected void fillStateContainer(StateContainer.Builder builder) { + protected void createBlockStateDefinition(StateContainer.Builder builder) { builder.add(FACING); } @@ -36,16 +38,16 @@ public abstract class FullyDirectionalBlock extends BlockBase { public Container(Properties properties) { super(properties); - this.setDefaultState(this.stateContainer.getBaseState().with(FACING, Direction.NORTH)); + this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH)); } @Override public BlockState getStateForPlacement(BlockItemUseContext context) { - return this.getDefaultState().with(FACING, context.getNearestLookingDirection().getOpposite()); + return this.defaultBlockState().setValue(FACING, context.getNearestLookingDirection().getOpposite()); } @Override - protected void fillStateContainer(StateContainer.Builder builder) { + protected void createBlockStateDefinition(StateContainer.Builder builder) { builder.add(FACING); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheColoredLampColors.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheColoredLampColors.java index 0068bbbc6..ac61cba61 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheColoredLampColors.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheColoredLampColors.java @@ -56,7 +56,7 @@ public enum TheColoredLampColors implements IStringSerializable { } @Override - public String getString() { + public String getSerializedName() { return this.regName; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheMiscBlocks.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheMiscBlocks.java index 7a08eb94a..e659d669c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheMiscBlocks.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheMiscBlocks.java @@ -36,7 +36,7 @@ public enum TheMiscBlocks implements IStringSerializable { } @Override - public String getString() { + public String getSerializedName() { return this.name; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheWildPlants.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheWildPlants.java index 1393c65b1..3342a37ec 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheWildPlants.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheWildPlants.java @@ -35,7 +35,7 @@ public enum TheWildPlants implements IStringSerializable { } @Override - public String getString() { + public String getSerializedName() { return this.name; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderBatteryBox.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderBatteryBox.java index d6e9a7d95..1062c3900 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderBatteryBox.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderBatteryBox.java @@ -43,26 +43,26 @@ public class RenderBatteryBox extends TileEntityRenderer { return; } - matrices.push(); + matrices.pushPose(); matrices.translate(.5f, .35f, .5f); - matrices.rotate(Vector3f.ZP.rotationDegrees(180)); + matrices.mulPose(Vector3f.ZP.rotationDegrees(180)); - matrices.push(); + matrices.pushPose(); matrices.scale(0.0075F, 0.0075F, 0.0075F); matrices.translate(0F, 0F, -60F); stack.getCapability(CapabilityEnergy.ENERGY).ifPresent(cap -> { - FontRenderer font = Minecraft.getInstance().fontRenderer; + FontRenderer font = Minecraft.getInstance().font; String energyTotal = Lang.cleanEnergyValues(cap, false); String energyName = Lang.transI18n("misc", "power_name_long"); for (int i = 0; i < 4; i++) { - font.drawString(matrices, energyTotal, -font.getStringWidth(energyTotal) / 2F, 10F, 0xFFFFFF); - font.drawString(matrices, energyName, -font.getStringWidth(energyName) / 2F, 20F, 0xFFFFFF); + font.draw(matrices, energyTotal, -font.width(energyTotal) / 2F, 10F, 0xFFFFFF); + font.draw(matrices, energyName, -font.width(energyName) / 2F, 20F, 0xFFFFFF); matrices.translate(-60F, 0F, 60F); - matrices.rotate(Vector3f.YP.rotationDegrees(90)); + matrices.mulPose(Vector3f.YP.rotationDegrees(90)); } // TODO: Remove if the above works // NumberFormat format = NumberFormat.getInstance(); @@ -82,27 +82,27 @@ public class RenderBatteryBox extends TileEntityRenderer { // } }); - matrices.pop(); // text rotation - matrices.pop(); // rotation + centering + matrices.popPose(); // text rotation + matrices.popPose(); // rotation + centering - double boop = Util.milliTime() / 800D; + double boop = Util.getMillis() / 800D; float scale = stack.getItem() instanceof BlockItem ? 0.85F : 0.65F; - matrices.push(); + matrices.pushPose(); matrices.translate(.5f, 1f + Math.sin(boop % (2 * Math.PI)) * 0.065, .5f); - matrices.rotate(Vector3f.YP.rotationDegrees((float) (boop * 40D % 360))); + matrices.mulPose(Vector3f.YP.rotationDegrees((float) (boop * 40D % 360))); matrices.scale(scale, scale, scale); try { - Minecraft.getInstance().getItemRenderer().renderItem( + Minecraft.getInstance().getItemRenderer().renderStatic( stack, ItemCameraTransforms.TransformType.FIXED, combinedLight, combinedOverlay, matrices, buffer ); } catch (Exception e) { ActuallyAdditions.LOGGER.error("Something went wrong trying to render an item in a battery box! The item is " + stack.getItem().getRegistryName() + "!", e); } - matrices.pop(); + matrices.popPose(); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderDisplayStand.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderDisplayStand.java index 06b3e2572..153f4d8fc 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderDisplayStand.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderDisplayStand.java @@ -35,12 +35,12 @@ public class RenderDisplayStand extends TileEntityRenderer { ItemStack stack = tile.inv.getStackInSlot(0); if (StackUtil.isValid(stack)) { // TODO: [port][refactor] migrate this logic into a single method, most renders use it - matrices.push(); + matrices.pushPose(); matrices.translate(0.5F, 1F, 0.5F); - double boop = Util.milliTime() / 800D; + double boop = Util.getMillis() / 800D; matrices.translate(0D, Math.sin(boop % (2 * Math.PI)) * 0.065, 0D); - matrices.rotate(new Quaternion((float) (boop * 40D % 360), 0, 1, 0)); // TODO: [port] might not work + matrices.mulPose(new Quaternion((float) (boop * 40D % 360), 0, 1, 0)); // TODO: [port] might not work float scale = stack.getItem() instanceof BlockItem ? 0.85F @@ -54,7 +54,7 @@ public class RenderEmpowerer extends TileEntityRenderer { ActuallyAdditions.LOGGER.error("Something went wrong trying to render an item in an empowerer! The item is " + stack.getItem().getRegistryName() + "!", e); } - matrices.pop(); + matrices.popPose(); } int index = tile.recipeForRenderIndex; @@ -62,10 +62,10 @@ public class RenderEmpowerer extends TileEntityRenderer { EmpowererRecipe recipe = ActuallyAdditionsAPI.EMPOWERER_RECIPES.get(index); if (recipe != null) { for (int i = 0; i < 3; i++) { - Direction facing = Direction.byHorizontalIndex(i); // TODO: [port][test] validate this works - BlockPos offset = tile.getPos().offset(facing, 3); + Direction facing = Direction.from2DDataValue(i); // TODO: [port][test] validate this works + BlockPos offset = tile.getBlockPos().relative(facing, 3); - AssetUtil.renderLaser(tile.getPos().getX() + 0.5, tile.getPos().getY() + 0.5, tile.getPos().getZ() + 0.5, offset.getX() + 0.5, offset.getY() + 0.95, offset.getZ() + 0.5, 80, 1F, 0.1F, recipe.getParticleColors()); + AssetUtil.renderLaser(tile.getBlockPos().getX() + 0.5, tile.getBlockPos().getY() + 0.5, tile.getBlockPos().getZ() + 0.5, offset.getX() + 0.5, offset.getY() + 0.95, offset.getZ() + 0.5, 80, 1F, 0.1F, recipe.getParticleColors()); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderLaserRelay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderLaserRelay.java index 30e6bc7e7..9db989782 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderLaserRelay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderLaserRelay.java @@ -58,31 +58,31 @@ public class RenderLaserRelay extends TileEntityRenderer { hasInvis = true; } - ItemStack hand = player.getHeldItemMainhand(); + ItemStack hand = player.getMainHandItem(); if (hasGoggles || StackUtil.isValid(hand) && (hand.getItem() == ConfigValues.itemCompassConfigurator || hand.getItem() instanceof ItemLaserWrench) || "themattabase".equals(player.getName().getString())) { - matrices.push(); + matrices.pushPose(); float yTrans = 0.2f; //tile.getBlockMetadata() == 0 ? 0.2F : 0.8F; // TODO: [port][fix] no clue what this is matrices.translate(0.5F, yTrans, 0.5F); matrices.scale(0.2F, 0.2F, 0.2F); - double boop = Util.milliTime() / 800D; - matrices.rotate(new Quaternion((float) (boop * 40D % 360), 0, 1, 0)); // TODO: [port][test] this might not work + double boop = Util.getMillis() / 800D; + matrices.mulPose(new Quaternion((float) (boop * 40D % 360), 0, 1, 0)); // TODO: [port][test] this might not work AssetUtil.renderItemInWorld(upgrade, combinedLight, combinedOverlay, matrices, buffer); - matrices.pop(); + matrices.popPose(); } } - ConcurrentSet connections = ActuallyAdditionsAPI.connectionHandler.getConnectionsFor(tile.getPos(), tile.getWorld()); + ConcurrentSet connections = ActuallyAdditionsAPI.connectionHandler.getConnectionsFor(tile.getBlockPos(), tile.getLevel()); if (connections != null && !connections.isEmpty()) { for (IConnectionPair pair : connections) { - if (!pair.doesSuppressRender() && tile.getPos().equals(pair.getPositions()[0])) { - BlockPos first = tile.getPos(); + if (!pair.doesSuppressRender() && tile.getBlockPos().equals(pair.getPositions()[0])) { + BlockPos first = tile.getBlockPos(); BlockPos second = pair.getPositions()[1]; - TileEntity secondTile = tile.getWorld().getTileEntity(second); + TileEntity secondTile = tile.getLevel().getBlockEntity(second); if (secondTile instanceof TileEntityLaserRelay) { ItemStack secondUpgrade = ((TileEntityLaserRelay) secondTile).inv.getStackInSlot(0); boolean otherInvis = StackUtil.isValid(secondUpgrade) && secondUpgrade.getItem() == ActuallyItems.LASER_UPGRADE_INVISIBILITY.get(); @@ -107,7 +107,7 @@ public class RenderLaserRelay extends TileEntityRenderer { } @Override - public boolean isGlobalRenderer(TileEntityLaserRelay tile) { + public boolean shouldRenderOffScreen(TileEntityLaserRelay tile) { return true; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderReconstructorLens.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderReconstructorLens.java index 06f347582..e98d08c97 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderReconstructorLens.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderReconstructorLens.java @@ -36,19 +36,19 @@ public class RenderReconstructorLens extends TileEntityRenderer= this.x && mouseY >= this.y && this.x < this.x + this.width && this.y < this.y + this.height; int offset = this.isHovered ? 1 : 0; - GlStateManager.enableBlend(); - GlStateManager.blendFuncSeparate(770, 771, 1, 0); - GlStateManager.blendFunc(770, 771); + GlStateManager._enableBlend(); + GlStateManager._blendFuncSeparate(770, 771, 1, 0); + GlStateManager._blendFunc(770, 771); int renderHeight = 25; this.blit(matrices, this.x, this.y, 224 + (this.assignedPage == null ? 0 @@ -84,9 +84,9 @@ public class BookmarkButton extends Button { if (this.assignedPage != null) { ItemStack display = this.assignedPage.getChapter().getDisplayItemStack(); if (StackUtil.isValid(display)) { - GlStateManager.pushMatrix(); + GlStateManager._pushMatrix(); AssetUtil.renderStackToGui(display, this.x + 2, this.y + 1, 0.725F); - GlStateManager.popMatrix(); + GlStateManager._popMatrix(); } } } @@ -113,7 +113,7 @@ public class BookmarkButton extends Button { } Minecraft mc = Minecraft.getInstance(); - GuiUtils.drawHoveringText(stack, list.stream().map(StringTextComponent::new).collect(Collectors.toList()), mouseX, mouseY, mc.currentScreen.width, mc.currentScreen.height, -1, mc.fontRenderer); + GuiUtils.drawHoveringText(stack, list.stream().map(StringTextComponent::new).collect(Collectors.toList()), mouseX, mouseY, mc.screen.width, mc.screen.height, -1, mc.font); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/EntryButton.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/EntryButton.java index 28a32dba3..7a506ac6b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/EntryButton.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/EntryButton.java @@ -38,30 +38,30 @@ public class EntryButton extends Button { @Override public void drawButton(Minecraft minecraft, int mouseX, int mouseY, float f) { if (this.visible) { - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.color3arg(1.0F, 1.0F, 1.0F, 1.0F); this.hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height; - GlStateManager.enableBlend(); + GlStateManager._enableBlend(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - GlStateManager.blendFunc(770, 771); + GlStateManager._blendFunc(770, 771); this.mouseDragged(minecraft, mouseX, mouseY); int textOffsetX = 0; if (StackUtil.isValid(this.stackToRender)) { - GlStateManager.pushMatrix(); + GlStateManager._pushMatrix(); AssetUtil.renderStackToGui(this.stackToRender, this.x - 4, this.y, 0.725F); - GlStateManager.popMatrix(); + GlStateManager._popMatrix(); textOffsetX = 10; } float scale = this.gui.getMediumFontSize(); if (this.hovered) { - GlStateManager.pushMatrix(); - AssetUtil.drawHorizontalGradientRect(this.x + textOffsetX - 1, this.y + this.height - 1, this.x + (int) (minecraft.fontRenderer.getStringWidth(this.displayString) * scale) + textOffsetX + 1, this.y + this.height, 0x80 << 24 | 22271, 22271, this.zLevel); - GlStateManager.popMatrix(); + GlStateManager._pushMatrix(); + AssetUtil.drawHorizontalGradientRect(this.x + textOffsetX - 1, this.y + this.height - 1, this.x + (int) (minecraft.font.width(this.displayString) * scale) + textOffsetX + 1, this.y + this.height, 0x80 << 24 | 22271, 22271, this.zLevel); + GlStateManager._popMatrix(); } - StringUtil.renderScaledAsciiString(minecraft.fontRenderer, this.displayString, this.x + textOffsetX, this.y + 2 + (this.height - 8) / 2, 0, false, scale); + StringUtil.renderScaledAsciiString(minecraft.font, this.displayString, this.x + textOffsetX, this.y + 2 + (this.height - 8) / 2, 0, false, scale); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/TrialsButton.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/TrialsButton.java index c6c2721d0..7838b922a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/TrialsButton.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/TrialsButton.java @@ -16,6 +16,8 @@ import de.ellpeck.actuallyadditions.mod.inventory.gui.TexturedButton; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.widget.button.Button.IPressable; + public class TrialsButton extends TexturedButton { private final boolean isTrials; @@ -32,7 +34,7 @@ public class TrialsButton extends TexturedButton { if (this.visible) { if (this.isHovered || this.isTrials) { - this.drawCenteredString(minecraft.fontRenderer, StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".trialsButton.name"), this.x + (this.width - 8) / 2, this.y + (this.height - 8) / 2, 14737632); + this.drawCenteredString(minecraft.font, StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".trialsButton.name"), this.x + (this.width - 8) / 2, this.y + (this.height - 8) / 2, 14737632); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntry.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntry.java index c8504fa65..094c8ba74 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntry.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntry.java @@ -57,7 +57,7 @@ public class BookletEntry implements IBookletEntry { if (!items.isEmpty()) { for (ItemStack stack : items) { if (StackUtil.isValid(stack)) { - List tooltip = stack.getTooltip(mc.player, mc.gameSettings.advancedItemTooltips + List tooltip = stack.getTooltipLines(mc.player, mc.options.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL); for (String strg : tooltip) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiBooklet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiBooklet.java index bab3946c4..089546e8d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiBooklet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiBooklet.java @@ -116,8 +116,8 @@ public abstract class GuiBooklet extends GuiBookletBase { if (this.hasSearchBar()) { this.searchField = new TextFieldWidget(this.font, this.guiLeft + this.xSize + 2, this.guiTop + this.ySize - 40 + 2, 64, 12, StringTextComponent.EMPTY); - this.searchField.setMaxStringLength(50); - this.searchField.setEnableBackgroundDrawing(false); + this.searchField.setMaxLength(50); + this.searchField.setBordered(false); this.children.add(this.searchField); } @@ -135,13 +135,13 @@ public abstract class GuiBooklet extends GuiBookletBase { } } - this.buttonTrials = new TrialsButton(this, btn -> this.getMinecraft().displayGuiScreen(new GuiEntry(this.previousScreen, this, ActuallyAdditionsAPI.entryTrials, 0, "", false))); + this.buttonTrials = new TrialsButton(this, btn -> this.getMinecraft().setScreen(new GuiEntry(this.previousScreen, this, ActuallyAdditionsAPI.entryTrials, 0, "", false))); this.addButton(this.buttonTrials); } @Override - public void onClose() { - super.onClose(); + public void removed() { + super.removed(); //Don't cache the parent GUI, otherwise it opens again when you close the cached book! this.previousScreen = null; @@ -173,19 +173,19 @@ public abstract class GuiBooklet extends GuiBookletBase { } public void drawScreenPre(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) { - GlStateManager.color4f(1F, 1F, 1F, 1F); - this.getMinecraft().getTextureManager().bindTexture(RES_LOC_GUI); + GlStateManager._color4f(1F, 1F, 1F, 1F); + this.getMinecraft().getTextureManager().bind(RES_LOC_GUI); blit(matrices, this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize, 512, 512); if (this.hasSearchBar()) { - this.getMinecraft().getTextureManager().bindTexture(RES_LOC_GADGETS); + this.getMinecraft().getTextureManager().bind(RES_LOC_GADGETS); this.blit(matrices, this.guiLeft + this.xSize, this.guiTop + this.ySize - 40, 188, 0, 68, 14); // boolean unicodeBefore = this.font.getUnicodeFlag(); // this.font.setUnicodeFlag(true); - if (!this.searchField.isFocused() && (this.searchField.getText() == null || this.searchField.getText().isEmpty())) { - this.font.drawString(matrices, TextFormatting.ITALIC + StringUtil.localize("info." + ActuallyAdditions.MODID + ".booklet.searchField"), this.guiLeft + this.xSize + 2, this.guiTop + this.ySize - 40 + 2, 0xFFFFFF); + if (!this.searchField.isFocused() && (this.searchField.getValue() == null || this.searchField.getValue().isEmpty())) { + this.font.draw(matrices, TextFormatting.ITALIC + StringUtil.localize("info." + ActuallyAdditions.MODID + ".booklet.searchField"), this.guiLeft + this.xSize + 2, this.guiTop + this.ySize - 40 + 2, 0xFFFFFF); } this.searchField.render(matrices, mouseX, mouseY, partialTicks); @@ -279,7 +279,7 @@ public abstract class GuiBooklet extends GuiBookletBase { } public void onBackButtonPressed() { - this.getMinecraft().displayGuiScreen(new GuiMainPage(this.previousScreen)); + this.getMinecraft().setScreen(new GuiMainPage(this.previousScreen)); } public boolean hasSearchBar() { @@ -310,7 +310,7 @@ public abstract class GuiBooklet extends GuiBookletBase { GuiBookletBase parent = !(this instanceof GuiEntry) ? this : this.parentPage; - this.getMinecraft().displayGuiScreen(new GuiEntry(this.previousScreen, parent, ActuallyAdditionsAPI.entryAllAndSearch, 0, searchBarText, true)); + this.getMinecraft().setScreen(new GuiEntry(this.previousScreen, parent, ActuallyAdditionsAPI.entryAllAndSearch, 0, searchBarText, true)); } // TODO: ensure typing still works diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiEntry.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiEntry.java index b90d0a057..67a4fe962 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiEntry.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiEntry.java @@ -80,7 +80,7 @@ public class GuiEntry extends GuiBooklet { super.init(); if (this.hasSearchBar() && this.searchText != null) { - this.searchField.setText(this.searchText); + this.searchField.setValue(this.searchText); if (this.focusSearch) { this.searchField.setFocused(true); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiMainPage.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiMainPage.java index 08cdc470c..a1d43d848 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiMainPage.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiMainPage.java @@ -73,12 +73,12 @@ public class GuiMainPage extends GuiBooklet { super.init(); int flavor = 1; - if (this.getMinecraft().world.rand.nextFloat() <= 0.1) { - flavor = MathHelper.nextInt(this.getMinecraft().world.rand, 2, 7); + if (this.getMinecraft().level.random.nextFloat() <= 0.1) { + flavor = MathHelper.nextInt(this.getMinecraft().level.random, 2, 7); } this.bookletName = "info." + ActuallyAdditions.MODID + ".booklet.manualName.1." + flavor; - String usedQuote = QUOTES[this.getMinecraft().world.rand.nextInt(QUOTES.length)]; + String usedQuote = QUOTES[this.getMinecraft().level.random.nextInt(QUOTES.length)]; String[] quoteSplit = usedQuote.split("@"); if (quoteSplit.length == 2) { this.quote = this.font.listFormattedStringToWidth(quoteSplit[0], 120); @@ -107,7 +107,7 @@ public class GuiMainPage extends GuiBooklet { } else if (playerName.equalsIgnoreCase("ellpeck") || playerName.equalsIgnoreCase("profprospector")) { String[] colors = new String[15]; for (int i = 0; i < colors.length; i++) { - colors[i] = TextFormatting.fromColorIndex(this.getMinecraft().world.rand.nextInt(15)).toString() + TextFormatting.ITALIC; + colors[i] = TextFormatting.getById(this.getMinecraft().level.random.nextInt(15)).toString() + TextFormatting.ITALIC; } this.bookletEdition = String.format("%sC%so%sl%so%sr%sf%su%sl %sE%sd%si%st%si%so%sn", (Object[]) colors); } else if (playerName.equalsIgnoreCase("oitsjustjose")) { @@ -174,7 +174,7 @@ public class GuiMainPage extends GuiBooklet { if (displayed.size() > button.id) { IBookletEntry entry = displayed.get(button.id); if (entry != null) { - this.getMinecraft().displayGuiScreen(new GuiEntry(this.previousScreen, this, entry, 0, "", false)); + this.getMinecraft().setScreen(new GuiEntry(this.previousScreen, this, entry, 0, "", false)); } } } @@ -184,7 +184,7 @@ public class GuiMainPage extends GuiBooklet { }*/ else if (button == this.configButton) { GuiScreen config = new GuiConfiguration(this); - this.getMinecraft().displayGuiScreen(config); + this.getMinecraft().setScreen(config); } else if (this.showTutorial && button == this.tutorialButton) { if (this.hasBookmarkButtons()) { if (!isShiftKeyDown()) { @@ -212,12 +212,12 @@ public class GuiMainPage extends GuiBooklet { super.drawScreenPre(mouseX, mouseY, partialTicks); String strg = TextFormatting.DARK_GREEN + StringUtil.localize(this.bookletName); - this.font.drawString(strg, this.guiLeft + 72 - this.font.getStringWidth(strg) / 2 - 3, this.guiTop + 19, 0); + this.font.draw(strg, this.guiLeft + 72 - this.font.width(strg) / 2 - 3, this.guiTop + 19, 0); strg = TextFormatting.DARK_GREEN + StringUtil.localize("info." + ActuallyAdditions.MODID + ".booklet.manualName.2"); - this.font.drawString(strg, this.guiLeft + 72 - this.font.getStringWidth(strg) / 2 - 3, this.guiTop + 19 + this.font.FONT_HEIGHT, 0); + this.font.draw(strg, this.guiLeft + 72 - this.font.width(strg) / 2 - 3, this.guiTop + 19 + this.font.lineHeight, 0); strg = TextFormatting.GOLD + TextFormatting.ITALIC.toString() + this.bookletEdition; - this.font.drawString(strg, this.guiLeft + 72 - this.font.getStringWidth(strg) / 2 - 3, this.guiTop + 40, 0); + this.font.draw(strg, this.guiLeft + 72 - this.font.width(strg) / 2 - 3, this.guiTop + 40, 0); if (this.showTutorial) { String text = TextFormatting.BLUE + "It looks like this is the first time you are using this manual. \nIf you click the button below, some useful bookmarks will be stored at the bottom of the GUI. You should definitely check them out to get started with " + ActuallyAdditions.NAME + "! \nIf you don't want this, shift-click the button."; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiPage.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiPage.java index 0a62a027a..083e4c06f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiPage.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/gui/GuiPage.java @@ -176,7 +176,7 @@ public class GuiPage extends GuiBooklet { String pageStrg = "Page " + (chapter.getPageIndex(this.pages[i]) + 1) + "/" + chapter.getAllPages().length; this.renderScaledAsciiString(pageStrg, this.guiLeft + 25 + i * 136, this.guiTop + this.ySize - 7, 0xFFFFFF, false, this.getLargeFontSize()); - GlStateManager.color(1F, 1F, 1F); + GlStateManager.color1arg(1F, 1F, 1F); page.drawScreenPre(this, this.guiLeft + 6 + i * 142, this.guiTop + 7, mouseX, mouseY, partialTicks); } } @@ -192,7 +192,7 @@ public class GuiPage extends GuiBooklet { for (int i = 0; i < this.pages.length; i++) { IBookletPage page = this.pages[i]; if (page != null) { - GlStateManager.color(1F, 1F, 1F); + GlStateManager.color1arg(1F, 1F, 1F); page.drawScreenPost(this, this.guiLeft + 6 + i * 142, this.guiTop + 7, mouseX, mouseY, partialTicks); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/ItemDisplay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/ItemDisplay.java index 1fc1a187c..ca82780c2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/ItemDisplay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/ItemDisplay.java @@ -57,10 +57,10 @@ public class ItemDisplay { public void drawPost(int mouseX, int mouseY) { if (this.isHovered(mouseX, mouseY)) { Minecraft mc = this.gui.mc; - boolean flagBefore = mc.fontRenderer.getUnicodeFlag(); - mc.fontRenderer.setUnicodeFlag(false); + boolean flagBefore = mc.font.getUnicodeFlag(); + mc.font.setUnicodeFlag(false); - List list = this.stack.getTooltip(mc.player, mc.gameSettings.advancedItemTooltips + List list = this.stack.getTooltipLines(mc.player, mc.options.advancedItemTooltips ? TooltipFlags.ADVANCED : TooltipFlags.NORMAL); @@ -76,9 +76,9 @@ public class ItemDisplay { list.add(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".clickToSeeRecipe")); } - GuiUtils.drawHoveringText(list, mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.fontRenderer); + GuiUtils.drawHoveringText(list, mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.font); - mc.fontRenderer.setUnicodeFlag(flagBefore); + mc.font.setUnicodeFlag(flagBefore); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCoffeeMachine.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCoffeeMachine.java index adcd80716..17e8409c4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCoffeeMachine.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCoffeeMachine.java @@ -33,7 +33,7 @@ public class PageCoffeeMachine extends BookletPage { public PageCoffeeMachine(int localizationKey, CoffeeIngredient ingredient) { super(localizationKey); this.ingredient = ingredient; - this.stacks = ingredient.getInput().getMatchingStacks(); + this.stacks = ingredient.getInput().getItems(); this.outcome = new ItemStack(ActuallyItems.COFFEE.get()); ActuallyAdditionsAPI.methodHandler.addEffectToStack(this.outcome, this.ingredient); @@ -44,7 +44,7 @@ public class PageCoffeeMachine extends BookletPage { public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); - gui.getMinecraft().getTextureManager().bindTexture(GuiBooklet.RES_LOC_GADGETS); + gui.getMinecraft().getTextureManager().bind(GuiBooklet.RES_LOC_GADGETS); GuiUtils.drawTexturedModalRect(startX + 5, startY + 10, 0, 74, 117, 72, 0); gui.renderScaledAsciiString("(Coffee Maker Recipe)", startX + 6, startY + 78, 0, false, gui.getMediumFontSize()); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrafting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrafting.java index c7cf5502d..bdbfcaa76 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrafting.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrafting.java @@ -109,7 +109,7 @@ public class PageCrafting extends BookletPage { if (!this.recipes.isEmpty()) { for (IRecipe recipe : this.recipes) { if (recipe != null) { - ItemStack output = recipe.getRecipeOutput(); + ItemStack output = recipe.getResultItem(); if (StackUtil.isValid(output)) { ItemStack copy = output.copy(); if (this.isWildcard) { @@ -129,7 +129,7 @@ public class PageCrafting extends BookletPage { if (recipe instanceof BlankRecipe) { this.recipeTypeLocKey = "tooltip." + ActuallyAdditions.MODID + ".disabled"; - gui.addOrModifyItemRenderer(recipe.getRecipeOutput(), startX + 100, startY + 25, 1F, false); + gui.addOrModifyItemRenderer(recipe.getResultItem(), startX + 100, startY + 25, 1F, false); return; } else if (recipe instanceof ShapedRecipes) { ShapedRecipes shaped = (ShapedRecipes) recipe; @@ -167,7 +167,7 @@ public class PageCrafting extends BookletPage { for (int y = 0; y < height; y++) { Ingredient ing = ings[y * width + x]; if (ing != null) { - ItemStack[] stacks = ing.getMatchingStacks(); + ItemStack[] stacks = ing.getItems(); if (stacks != null && stacks.length > 0) { ItemStack stack = stacks[0]; if (StackUtil.isValid(stack)) { @@ -184,6 +184,6 @@ public class PageCrafting extends BookletPage { } } - gui.addOrModifyItemRenderer(recipe.getRecipeOutput(), startX + 100, startY + 25, 1F, false); + gui.addOrModifyItemRenderer(recipe.getResultItem(), startX + 100, startY + 25, 1F, false); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrusherRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrusherRecipe.java index 567f1f5ba..bdf6cb365 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrusherRecipe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrusherRecipe.java @@ -33,7 +33,7 @@ public class PageCrusherRecipe extends BookletPage { public PageCrusherRecipe(int localizationKey, CrusherRecipe recipe) { super(localizationKey); this.recipe = recipe; - this.stacks = recipe.getInput().getMatchingStacks(); + this.stacks = recipe.getInput().getItems(); } @Override @@ -41,7 +41,7 @@ public class PageCrusherRecipe extends BookletPage { public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); - gui.getMinecraft().getTextureManager().bindTexture(GuiBooklet.RES_LOC_GADGETS); + gui.getMinecraft().getTextureManager().bind(GuiBooklet.RES_LOC_GADGETS); GuiUtils.drawTexturedModalRect(startX + 38, startY + 6, 136, 0, 52, 74, 0); gui.renderScaledAsciiString("(" + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".crusherRecipe") + ")", startX + 36, startY + 85, 0, false, gui.getMediumFontSize()); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageEmpowerer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageEmpowerer.java index 52208e5c9..3e2176b6d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageEmpowerer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageEmpowerer.java @@ -37,11 +37,11 @@ public class PageEmpowerer extends BookletPage { super(localizationKey); this.recipe = recipe; if (recipe != null) { - this.inputs = recipe.getInput().getMatchingStacks(); - this.stand1 = recipe.getStandOne().getMatchingStacks(); - this.stand2 = recipe.getStandTwo().getMatchingStacks(); - this.stand3 = recipe.getStandThree().getMatchingStacks(); - this.stand4 = recipe.getStandFour().getMatchingStacks(); + this.inputs = recipe.getInput().getItems(); + this.stand1 = recipe.getStandOne().getItems(); + this.stand2 = recipe.getStandTwo().getItems(); + this.stand3 = recipe.getStandThree().getItems(); + this.stand4 = recipe.getStandFour().getItems(); } } @@ -50,7 +50,7 @@ public class PageEmpowerer extends BookletPage { public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); - gui.getMinecraft().getTextureManager().bindTexture(GuiBooklet.RES_LOC_GADGETS); + gui.getMinecraft().getTextureManager().bind(GuiBooklet.RES_LOC_GADGETS); GuiUtils.drawTexturedModalRect(startX + 5, startY + 10, 117, 74, 116, 72, 0); gui.renderScaledAsciiString("(" + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".empowererRecipe") + ")", startX + 6, startY + 85, 0, false, gui.getMediumFontSize()); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageFurnace.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageFurnace.java index 225591dc2..ec76bfcb1 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageFurnace.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageFurnace.java @@ -43,7 +43,7 @@ public class PageFurnace extends BookletPage { for (Map.Entry entry : FurnaceRecipes.instance().getSmeltingList().entrySet()) { ItemStack stack = entry.getValue(); if (StackUtil.isValid(stack)) { - if (stack.isItemEqual(output)) { + if (stack.sameItem(output)) { return entry.getKey(); } } @@ -56,7 +56,7 @@ public class PageFurnace extends BookletPage { public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); - gui.getMinecraft().getTextureManager().bindTexture(GuiBooklet.RES_LOC_GADGETS); + gui.getMinecraft().getTextureManager().bind(GuiBooklet.RES_LOC_GADGETS); GuiUtils.drawTexturedModalRect(startX + 23, startY + 10, 0, 146, 80, 26, 0); gui.renderScaledAsciiString("(" + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".furnaceRecipe") + ")", startX + 32, startY + 42, 0, false, gui.getMediumFontSize()); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PagePicture.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PagePicture.java index 4b1342443..da6aa2bb0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PagePicture.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PagePicture.java @@ -44,7 +44,7 @@ public class PagePicture extends BookletPage { public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); - gui.getMinecraft().getTextureManager().bindTexture(this.resLoc); + gui.getMinecraft().getTextureManager().bind(this.resLoc); RenderSystem.pushMatrix(); RenderSystem.enableBlend(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageReconstructor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageReconstructor.java index 26dd270da..3abb7e2ac 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageReconstructor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageReconstructor.java @@ -35,7 +35,7 @@ public class PageReconstructor extends BookletPage { super(localizationKey); this.recipe = recipe; if (recipe != null) { - this.stacks = recipe.getInput().getMatchingStacks(); + this.stacks = recipe.getInput().getItems(); } } @@ -44,7 +44,7 @@ public class PageReconstructor extends BookletPage { public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); - gui.getMinecraft().getTextureManager().bindTexture(GuiBooklet.RES_LOC_GADGETS); + gui.getMinecraft().getTextureManager().bind(GuiBooklet.RES_LOC_GADGETS); GuiUtils.drawTexturedModalRect(startX + 30, startY + 10, 80, 146, 68, 48, 0); gui.renderScaledAsciiString("(" + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".reconstructorRecipe") + ")", startX + 6, startY + 63, 0, false, gui.getMediumFontSize()); @@ -75,7 +75,7 @@ public class PageReconstructor extends BookletPage { if (this.recipe != null) { ItemStack copy = this.recipe.getOutput().copy(); if (this.isWildcard) { - copy.setDamage(Util.WILDCARD); + copy.setDamageValue(Util.WILDCARD); } list.add(copy); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/config/ConfigValues.java b/src/main/java/de/ellpeck/actuallyadditions/mod/config/ConfigValues.java index 0bcdd5e92..7b0b42a5f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/config/ConfigValues.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/config/ConfigValues.java @@ -59,7 +59,7 @@ public final class ConfigValues { if (itemRedstoneTorchConfigurator == null || itemCompassConfigurator == null) { ActuallyAdditions.LOGGER.error("Parsing the Configuration Items config failed, reverting back to the default settings!"); - itemRedstoneTorchConfigurator = Item.getItemFromBlock(Blocks.REDSTONE_TORCH); + itemRedstoneTorchConfigurator = Item.byBlock(Blocks.REDSTONE_TORCH); itemCompassConfigurator = Items.COMPASS; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/data/PlayerData.java b/src/main/java/de/ellpeck/actuallyadditions/mod/data/PlayerData.java index 1b0ec595b..8974de574 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/data/PlayerData.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/data/PlayerData.java @@ -28,9 +28,9 @@ import java.util.concurrent.ConcurrentHashMap; public final class PlayerData { public static PlayerSave getDataFromPlayer(PlayerEntity player) { - WorldData worldData = WorldData.get(player.getEntityWorld()); + WorldData worldData = WorldData.get(player.getCommandSenderWorld()); ConcurrentHashMap data = worldData.playerSaveData; - UUID id = player.getUniqueID(); + UUID id = player.getUUID(); if (data.containsKey(id)) { PlayerSave save = data.get(id); @@ -42,7 +42,7 @@ public final class PlayerData { //Add Data if none is existant PlayerSave save = new PlayerSave(id); data.put(id, save); - worldData.markDirty(); + worldData.setDirty(); return save; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/data/WorldData.java b/src/main/java/de/ellpeck/actuallyadditions/mod/data/WorldData.java index a3161d38f..dc6e25619 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/data/WorldData.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/data/WorldData.java @@ -38,12 +38,12 @@ public class WorldData extends WorldSavedData { } public static WorldData get(World world) { - WorldData storage = ((ServerWorld) world).getSavedData().get(WorldData::new, SAVE_NAME); + WorldData storage = ((ServerWorld) world).getDataStorage().get(WorldData::new, SAVE_NAME); if (storage == null) { storage = new WorldData(); - storage.markDirty(); - ((ServerWorld) world).getSavedData().set(storage); + storage.setDirty(); + ((ServerWorld) world).getDataStorage().set(storage); } return storage; @@ -57,7 +57,7 @@ public class WorldData extends WorldSavedData { } @Override - public void read(CompoundNBT compound) { + public void load(CompoundNBT compound) { this.laserRelayNetworks.clear(); ListNBT networkList = compound.getList("Networks", 10); for (int i = 0; i < networkList.size(); i++) { @@ -70,7 +70,7 @@ public class WorldData extends WorldSavedData { for (int i = 0; i < playerList.size(); i++) { CompoundNBT player = playerList.getCompound(i); - UUID id = player.getUniqueId("UUID"); + UUID id = player.getUUID("UUID"); CompoundNBT data = player.getCompound("Data"); PlayerSave save = new PlayerSave(id); @@ -80,7 +80,7 @@ public class WorldData extends WorldSavedData { } @Override - public CompoundNBT write(CompoundNBT compound) { + public CompoundNBT save(CompoundNBT compound) { //Laser World Data ListNBT networkList = new ListNBT(); for (Network network : this.laserRelayNetworks) { @@ -92,7 +92,7 @@ public class WorldData extends WorldSavedData { ListNBT playerList = new ListNBT(); for (PlayerSave save : this.playerSaveData.values()) { CompoundNBT player = new CompoundNBT(); - player.putUniqueId("UUID", save.id); + player.putUUID("UUID", save.id); CompoundNBT data = new CompoundNBT(); save.writeToNBT(data, true); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/entity/EntityWorm.java b/src/main/java/de/ellpeck/actuallyadditions/mod/entity/EntityWorm.java index 8f0e01e09..59c6ecb36 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/entity/EntityWorm.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/entity/EntityWorm.java @@ -35,10 +35,10 @@ public class EntityWorm extends Entity { Block block = state.getBlock(); boolean rightBlock = block instanceof BlockFarmland || block instanceof BlockDirt || block instanceof BlockGrass; if (rightBlock) { - BlockPos posUp = pos.up(); + BlockPos posUp = pos.above(); BlockState stateUp = world.getBlockState(posUp); Block blockUp = stateUp.getBlock(); - return blockUp instanceof IPlantable || blockUp instanceof BlockBush || blockUp.isReplaceable(world, posUp); + return blockUp instanceof IPlantable || blockUp instanceof BlockBush || blockUp.canBeReplaced(world, posUp); } else { return false; } @@ -66,53 +66,53 @@ public class EntityWorm extends Entity { @Override public void onEntityUpdate() { - if (!this.world.isRemote) { + if (!this.level.isClientSide) { this.timer++; if (this.timer % 50 == 0) { for (int x = -1; x <= 1; x++) { for (int z = -1; z <= 1; z++) { BlockPos pos = new BlockPos(this.posX + x, this.posY, this.posZ + z); - BlockState state = this.world.getBlockState(pos); + BlockState state = this.level.getBlockState(pos); Block block = state.getBlock(); boolean isMiddlePose = x == 0 && z == 0; - if (canWormify(this.world, pos, state)) { + if (canWormify(this.level, pos, state)) { boolean isFarmland = block instanceof BlockFarmland; if (!isFarmland || state.getValue(BlockFarmland.MOISTURE) < 7) { - if (isMiddlePose || this.world.rand.nextFloat() >= 0.45F) { + if (isMiddlePose || this.level.random.nextFloat() >= 0.45F) { if (!isFarmland) { - DefaultFarmerBehavior.useHoeAt(this.world, pos); + DefaultFarmerBehavior.useHoeAt(this.level, pos); } - state = this.world.getBlockState(pos); + state = this.level.getBlockState(pos); isFarmland = state.getBlock() instanceof BlockFarmland; if (isFarmland) { - this.world.setBlockState(pos, state.withProperty(BlockFarmland.MOISTURE, 7), 2); + this.level.setBlock(pos, state.withProperty(BlockFarmland.MOISTURE, 7), 2); } } } - if (isFarmland && this.world.rand.nextFloat() >= 0.95F) { - BlockPos plant = pos.up(); - if (!this.world.isAirBlock(plant)) { - BlockState plantState = this.world.getBlockState(plant); + if (isFarmland && this.level.random.nextFloat() >= 0.95F) { + BlockPos plant = pos.above(); + if (!this.level.isEmptyBlock(plant)) { + BlockState plantState = this.level.getBlockState(plant); Block plantBlock = plantState.getBlock(); if ((plantBlock instanceof IGrowable || plantBlock instanceof IPlantable) && !(plantBlock instanceof BlockGrass)) { - plantBlock.updateTick(this.world, plant, plantState, this.world.rand); + plantBlock.updateTick(this.level, plant, plantState, this.level.random); - BlockState newState = this.world.getBlockState(plant); + BlockState newState = this.level.getBlockState(plant); if (newState != plantState) { - this.world.playEvent(2005, plant, 0); + this.level.levelEvent(2005, plant, 0); } } } } } else if (isMiddlePose) { - this.setDead(); + this.removeAfterChangingDimensions(); } } } @@ -120,7 +120,7 @@ public class EntityWorm extends Entity { int dieTime = ConfigIntValues.WORMS_DIE_TIME.getValue(); if (dieTime > 0 && this.timer >= dieTime) { - this.setDead(); + this.removeAfterChangingDimensions(); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/ClientEvents.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/ClientEvents.java index 1810d7e1c..351395aec 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/event/ClientEvents.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/event/ClientEvents.java @@ -41,8 +41,8 @@ import net.minecraftforge.eventbus.api.SubscribeEvent; @OnlyIn(Dist.CLIENT) public class ClientEvents { - private static final ITextComponent ADVANCED_INFO_TEXT_PRE = new StringTextComponent(" -").mergeStyle(TextFormatting.DARK_GRAY); - private static final ITextComponent ADVANCED_INFO_HEADER_PRE = new StringTextComponent(" -").mergeStyle(TextFormatting.GRAY); + private static final ITextComponent ADVANCED_INFO_TEXT_PRE = new StringTextComponent(" -").withStyle(TextFormatting.DARK_GRAY); + private static final ITextComponent ADVANCED_INFO_HEADER_PRE = new StringTextComponent(" -").withStyle(TextFormatting.GRAY); private static EnergyDisplay energyDisplay; @@ -52,7 +52,7 @@ public class ClientEvents { if (event.phase == TickEvent.Phase.END) { Minecraft mc = Minecraft.getInstance(); - if (mc.world == null) { + if (mc.level == null) { WorldData.clear(); } } @@ -162,15 +162,15 @@ public class ClientEvents { @SubscribeEvent public void onGameOverlay(RenderGameOverlayEvent.Post event) { Minecraft minecraft = Minecraft.getInstance(); - if (event.getType() == RenderGameOverlayEvent.ElementType.ALL && minecraft.currentScreen == null) { + if (event.getType() == RenderGameOverlayEvent.ElementType.ALL && minecraft.screen == null) { PlayerEntity player = minecraft.player; if (player == null) { return; } - RayTraceResult posHit = minecraft.objectMouseOver; - FontRenderer font = minecraft.fontRenderer; - ItemStack stack = player.getHeldItemMainhand(); + RayTraceResult posHit = minecraft.hitResult; + FontRenderer font = minecraft.font; + ItemStack stack = player.getMainHandItem(); if (StackUtil.isValid(stack)) { if (stack.getItem() instanceof IHudDisplay) { @@ -180,8 +180,8 @@ public class ClientEvents { if (posHit != null && posHit.getType() == RayTraceResult.Type.BLOCK) { BlockRayTraceResult rayCast = (BlockRayTraceResult) posHit; - Block blockHit = minecraft.world.getBlockState(rayCast.getPos()).getBlock(); - TileEntity tileHit = minecraft.world.getTileEntity(rayCast.getPos()); + Block blockHit = minecraft.level.getBlockState(rayCast.getBlockPos()).getBlock(); + TileEntity tileHit = minecraft.level.getBlockEntity(rayCast.getBlockPos()); if (blockHit instanceof IHudDisplay) { ((IHudDisplay) blockHit).displayHud(event.getMatrixStack(), minecraft, player, stack, posHit, event.getWindow()); @@ -193,30 +193,30 @@ public class ClientEvents { String strg = String.format("%s: %s", StringUtil.localize("info." + ActuallyAdditions.MODID + ".redstoneMode.name"), TextFormatting.DARK_RED + StringUtil.localize("info." + ActuallyAdditions.MODID + ".redstoneMode." + (base.isPulseMode ? "pulse" : "deactivation")) + TextFormatting.RESET); - font.drawStringWithShadow(event.getMatrixStack(), strg, event.getWindow().getScaledWidth() / 2f + 5, event.getWindow().getScaledHeight() / 2f + 5, StringUtil.DECIMAL_COLOR_WHITE); + font.drawShadow(event.getMatrixStack(), strg, event.getWindow().getGuiScaledWidth() / 2f + 5, event.getWindow().getGuiScaledHeight() / 2f + 5, StringUtil.DECIMAL_COLOR_WHITE); String expl; if (StackUtil.isValid(stack) && stack.getItem() == ConfigValues.itemRedstoneTorchConfigurator) { expl = TextFormatting.GREEN + StringUtil.localize("info." + ActuallyAdditions.MODID + ".redstoneMode.validItem"); } else { - expl = TextFormatting.GRAY.toString() + TextFormatting.ITALIC + StringUtil.localizeFormatted("info." + ActuallyAdditions.MODID + ".redstoneMode.invalidItem", StringUtil.localize(ConfigValues.itemRedstoneTorchConfigurator.getTranslationKey() + ".name")); + expl = TextFormatting.GRAY.toString() + TextFormatting.ITALIC + StringUtil.localizeFormatted("info." + ActuallyAdditions.MODID + ".redstoneMode.invalidItem", StringUtil.localize(ConfigValues.itemRedstoneTorchConfigurator.getDescriptionId() + ".name")); } - font.drawStringWithShadow(event.getMatrixStack(), expl, event.getWindow().getScaledWidth() / 2f + 5, event.getWindow().getScaledHeight() / 2f + 15, StringUtil.DECIMAL_COLOR_WHITE); + font.drawShadow(event.getMatrixStack(), expl, event.getWindow().getGuiScaledWidth() / 2f + 5, event.getWindow().getGuiScaledHeight() / 2f + 15, StringUtil.DECIMAL_COLOR_WHITE); } } if (tileHit instanceof IEnergyDisplay) { IEnergyDisplay display = (IEnergyDisplay) tileHit; - if (!display.needsHoldShift() || player.isSneaking()) { + if (!display.needsHoldShift() || player.isShiftKeyDown()) { if (energyDisplay == null) { energyDisplay = new EnergyDisplay(0, 0, null); } - energyDisplay.setData(2, event.getWindow().getScaledHeight() - 96, display.getEnergyStorage(), true, true); + energyDisplay.setData(2, event.getWindow().getGuiScaledHeight() - 96, display.getEnergyStorage(), true, true); - GlStateManager.pushMatrix(); - GlStateManager.color4f(1F, 1F, 1F, 1F); + GlStateManager._pushMatrix(); + GlStateManager._color4f(1F, 1F, 1F, 1F); energyDisplay.draw(); - GlStateManager.popMatrix(); + GlStateManager._popMatrix(); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/CommonEvents.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/CommonEvents.java index bbc700e11..f7669296d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/event/CommonEvents.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/event/CommonEvents.java @@ -61,10 +61,10 @@ public class CommonEvents { if (item != null && item.isAlive()) { ItemStack stack = item.getItem(); if (StackUtil.isValid(stack)) { - for (int i = 0; i < player.inventory.getSizeInventory(); i++) { - if (i != player.inventory.currentItem) { + for (int i = 0; i < player.inventory.getContainerSize(); i++) { + if (i != player.inventory.selected) { - ItemStack invStack = player.inventory.getStackInSlot(i); + ItemStack invStack = player.inventory.getItem(i); if (StackUtil.isValid(invStack) && invStack.getItem() instanceof ItemBag && invStack.hasTag()) { if (invStack.getOrCreateTag().getBoolean("AutoInsert")) { boolean changed = false; @@ -139,11 +139,11 @@ public class CommonEvents { @SubscribeEvent public void onEntityDropEvent(LivingDropsEvent event) { - if (event.getEntityLiving().world != null && !event.getEntityLiving().world.isRemote && event.getSource().getTrueSource() instanceof PlayerEntity) { + if (event.getEntityLiving().level != null && !event.getEntityLiving().level.isClientSide && event.getSource().getEntity() instanceof PlayerEntity) { //Drop Cobwebs from Spiders if (ConfigBoolValues.DO_SPIDER_DROPS.isEnabled() && event.getEntityLiving() instanceof SpiderEntity) { - if (event.getEntityLiving().world.rand.nextInt(20) <= event.getLootingLevel() * 2) { - event.getDrops().add(new ItemEntity(event.getEntityLiving().world, event.getEntityLiving().getPosX(), event.getEntityLiving().getPosY(), event.getEntityLiving().getPosZ(), new ItemStack(Blocks.COBWEB, event.getEntityLiving().world.rand.nextInt(2 + event.getLootingLevel()) + 1))); + if (event.getEntityLiving().level.random.nextInt(20) <= event.getLootingLevel() * 2) { + event.getDrops().add(new ItemEntity(event.getEntityLiving().level, event.getEntityLiving().getX(), event.getEntityLiving().getY(), event.getEntityLiving().getZ(), new ItemStack(Blocks.COBWEB, event.getEntityLiving().level.random.nextInt(2 + event.getLootingLevel()) + 1))); } } } @@ -151,10 +151,10 @@ public class CommonEvents { @SubscribeEvent public void onLogInEvent(PlayerEvent.PlayerLoggedInEvent event) { - if (!event.getPlayer().world.isRemote && event.getPlayer() instanceof ServerPlayerEntity) { + if (!event.getPlayer().level.isClientSide && event.getPlayer() instanceof ServerPlayerEntity) { ServerPlayerEntity player = (ServerPlayerEntity) event.getPlayer(); PacketHandlerHelper.syncPlayerData(player, true); - ActuallyAdditions.LOGGER.info("Sending Player Data to player " + player.getName() + " with UUID " + player.getUniqueID() + "."); + ActuallyAdditions.LOGGER.info("Sending Player Data to player " + player.getName() + " with UUID " + player.getUUID() + "."); } } @@ -163,18 +163,18 @@ public class CommonEvents { //checkAchievements(event.crafting, event.player, InitAchievements.Type.CRAFTING); if (ConfigBoolValues.GIVE_BOOKLET_ON_FIRST_CRAFT.isEnabled()) { - if (!event.getPlayer().world.isRemote && StackUtil.isValid(event.getCrafting()) && event.getCrafting().getItem() != ActuallyItems.ITEM_BOOKLET.get()) { + if (!event.getPlayer().level.isClientSide && StackUtil.isValid(event.getCrafting()) && event.getCrafting().getItem() != ActuallyItems.ITEM_BOOKLET.get()) { String name = event.getCrafting().getItem().getRegistryName().toString(); if (name != null && name.toLowerCase(Locale.ROOT).contains(ActuallyAdditions.MODID)) { PlayerData.PlayerSave save = PlayerData.getDataFromPlayer(event.getPlayer()); if (save != null && !save.bookGottenAlready) { save.bookGottenAlready = true; - WorldData.get(event.getPlayer().getEntityWorld()).markDirty(); + WorldData.get(event.getPlayer().getCommandSenderWorld()).setDirty(); - ItemEntity entityItem = new ItemEntity(event.getPlayer().world, event.getPlayer().getPosX(), event.getPlayer().getPosY(), event.getPlayer().getPosZ(), new ItemStack(ActuallyItems.ITEM_BOOKLET.get())); - entityItem.setPickupDelay(0); - event.getPlayer().world.addEntity(entityItem); + ItemEntity entityItem = new ItemEntity(event.getPlayer().level, event.getPlayer().getX(), event.getPlayer().getY(), event.getPlayer().getZ(), new ItemStack(ActuallyItems.ITEM_BOOKLET.get())); + entityItem.setPickUpDelay(0); + event.getPlayer().level.addFreshEntity(entityItem); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBag.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBag.java index 332dafdfb..44cac7aa6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBag.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBag.java @@ -52,7 +52,7 @@ public class ContainerBag extends Container implements IButtonReactor { private final ItemStack sack; public static ContainerBag fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { - return new ContainerBag(windowId, inv, data.readItemStack(), data.readBoolean()); + return new ContainerBag(windowId, inv, data.readItem(), data.readBoolean()); } public ContainerBag(int windowId, PlayerInventory inventory, ItemStack sack, boolean isVoid) { @@ -70,7 +70,7 @@ public class ContainerBag extends Container implements IButtonReactor { if (this.isVoid) { this.addSlot(new SlotDeletion(this.bagInventory, 0, 64, 65) { @Override - public boolean isItemValid(ItemStack stack) { + public boolean mayPlace(ItemStack stack) { return ContainerBag.this.filter.check(stack); } }); @@ -79,7 +79,7 @@ public class ContainerBag extends Container implements IButtonReactor { for (int j = 0; j < 7; j++) { this.addSlot(new SlotItemHandlerUnconditioned(this.bagInventory, j + i * 7, 10 + j * 18, 10 + i * 18) { @Override - public boolean isItemValid(ItemStack stack) { + public boolean mayPlace(ItemStack stack) { return !isBlacklisted(stack) && ContainerBag.this.filter.check(stack); } }); @@ -93,16 +93,16 @@ public class ContainerBag extends Container implements IButtonReactor { } } for (int i = 0; i < 9; i++) { - if (i == inventory.currentItem) { + if (i == inventory.selected) { this.addSlot(new SlotImmovable(inventory, i, 8 + i * 18, 152)); } else { this.addSlot(new Slot(inventory, i, 8 + i * 18, 152)); } } - ItemStack stack = inventory.getCurrentItem(); + ItemStack stack = inventory.getSelected(); if (StackUtil.isValid(stack) && stack.getItem() instanceof ItemBag) { - ItemDrill.loadSlotsFromNBT(this.bagInventory, inventory.getCurrentItem()); + ItemDrill.loadSlotsFromNBT(this.bagInventory, inventory.getSelected()); if (stack.hasTag()) { CompoundNBT compound = stack.getOrCreateTag(); this.filter.readFromNBT(compound, "Filter"); @@ -118,25 +118,25 @@ public class ContainerBag extends Container implements IButtonReactor { } @Override - public void detectAndSendChanges() { - super.detectAndSendChanges(); + public void broadcastChanges() { + super.broadcastChanges(); if (this.filter.needsUpdateSend() || this.autoInsert != this.oldAutoInsert) { - for (IContainerListener listener : this.listeners) { - listener.sendWindowProperty(this, 0, this.filter.isWhitelist + for (IContainerListener listener : this.containerListeners) { + listener.setContainerData(this, 0, this.filter.isWhitelist ? 1 : 0); - listener.sendWindowProperty(this, 1, this.filter.respectMeta + listener.setContainerData(this, 1, this.filter.respectMeta ? 1 : 0); - listener.sendWindowProperty(this, 2, this.filter.respectNBT + listener.setContainerData(this, 2, this.filter.respectNBT ? 1 : 0); - listener.sendWindowProperty(this, 3, this.filter.respectOredict); - listener.sendWindowProperty(this, 4, this.autoInsert + listener.setContainerData(this, 3, this.filter.respectOredict); + listener.setContainerData(this, 4, this.autoInsert ? 1 : 0); - listener.sendWindowProperty(this, 5, this.filter.respectMod + listener.setContainerData(this, 5, this.filter.respectMod ? 1 : 0); } @@ -147,7 +147,7 @@ public class ContainerBag extends Container implements IButtonReactor { @Override @OnlyIn(Dist.CLIENT) - public void updateProgressBar(int id, int data) { + public void setData(int id, int data) { if (id == 0) { this.filter.isWhitelist = data == 1; } else if (id == 1) { @@ -164,40 +164,40 @@ public class ContainerBag extends Container implements IButtonReactor { } @Override - public ItemStack transferStackInSlot(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(PlayerEntity player, int slot) { int inventoryStart = this.bagInventory.getSlots() + 4; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; int hotbarEnd = hotbarStart + 8; - Slot theSlot = this.inventorySlots.get(slot); + Slot theSlot = this.slots.get(slot); - if (theSlot != null && theSlot.getHasStack()) { - ItemStack newStack = theSlot.getStack(); + if (theSlot != null && theSlot.hasItem()) { + ItemStack newStack = theSlot.getItem(); ItemStack currentStack = newStack.copy(); //Other Slots in Inventory excluded if (slot >= inventoryStart) { //Shift from Inventory - if (this.isVoid || !this.filter.check(newStack) || !this.mergeItemStack(newStack, 4, 32, false)) { + if (this.isVoid || !this.filter.check(newStack) || !this.moveItemStackTo(newStack, 4, 32, false)) { if (slot >= inventoryStart && slot <= inventoryEnd) { - if (!this.mergeItemStack(newStack, hotbarStart, hotbarEnd + 1, false)) { + if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd + 1, false)) { + } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { return StackUtil.getEmpty(); } } // - } else if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, false)) { + } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } if (!StackUtil.isValid(newStack)) { - theSlot.putStack(StackUtil.getEmpty()); + theSlot.set(StackUtil.getEmpty()); } else { - theSlot.onSlotChanged(); + theSlot.setChanged(); } if (newStack.getCount() == currentStack.getCount()) { @@ -211,31 +211,31 @@ public class ContainerBag extends Container implements IButtonReactor { } @Override - public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) { + public ItemStack clicked(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) { if (SlotFilter.checkFilter(this, slotId, player)) { return StackUtil.getEmpty(); - } else if (clickTypeIn == ClickType.SWAP && dragType == this.inventory.currentItem) { + } else if (clickTypeIn == ClickType.SWAP && dragType == this.inventory.selected) { return ItemStack.EMPTY; } else { - return super.slotClick(slotId, dragType, clickTypeIn, player); + return super.clicked(slotId, dragType, clickTypeIn, player); } } @Override - public void onContainerClosed(PlayerEntity player) { - ItemStack stack = this.inventory.getCurrentItem(); + public void removed(PlayerEntity player) { + ItemStack stack = this.inventory.getSelected(); if (StackUtil.isValid(stack) && stack.getItem() instanceof ItemBag) { - ItemDrill.writeSlotsToNBT(this.bagInventory, this.inventory.getCurrentItem()); + ItemDrill.writeSlotsToNBT(this.bagInventory, this.inventory.getSelected()); CompoundNBT compound = stack.getOrCreateTag(); this.filter.writeToNBT(compound, "Filter"); compound.putBoolean("AutoInsert", this.autoInsert); } - super.onContainerClosed(player); + super.removed(player); } @Override - public boolean canInteractWith(PlayerEntity player) { - return !this.sack.isEmpty() && player.getHeldItemMainhand() == this.sack; + public boolean stillValid(PlayerEntity player) { + return !this.sack.isEmpty() && player.getMainHandItem() == this.sack; } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBioReactor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBioReactor.java index 796852f6d..894f042d6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBioReactor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBioReactor.java @@ -26,7 +26,7 @@ public class ContainerBioReactor extends Container { public final TileEntityBioReactor tile; public static ContainerBioReactor fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { - return new ContainerBioReactor(windowId, inv, (TileEntityBioReactor) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos()))); + return new ContainerBioReactor(windowId, inv, (TileEntityBioReactor) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } public ContainerBioReactor(int windowId, PlayerInventory inventory, TileEntityBioReactor tile) { @@ -51,43 +51,43 @@ public class ContainerBioReactor extends Container { } @Override - public ItemStack transferStackInSlot(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(PlayerEntity player, int slot) { int inventoryStart = 8; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; int hotbarEnd = hotbarStart + 8; - Slot theSlot = this.inventorySlots.get(slot); + Slot theSlot = this.slots.get(slot); - if (theSlot != null && theSlot.getHasStack()) { - ItemStack newStack = theSlot.getStack(); + if (theSlot != null && theSlot.hasItem()) { + ItemStack newStack = theSlot.getItem(); ItemStack currentStack = newStack.copy(); //Other Slots in Inventory excluded if (slot >= inventoryStart) { //Shift from Inventory if (TileEntityBioReactor.isValidItem(newStack)) { - if (!this.mergeItemStack(newStack, 0, 8, false)) { + if (!this.moveItemStackTo(newStack, 0, 8, false)) { return StackUtil.getEmpty(); } } // else if (slot >= inventoryStart && slot <= inventoryEnd) { - if (!this.mergeItemStack(newStack, hotbarStart, hotbarEnd + 1, false)) { + if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd + 1, false)) { + } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, false)) { + } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } if (!StackUtil.isValid(newStack)) { - theSlot.putStack(StackUtil.getEmpty()); + theSlot.set(StackUtil.getEmpty()); } else { - theSlot.onSlotChanged(); + theSlot.setChanged(); } if (newStack.getCount() == currentStack.getCount()) { @@ -101,7 +101,7 @@ public class ContainerBioReactor extends Container { } @Override - public boolean canInteractWith(PlayerEntity player) { + public boolean stillValid(PlayerEntity player) { return this.tile.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBreaker.java index a6befe650..db9d5f45c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerBreaker.java @@ -27,7 +27,7 @@ public class ContainerBreaker extends Container { public final TileEntityBreaker breaker; public static ContainerBreaker fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { - return new ContainerBreaker(windowId, inv, (TileEntityBreaker) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos()))); + return new ContainerBreaker(windowId, inv, (TileEntityBreaker) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } public ContainerBreaker(int windowId, PlayerInventory inventory, TileEntityBreaker tile) { @@ -52,39 +52,39 @@ public class ContainerBreaker extends Container { } @Override - public ItemStack transferStackInSlot(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(PlayerEntity player, int slot) { int inventoryStart = 9; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; int hotbarEnd = hotbarStart + 8; - Slot theSlot = this.inventorySlots.get(slot); + Slot theSlot = this.slots.get(slot); - if (theSlot != null && theSlot.getHasStack()) { - ItemStack newStack = theSlot.getStack(); + if (theSlot != null && theSlot.hasItem()) { + ItemStack newStack = theSlot.getItem(); ItemStack currentStack = newStack.copy(); //Other Slots in Inventory excluded if (slot >= inventoryStart) { //Shift from Inventory - if (!this.mergeItemStack(newStack, 0, 9, false)) { + if (!this.moveItemStackTo(newStack, 0, 9, false)) { // if (slot >= inventoryStart && slot <= inventoryEnd) { - if (!this.mergeItemStack(newStack, hotbarStart, hotbarEnd + 1, false)) { + if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd + 1, false)) { + } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { return StackUtil.getEmpty(); } } - } else if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, false)) { + } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } if (!StackUtil.isValid(newStack)) { - theSlot.putStack(StackUtil.getEmpty()); + theSlot.set(StackUtil.getEmpty()); } else { - theSlot.onSlotChanged(); + theSlot.setChanged(); } if (newStack.getCount() == currentStack.getCount()) { @@ -98,7 +98,7 @@ public class ContainerBreaker extends Container { } @Override - public boolean canInteractWith(PlayerEntity player) { + public boolean stillValid(PlayerEntity player) { return this.breaker.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCanolaPress.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCanolaPress.java index ebb0e28ed..00f940888 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCanolaPress.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCanolaPress.java @@ -28,7 +28,7 @@ public class ContainerCanolaPress extends Container { public final TileEntityCanolaPress press; public static ContainerCanolaPress fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { - return new ContainerCanolaPress(windowId, inv, (TileEntityCanolaPress) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos()))); + return new ContainerCanolaPress(windowId, inv, (TileEntityCanolaPress) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } public ContainerCanolaPress(int windowId, PlayerInventory inventory, TileEntityCanolaPress tile) { @@ -48,43 +48,43 @@ public class ContainerCanolaPress extends Container { } @Override - public ItemStack transferStackInSlot(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(PlayerEntity player, int slot) { int inventoryStart = 1; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; int hotbarEnd = hotbarStart + 8; - Slot theSlot = this.inventorySlots.get(slot); + Slot theSlot = this.slots.get(slot); - if (theSlot != null && theSlot.getHasStack()) { - ItemStack newStack = theSlot.getStack(); + if (theSlot != null && theSlot.hasItem()) { + ItemStack newStack = theSlot.getItem(); ItemStack currentStack = newStack.copy(); //Other Slots in Inventory excluded if (slot >= inventoryStart) { //Shift from Inventory if (newStack.getItem() == ActuallyItems.CANOLA.get()) { - if (!this.mergeItemStack(newStack, 0, 1, false)) { + if (!this.moveItemStackTo(newStack, 0, 1, false)) { return StackUtil.getEmpty(); } } // else if (slot >= inventoryStart && slot <= inventoryEnd) { - if (!this.mergeItemStack(newStack, hotbarStart, hotbarEnd + 1, false)) { + if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd + 1, false)) { + } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, false)) { + } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } if (!StackUtil.isValid(newStack)) { - theSlot.putStack(StackUtil.getEmpty()); + theSlot.set(StackUtil.getEmpty()); } else { - theSlot.onSlotChanged(); + theSlot.setChanged(); } if (newStack.getCount() == currentStack.getCount()) { @@ -98,7 +98,7 @@ public class ContainerCanolaPress extends Container { } @Override - public boolean canInteractWith(PlayerEntity player) { + public boolean stillValid(PlayerEntity player) { return this.press.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCoalGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCoalGenerator.java index 6dac5ac15..e0447d015 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCoalGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCoalGenerator.java @@ -28,7 +28,7 @@ public class ContainerCoalGenerator extends Container { public final TileEntityCoalGenerator generator; public static ContainerCoalGenerator fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { - return new ContainerCoalGenerator(windowId, inv, (TileEntityCoalGenerator) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos()))); + return new ContainerCoalGenerator(windowId, inv, (TileEntityCoalGenerator) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } public ContainerCoalGenerator(int windowId, PlayerInventory inventory, TileEntityCoalGenerator tile) { @@ -48,43 +48,43 @@ public class ContainerCoalGenerator extends Container { } @Override - public ItemStack transferStackInSlot(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(PlayerEntity player, int slot) { int inventoryStart = 1; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; int hotbarEnd = hotbarStart + 8; - Slot theSlot = this.inventorySlots.get(slot); + Slot theSlot = this.slots.get(slot); - if (theSlot != null && theSlot.getHasStack()) { - ItemStack newStack = theSlot.getStack(); + if (theSlot != null && theSlot.hasItem()) { + ItemStack newStack = theSlot.getItem(); ItemStack currentStack = newStack.copy(); //Other Slots in Inventory excluded if (slot >= inventoryStart) { //Shift from Inventory if (ForgeHooks.getBurnTime(newStack) > 0) { - if (!this.mergeItemStack(newStack, 0, 1, false)) { + if (!this.moveItemStackTo(newStack, 0, 1, false)) { return StackUtil.getEmpty(); } } // else if (slot >= inventoryStart && slot <= inventoryEnd) { - if (!this.mergeItemStack(newStack, hotbarStart, hotbarEnd + 1, false)) { + if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd + 1, false)) { + } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, false)) { + } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } if (!StackUtil.isValid(newStack)) { - theSlot.putStack(StackUtil.getEmpty()); + theSlot.set(StackUtil.getEmpty()); } else { - theSlot.onSlotChanged(); + theSlot.setChanged(); } if (newStack.getCount() == currentStack.getCount()) { @@ -98,7 +98,7 @@ public class ContainerCoalGenerator extends Container { } @Override - public boolean canInteractWith(PlayerEntity player) { + public boolean stillValid(PlayerEntity player) { return this.generator.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCoffeeMachine.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCoffeeMachine.java index 1db102237..a96b063a7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCoffeeMachine.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCoffeeMachine.java @@ -31,7 +31,7 @@ public class ContainerCoffeeMachine extends Container { public final TileEntityCoffeeMachine machine; public static ContainerCoffeeMachine fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { - return new ContainerCoffeeMachine(windowId, inv, (TileEntityCoffeeMachine) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos()))); + return new ContainerCoffeeMachine(windowId, inv, (TileEntityCoffeeMachine) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } public ContainerCoffeeMachine(int windowId, PlayerInventory inventory, TileEntityCoffeeMachine tile) { @@ -59,58 +59,58 @@ public class ContainerCoffeeMachine extends Container { } @Override - public ItemStack transferStackInSlot(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(PlayerEntity player, int slot) { int inventoryStart = 11; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; int hotbarEnd = hotbarStart + 8; - Slot theSlot = this.inventorySlots.get(slot); + Slot theSlot = this.slots.get(slot); - if (theSlot != null && theSlot.getHasStack()) { - ItemStack newStack = theSlot.getStack(); + if (theSlot != null && theSlot.hasItem()) { + ItemStack newStack = theSlot.getItem(); ItemStack currentStack = newStack.copy(); //Slots in Inventory to shift from if (slot == TileEntityCoffeeMachine.SLOT_OUTPUT) { - if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, true)) { + if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, true)) { return StackUtil.getEmpty(); } - theSlot.onSlotChange(newStack, currentStack); + theSlot.onQuickCraft(newStack, currentStack); } //Other Slots in Inventory excluded else if (slot >= inventoryStart) { //Shift from Inventory if (newStack.getItem() == ActuallyItems.COFFEE_CUP.get()) { - if (!this.mergeItemStack(newStack, TileEntityCoffeeMachine.SLOT_INPUT, TileEntityCoffeeMachine.SLOT_INPUT + 1, false)) { + if (!this.moveItemStackTo(newStack, TileEntityCoffeeMachine.SLOT_INPUT, TileEntityCoffeeMachine.SLOT_INPUT + 1, false)) { return StackUtil.getEmpty(); } } else if (ItemCoffee.getIngredientFromStack(newStack) != null) { - if (!this.mergeItemStack(newStack, 3, 11, false)) { + if (!this.moveItemStackTo(newStack, 3, 11, false)) { return StackUtil.getEmpty(); } } else if (ActuallyTags.Items.COFFEE_BEANS.contains(newStack.getItem())) { - if (!this.mergeItemStack(newStack, TileEntityCoffeeMachine.SLOT_COFFEE_BEANS, TileEntityCoffeeMachine.SLOT_COFFEE_BEANS + 1, false)) { + if (!this.moveItemStackTo(newStack, TileEntityCoffeeMachine.SLOT_COFFEE_BEANS, TileEntityCoffeeMachine.SLOT_COFFEE_BEANS + 1, false)) { return StackUtil.getEmpty(); } } // else if (slot >= inventoryStart && slot <= inventoryEnd) { - if (!this.mergeItemStack(newStack, hotbarStart, hotbarEnd + 1, false)) { + if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd + 1, false)) { + } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, false)) { + } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } if (!StackUtil.isValid(newStack)) { - theSlot.putStack(StackUtil.getEmpty()); + theSlot.set(StackUtil.getEmpty()); } else { - theSlot.onSlotChanged(); + theSlot.setChanged(); } if (newStack.getCount() == currentStack.getCount()) { @@ -124,7 +124,7 @@ public class ContainerCoffeeMachine extends Container { } @Override - public boolean canInteractWith(PlayerEntity player) { + public boolean stillValid(PlayerEntity player) { return this.machine.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDirectionalBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDirectionalBreaker.java index f6f9158f9..6d71a524e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDirectionalBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDirectionalBreaker.java @@ -27,7 +27,7 @@ public class ContainerDirectionalBreaker extends Container { public final TileEntityDirectionalBreaker breaker; public static ContainerDirectionalBreaker fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { - return new ContainerDirectionalBreaker(windowId, inv, (TileEntityDirectionalBreaker) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos()))); + return new ContainerDirectionalBreaker(windowId, inv, (TileEntityDirectionalBreaker) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } public ContainerDirectionalBreaker(int windowId, PlayerInventory inventory, TileEntityDirectionalBreaker tile) { @@ -51,39 +51,39 @@ public class ContainerDirectionalBreaker extends Container { } @Override - public ItemStack transferStackInSlot(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(PlayerEntity player, int slot) { int inventoryStart = 9; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; int hotbarEnd = hotbarStart + 8; - Slot theSlot = this.inventorySlots.get(slot); + Slot theSlot = this.slots.get(slot); - if (theSlot != null && theSlot.getHasStack()) { - ItemStack newStack = theSlot.getStack(); + if (theSlot != null && theSlot.hasItem()) { + ItemStack newStack = theSlot.getItem(); ItemStack currentStack = newStack.copy(); //Other Slots in Inventory excluded if (slot >= inventoryStart) { //Shift from Inventory - if (!this.mergeItemStack(newStack, 0, 9, false)) { + if (!this.moveItemStackTo(newStack, 0, 9, false)) { // if (slot >= inventoryStart && slot <= inventoryEnd) { - if (!this.mergeItemStack(newStack, hotbarStart, hotbarEnd + 1, false)) { + if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd + 1, false)) { + } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { return StackUtil.getEmpty(); } } - } else if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, false)) { + } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } if (!StackUtil.isValid(newStack)) { - theSlot.putStack(StackUtil.getEmpty()); + theSlot.set(StackUtil.getEmpty()); } else { - theSlot.onSlotChanged(); + theSlot.setChanged(); } if (newStack.getCount() == currentStack.getCount()) { @@ -97,7 +97,7 @@ public class ContainerDirectionalBreaker extends Container { } @Override - public boolean canInteractWith(PlayerEntity player) { + public boolean stillValid(PlayerEntity player) { return this.breaker.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDrill.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDrill.java index 47fe222c0..77b887a2a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDrill.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDrill.java @@ -42,7 +42,7 @@ public class ContainerDrill extends Container { for (int i = 0; i < SLOT_AMOUNT; i++) { this.addSlot(new SlotItemHandlerUnconditioned(this.drillInventory, i, 44 + i * 18, 19) { @Override - public boolean isItemValid(ItemStack stack) { + public boolean mayPlace(ItemStack stack) { return stack.getItem() instanceof ItemDrillUpgrade; } }); @@ -54,57 +54,57 @@ public class ContainerDrill extends Container { } } for (int i = 0; i < 9; i++) { - if (i == inventory.currentItem) { + if (i == inventory.selected) { this.addSlot(new SlotImmovable(inventory, i, 8 + i * 18, 116)); } else { this.addSlot(new Slot(inventory, i, 8 + i * 18, 116)); } } - ItemStack stack = inventory.getCurrentItem(); + ItemStack stack = inventory.getSelected(); if (StackUtil.isValid(stack) && stack.getItem() instanceof ItemDrill) { - ItemDrill.loadSlotsFromNBT(this.drillInventory, inventory.getCurrentItem()); + ItemDrill.loadSlotsFromNBT(this.drillInventory, inventory.getSelected()); } } @Override - public ItemStack transferStackInSlot(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(PlayerEntity player, int slot) { int inventoryStart = 5; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; int hotbarEnd = hotbarStart + 8; - Slot theSlot = this.inventorySlots.get(slot); + Slot theSlot = this.slots.get(slot); - if (theSlot != null && theSlot.getHasStack()) { - ItemStack newStack = theSlot.getStack(); + if (theSlot != null && theSlot.hasItem()) { + ItemStack newStack = theSlot.getItem(); ItemStack currentStack = newStack.copy(); //Other Slots in Inventory excluded if (slot >= inventoryStart) { //Shift from Inventory if (newStack.getItem() instanceof ItemDrillUpgrade) { - if (!this.mergeItemStack(newStack, 0, 5, false)) { + if (!this.moveItemStackTo(newStack, 0, 5, false)) { return StackUtil.getEmpty(); } } // else if (slot >= inventoryStart && slot <= inventoryEnd) { - if (!this.mergeItemStack(newStack, hotbarStart, hotbarEnd + 1, false)) { + if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd + 1, false)) { + } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, false)) { + } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } if (!StackUtil.isValid(newStack)) { - theSlot.putStack(StackUtil.getEmpty()); + theSlot.set(StackUtil.getEmpty()); } else { - theSlot.onSlotChanged(); + theSlot.setChanged(); } if (newStack.getCount() == currentStack.getCount()) { @@ -118,25 +118,25 @@ public class ContainerDrill extends Container { } @Override - public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) { - if (clickTypeIn == ClickType.SWAP && dragType == this.inventory.currentItem) { + public ItemStack clicked(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) { + if (clickTypeIn == ClickType.SWAP && dragType == this.inventory.selected) { return ItemStack.EMPTY; } else { - return super.slotClick(slotId, dragType, clickTypeIn, player); + return super.clicked(slotId, dragType, clickTypeIn, player); } } @Override - public void onContainerClosed(PlayerEntity player) { - ItemStack stack = this.inventory.getCurrentItem(); + public void removed(PlayerEntity player) { + ItemStack stack = this.inventory.getSelected(); if (StackUtil.isValid(stack) && stack.getItem() instanceof ItemDrill) { - ItemDrill.writeSlotsToNBT(this.drillInventory, this.inventory.getCurrentItem()); + ItemDrill.writeSlotsToNBT(this.drillInventory, this.inventory.getSelected()); } - super.onContainerClosed(player); + super.removed(player); } @Override - public boolean canInteractWith(PlayerEntity player) { + public boolean stillValid(PlayerEntity player) { return true; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDropper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDropper.java index b9f82f82a..9f5aee685 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDropper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDropper.java @@ -29,7 +29,7 @@ public class ContainerDropper extends Container { PlayerEntity player; public static ContainerDropper fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { - return new ContainerDropper(windowId, inv, (TileEntityDropper) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos()))); + return new ContainerDropper(windowId, inv, (TileEntityDropper) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } public ContainerDropper(int windowId, PlayerInventory inventory, TileEntityDropper tile) { @@ -54,39 +54,39 @@ public class ContainerDropper extends Container { } @Override - public ItemStack transferStackInSlot(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(PlayerEntity player, int slot) { int inventoryStart = 9; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; int hotbarEnd = hotbarStart + 8; - Slot theSlot = this.inventorySlots.get(slot); + Slot theSlot = this.slots.get(slot); - if (theSlot != null && theSlot.getHasStack()) { - ItemStack newStack = theSlot.getStack(); + if (theSlot != null && theSlot.hasItem()) { + ItemStack newStack = theSlot.getItem(); ItemStack currentStack = newStack.copy(); //Other Slots in Inventory excluded if (slot >= inventoryStart) { //Shift from Inventory - if (!this.mergeItemStack(newStack, 0, 9, false)) { + if (!this.moveItemStackTo(newStack, 0, 9, false)) { // if (slot >= inventoryStart && slot <= inventoryEnd) { - if (!this.mergeItemStack(newStack, hotbarStart, hotbarEnd + 1, false)) { + if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd + 1, false)) { + } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { return StackUtil.getEmpty(); } } - } else if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, false)) { + } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } if (!StackUtil.isValid(newStack)) { - theSlot.putStack(StackUtil.getEmpty()); + theSlot.set(StackUtil.getEmpty()); } else { - theSlot.onSlotChanged(); + theSlot.setChanged(); } if (newStack.getCount() == currentStack.getCount()) { @@ -100,15 +100,15 @@ public class ContainerDropper extends Container { } @Override - public boolean canInteractWith(PlayerEntity player) { + public boolean stillValid(PlayerEntity player) { return this.dropper.canPlayerUse(player); } @Override - public void onContainerClosed(PlayerEntity playerIn) { - super.onContainerClosed(playerIn); + public void removed(PlayerEntity playerIn) { + super.removed(playerIn); if (!this.player.isSpectator()) { - this.dropper.getWorld().notifyNeighborsOfStateChange(this.dropper.getPos(), ActuallyBlocks.DROPPER.get()); + this.dropper.getLevel().updateNeighborsAt(this.dropper.getBlockPos(), ActuallyBlocks.DROPPER.get()); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnergizer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnergizer.java index 7741dfc94..185f8a918 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnergizer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnergizer.java @@ -33,7 +33,7 @@ public class ContainerEnergizer extends Container { public final TileEntityEnergizer energizer; public static ContainerEnergizer fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { - return new ContainerEnergizer(windowId, inv, (TileEntityEnergizer) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos()))); + return new ContainerEnergizer(windowId, inv, (TileEntityEnergizer) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } public ContainerEnergizer(int windowId, PlayerInventory inventory, TileEntityEnergizer tile) { @@ -42,8 +42,8 @@ public class ContainerEnergizer extends Container { this.addSlot(new SlotItemHandlerUnconditioned(this.energizer.inv, 0, 76, 73) { @Override - public boolean isItemValid(ItemStack stack) { - return super.isItemValid(stack) && stack.getCapability(CapabilityEnergy.ENERGY, null).isPresent(); + public boolean mayPlace(ItemStack stack) { + return super.mayPlace(stack) && stack.getCapability(CapabilityEnergy.ENERGY, null).isPresent(); } }); this.addSlot(new SlotOutput(this.energizer.inv, 1, 76, 42)); @@ -61,19 +61,19 @@ public class ContainerEnergizer extends Container { EquipmentSlotType slot = VALID_EQUIPMENT_SLOTS[k]; this.addSlot(new Slot(inventory, 36 + 3 - k, 102, 19 + k * 18) { @Override - public int getSlotStackLimit() { + public int getMaxStackSize() { return 1; } @Override - public boolean isItemValid(ItemStack stack) { + public boolean mayPlace(ItemStack stack) { return StackUtil.isValid(stack) && stack.getItem() instanceof ArmorItem; } @Override - public boolean canTakeStack(PlayerEntity player) { - ItemStack itemstack = this.getStack(); - return (itemstack.isEmpty() || player.isCreative() || !EnchantmentHelper.hasBindingCurse(itemstack)) && super.canTakeStack(player); + public boolean mayPickup(PlayerEntity player) { + ItemStack itemstack = this.getItem(); + return (itemstack.isEmpty() || player.isCreative() || !EnchantmentHelper.hasBindingCurse(itemstack)) && super.mayPickup(player); } // TODO: [port] add back @@ -88,50 +88,50 @@ public class ContainerEnergizer extends Container { } @Override - public ItemStack transferStackInSlot(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(PlayerEntity player, int slot) { int inventoryStart = 2; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; int hotbarEnd = hotbarStart + 8; - Slot theSlot = this.inventorySlots.get(slot); + Slot theSlot = this.slots.get(slot); - if (theSlot != null && theSlot.getHasStack()) { - ItemStack newStack = theSlot.getStack(); + if (theSlot != null && theSlot.hasItem()) { + ItemStack newStack = theSlot.getItem(); ItemStack currentStack = newStack.copy(); //Slots in Inventory to shift from if (slot == 1) { - if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, true)) { + if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, true)) { return StackUtil.getEmpty(); } - theSlot.onSlotChange(newStack, currentStack); + theSlot.onQuickCraft(newStack, currentStack); } //Other Slots in Inventory excluded else if (slot >= inventoryStart) { //Shift from Inventory if (newStack.getCapability(CapabilityEnergy.ENERGY, null).isPresent()) { - if (!this.mergeItemStack(newStack, 0, 1, false)) { + if (!this.moveItemStackTo(newStack, 0, 1, false)) { return StackUtil.getEmpty(); } } // else if (slot >= inventoryStart && slot <= inventoryEnd) { - if (!this.mergeItemStack(newStack, hotbarStart, hotbarEnd + 1, false)) { + if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd + 1, false)) { + } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, false)) { + } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } if (!StackUtil.isValid(newStack)) { - theSlot.putStack(StackUtil.getEmpty()); + theSlot.set(StackUtil.getEmpty()); } else { - theSlot.onSlotChanged(); + theSlot.setChanged(); } if (newStack.getCount() == currentStack.getCount()) { @@ -145,7 +145,7 @@ public class ContainerEnergizer extends Container { } @Override - public boolean canInteractWith(PlayerEntity player) { + public boolean stillValid(PlayerEntity player) { return this.energizer.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnervator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnervator.java index 20969abce..947422b7f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnervator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnervator.java @@ -31,7 +31,7 @@ public class ContainerEnervator extends Container { public final TileEntityEnervator enervator; public static ContainerEnervator fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { - return new ContainerEnervator(windowId, inv, (TileEntityEnervator) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos()))); + return new ContainerEnervator(windowId, inv, (TileEntityEnervator) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } public ContainerEnervator(int windowId, PlayerInventory inventory, TileEntityEnervator tile) { @@ -54,13 +54,13 @@ public class ContainerEnervator extends Container { EquipmentSlotType slot = ContainerEnergizer.VALID_EQUIPMENT_SLOTS[k]; this.addSlot(new Slot(inventory, 36 + 3 - k, 102, 19 + k * 18) { @Override - public int getSlotStackLimit() { + public int getMaxStackSize() { return 1; } // TODO: [port] validate that this is correct @Override - public boolean isItemValid(ItemStack stack) { + public boolean mayPlace(ItemStack stack) { return StackUtil.isValid(stack) && stack.getItem() instanceof ArmorItem; } @@ -76,50 +76,50 @@ public class ContainerEnervator extends Container { } @Override - public ItemStack transferStackInSlot(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(PlayerEntity player, int slot) { int inventoryStart = 2; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; int hotbarEnd = hotbarStart + 8; - Slot theSlot = this.inventorySlots.get(slot); + Slot theSlot = this.slots.get(slot); - if (theSlot != null && theSlot.getHasStack()) { - ItemStack newStack = theSlot.getStack(); + if (theSlot != null && theSlot.hasItem()) { + ItemStack newStack = theSlot.getItem(); ItemStack currentStack = newStack.copy(); //Slots in Inventory to shift from if (slot == 1) { - if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, true)) { + if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, true)) { return StackUtil.getEmpty(); } - theSlot.onSlotChange(newStack, currentStack); + theSlot.onQuickCraft(newStack, currentStack); } //Other Slots in Inventory excluded else if (slot >= inventoryStart) { //Shift from Inventory if (newStack.getCapability(CapabilityEnergy.ENERGY).isPresent()) { - if (!this.mergeItemStack(newStack, 0, 1, false)) { + if (!this.moveItemStackTo(newStack, 0, 1, false)) { return StackUtil.getEmpty(); } } // else if (slot >= inventoryStart && slot <= inventoryEnd) { - if (!this.mergeItemStack(newStack, hotbarStart, hotbarEnd + 1, false)) { + if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd + 1, false)) { + } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, false)) { + } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } if (!StackUtil.isValid(newStack)) { - theSlot.putStack(StackUtil.getEmpty()); + theSlot.set(StackUtil.getEmpty()); } else { - theSlot.onSlotChanged(); + theSlot.setChanged(); } if (newStack.getCount() == currentStack.getCount()) { @@ -133,7 +133,7 @@ public class ContainerEnervator extends Container { } @Override - public boolean canInteractWith(PlayerEntity player) { + public boolean stillValid(PlayerEntity player) { return this.enervator.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFarmer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFarmer.java index 46485bee2..e44b7b801 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFarmer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFarmer.java @@ -27,7 +27,7 @@ public class ContainerFarmer extends Container { public final TileEntityFarmer farmer; public static ContainerFarmer fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { - return new ContainerFarmer(windowId, inv, (TileEntityFarmer) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos()))); + return new ContainerFarmer(windowId, inv, (TileEntityFarmer) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } public ContainerFarmer(int windowId, PlayerInventory inventory, TileEntityFarmer tile) { @@ -56,39 +56,39 @@ public class ContainerFarmer extends Container { } @Override - public ItemStack transferStackInSlot(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(PlayerEntity player, int slot) { int inventoryStart = 12; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; int hotbarEnd = hotbarStart + 8; - Slot theSlot = this.inventorySlots.get(slot); + Slot theSlot = this.slots.get(slot); - if (theSlot != null && theSlot.getHasStack()) { - ItemStack newStack = theSlot.getStack(); + if (theSlot != null && theSlot.hasItem()) { + ItemStack newStack = theSlot.getItem(); ItemStack currentStack = newStack.copy(); //Other Slots in Inventory excluded if (slot >= inventoryStart) { //Shift from Inventory - if (!this.mergeItemStack(newStack, 0, 6, false)) { + if (!this.moveItemStackTo(newStack, 0, 6, false)) { // if (slot >= inventoryStart && slot <= inventoryEnd) { - if (!this.mergeItemStack(newStack, hotbarStart, hotbarEnd + 1, false)) { + if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd + 1, false)) { + } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { return StackUtil.getEmpty(); } } - } else if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, false)) { + } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } if (!StackUtil.isValid(newStack)) { - theSlot.putStack(StackUtil.getEmpty()); + theSlot.set(StackUtil.getEmpty()); } else { - theSlot.onSlotChanged(); + theSlot.setChanged(); } if (newStack.getCount() == currentStack.getCount()) { @@ -102,7 +102,7 @@ public class ContainerFarmer extends Container { } @Override - public boolean canInteractWith(PlayerEntity player) { + public boolean stillValid(PlayerEntity player) { return this.farmer.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFeeder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFeeder.java index 230fe06be..7d5b2a178 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFeeder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFeeder.java @@ -27,7 +27,7 @@ public class ContainerFeeder extends Container { public final TileEntityFeeder feeder; public static ContainerFeeder fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { - return new ContainerFeeder(windowId, inv, (TileEntityFeeder) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos()))); + return new ContainerFeeder(windowId, inv, (TileEntityFeeder) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } public ContainerFeeder(int windowId, PlayerInventory inventory, TileEntityFeeder tile) { @@ -46,39 +46,39 @@ public class ContainerFeeder extends Container { } @Override - public ItemStack transferStackInSlot(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(PlayerEntity player, int slot) { int inventoryStart = 1; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; int hotbarEnd = hotbarStart + 8; - Slot theSlot = this.inventorySlots.get(slot); + Slot theSlot = this.slots.get(slot); - if (theSlot != null && theSlot.getHasStack()) { - ItemStack newStack = theSlot.getStack(); + if (theSlot != null && theSlot.hasItem()) { + ItemStack newStack = theSlot.getItem(); ItemStack currentStack = newStack.copy(); //Other Slots in Inventory excluded if (slot >= inventoryStart) { //Shift from Inventory - if (!this.mergeItemStack(newStack, 0, 1, false)) { + if (!this.moveItemStackTo(newStack, 0, 1, false)) { // if (slot >= inventoryStart && slot <= inventoryEnd) { - if (!this.mergeItemStack(newStack, hotbarStart, hotbarEnd + 1, false)) { + if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd + 1, false)) { + } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { return StackUtil.getEmpty(); } } - } else if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, false)) { + } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } if (!StackUtil.isValid(newStack)) { - theSlot.putStack(StackUtil.getEmpty()); + theSlot.set(StackUtil.getEmpty()); } else { - theSlot.onSlotChanged(); + theSlot.setChanged(); } if (newStack.getCount() == currentStack.getCount()) { @@ -92,7 +92,7 @@ public class ContainerFeeder extends Container { } @Override - public boolean canInteractWith(PlayerEntity player) { + public boolean stillValid(PlayerEntity player) { return this.feeder.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFermentingBarrel.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFermentingBarrel.java index 30e07e601..17b3a771a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFermentingBarrel.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFermentingBarrel.java @@ -26,7 +26,7 @@ public class ContainerFermentingBarrel extends Container { public final TileEntityFermentingBarrel barrel; public static ContainerFermentingBarrel fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { - return new ContainerFermentingBarrel(windowId, inv, (TileEntityFermentingBarrel) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos()))); + return new ContainerFermentingBarrel(windowId, inv, (TileEntityFermentingBarrel) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } public ContainerFermentingBarrel(int windowId, PlayerInventory inventory, TileEntityFermentingBarrel tile) { @@ -44,35 +44,35 @@ public class ContainerFermentingBarrel extends Container { } @Override - public ItemStack transferStackInSlot(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(PlayerEntity player, int slot) { int inventoryStart = 0; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; int hotbarEnd = hotbarStart + 8; - Slot theSlot = this.inventorySlots.get(slot); + Slot theSlot = this.slots.get(slot); - if (theSlot != null && theSlot.getHasStack()) { - ItemStack newStack = theSlot.getStack(); + if (theSlot != null && theSlot.hasItem()) { + ItemStack newStack = theSlot.getItem(); ItemStack currentStack = newStack.copy(); //Other Slots in Inventory excluded if (slot >= inventoryStart) { if (slot >= inventoryStart && slot <= inventoryEnd) { - if (!this.mergeItemStack(newStack, hotbarStart, hotbarEnd + 1, false)) { + if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd + 1, false)) { + } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, false)) { + } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } if (!StackUtil.isValid(newStack)) { - theSlot.putStack(StackUtil.getEmpty()); + theSlot.set(StackUtil.getEmpty()); } else { - theSlot.onSlotChanged(); + theSlot.setChanged(); } if (newStack.getCount() == currentStack.getCount()) { @@ -86,7 +86,7 @@ public class ContainerFermentingBarrel extends Container { } @Override - public boolean canInteractWith(PlayerEntity player) { + public boolean stillValid(PlayerEntity player) { return this.barrel.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFilter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFilter.java index 28e0831bb..09893c47c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFilter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFilter.java @@ -50,30 +50,30 @@ public class ContainerFilter extends Container { } } for (int i = 0; i < 9; i++) { - if (i == inventory.currentItem) { + if (i == inventory.selected) { this.addSlot(new SlotImmovable(inventory, i, 8 + i * 18, 152)); } else { this.addSlot(new Slot(inventory, i, 8 + i * 18, 152)); } } - ItemStack stack = inventory.getCurrentItem(); + ItemStack stack = inventory.getSelected(); if (SlotFilter.isFilter(stack)) { - ItemDrill.loadSlotsFromNBT(this.filterInventory, inventory.getCurrentItem()); + ItemDrill.loadSlotsFromNBT(this.filterInventory, inventory.getSelected()); } } @Override - public ItemStack transferStackInSlot(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(PlayerEntity player, int slot) { int inventoryStart = SLOT_AMOUNT; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; int hotbarEnd = hotbarStart + 8; - Slot theSlot = this.inventorySlots.get(slot); + Slot theSlot = this.slots.get(slot); - if (theSlot != null && theSlot.getHasStack()) { - ItemStack newStack = theSlot.getStack(); + if (theSlot != null && theSlot.hasItem()) { + ItemStack newStack = theSlot.getItem(); ItemStack currentStack = newStack.copy(); //Other Slots in Inventory excluded @@ -81,20 +81,20 @@ public class ContainerFilter extends Container { //Shift from Inventory // if (slot >= inventoryStart && slot <= inventoryEnd) { - if (!this.mergeItemStack(newStack, hotbarStart, hotbarEnd + 1, false)) { + if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd + 1, false)) { + } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, false)) { + } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } if (!StackUtil.isValid(newStack)) { - theSlot.putStack(StackUtil.getEmpty()); + theSlot.set(StackUtil.getEmpty()); } else { - theSlot.onSlotChanged(); + theSlot.setChanged(); } if (newStack.getCount() == currentStack.getCount()) { @@ -108,27 +108,27 @@ public class ContainerFilter extends Container { } @Override - public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) { + public ItemStack clicked(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) { if (SlotFilter.checkFilter(this, slotId, player)) { return StackUtil.getEmpty(); - } else if (clickTypeIn == ClickType.SWAP && dragType == this.inventory.currentItem) { + } else if (clickTypeIn == ClickType.SWAP && dragType == this.inventory.selected) { return ItemStack.EMPTY; } else { - return super.slotClick(slotId, dragType, clickTypeIn, player); + return super.clicked(slotId, dragType, clickTypeIn, player); } } @Override - public void onContainerClosed(PlayerEntity player) { - ItemStack stack = this.inventory.getCurrentItem(); + public void removed(PlayerEntity player) { + ItemStack stack = this.inventory.getSelected(); if (SlotFilter.isFilter(stack)) { - ItemDrill.writeSlotsToNBT(this.filterInventory, this.inventory.getCurrentItem()); + ItemDrill.writeSlotsToNBT(this.filterInventory, this.inventory.getSelected()); } - super.onContainerClosed(player); + super.removed(player); } @Override - public boolean canInteractWith(PlayerEntity player) { + public boolean stillValid(PlayerEntity player) { return true; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFireworkBox.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFireworkBox.java index 852ca08ca..6786b3c39 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFireworkBox.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFireworkBox.java @@ -27,12 +27,12 @@ public class ContainerFireworkBox extends Container { } @Override - public ItemStack transferStackInSlot(PlayerEntity playerIn, int index) { + public ItemStack quickMoveStack(PlayerEntity playerIn, int index) { return ItemStack.EMPTY; } @Override - public boolean canInteractWith(PlayerEntity playerIn) { + public boolean stillValid(PlayerEntity playerIn) { return true; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFluidCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFluidCollector.java index 9e847334c..e379c445a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFluidCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFluidCollector.java @@ -26,7 +26,7 @@ public class ContainerFluidCollector extends Container { public final TileEntityFluidCollector collector; public static ContainerFluidCollector fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { - return new ContainerFluidCollector(windowId, inv, (TileEntityFluidCollector) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos()))); + return new ContainerFluidCollector(windowId, inv, (TileEntityFluidCollector) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } public ContainerFluidCollector(int windowId, PlayerInventory inventory, TileEntityFluidCollector tile) { @@ -44,42 +44,42 @@ public class ContainerFluidCollector extends Container { } @Override - public ItemStack transferStackInSlot(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(PlayerEntity player, int slot) { int inventoryStart = 0; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; int hotbarEnd = hotbarStart + 8; - Slot theSlot = this.inventorySlots.get(slot); + Slot theSlot = this.slots.get(slot); - if (theSlot != null && theSlot.getHasStack()) { - ItemStack newStack = theSlot.getStack(); + if (theSlot != null && theSlot.hasItem()) { + ItemStack newStack = theSlot.getItem(); ItemStack currentStack = newStack.copy(); //Slots in Inventory to shift from if (slot == 1) { - if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, true)) { + if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, true)) { return StackUtil.getEmpty(); } - theSlot.onSlotChange(newStack, currentStack); + theSlot.onQuickCraft(newStack, currentStack); } //Other Slots in Inventory excluded else if (slot >= inventoryStart) { if (slot >= inventoryStart && slot <= inventoryEnd) { - if (!this.mergeItemStack(newStack, hotbarStart, hotbarEnd + 1, false)) { + if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd + 1, false)) { + } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, false)) { + } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } if (!StackUtil.isValid(newStack)) { - theSlot.putStack(StackUtil.getEmpty()); + theSlot.set(StackUtil.getEmpty()); } else { - theSlot.onSlotChanged(); + theSlot.setChanged(); } if (newStack.getCount() == currentStack.getCount()) { @@ -93,7 +93,7 @@ public class ContainerFluidCollector extends Container { } @Override - public boolean canInteractWith(PlayerEntity player) { + public boolean stillValid(PlayerEntity player) { return this.collector.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFurnaceDouble.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFurnaceDouble.java index 1ef6893b2..e61e4a114 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFurnaceDouble.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFurnaceDouble.java @@ -31,7 +31,7 @@ public class ContainerFurnaceDouble extends Container { public final TileEntityFurnaceDouble furnace; public static ContainerFurnaceDouble fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { - return new ContainerFurnaceDouble(windowId, inv, (TileEntityFurnaceDouble) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos()))); + return new ContainerFurnaceDouble(windowId, inv, (TileEntityFurnaceDouble) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } public ContainerFurnaceDouble(int windowId, PlayerInventory inventory, TileEntityFurnaceDouble tile) { @@ -54,39 +54,39 @@ public class ContainerFurnaceDouble extends Container { } @Override - public ItemStack transferStackInSlot(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(PlayerEntity player, int slot) { int inventoryStart = 4; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; int hotbarEnd = hotbarStart + 8; - Slot theSlot = this.inventorySlots.get(slot); + Slot theSlot = this.slots.get(slot); - if (theSlot != null && theSlot.getHasStack()) { - ItemStack newStack = theSlot.getStack(); + if (theSlot != null && theSlot.hasItem()) { + ItemStack newStack = theSlot.getItem(); ItemStack currentStack = newStack.copy(); //Slots in Inventory to shift from if (slot == TileEntityFurnaceDouble.SLOT_OUTPUT_1 || slot == TileEntityFurnaceDouble.SLOT_OUTPUT_2) { - if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, true)) { + if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, true)) { return StackUtil.getEmpty(); } - theSlot.onSlotChange(newStack, currentStack); + theSlot.onQuickCraft(newStack, currentStack); } //Other Slots in Inventory excluded else if (slot >= inventoryStart) { // TODO: VALIDATE - IRecipe irecipe = this.furnace.getWorld().getRecipeManager().getRecipe(IRecipeType.SMELTING, new Inventory(newStack), this.furnace.getWorld()).orElse(null); + IRecipe irecipe = this.furnace.getLevel().getRecipeManager().getRecipeFor(IRecipeType.SMELTING, new Inventory(newStack), this.furnace.getLevel()).orElse(null); if (irecipe == null) { return StackUtil.getEmpty(); } - ItemStack recipeOutput = irecipe.getRecipeOutput(); + ItemStack recipeOutput = irecipe.getResultItem(); //Shift from Inventory if (StackUtil.isValid(recipeOutput)) { - if (!this.mergeItemStack(newStack, TileEntityFurnaceDouble.SLOT_INPUT_1, TileEntityFurnaceDouble.SLOT_INPUT_1 + 1, false)) { - if (!this.mergeItemStack(newStack, TileEntityFurnaceDouble.SLOT_INPUT_2, TileEntityFurnaceDouble.SLOT_INPUT_2 + 1, false)) { + if (!this.moveItemStackTo(newStack, TileEntityFurnaceDouble.SLOT_INPUT_1, TileEntityFurnaceDouble.SLOT_INPUT_1 + 1, false)) { + if (!this.moveItemStackTo(newStack, TileEntityFurnaceDouble.SLOT_INPUT_2, TileEntityFurnaceDouble.SLOT_INPUT_2 + 1, false)) { return StackUtil.getEmpty(); } } @@ -94,20 +94,20 @@ public class ContainerFurnaceDouble extends Container { // else if (slot >= inventoryStart && slot <= inventoryEnd) { - if (!this.mergeItemStack(newStack, hotbarStart, hotbarEnd + 1, false)) { + if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd + 1, false)) { + } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, false)) { + } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } if (!StackUtil.isValid(newStack)) { - theSlot.putStack(StackUtil.getEmpty()); + theSlot.set(StackUtil.getEmpty()); } else { - theSlot.onSlotChanged(); + theSlot.setChanged(); } if (newStack.getCount() == currentStack.getCount()) { @@ -121,7 +121,7 @@ public class ContainerFurnaceDouble extends Container { } @Override - public boolean canInteractWith(PlayerEntity player) { + public boolean stillValid(PlayerEntity player) { return this.furnace.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerGrinder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerGrinder.java index d56a777ac..162424d62 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerGrinder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerGrinder.java @@ -29,7 +29,7 @@ public class ContainerGrinder extends Container { public final boolean isDouble; public static ContainerGrinder fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { - return new ContainerGrinder(windowId, inv, (TileEntityGrinder) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos()))); + return new ContainerGrinder(windowId, inv, (TileEntityGrinder) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } public ContainerGrinder(int windowId, PlayerInventory inventory, TileEntityGrinder tile) { @@ -63,7 +63,7 @@ public class ContainerGrinder extends Container { } @Override - public ItemStack transferStackInSlot(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(PlayerEntity player, int slot) { int inventoryStart = this.isDouble ? 6 : 3; @@ -71,26 +71,26 @@ public class ContainerGrinder extends Container { int hotbarStart = inventoryEnd + 1; int hotbarEnd = hotbarStart + 8; - Slot theSlot = this.inventorySlots.get(slot); + Slot theSlot = this.slots.get(slot); - if (theSlot != null && theSlot.getHasStack()) { - ItemStack newStack = theSlot.getStack(); + if (theSlot != null && theSlot.hasItem()) { + ItemStack newStack = theSlot.getItem(); ItemStack currentStack = newStack.copy(); //Slots in Inventory to shift from if (slot == TileEntityGrinder.SLOT_OUTPUT_1_1 || slot == TileEntityGrinder.SLOT_OUTPUT_1_2 || this.isDouble && (slot == TileEntityGrinder.SLOT_OUTPUT_2_1 || slot == TileEntityGrinder.SLOT_OUTPUT_2_2)) { - if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, true)) { + if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, true)) { return StackUtil.getEmpty(); } - theSlot.onSlotChange(newStack, currentStack); + theSlot.onQuickCraft(newStack, currentStack); } //Other Slots in Inventory excluded else if (slot >= inventoryStart) { //Shift from Inventory if (CrusherRecipeRegistry.getRecipeFromInput(newStack) != null) { - if (!this.mergeItemStack(newStack, TileEntityGrinder.SLOT_INPUT_1, TileEntityGrinder.SLOT_INPUT_1 + 1, false)) { + if (!this.moveItemStackTo(newStack, TileEntityGrinder.SLOT_INPUT_1, TileEntityGrinder.SLOT_INPUT_1 + 1, false)) { if (this.isDouble) { - if (!this.mergeItemStack(newStack, TileEntityGrinder.SLOT_INPUT_2, TileEntityGrinder.SLOT_INPUT_2 + 1, false)) { + if (!this.moveItemStackTo(newStack, TileEntityGrinder.SLOT_INPUT_2, TileEntityGrinder.SLOT_INPUT_2 + 1, false)) { return StackUtil.getEmpty(); } } else { @@ -101,20 +101,20 @@ public class ContainerGrinder extends Container { // else if (slot >= inventoryStart && slot <= inventoryEnd) { - if (!this.mergeItemStack(newStack, hotbarStart, hotbarEnd + 1, false)) { + if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd + 1, false)) { + } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, false)) { + } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } if (!StackUtil.isValid(newStack)) { - theSlot.putStack(StackUtil.getEmpty()); + theSlot.set(StackUtil.getEmpty()); } else { - theSlot.onSlotChanged(); + theSlot.setChanged(); } if (newStack.getCount() == currentStack.getCount()) { @@ -128,7 +128,7 @@ public class ContainerGrinder extends Container { } @Override - public boolean canInteractWith(PlayerEntity player) { + public boolean stillValid(PlayerEntity player) { return this.tileGrinder.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerInputter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerInputter.java index 6e67ecdce..96bee2e45 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerInputter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerInputter.java @@ -30,7 +30,7 @@ public class ContainerInputter extends Container { public final boolean isAdvanced; public static ContainerInputter fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { - return new ContainerInputter(windowId, inv, (TileEntityInputter) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos()))); + return new ContainerInputter(windowId, inv, (TileEntityInputter) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } public ContainerInputter(int windowId, PlayerInventory inventory, TileEntityInputter tile) { @@ -69,7 +69,7 @@ public class ContainerInputter extends Container { } @Override - public ItemStack transferStackInSlot(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(PlayerEntity player, int slot) { int inventoryStart = this.isAdvanced ? 25 : 1; @@ -77,33 +77,33 @@ public class ContainerInputter extends Container { int hotbarStart = inventoryEnd + 1; int hotbarEnd = hotbarStart + 8; - Slot theSlot = this.inventorySlots.get(slot); + Slot theSlot = this.slots.get(slot); - if (theSlot != null && theSlot.getHasStack()) { - ItemStack newStack = theSlot.getStack(); + if (theSlot != null && theSlot.hasItem()) { + ItemStack newStack = theSlot.getItem(); ItemStack currentStack = newStack.copy(); //Other Slots in Inventory excluded if (slot >= inventoryStart) { //Shift from Inventory - if (!this.mergeItemStack(newStack, 0, 1, false)) { + if (!this.moveItemStackTo(newStack, 0, 1, false)) { // if (slot >= inventoryStart && slot <= inventoryEnd) { - if (!this.mergeItemStack(newStack, hotbarStart, hotbarEnd + 1, false)) { + if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd + 1, false)) { + } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { return StackUtil.getEmpty(); } } - } else if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, false)) { + } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } if (!StackUtil.isValid(newStack)) { - theSlot.putStack(StackUtil.getEmpty()); + theSlot.set(StackUtil.getEmpty()); } else { - theSlot.onSlotChanged(); + theSlot.setChanged(); } if (newStack.getCount() == currentStack.getCount()) { @@ -117,16 +117,16 @@ public class ContainerInputter extends Container { } @Override - public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) { + public ItemStack clicked(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) { if (SlotFilter.checkFilter(this, slotId, player)) { return StackUtil.getEmpty(); } else { - return super.slotClick(slotId, dragType, clickTypeIn, player); + return super.clicked(slotId, dragType, clickTypeIn, player); } } @Override - public boolean canInteractWith(PlayerEntity player) { + public boolean stillValid(PlayerEntity player) { return this.tileInputter.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerLaserRelayItemWhitelist.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerLaserRelayItemWhitelist.java index 62466840a..c63ae12ee 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerLaserRelayItemWhitelist.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerLaserRelayItemWhitelist.java @@ -28,7 +28,7 @@ public class ContainerLaserRelayItemWhitelist extends Container { public final TileEntityLaserRelayItemWhitelist tile; public static ContainerLaserRelayItemWhitelist fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { - return new ContainerLaserRelayItemWhitelist(windowId, inv, (TileEntityLaserRelayItemWhitelist) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos()))); + return new ContainerLaserRelayItemWhitelist(windowId, inv, (TileEntityLaserRelayItemWhitelist) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } public ContainerLaserRelayItemWhitelist(int windowId, PlayerInventory inventory, TileEntityLaserRelayItemWhitelist tile) { @@ -56,35 +56,35 @@ public class ContainerLaserRelayItemWhitelist extends Container { } @Override - public ItemStack transferStackInSlot(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(PlayerEntity player, int slot) { int inventoryStart = 24; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; int hotbarEnd = hotbarStart + 8; - Slot theSlot = this.inventorySlots.get(slot); + Slot theSlot = this.slots.get(slot); - if (theSlot != null && theSlot.getHasStack()) { - ItemStack newStack = theSlot.getStack(); + if (theSlot != null && theSlot.hasItem()) { + ItemStack newStack = theSlot.getItem(); ItemStack currentStack = newStack.copy(); //Other Slots in Inventory excluded if (slot >= inventoryStart) { if (slot >= inventoryStart && slot <= inventoryEnd) { - if (!this.mergeItemStack(newStack, hotbarStart, hotbarEnd + 1, false)) { + if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd + 1, false)) { + } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, false)) { + } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } if (!StackUtil.isValid(newStack)) { - theSlot.putStack(StackUtil.getEmpty()); + theSlot.set(StackUtil.getEmpty()); } else { - theSlot.onSlotChanged(); + theSlot.setChanged(); } if (newStack.getCount() == currentStack.getCount()) { @@ -98,16 +98,16 @@ public class ContainerLaserRelayItemWhitelist extends Container { } @Override - public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) { + public ItemStack clicked(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) { if (SlotFilter.checkFilter(this, slotId, player)) { return StackUtil.getEmpty(); } else { - return super.slotClick(slotId, dragType, clickTypeIn, player); + return super.clicked(slotId, dragType, clickTypeIn, player); } } @Override - public boolean canInteractWith(PlayerEntity player) { + public boolean stillValid(PlayerEntity player) { return this.tile.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerMiner.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerMiner.java index 55e859942..ae4210a5e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerMiner.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerMiner.java @@ -27,7 +27,7 @@ public class ContainerMiner extends Container { public final TileEntityMiner miner; public static ContainerMiner fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { - return new ContainerMiner(windowId, inv, (TileEntityMiner) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos()))); + return new ContainerMiner(windowId, inv, (TileEntityMiner) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } public ContainerMiner(int windowId, PlayerInventory inventory, TileEntityMiner tile) { @@ -51,39 +51,39 @@ public class ContainerMiner extends Container { } @Override - public ItemStack transferStackInSlot(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(PlayerEntity player, int slot) { int inventoryStart = 9; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; int hotbarEnd = hotbarStart + 8; - Slot theSlot = this.inventorySlots.get(slot); + Slot theSlot = this.slots.get(slot); - if (theSlot != null && theSlot.getHasStack()) { - ItemStack newStack = theSlot.getStack(); + if (theSlot != null && theSlot.hasItem()) { + ItemStack newStack = theSlot.getItem(); ItemStack currentStack = newStack.copy(); //Other Slots in Inventory excluded if (slot >= inventoryStart) { //Shift from Inventory - if (!this.mergeItemStack(newStack, 0, 9, false)) { + if (!this.moveItemStackTo(newStack, 0, 9, false)) { // if (slot >= inventoryStart && slot <= inventoryEnd) { - if (!this.mergeItemStack(newStack, hotbarStart, hotbarEnd + 1, false)) { + if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd + 1, false)) { + } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { return StackUtil.getEmpty(); } } - } else if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, false)) { + } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } if (!StackUtil.isValid(newStack)) { - theSlot.putStack(StackUtil.getEmpty()); + theSlot.set(StackUtil.getEmpty()); } else { - theSlot.onSlotChanged(); + theSlot.setChanged(); } if (newStack.getCount() == currentStack.getCount()) { @@ -97,7 +97,7 @@ public class ContainerMiner extends Container { } @Override - public boolean canInteractWith(PlayerEntity player) { + public boolean stillValid(PlayerEntity player) { return this.miner.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerOilGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerOilGenerator.java index b1534f732..9218564ae 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerOilGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerOilGenerator.java @@ -26,7 +26,7 @@ public class ContainerOilGenerator extends Container { public final TileEntityOilGenerator generator; public static ContainerOilGenerator fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { - return new ContainerOilGenerator(windowId, inv, (TileEntityOilGenerator) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos()))); + return new ContainerOilGenerator(windowId, inv, (TileEntityOilGenerator) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } public ContainerOilGenerator(int windowId, PlayerInventory inventory, TileEntityOilGenerator tile) { @@ -44,35 +44,35 @@ public class ContainerOilGenerator extends Container { } @Override - public ItemStack transferStackInSlot(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(PlayerEntity player, int slot) { int inventoryStart = 0; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; int hotbarEnd = hotbarStart + 8; - Slot theSlot = this.inventorySlots.get(slot); + Slot theSlot = this.slots.get(slot); - if (theSlot != null && theSlot.getHasStack()) { - ItemStack newStack = theSlot.getStack(); + if (theSlot != null && theSlot.hasItem()) { + ItemStack newStack = theSlot.getItem(); ItemStack currentStack = newStack.copy(); //Other Slots in Inventory excluded if (slot >= inventoryStart) { if (slot >= inventoryStart && slot <= inventoryEnd) { - if (!this.mergeItemStack(newStack, hotbarStart, hotbarEnd + 1, false)) { + if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd + 1, false)) { + } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, false)) { + } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } if (!StackUtil.isValid(newStack)) { - theSlot.putStack(StackUtil.getEmpty()); + theSlot.set(StackUtil.getEmpty()); } else { - theSlot.onSlotChanged(); + theSlot.setChanged(); } if (newStack.getCount() == currentStack.getCount()) { @@ -86,7 +86,7 @@ public class ContainerOilGenerator extends Container { } @Override - public boolean canInteractWith(PlayerEntity player) { + public boolean stillValid(PlayerEntity player) { return this.generator.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerPhantomPlacer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerPhantomPlacer.java index 109debde0..7adf2acac 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerPhantomPlacer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerPhantomPlacer.java @@ -27,7 +27,7 @@ public class ContainerPhantomPlacer extends Container { public final TileEntityPhantomPlacer placer; public static ContainerPhantomPlacer fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { - return new ContainerPhantomPlacer(windowId, inv, (TileEntityPhantomPlacer) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos()))); + return new ContainerPhantomPlacer(windowId, inv, (TileEntityPhantomPlacer) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } public ContainerPhantomPlacer(int windowId, PlayerInventory inventory, TileEntityPhantomPlacer tile) { @@ -51,39 +51,39 @@ public class ContainerPhantomPlacer extends Container { } @Override - public ItemStack transferStackInSlot(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(PlayerEntity player, int slot) { int inventoryStart = 9; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; int hotbarEnd = hotbarStart + 8; - Slot theSlot = this.inventorySlots.get(slot); + Slot theSlot = this.slots.get(slot); - if (theSlot != null && theSlot.getHasStack()) { - ItemStack newStack = theSlot.getStack(); + if (theSlot != null && theSlot.hasItem()) { + ItemStack newStack = theSlot.getItem(); ItemStack currentStack = newStack.copy(); //Other Slots in Inventory excluded if (slot >= inventoryStart) { //Shift from Inventory - if (!this.mergeItemStack(newStack, 0, 9, false)) { + if (!this.moveItemStackTo(newStack, 0, 9, false)) { // if (slot >= inventoryStart && slot <= inventoryEnd) { - if (!this.mergeItemStack(newStack, hotbarStart, hotbarEnd + 1, false)) { + if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd + 1, false)) { + } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { return StackUtil.getEmpty(); } } - } else if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, false)) { + } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } if (!StackUtil.isValid(newStack)) { - theSlot.putStack(StackUtil.getEmpty()); + theSlot.set(StackUtil.getEmpty()); } else { - theSlot.onSlotChanged(); + theSlot.setChanged(); } if (newStack.getCount() == currentStack.getCount()) { @@ -97,7 +97,7 @@ public class ContainerPhantomPlacer extends Container { } @Override - public boolean canInteractWith(PlayerEntity player) { + public boolean stillValid(PlayerEntity player) { return this.placer.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerRangedCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerRangedCollector.java index 0d6b81ca7..21df5e954 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerRangedCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerRangedCollector.java @@ -29,7 +29,7 @@ public class ContainerRangedCollector extends Container { public final TileEntityRangedCollector collector; public static ContainerRangedCollector fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { - return new ContainerRangedCollector(windowId, inv, (TileEntityRangedCollector) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos()))); + return new ContainerRangedCollector(windowId, inv, (TileEntityRangedCollector) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } public ContainerRangedCollector(int windowId, PlayerInventory inventory, TileEntityRangedCollector tile) { @@ -58,39 +58,39 @@ public class ContainerRangedCollector extends Container { } @Override - public ItemStack transferStackInSlot(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(PlayerEntity player, int slot) { int inventoryStart = 18; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; int hotbarEnd = hotbarStart + 8; - Slot theSlot = this.inventorySlots.get(slot); + Slot theSlot = this.slots.get(slot); - if (theSlot != null && theSlot.getHasStack()) { - ItemStack newStack = theSlot.getStack(); + if (theSlot != null && theSlot.hasItem()) { + ItemStack newStack = theSlot.getItem(); ItemStack currentStack = newStack.copy(); //Other Slots in Inventory excluded if (slot >= inventoryStart) { //Shift from Inventory - if (!this.mergeItemStack(newStack, 0, 6, false)) { + if (!this.moveItemStackTo(newStack, 0, 6, false)) { // if (slot >= inventoryStart && slot <= inventoryEnd) { - if (!this.mergeItemStack(newStack, hotbarStart, hotbarEnd + 1, false)) { + if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd + 1, false)) { + } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { return StackUtil.getEmpty(); } } - } else if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, false)) { + } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } if (!StackUtil.isValid(newStack)) { - theSlot.putStack(StackUtil.getEmpty()); + theSlot.set(StackUtil.getEmpty()); } else { - theSlot.onSlotChanged(); + theSlot.setChanged(); } if (newStack.getCount() == currentStack.getCount()) { @@ -104,16 +104,16 @@ public class ContainerRangedCollector extends Container { } @Override - public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) { + public ItemStack clicked(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) { if (SlotFilter.checkFilter(this, slotId, player)) { return StackUtil.getEmpty(); } else { - return super.slotClick(slotId, dragType, clickTypeIn, player); + return super.clicked(slotId, dragType, clickTypeIn, player); } } @Override - public boolean canInteractWith(PlayerEntity player) { + public boolean stillValid(PlayerEntity player) { return this.collector.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerXPSolidifier.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerXPSolidifier.java index 3e2745ea8..64aadc0b1 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerXPSolidifier.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerXPSolidifier.java @@ -29,7 +29,7 @@ public class ContainerXPSolidifier extends Container { public final TileEntityXPSolidifier solidifier; public static ContainerXPSolidifier fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { - return new ContainerXPSolidifier(windowId, inv, (TileEntityXPSolidifier) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos()))); + return new ContainerXPSolidifier(windowId, inv, (TileEntityXPSolidifier) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); } public ContainerXPSolidifier(int windowId, PlayerInventory inventory, TileEntityXPSolidifier tile) { @@ -50,39 +50,39 @@ public class ContainerXPSolidifier extends Container { } @Override - public ItemStack transferStackInSlot(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(PlayerEntity player, int slot) { int inventoryStart = 2; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; int hotbarEnd = hotbarStart + 8; - Slot theSlot = this.inventorySlots.get(slot); + Slot theSlot = this.slots.get(slot); - if (theSlot != null && theSlot.getHasStack()) { - ItemStack newStack = theSlot.getStack(); + if (theSlot != null && theSlot.hasItem()) { + ItemStack newStack = theSlot.getItem(); ItemStack currentStack = newStack.copy(); //Other Slots in Inventory excluded if (slot >= inventoryStart) { if (newStack.getItem() instanceof ItemSolidifiedExperience) { - if (!this.mergeItemStack(newStack, 1, 2, false)) { + if (!this.moveItemStackTo(newStack, 1, 2, false)) { return StackUtil.getEmpty(); } } else if (slot >= inventoryStart && slot <= inventoryEnd) { - if (!this.mergeItemStack(newStack, hotbarStart, hotbarEnd + 1, false)) { + if (!this.moveItemStackTo(newStack, hotbarStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd + 1, false)) { + } else if (slot >= inventoryEnd + 1 && slot < hotbarEnd + 1 && !this.moveItemStackTo(newStack, inventoryStart, inventoryEnd + 1, false)) { return StackUtil.getEmpty(); } - } else if (!this.mergeItemStack(newStack, inventoryStart, hotbarEnd + 1, false)) { + } else if (!this.moveItemStackTo(newStack, inventoryStart, hotbarEnd + 1, false)) { return StackUtil.getEmpty(); } if (!StackUtil.isValid(newStack)) { - theSlot.putStack(StackUtil.getEmpty()); + theSlot.set(StackUtil.getEmpty()); } else { - theSlot.onSlotChanged(); + theSlot.setChanged(); } if (newStack.getCount() == currentStack.getCount()) { @@ -96,7 +96,7 @@ public class ContainerXPSolidifier extends Container { } @Override - public boolean canInteractWith(PlayerEntity player) { + public boolean stillValid(PlayerEntity player) { return this.solidifier.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/GuiHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/GuiHandler.java index ab068febc..862ef0fbf 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/GuiHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/GuiHandler.java @@ -28,7 +28,7 @@ public class GuiHandler { public Object getServerGuiElement(int id, PlayerEntity player, World world, int x, int y, int z) { TileEntityBase tile = null; if (GuiTypes.values()[id].checkTileEntity) { - tile = (TileEntityBase) world.getTileEntity(new BlockPos(x, y, z)); + tile = (TileEntityBase) world.getBlockEntity(new BlockPos(x, y, z)); } switch (GuiTypes.values()[id]) { // case FEEDER: @@ -110,7 +110,7 @@ public class GuiHandler { public Object getClientGuiElement(int id, PlayerEntity player, World world, int x, int y, int z) { TileEntityBase tile = null; if (GuiTypes.values()[id].checkTileEntity) { - tile = (TileEntityBase) world.getTileEntity(new BlockPos(x, y, z)); + tile = (TileEntityBase) world.getBlockEntity(new BlockPos(x, y, z)); } switch (GuiTypes.values()[id]) { case FEEDER: diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/EnergyDisplay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/EnergyDisplay.java index d2086d9e8..adf3d56c6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/EnergyDisplay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/EnergyDisplay.java @@ -53,7 +53,7 @@ public class EnergyDisplay extends AbstractGui { public void draw(MatrixStack matrices) { Minecraft mc = Minecraft.getInstance(); - mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); + mc.getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); int barX = this.x; int barY = this.y; @@ -69,14 +69,14 @@ public class EnergyDisplay extends AbstractGui { if (this.rfReference.getEnergyStored() > 0) { int i = this.rfReference.getEnergyStored() * 83 / this.rfReference.getMaxEnergyStored(); - float[] color = AssetUtil.getWheelColor(mc.world.getTotalWorldTime() % 256); + float[] color = AssetUtil.getWheelColor(mc.level.getTotalWorldTime() % 256); RenderSystem.color4f(color[0] / 255F, color[1] / 255F, color[2] / 255F); this.blit(matrices, barX + 1, barY + 84 - i, 36, 172, 16, i); RenderSystem.color4f(1F, 1F, 1F); } if (this.drawTextNextTo) { - this.drawString(mc.fontRenderer, this.getOverlayText(), barX + 25, barY + 78, StringUtil.DECIMAL_COLOR_WHITE); + this.drawString(mc.font, this.getOverlayText(), barX + 25, barY + 78, StringUtil.DECIMAL_COLOR_WHITE); } } @@ -86,7 +86,7 @@ public class EnergyDisplay extends AbstractGui { List text = new ArrayList<>(); text.add(this.getOverlayText()); - GuiUtils.drawHoveringText(text, mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.fontRenderer); + GuiUtils.drawHoveringText(text, mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.font); } } @@ -100,6 +100,6 @@ public class EnergyDisplay extends AbstractGui { private String getOverlayText() { NumberFormat format = NumberFormat.getInstance(); - return String.format("%s/%s %s", format.format(this.rfReference.getEnergyStored()), format.format(this.rfReference.getMaxEnergyStored()), I18n.format("actuallyadditions.cflong")); + return String.format("%s/%s %s", format.format(this.rfReference.getEnergyStored()), format.format(this.rfReference.getMaxEnergyStored()), I18n.get("actuallyadditions.cflong")); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/FilterSettingsGui.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/FilterSettingsGui.java index f14e7a798..ee72f8afb 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/FilterSettingsGui.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/FilterSettingsGui.java @@ -60,19 +60,19 @@ public class FilterSettingsGui extends AbstractGui { } public void tick() { - this.whitelistButton.setMessage(new StringTextComponent("WH").mergeStyle(this.theSettings.isWhitelist + this.whitelistButton.setMessage(new StringTextComponent("WH").withStyle(this.theSettings.isWhitelist ? TextFormatting.DARK_GREEN : TextFormatting.RED)); - this.whitelistButton.setMessage(new StringTextComponent("ME").mergeStyle(this.theSettings.respectMeta + this.whitelistButton.setMessage(new StringTextComponent("ME").withStyle(this.theSettings.respectMeta ? TextFormatting.DARK_GREEN : TextFormatting.RED)); - this.whitelistButton.setMessage(new StringTextComponent("NB").mergeStyle(this.theSettings.respectNBT + this.whitelistButton.setMessage(new StringTextComponent("NB").withStyle(this.theSettings.respectNBT ? TextFormatting.DARK_GREEN : TextFormatting.RED)); - this.whitelistButton.setMessage(new StringTextComponent("MO").mergeStyle(this.theSettings.respectMod + this.whitelistButton.setMessage(new StringTextComponent("MO").withStyle(this.theSettings.respectMod ? TextFormatting.DARK_GREEN : TextFormatting.RED)); - this.whitelistButton.setMessage(new StringTextComponent("OR").mergeStyle(this.theSettings.respectOredict == 0 + this.whitelistButton.setMessage(new StringTextComponent("OR").withStyle(this.theSettings.respectOredict == 0 ? TextFormatting.DARK_GREEN : this.theSettings.respectOredict == 1 ? TextFormatting.GREEN @@ -87,25 +87,25 @@ public class FilterSettingsGui extends AbstractGui { list.add(TextFormatting.BOLD + (this.theSettings.isWhitelist ? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.whitelist") : StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.blacklist"))); - list.addAll(mc.fontRenderer.listFormattedStringToWidth(StringUtil.localizeFormatted("info." + ActuallyAdditions.MODID + ".gui.whitelistInfo"), 200)); - GuiUtils.drawHoveringText(list, mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.fontRenderer); + list.addAll(mc.font.listFormattedStringToWidth(StringUtil.localizeFormatted("info." + ActuallyAdditions.MODID + ".gui.whitelistInfo"), 200)); + GuiUtils.drawHoveringText(list, mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.font); } else if (this.metaButton.isMouseOver(mouseX, mouseY)) { GuiUtils.drawHoveringText(Collections.singletonList(TextFormatting.BOLD + (this.theSettings.respectMeta ? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.respectMeta") - : StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.ignoreMeta"))), mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.fontRenderer); + : StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.ignoreMeta"))), mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.font); } else if (this.nbtButton.isMouseOver(mouseX, mouseY)) { GuiUtils.drawHoveringText(Collections.singletonList(TextFormatting.BOLD + (this.theSettings.respectNBT ? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.respectNBT") - : StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.ignoreNBT"))), mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.fontRenderer); + : StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.ignoreNBT"))), mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.font); } else if (this.modButton.isMouseOver(mouseX, mouseY)) { List list = new ArrayList<>(); list.add(TextFormatting.BOLD + (this.theSettings.respectMod ? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.respectMod") : StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.ignoreMod"))); - list.addAll(mc.fontRenderer.listFormattedStringToWidth(StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.respectModInfo"), 200)); + list.addAll(mc.font.listFormattedStringToWidth(StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.respectModInfo"), 200)); - GuiUtils.drawHoveringText(list, mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.fontRenderer); + GuiUtils.drawHoveringText(list, mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.font); } else if (this.oredictButton.isMouseOver()) { List list = new ArrayList<>(); list.add(TextFormatting.BOLD + (this.theSettings.respectOredict == 0 @@ -122,9 +122,9 @@ public class FilterSettingsGui extends AbstractGui { } if (type != null) { - list.addAll(mc.fontRenderer.listFormattedStringToWidth(StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.respectOredictInfo." + type), 200)); + list.addAll(mc.font.listFormattedStringToWidth(StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.respectOredictInfo." + type), 200)); } - GuiUtils.drawHoveringText(list, mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.fontRenderer); + GuiUtils.drawHoveringText(list, mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.font); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/FluidDisplay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/FluidDisplay.java index 6ab83eebb..0ab7f4442 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/FluidDisplay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/FluidDisplay.java @@ -59,7 +59,7 @@ public class FluidDisplay extends AbstractGui { public void draw(MatrixStack matrices) { Minecraft mc = Minecraft.getInstance(); - mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); + mc.getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); int barX = this.x; int barY = this.y; @@ -86,21 +86,21 @@ public class FluidDisplay extends AbstractGui { } if (stack != null && fluid != null && this.resLoc != null) { - mc.getTextureManager().bindTexture(this.resLoc); + mc.getTextureManager().bind(this.resLoc); - GlStateManager.pushMatrix(); - GlStateManager.enableBlend(); + GlStateManager._pushMatrix(); + GlStateManager._enableBlend(); GlStateManager.disableAlpha(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); int i = this.fluidReference.getFluidAmount() * 83 / this.fluidReference.getCapacity(); Gui.drawModalRectWithCustomSizedTexture(barX + 1, barY + 84 - i, 36, 172, 16, i, 16, 512); - GlStateManager.disableBlend(); + GlStateManager._disableBlend(); GlStateManager.enableAlpha(); - GlStateManager.popMatrix(); + GlStateManager._popMatrix(); } if (this.drawTextNextTo) { - this.drawString(mc.fontRenderer, this.getOverlayText(), barX + 25, barY + 78, StringUtil.DECIMAL_COLOR_WHITE); + this.drawString(mc.font, this.getOverlayText(), barX + 25, barY + 78, StringUtil.DECIMAL_COLOR_WHITE); } } @@ -111,7 +111,7 @@ public class FluidDisplay extends AbstractGui { ? 93 : 85)) { Minecraft mc = Minecraft.getInstance(); - GuiUtils.drawHoveringText(Collections.singletonList(this.getOverlayText()), mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.fontRenderer); + GuiUtils.drawHoveringText(Collections.singletonList(this.getOverlayText()), mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.font); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiBag.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiBag.java index 65ce4c47d..9345bc439 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiBag.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiBag.java @@ -40,8 +40,8 @@ public class GuiBag extends GuiWtfMojang { public GuiBag(ContainerBag container, PlayerInventory inventory, ITextComponent title) { super(container, inventory); - this.xSize = 176; - this.ySize = 90 + 86; + this.imageWidth = 176; + this.imageHeight = 90 + 86; this.isVoid = container.isVoid; this.container = container; } @@ -50,9 +50,9 @@ public class GuiBag extends GuiWtfMojang { public void init() { super.init(); - this.filter = new FilterSettingsGui(this.container.filter, this.guiLeft + 138, this.guiTop + 10, this.buttonList); + this.filter = new FilterSettingsGui(this.container.filter, this.leftPos + 138, this.topPos + 10, this.buttonList); - this.buttonAutoInsert = new Button(0, this.guiLeft - 21, this.guiTop + 8, 20, 20, (this.container.autoInsert + this.buttonAutoInsert = new Button(0, this.leftPos - 21, this.topPos + 8, 20, 20, (this.container.autoInsert ? TextFormatting.DARK_GREEN : TextFormatting.RED) + "I"); this.addButton(this.buttonAutoInsert); @@ -62,8 +62,8 @@ public class GuiBag extends GuiWtfMojang { protected void actionPerformed(Button button) throws IOException { CompoundNBT data = new CompoundNBT(); data.setInteger("ButtonID", button.id); - data.setInteger("PlayerID", Minecraft.getInstance().player.getEntityId()); - data.setInteger("WorldID", Minecraft.getInstance().world.provider.getDimension()); + data.setInteger("PlayerID", Minecraft.getInstance().player.getId()); + data.setInteger("WorldID", Minecraft.getInstance().level.provider.getDimension()); PacketHandler.THE_NETWORK.sendToServer(new PacketClientToServer(data, PacketHandler.GUI_BUTTON_TO_CONTAINER_HANDLER)); } @@ -79,7 +79,7 @@ public class GuiBag extends GuiWtfMojang { @Override public void drawGuiContainerForegroundLayer(int x, int y) { - AssetUtil.displayNameString(this.font, this.xSize, -10, StringUtil.localize("container." + ActuallyAdditions.MODID + "." + (this.isVoid + AssetUtil.displayNameString(this.font, this.imageWidth, -10, StringUtil.localize("container." + ActuallyAdditions.MODID + "." + (this.isVoid ? "voidBag" : "bag") + ".name")); } @@ -96,20 +96,20 @@ public class GuiBag extends GuiWtfMojang { : "Off")); text.addAll(this.font.listFormattedStringToWidth("Turn this on to make items that get picked up automatically go into the bag.", 200)); text.addAll(this.font.listFormattedStringToWidth(TextFormatting.GRAY + "" + TextFormatting.ITALIC + "Note that this WON'T work when you are holding the bag in your hand.", 200)); - this.renderToolTip(stack, text, mouseX, mouseY, this.getMinecraft().fontRenderer); + this.renderToolTip(stack, text, mouseX, mouseY, this.getMinecraft().font); } } @Override - protected void drawGuiContainerBackgroundLayer(MatrixStack matrixStack, float partialTicks, int x, int y) { + protected void renderBg(MatrixStack matrixStack, float partialTicks, int x, int y) { RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); - this.blit(matrixStack, this.guiLeft, this.guiTop + 90, 0, 0, 176, 86); + this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + this.blit(matrixStack, this.leftPos, this.topPos + 90, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bindTexture(this.isVoid + this.getMinecraft().getTextureManager().bind(this.isVoid ? RES_LOC_VOID : RES_LOC); - this.blit(matrixStack, this.guiLeft, this.guiTop, 0, 0, 176, 90); + this.blit(matrixStack, this.leftPos, this.topPos, 0, 0, 176, 90); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiBioReactor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiBioReactor.java index 1404b750a..9b311a268 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiBioReactor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiBioReactor.java @@ -28,14 +28,14 @@ public class GuiBioReactor extends GuiWtfMojang { public GuiBioReactor(ContainerBioReactor container, PlayerInventory inventory, ITextComponent title) { super(container, inventory); this.tile = container.tile; - this.xSize = 176; - this.ySize = 93 + 86; + this.imageWidth = 176; + this.imageHeight = 93 + 86; } @Override public void init() { super.init(); - this.energy = new EnergyDisplay(this.guiLeft + 116, this.guiTop + 5, this.tile.storage); + this.energy = new EnergyDisplay(this.leftPos + 116, this.topPos + 5, this.tile.storage); } @Override @@ -45,27 +45,27 @@ public class GuiBioReactor extends GuiWtfMojang { } @Override - public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) { - AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.tile); + public void renderLabels(MatrixStack matrices, int x, int y) { + AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.tile); } @Override - public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float partialTicks, int x, int y) { + public void renderBg(MatrixStack matrices, float partialTicks, int x, int y) { RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); - this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); + this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + this.blit(matrices, this.leftPos, this.topPos + 93, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bindTexture(RES_LOC); - this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93); + this.getMinecraft().getTextureManager().bind(RES_LOC); + this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 93); if (this.tile.burnTime > 0) { int i = this.tile.burnTime * 13 / this.tile.maxBurnTime; - this.blit(matrices, this.guiLeft + 87, this.guiTop + 51 + 12 - i, 176, 96 - i, 14, i); + this.blit(matrices, this.leftPos + 87, this.topPos + 51 + 12 - i, 176, 96 - i, 14, i); } if (this.tile.producePerTick > 0) { - drawCenteredString(matrices, this.font, this.tile.producePerTick + " " + I18n.format("actuallyadditions.cft"), this.guiLeft + 87, this.guiTop + 86, 0xFFFFFF); + drawCenteredString(matrices, this.font, this.tile.producePerTick + " " + I18n.get("actuallyadditions.cft"), this.leftPos + 87, this.topPos + 86, 0xFFFFFF); } this.energy.draw(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiBreaker.java index 05523528e..bcc45bea3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiBreaker.java @@ -30,23 +30,23 @@ public class GuiBreaker extends GuiWtfMojang { public GuiBreaker(ContainerBreaker container, PlayerInventory inventory, ITextComponent title) { super(container, inventory); this.breaker = container.breaker; - this.xSize = 176; - this.ySize = 93 + 86; + this.imageWidth = 176; + this.imageHeight = 93 + 86; } @Override - protected void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) { - AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.breaker); + protected void renderLabels(MatrixStack matrices, int x, int y) { + AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.breaker); } @Override - protected void drawGuiContainerBackgroundLayer(MatrixStack matrices, float partialTicks, int x, int y) { + protected void renderBg(MatrixStack matrices, float partialTicks, int x, int y) { RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); - this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); + this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + this.blit(matrices, this.leftPos, this.topPos + 93, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bindTexture(RES_LOC); - this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93); + this.getMinecraft().getTextureManager().bind(RES_LOC); + this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 93); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCanolaPress.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCanolaPress.java index e610bf4fc..b6eecd79d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCanolaPress.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCanolaPress.java @@ -31,15 +31,15 @@ public class GuiCanolaPress extends GuiWtfMojang { public GuiCanolaPress(ContainerCanolaPress container, PlayerInventory inventory, ITextComponent title) { super(container, inventory); this.press = container.press; - this.xSize = 176; - this.ySize = 93 + 86; + this.imageWidth = 176; + this.imageHeight = 93 + 86; } @Override public void init() { super.init(); - this.energy = new EnergyDisplay(this.guiLeft + 42, this.guiTop + 5, this.press.storage); - this.fluid = new FluidDisplay(this.guiLeft + 116, this.guiTop + 5, this.press.tank); + this.energy = new EnergyDisplay(this.leftPos + 42, this.topPos + 5, this.press.storage); + this.fluid = new FluidDisplay(this.leftPos + 116, this.topPos + 5, this.press.tank); } @Override @@ -51,23 +51,23 @@ public class GuiCanolaPress extends GuiWtfMojang { } @Override - public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) { - AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.press); + public void renderLabels(MatrixStack matrices, int x, int y) { + AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.press); } @Override - public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) { + public void renderBg(MatrixStack matrices, float f, int x, int y) { RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); - this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); + this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + this.blit(matrices, this.leftPos, this.topPos + 93, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bindTexture(RES_LOC); - this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93); + this.getMinecraft().getTextureManager().bind(RES_LOC); + this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 93); if (this.press.currentProcessTime > 0) { int i = this.press.getProcessScaled(29); - this.blit(matrices, this.guiLeft + 83, this.guiTop + 32, 176, 0, 12, i); + this.blit(matrices, this.leftPos + 83, this.topPos + 32, 176, 0, 12, i); } this.energy.draw(matrices); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCoalGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCoalGenerator.java index e1494a9f1..736c0a816 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCoalGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCoalGenerator.java @@ -30,14 +30,14 @@ public class GuiCoalGenerator extends GuiWtfMojang { public GuiCoalGenerator(ContainerCoalGenerator container, PlayerInventory inventory, ITextComponent title) { super(container, inventory); this.generator = container.generator; - this.xSize = 176; - this.ySize = 93 + 86; + this.imageWidth = 176; + this.imageHeight = 93 + 86; } @Override public void init() { super.init(); - this.energy = new EnergyDisplay(this.guiLeft + 42, this.guiTop + 5, this.generator.storage); + this.energy = new EnergyDisplay(this.leftPos + 42, this.topPos + 5, this.generator.storage); } @Override @@ -47,23 +47,23 @@ public class GuiCoalGenerator extends GuiWtfMojang { } @Override - public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) { - AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.generator); + public void renderLabels(MatrixStack matrices, int x, int y) { + AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.generator); } @Override - public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) { + public void renderBg(MatrixStack matrices, float f, int x, int y) { RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); - this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); + this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + this.blit(matrices, this.leftPos, this.topPos + 93, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bindTexture(RES_LOC); - this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93); + this.getMinecraft().getTextureManager().bind(RES_LOC); + this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 93); if (this.generator.currentBurnTime > 0) { int i = this.generator.getBurningScaled(13); - this.blit(matrices, this.guiLeft + 87, this.guiTop + 27 + 12 - i, 176, 96 - i, 14, i); + this.blit(matrices, this.leftPos + 87, this.topPos + 27 + 12 - i, 176, 96 - i, 14, i); } this.energy.draw(matrices); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCoffeeMachine.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCoffeeMachine.java index 7fe2ef2dd..703e30ecf 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCoffeeMachine.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiCoffeeMachine.java @@ -39,19 +39,19 @@ public class GuiCoffeeMachine extends GuiWtfMojang { public GuiCoffeeMachine(ContainerCoffeeMachine container, PlayerInventory inventory, ITextComponent title) { super(container, inventory); this.machine = container.machine; - this.xSize = 176; - this.ySize = 93 + 86; + this.imageWidth = 176; + this.imageHeight = 93 + 86; } @Override public void init() { super.init(); - Button buttonOkay = new Button(this.guiLeft + 60, this.guiTop + 11, 58, 20, StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.ok")); + Button buttonOkay = new Button(this.leftPos + 60, this.topPos + 11, 58, 20, StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.ok")); this.addButton(buttonOkay); - this.energy = new EnergyDisplay(this.guiLeft + 16, this.guiTop + 5, this.machine.storage); - this.fluid = new FluidDisplay(this.guiLeft - 30, this.guiTop + 1, this.machine.tank, true, false); + this.energy = new EnergyDisplay(this.leftPos + 16, this.topPos + 5, this.machine.storage); + this.fluid = new FluidDisplay(this.leftPos - 30, this.topPos + 1, this.machine.tank, true, false); } @Override @@ -59,7 +59,7 @@ public class GuiCoffeeMachine extends GuiWtfMojang { super.render(matrices, x, y, f); String text2 = this.machine.coffeeCacheAmount + "/" + TileEntityCoffeeMachine.COFFEE_CACHE_MAX_AMOUNT + " " + StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.coffee"); - if (x >= this.guiLeft + 40 && y >= this.guiTop + 25 && x <= this.guiLeft + 49 && y <= this.guiTop + 56) { + if (x >= this.leftPos + 40 && y >= this.topPos + 25 && x <= this.leftPos + 49 && y <= this.topPos + 56) { this.drawHoveringText(Collections.singletonList(text2), x, y); } @@ -68,31 +68,31 @@ public class GuiCoffeeMachine extends GuiWtfMojang { } @Override - public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) { - AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.machine); + public void renderLabels(MatrixStack matrices, int x, int y) { + AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.machine); } @Override - public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) { + public void renderBg(MatrixStack matrices, float f, int x, int y) { RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); - this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); + this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + this.blit(matrices, this.leftPos, this.topPos + 93, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bindTexture(RES_LOC); - this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93); + this.getMinecraft().getTextureManager().bind(RES_LOC); + this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 93); if (this.machine.coffeeCacheAmount > 0) { int i = this.machine.getCoffeeScaled(30); - this.blit(matrices, this.guiLeft + 41, this.guiTop + 56 - i, 192, 0, 8, i); + this.blit(matrices, this.leftPos + 41, this.topPos + 56 - i, 192, 0, 8, i); } if (this.machine.brewTime > 0) { int i = this.machine.getBrewScaled(23); - this.blit(matrices, this.guiLeft + 53, this.guiTop + 42, 192, 30, i, 16); + this.blit(matrices, this.leftPos + 53, this.topPos + 42, 192, 30, i, 16); int j = this.machine.getBrewScaled(26); - this.blit(matrices, this.guiLeft + 99 + 25 - j, this.guiTop + 44, 192 + 25 - j, 46, j, 12); + this.blit(matrices, this.leftPos + 99 + 25 - j, this.topPos + 44, 192 + 25 - j, 46, j, 12); } this.energy.draw(matrices); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDirectionalBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDirectionalBreaker.java index 167d8af83..af37a9d29 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDirectionalBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDirectionalBreaker.java @@ -30,14 +30,14 @@ public class GuiDirectionalBreaker extends GuiWtfMojang { public GuiDrill(ContainerDrill container, PlayerInventory inventory, ITextComponent title) { super(container, inventory); - this.xSize = 176; - this.ySize = 54 + 86; + this.imageWidth = 176; + this.imageHeight = 54 + 86; } @Override - public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) { - AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, StringUtil.localize("container." + ActuallyAdditions.MODID + ".drill.name")); + public void renderLabels(MatrixStack matrices, int x, int y) { + AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, StringUtil.localize("container." + ActuallyAdditions.MODID + ".drill.name")); } @Override - public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) { + public void renderBg(MatrixStack matrices, float f, int x, int y) { RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); - this.blit(matrices, this.guiLeft, this.guiTop + 54, 0, 0, 176, 86); + this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + this.blit(matrices, this.leftPos, this.topPos + 54, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bindTexture(RES_LOC); - this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 54); + this.getMinecraft().getTextureManager().bind(RES_LOC); + this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 54); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDropper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDropper.java index f4f3d3192..255e99ae2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDropper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiDropper.java @@ -30,23 +30,23 @@ public class GuiDropper extends GuiWtfMojang { public GuiDropper(ContainerDropper container, PlayerInventory inventory, ITextComponent title) { super(container, inventory); this.dropper = container.dropper; - this.xSize = 176; - this.ySize = 93 + 86; + this.imageWidth = 176; + this.imageHeight = 93 + 86; } @Override - public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) { - AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.dropper); + public void renderLabels(MatrixStack matrices, int x, int y) { + AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.dropper); } @Override - public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) { + public void renderBg(MatrixStack matrices, float f, int x, int y) { RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); - this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); + this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + this.blit(matrices, this.leftPos, this.topPos + 93, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bindTexture(RES_LOC); - this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93); + this.getMinecraft().getTextureManager().bind(RES_LOC); + this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 93); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiEnergizer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiEnergizer.java index 08651d2da..c64d1a4fd 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiEnergizer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiEnergizer.java @@ -30,14 +30,14 @@ public class GuiEnergizer extends GuiWtfMojang { public GuiEnergizer(ContainerEnergizer container, PlayerInventory inventory, ITextComponent title) { super(container, inventory); this.energizer = container.energizer; - this.xSize = 176; - this.ySize = 93 + 86; + this.imageWidth = 176; + this.imageHeight = 93 + 86; } @Override public void init() { super.init(); - this.energy = new EnergyDisplay(this.guiLeft + 56, this.guiTop + 5, this.energizer.storage); + this.energy = new EnergyDisplay(this.leftPos + 56, this.topPos + 5, this.energizer.storage); } @Override @@ -47,19 +47,19 @@ public class GuiEnergizer extends GuiWtfMojang { } @Override - public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) { - AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.energizer); + public void renderLabels(MatrixStack matrices, int x, int y) { + AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.energizer); } @Override - public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) { + public void renderBg(MatrixStack matrices, float f, int x, int y) { RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); - this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); + this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + this.blit(matrices, this.leftPos, this.topPos + 93, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bindTexture(RES_LOC); - this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93); + this.getMinecraft().getTextureManager().bind(RES_LOC); + this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 93); this.energy.draw(matrices); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiEnervator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiEnervator.java index 7032bba0a..517ee3241 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiEnervator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiEnervator.java @@ -31,14 +31,14 @@ public class GuiEnervator extends GuiWtfMojang { public GuiEnervator(ContainerEnervator container, PlayerInventory inventory, ITextComponent title) { super(container, inventory); this.enervator = container.enervator; - this.xSize = 176; - this.ySize = 93 + 86; + this.imageWidth = 176; + this.imageHeight = 93 + 86; } @Override public void init() { super.init(); - this.energy = new EnergyDisplay(this.guiLeft + 56, this.guiTop + 5, this.enervator.storage); + this.energy = new EnergyDisplay(this.leftPos + 56, this.topPos + 5, this.enervator.storage); } @Override @@ -48,19 +48,19 @@ public class GuiEnervator extends GuiWtfMojang { } @Override - public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) { - AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.enervator); + public void renderLabels(MatrixStack matrices, int x, int y) { + AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.enervator); } @Override - public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) { + public void renderBg(MatrixStack matrices, float f, int x, int y) { RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); - this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); + this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + this.blit(matrices, this.leftPos, this.topPos + 93, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bindTexture(RES_LOC); - this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93); + this.getMinecraft().getTextureManager().bind(RES_LOC); + this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 93); this.energy.draw(matrices); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFarmer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFarmer.java index 5bbde7520..bb7d9997c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFarmer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFarmer.java @@ -32,31 +32,31 @@ public class GuiFarmer extends GuiWtfMojang { public GuiFarmer(ContainerFarmer container, PlayerInventory inventory, ITextComponent title) { super(container, inventory); this.farmer = container.farmer; - this.xSize = 176; - this.ySize = 93 + 86; + this.imageWidth = 176; + this.imageHeight = 93 + 86; } @Override public void init() { super.init(); - this.energy = new EnergyDisplay(this.guiLeft + 33, this.guiTop + 6, this.farmer.storage); + this.energy = new EnergyDisplay(this.leftPos + 33, this.topPos + 6, this.farmer.storage); } @Override - public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) { - AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.farmer); + public void renderLabels(MatrixStack matrices, int x, int y) { + AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.farmer); } @Override - public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) { + public void renderBg(MatrixStack matrices, float f, int x, int y) { RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); - this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); + this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + this.blit(matrices, this.leftPos, this.topPos + 93, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bindTexture(RES_LOC); - this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93); + this.getMinecraft().getTextureManager().bind(RES_LOC); + this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 93); this.energy.draw(matrices); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFeeder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFeeder.java index 30fb1752b..78bac5452 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFeeder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFeeder.java @@ -33,14 +33,14 @@ public class GuiFeeder extends GuiWtfMojang { public GuiFeeder(ContainerFeeder container, PlayerInventory inventory, ITextComponent title) { super(container, inventory); this.tileFeeder = container.feeder; - this.xSize = 176; - this.ySize = 70 + 86; + this.imageWidth = 176; + this.imageHeight = 70 + 86; } @Override public void render(MatrixStack matrices, int x, int y, float f) { super.render(matrices, x, y, f); - if (x >= this.guiLeft + 69 && y >= this.guiTop + 30 && x <= this.guiLeft + 69 + 10 && y <= this.guiTop + 30 + 10) { + if (x >= this.leftPos + 69 && y >= this.topPos + 30 && x <= this.leftPos + 69 + 10 && y <= this.topPos + 30 + 10) { String[] array = new String[]{this.tileFeeder.currentAnimalAmount + " " + StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.animals"), this.tileFeeder.currentAnimalAmount >= 2 && this.tileFeeder.currentAnimalAmount < TileEntityFeeder.THRESHOLD ? StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.enoughToBreed") : this.tileFeeder.currentAnimalAmount >= TileEntityFeeder.THRESHOLD @@ -51,29 +51,29 @@ public class GuiFeeder extends GuiWtfMojang { } @Override - public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) { - AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.tileFeeder); + public void renderLabels(MatrixStack matrices, int x, int y) { + AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.tileFeeder); } @Override - public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) { + public void renderBg(MatrixStack matrices, float f, int x, int y) { RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); - this.blit(matrices, this.guiLeft, this.guiTop + 70, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bindTexture(RES_LOC); - this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 70); + this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + this.blit(matrices, this.leftPos, this.topPos + 70, 0, 0, 176, 86); + this.getMinecraft().getTextureManager().bind(RES_LOC); + this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 70); if (this.tileFeeder.currentTimer > 0) { int i = this.tileFeeder.getCurrentTimerToScale(20); - this.blit(matrices, this.guiLeft + 85, this.guiTop + 42 - i, 181, 19 + 19 - i, 6, 20); + this.blit(matrices, this.leftPos + 85, this.topPos + 42 - i, 181, 19 + 19 - i, 6, 20); } if (this.tileFeeder.currentAnimalAmount >= 2 && this.tileFeeder.currentAnimalAmount < TileEntityFeeder.THRESHOLD) { - this.blit(matrices, this.guiLeft + 70, this.guiTop + 31, 192, 16, 8, 8); + this.blit(matrices, this.leftPos + 70, this.topPos + 31, 192, 16, 8, 8); } if (this.tileFeeder.currentAnimalAmount >= TileEntityFeeder.THRESHOLD) { - this.blit(matrices, this.guiLeft + 70, this.guiTop + 31, 192, 24, 8, 8); + this.blit(matrices, this.leftPos + 70, this.topPos + 31, 192, 24, 8, 8); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFermentingBarrel.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFermentingBarrel.java index 7c988e8fc..149ee9efb 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFermentingBarrel.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFermentingBarrel.java @@ -32,8 +32,8 @@ public class GuiFermentingBarrel extends GuiWtfMojang public GuiFermentingBarrel(ContainerFermentingBarrel container, PlayerInventory inventory, ITextComponent title) { super(container, inventory); this.press = container.barrel; - this.xSize = 176; - this.ySize = 93 + 86; + this.imageWidth = 176; + this.imageHeight = 93 + 86; } @Override @@ -46,28 +46,28 @@ public class GuiFermentingBarrel extends GuiWtfMojang @Override public void init() { super.init(); - this.input = new FluidDisplay(this.guiLeft + 60, this.guiTop + 5, this.press.canolaTank); - this.output = new FluidDisplay(this.guiLeft + 98, this.guiTop + 5, this.press.oilTank); + this.input = new FluidDisplay(this.leftPos + 60, this.topPos + 5, this.press.canolaTank); + this.output = new FluidDisplay(this.leftPos + 98, this.topPos + 5, this.press.oilTank); } @Override - public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) { - AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.press); + public void renderLabels(MatrixStack matrices, int x, int y) { + AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.press); } @Override - public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) { + public void renderBg(MatrixStack matrices, float f, int x, int y) { RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); - this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); + this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + this.blit(matrices, this.leftPos, this.topPos + 93, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bindTexture(RES_LOC); - this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93); + this.getMinecraft().getTextureManager().bind(RES_LOC); + this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 93); if (this.press.currentProcessTime > 0) { int i = this.press.getProcessScaled(29); - this.blit(matrices, this.guiLeft + 82, this.guiTop + 34, 176, 0, 12, i); + this.blit(matrices, this.leftPos + 82, this.topPos + 34, 176, 0, 12, i); } this.input.draw(matrices); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFilter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFilter.java index 07d50ae89..079618614 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFilter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFilter.java @@ -29,23 +29,23 @@ public class GuiFilter extends GuiWtfMojang { public GuiFilter(ContainerFilter container, PlayerInventory inventory, ITextComponent title) { super(container, inventory); - this.xSize = 176; - this.ySize = 90 + 86; + this.imageWidth = 176; + this.imageHeight = 90 + 86; } @Override - public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) { - AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, StringUtil.localize("container." + ActuallyAdditions.MODID + ".filter.name")); + public void renderLabels(MatrixStack matrices, int x, int y) { + AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, StringUtil.localize("container." + ActuallyAdditions.MODID + ".filter.name")); } @Override - public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) { + public void renderBg(MatrixStack matrices, float f, int x, int y) { RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); - this.blit(matrices, this.guiLeft, this.guiTop + 90, 0, 0, 176, 86); + this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + this.blit(matrices, this.leftPos, this.topPos + 90, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bindTexture(RES_LOC); - this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 90); + this.getMinecraft().getTextureManager().bind(RES_LOC); + this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 90); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFireworkBox.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFireworkBox.java index 92fab2c19..24fad9374 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFireworkBox.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFireworkBox.java @@ -28,8 +28,8 @@ public class GuiFireworkBox extends ContainerScreen { public GuiFireworkBox(ContainerFireworkBox screenContainer, PlayerInventory inv, ITextComponent titleIn) { super(screenContainer, inv, titleIn); // this.tile = tile.; - this.xSize = 300; - this.ySize = 120; + this.imageWidth = 300; + this.imageHeight = 120; } @Override @@ -53,7 +53,7 @@ public class GuiFireworkBox extends ContainerScreen { } @Override - protected void drawGuiContainerBackgroundLayer(MatrixStack matrixStack, float partialTicks, int x, int y) { + protected void renderBg(MatrixStack matrixStack, float partialTicks, int x, int y) { } @@ -110,12 +110,12 @@ public class GuiFireworkBox extends ContainerScreen { } @Override - protected void func_230979_b_() { + protected void updateMessage() { } @Override - protected void func_230972_a_() { + protected void applyValue() { } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFluidCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFluidCollector.java index 3d3a7e467..b66705014 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFluidCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFluidCollector.java @@ -32,8 +32,8 @@ public class GuiFluidCollector extends GuiWtfMojang { public GuiFluidCollector(ContainerFluidCollector container, PlayerInventory inventory, ITextComponent title) { super(container, inventory); this.collector = container.collector; - this.xSize = 176; - this.ySize = 93 + 86; + this.imageWidth = 176; + this.imageHeight = 93 + 86; } @Override @@ -46,23 +46,23 @@ public class GuiFluidCollector extends GuiWtfMojang { @Override public void init() { super.init(); - this.fluid = new FluidDisplay(this.guiLeft + 67, this.guiTop + 5, this.collector.tank); + this.fluid = new FluidDisplay(this.leftPos + 67, this.topPos + 5, this.collector.tank); } @Override - public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) { - AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.collector); + public void renderLabels(MatrixStack matrices, int x, int y) { + AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.collector); } @Override - public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) { + public void renderBg(MatrixStack matrices, float f, int x, int y) { RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); - this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); + this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + this.blit(matrices, this.leftPos, this.topPos + 93, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bindTexture(RES_LOC); - this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93); + this.getMinecraft().getTextureManager().bind(RES_LOC); + this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 93); this.fluid.draw(matrices); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFurnaceDouble.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFurnaceDouble.java index 46bf9c246..3b1149a8c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFurnaceDouble.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiFurnaceDouble.java @@ -42,8 +42,8 @@ public class GuiFurnaceDouble extends GuiWtfMojang { public GuiFurnaceDouble(ContainerFurnaceDouble container, PlayerInventory inventory, ITextComponent title) { super(container, inventory); this.tileFurnace = container.furnace; - this.xSize = 176; - this.ySize = 93 + 86; + this.imageWidth = 176; + this.imageHeight = 93 + 86; } @Override @@ -61,9 +61,9 @@ public class GuiFurnaceDouble extends GuiWtfMojang { @Override public void init() { super.init(); - this.energy = new EnergyDisplay(this.guiLeft + 27, this.guiTop + 5, this.tileFurnace.storage); + this.energy = new EnergyDisplay(this.leftPos + 27, this.topPos + 5, this.tileFurnace.storage); - this.buttonAutoSplit = new GuiInputter.SmallerButton(0, this.guiLeft, this.guiTop, "S"); + this.buttonAutoSplit = new GuiInputter.SmallerButton(0, this.leftPos, this.topPos, "S"); this.addButton(this.buttonAutoSplit); } @@ -72,7 +72,7 @@ public class GuiFurnaceDouble extends GuiWtfMojang { public void tick() { super.tick(); - this.buttonAutoSplit.setMessage(new StringTextComponent("S").mergeStyle(this.tileFurnace.isAutoSplit + this.buttonAutoSplit.setMessage(new StringTextComponent("S").withStyle(this.tileFurnace.isAutoSplit ? TextFormatting.DARK_GREEN : TextFormatting.RED)); } @@ -85,27 +85,27 @@ public class GuiFurnaceDouble extends GuiWtfMojang { } @Override - public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) { - AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.tileFurnace); + public void renderLabels(MatrixStack matrices, int x, int y) { + AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.tileFurnace); } @Override - public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) { + public void renderBg(MatrixStack matrices, float f, int x, int y) { RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); - this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); + this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + this.blit(matrices, this.leftPos, this.topPos + 93, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bindTexture(RES_LOC); - this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93); + this.getMinecraft().getTextureManager().bind(RES_LOC); + this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 93); if (this.tileFurnace.firstSmeltTime > 0) { int i = this.tileFurnace.getFirstTimeToScale(23); - this.blit(matrices, this.guiLeft + 51, this.guiTop + 40, 176, 0, 24, i); + this.blit(matrices, this.leftPos + 51, this.topPos + 40, 176, 0, 24, i); } if (this.tileFurnace.secondSmeltTime > 0) { int i = this.tileFurnace.getSecondTimeToScale(23); - this.blit(matrices, this.guiLeft + 101, this.guiTop + 40, 176, 22, 24, i); + this.blit(matrices, this.leftPos + 101, this.topPos + 40, 176, 22, 24, i); } this.energy.draw(matrices); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiGrinder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiGrinder.java index 8149a8c01..2812ae2f4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiGrinder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiGrinder.java @@ -45,19 +45,19 @@ public class GuiGrinder extends GuiWtfMojang { super(container, inventory); this.tileGrinder = container.tileGrinder; this.isDouble = container.isDouble; - this.xSize = 176; - this.ySize = 93 + 86; + this.imageWidth = 176; + this.imageHeight = 93 + 86; } @Override public void init() { super.init(); - this.energy = new EnergyDisplay(this.guiLeft + (this.isDouble + this.energy = new EnergyDisplay(this.leftPos + (this.isDouble ? 13 - : 42), this.guiTop + 5, this.tileGrinder.storage); + : 42), this.topPos + 5, this.tileGrinder.storage); if (this.isDouble) { - this.buttonAutoSplit = new GuiInputter.SmallerButton(0, this.guiLeft - 10, this.guiTop, "S"); + this.buttonAutoSplit = new GuiInputter.SmallerButton(0, this.leftPos - 10, this.topPos, "S"); this.addButton(this.buttonAutoSplit); } } @@ -74,7 +74,7 @@ public class GuiGrinder extends GuiWtfMojang { super.tick(); if (this.isDouble) { - this.buttonAutoSplit.setMessage(new StringTextComponent("S").mergeStyle(this.tileGrinder.isAutoSplit + this.buttonAutoSplit.setMessage(new StringTextComponent("S").withStyle(this.tileGrinder.isAutoSplit ? TextFormatting.DARK_GREEN : TextFormatting.RED)); } @@ -94,32 +94,32 @@ public class GuiGrinder extends GuiWtfMojang { } @Override - public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) { - AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.tileGrinder); + public void renderLabels(MatrixStack matrices, int x, int y) { + AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.tileGrinder); } @Override - public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) { + public void renderBg(MatrixStack matrices, float f, int x, int y) { RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); - this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); + this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + this.blit(matrices, this.leftPos, this.topPos + 93, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bindTexture(this.isDouble + this.getMinecraft().getTextureManager().bind(this.isDouble ? RES_LOC_DOUBLE : RES_LOC); - this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93); + this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 93); if (this.tileGrinder.firstCrushTime > 0) { int i = this.tileGrinder.getFirstTimeToScale(23); - this.blit(matrices, this.guiLeft + (this.isDouble + this.blit(matrices, this.leftPos + (this.isDouble ? 51 - : 80), this.guiTop + 40, 176, 0, 24, i); + : 80), this.topPos + 40, 176, 0, 24, i); } if (this.isDouble) { if (this.tileGrinder.secondCrushTime > 0) { int i = this.tileGrinder.getSecondTimeToScale(23); - this.blit(matrices, this.guiLeft + 101, this.guiTop + 40, 176, 22, 24, i); + this.blit(matrices, this.leftPos + 101, this.topPos + 40, 176, 22, 24, i); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiInputter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiInputter.java index 59e99f22b..aa419cdc3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiInputter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiInputter.java @@ -28,6 +28,8 @@ import net.minecraft.util.text.ITextComponent; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraft.client.gui.widget.button.Button.IPressable; + @OnlyIn(Dist.CLIENT) public class GuiInputter extends GuiWtfMojang { @@ -48,8 +50,8 @@ public class GuiInputter extends GuiWtfMojang { public GuiInputter(ContainerInputter container, PlayerInventory inventory, ITextComponent title) { super(container, inventory); this.tileInputter = container.tileInputter; - this.xSize = 176; - this.ySize = 97 + 86 + (container.isAdvanced + this.imageWidth = 176; + this.imageHeight = 97 + 86 + (container.isAdvanced ? OFFSET_ADVANCED : 0); this.isAdvanced = container.isAdvanced; @@ -60,49 +62,49 @@ public class GuiInputter extends GuiWtfMojang { super.init(); if (this.isAdvanced) { - this.leftFilter = new FilterSettingsGui(this.tileInputter.leftFilter, this.guiLeft + 3, this.guiTop + 6, this.buttonList); - this.rightFilter = new FilterSettingsGui(this.tileInputter.rightFilter, this.guiLeft + 157, this.guiTop + 6, this.buttonList); + this.leftFilter = new FilterSettingsGui(this.tileInputter.leftFilter, this.leftPos + 3, this.topPos + 6, this.buttonList); + this.rightFilter = new FilterSettingsGui(this.tileInputter.rightFilter, this.leftPos + 157, this.topPos + 6, this.buttonList); } - this.fieldPullStart = new TextFieldWidget(this.font, this.guiLeft + 6, this.guiTop + 80 + (this.isAdvanced + this.fieldPullStart = new TextFieldWidget(this.font, this.leftPos + 6, this.topPos + 80 + (this.isAdvanced ? OFFSET_ADVANCED : 0), 34, 8); - this.fieldPullStart.setMaxStringLength(5); - this.fieldPullStart.setEnableBackgroundDrawing(false); + this.fieldPullStart.setMaxLength(5); + this.fieldPullStart.setBordered(false); this.children.add(this.fieldPullStart); - this.fieldPullEnd = new TextFieldWidget(this.font, this.guiLeft + 50, this.guiTop + 80 + (this.isAdvanced + this.fieldPullEnd = new TextFieldWidget(this.font, this.leftPos + 50, this.topPos + 80 + (this.isAdvanced ? OFFSET_ADVANCED : 0), 34, 8); - this.fieldPullEnd.setMaxStringLength(5); - this.fieldPullEnd.setEnableBackgroundDrawing(false); + this.fieldPullEnd.setMaxLength(5); + this.fieldPullEnd.setBordered(false); this.children.add(this.fieldPullEnd); - this.fieldPutStart = new TextFieldWidget(this.font, this.guiLeft + 91, this.guiTop + 80 + (this.isAdvanced + this.fieldPutStart = new TextFieldWidget(this.font, this.leftPos + 91, this.topPos + 80 + (this.isAdvanced ? OFFSET_ADVANCED : 0), 34, 8); - this.fieldPutStart.setMaxStringLength(5); - this.fieldPutStart.setEnableBackgroundDrawing(false); + this.fieldPutStart.setMaxLength(5); + this.fieldPutStart.setBordered(false); this.children.add(this.fieldPutStart); - this.fieldPutEnd = new TextFieldWidget(this.font, this.guiLeft + 135, this.guiTop + 80 + (this.isAdvanced + this.fieldPutEnd = new TextFieldWidget(this.font, this.leftPos + 135, this.topPos + 80 + (this.isAdvanced ? OFFSET_ADVANCED : 0), 34, 8); - this.fieldPutEnd.setMaxStringLength(5); - this.fieldPutEnd.setEnableBackgroundDrawing(false); + this.fieldPutEnd.setMaxLength(5); + this.fieldPutEnd.setBordered(false); this.children.add(this.fieldPutEnd); - SmallerButton buttonSidePutP = new SmallerButton(0, this.guiLeft + 155, this.guiTop + 43 + (this.isAdvanced + SmallerButton buttonSidePutP = new SmallerButton(0, this.leftPos + 155, this.topPos + 43 + (this.isAdvanced ? OFFSET_ADVANCED : 0), ">"); - SmallerButton buttonSidePutM = new SmallerButton(1, this.guiLeft + 90, this.guiTop + 43 + (this.isAdvanced + SmallerButton buttonSidePutM = new SmallerButton(1, this.leftPos + 90, this.topPos + 43 + (this.isAdvanced ? OFFSET_ADVANCED : 0), "<"); - SmallerButton buttonSidePullP = new SmallerButton(2, this.guiLeft + 70, this.guiTop + 43 + (this.isAdvanced + SmallerButton buttonSidePullP = new SmallerButton(2, this.leftPos + 70, this.topPos + 43 + (this.isAdvanced ? OFFSET_ADVANCED : 0), ">"); - SmallerButton buttonSidePullM = new SmallerButton(3, this.guiLeft + 5, this.guiTop + 43 + (this.isAdvanced + SmallerButton buttonSidePullM = new SmallerButton(3, this.leftPos + 5, this.topPos + 43 + (this.isAdvanced ? OFFSET_ADVANCED : 0), "<"); @@ -111,7 +113,7 @@ public class GuiInputter extends GuiWtfMojang { this.addButton(buttonSidePutM); this.addButton(buttonSidePullM); - this.addButton(new TinyButton(TileEntityInputter.OKAY_BUTTON_ID, this.guiLeft + 84, this.guiTop + 91 + (this.isAdvanced + this.addButton(new TinyButton(TileEntityInputter.OKAY_BUTTON_ID, this.leftPos + 84, this.topPos + 91 + (this.isAdvanced ? OFFSET_ADVANCED : 0))); } @@ -120,20 +122,20 @@ public class GuiInputter extends GuiWtfMojang { public void render(MatrixStack matrices, int x, int y, float f) { super.render(matrices, x, y, f); - int newTopOffset = this.guiTop + (this.isAdvanced + int newTopOffset = this.topPos + (this.isAdvanced ? OFFSET_ADVANCED : 0); //Info Mode on! - if (x >= this.guiLeft + 4 && y >= newTopOffset + 65 && x <= this.guiLeft + 4 + 38 && y <= newTopOffset + 65 + 12) { + if (x >= this.leftPos + 4 && y >= newTopOffset + 65 && x <= this.leftPos + 4 + 38 && y <= newTopOffset + 65 + 12) { this.drawHoveringText(this.font.listFormattedStringToWidth(StringUtil.localizeFormatted("info." + ActuallyAdditions.MODID + ".inputter.info.1").replace("

", StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.pull")), 200), x, y); } - if (x >= this.guiLeft + 89 && y >= newTopOffset + 65 && x <= this.guiLeft + 89 + 38 && y <= newTopOffset + 65 + 12) { + if (x >= this.leftPos + 89 && y >= newTopOffset + 65 && x <= this.leftPos + 89 + 38 && y <= newTopOffset + 65 + 12) { this.drawHoveringText(this.font.listFormattedStringToWidth(StringUtil.localizeFormatted("info." + ActuallyAdditions.MODID + ".inputter.info.1").replace("

", StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.put")), 200), x, y); } - if (x >= this.guiLeft + 48 && y >= newTopOffset + 65 && x <= this.guiLeft + 48 + 38 && y <= newTopOffset + 65 + 12) { + if (x >= this.leftPos + 48 && y >= newTopOffset + 65 && x <= this.leftPos + 48 + 38 && y <= newTopOffset + 65 + 12) { this.drawHoveringText(this.font.listFormattedStringToWidth(StringUtil.localizeFormatted("info." + ActuallyAdditions.MODID + ".inputter.info.2").replace("

", StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.pull")), 200), x, y); } - if (x >= this.guiLeft + 133 && y >= newTopOffset + 65 && x <= this.guiLeft + 133 + 38 && y <= newTopOffset + 65 + 12) { + if (x >= this.leftPos + 133 && y >= newTopOffset + 65 && x <= this.leftPos + 133 + 38 && y <= newTopOffset + 65 + 12) { this.drawHoveringText(this.font.listFormattedStringToWidth(StringUtil.localizeFormatted("info." + ActuallyAdditions.MODID + ".inputter.info.2").replace("

", StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.put")), 200), x, y); } @@ -144,50 +146,50 @@ public class GuiInputter extends GuiWtfMojang { } @Override - public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) { - AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.tileInputter); + public void renderLabels(MatrixStack matrices, int x, int y) { + AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.tileInputter); } @Override - public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) { + public void renderBg(MatrixStack matrices, float f, int x, int y) { RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); - this.blit(matrices, this.guiLeft, this.guiTop + 97 + (this.isAdvanced + this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + this.blit(matrices, this.leftPos, this.topPos + 97 + (this.isAdvanced ? OFFSET_ADVANCED : 0), 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bindTexture(this.isAdvanced + this.getMinecraft().getTextureManager().bind(this.isAdvanced ? RES_LOC_ADVANCED : RES_LOC); - this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 97 + (this.isAdvanced + this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 97 + (this.isAdvanced ? OFFSET_ADVANCED : 0)); - this.font.drawString(matrices, StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.inbound"), this.guiLeft + 23 + 3, this.guiTop + 32 + (this.isAdvanced + this.font.draw(matrices, StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.inbound"), this.leftPos + 23 + 3, this.topPos + 32 + (this.isAdvanced ? OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT); - this.font.drawString(matrices, StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.outbound"), this.guiLeft + 104 + 3, this.guiTop + 32 + (this.isAdvanced + this.font.draw(matrices, StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.outbound"), this.leftPos + 104 + 3, this.topPos + 32 + (this.isAdvanced ? OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT); - this.font.drawString(matrices, SIDES[this.tileInputter.sideToPull + 1], this.guiLeft + 24 + 1, this.guiTop + 45 + 3 + (this.isAdvanced + this.font.draw(matrices, SIDES[this.tileInputter.sideToPull + 1], this.leftPos + 24 + 1, this.topPos + 45 + 3 + (this.isAdvanced ? OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT); - this.font.drawString(matrices, SIDES[this.tileInputter.sideToPut + 1], this.guiLeft + 109 + 1, this.guiTop + 45 + 3 + (this.isAdvanced + this.font.draw(matrices, SIDES[this.tileInputter.sideToPut + 1], this.leftPos + 109 + 1, this.topPos + 45 + 3 + (this.isAdvanced ? OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT); - this.font.drawString(matrices, Integer.toString(this.tileInputter.slotToPutStart), this.guiLeft + 92, this.guiTop + 67 + (this.isAdvanced + this.font.draw(matrices, Integer.toString(this.tileInputter.slotToPutStart), this.leftPos + 92, this.topPos + 67 + (this.isAdvanced ? OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_WHITE); - this.font.drawString(matrices, Integer.toString(this.tileInputter.slotToPutEnd), this.guiLeft + 136, this.guiTop + 67 + (this.isAdvanced + this.font.draw(matrices, Integer.toString(this.tileInputter.slotToPutEnd), this.leftPos + 136, this.topPos + 67 + (this.isAdvanced ? OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_WHITE); - this.font.drawString(matrices, Integer.toString(this.tileInputter.slotToPullStart), this.guiLeft + 7, this.guiTop + 67 + (this.isAdvanced + this.font.draw(matrices, Integer.toString(this.tileInputter.slotToPullStart), this.leftPos + 7, this.topPos + 67 + (this.isAdvanced ? OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_WHITE); - this.font.drawString(matrices, Integer.toString(this.tileInputter.slotToPullEnd), this.guiLeft + 51, this.guiTop + 67 + (this.isAdvanced + this.font.draw(matrices, Integer.toString(this.tileInputter.slotToPullEnd), this.leftPos + 51, this.topPos + 67 + (this.isAdvanced ? OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_WHITE); } @@ -243,9 +245,9 @@ public class GuiInputter extends GuiWtfMojang { } public void setVariable(TextFieldWidget field, int sendInt) { - if (!field.getText().isEmpty()) { - this.sendPacket(this.parse(field.getText()), sendInt); - field.setText(""); + if (!field.getValue().isEmpty()) { + this.sendPacket(this.parse(field.getValue()), sendInt); + field.setValue(""); } } @@ -293,13 +295,13 @@ public class GuiInputter extends GuiWtfMojang { @Override public void render(MatrixStack matrices, int x, int y, float f) { if (this.visible) { - Minecraft.getInstance().getTextureManager().bindTexture(this.resLoc); + Minecraft.getInstance().getTextureManager().bind(this.resLoc); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); this.isHovered = x >= this.x && y >= this.y && x < this.x + this.width && y < this.y + this.height; int k = this.getHoverState(this.hovered); - GlStateManager.enableBlend(); + GlStateManager._enableBlend(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - GlStateManager.blendFunc(770, 771); + GlStateManager._blendFunc(770, 771); this.blit(matrices, this.x, this.y, this.smaller ? 200 : 176, k * this.height, this.width, this.height); @@ -331,13 +333,13 @@ public class GuiInputter extends GuiWtfMojang { @Override public void drawButton(Minecraft mc, int x, int y, float f) { if (this.visible) { - mc.getTextureManager().bindTexture(this.resLoc); + mc.getTextureManager().bind(this.resLoc); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); this.hovered = x >= this.x && y >= this.y && x < this.x + this.width && y < this.y + this.height; int k = this.getHoverState(this.hovered); - GlStateManager.enableBlend(); + GlStateManager._enableBlend(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - GlStateManager.blendFunc(770, 771); + GlStateManager._blendFunc(770, 771); this.blit(matrices, this.x, this.y, 192, k * 8, 8, 8); this.mouseDragged(mc, x, y); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiLaserRelayItemWhitelist.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiLaserRelayItemWhitelist.java index 8ff47e245..82a2eeaf6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiLaserRelayItemWhitelist.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiLaserRelayItemWhitelist.java @@ -45,8 +45,8 @@ public class GuiLaserRelayItemWhitelist extends GuiWtfMojang { public GuiMiner(ContainerMiner container, PlayerInventory inventory, ITextComponent title) { super(container, inventory); this.miner = container.miner; - this.xSize = 176; - this.ySize = 93 + 86; + this.imageWidth = 176; + this.imageHeight = 93 + 86; } @Override public void init() { super.init(); - Button buttonMode = new Button(this.guiLeft + this.xSize / 2 - 51, this.guiTop + 75, 50, 20, "Mode", button -> { + Button buttonMode = new Button(this.leftPos + this.imageWidth / 2 - 51, this.topPos + 75, 50, 20, "Mode", button -> { }); this.addButton(buttonMode); - Button buttonReset = new Button(this.guiLeft + this.xSize / 2 + 1, this.guiTop + 75, 50, 20, "Reset", button -> { + Button buttonReset = new Button(this.leftPos + this.imageWidth / 2 + 1, this.topPos + 75, 50, 20, "Reset", button -> { }); this.addButton(buttonReset); } @Override - public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) { - AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.miner); + public void renderLabels(MatrixStack matrices, int x, int y) { + AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.miner); } @Override - public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) { + public void renderBg(MatrixStack matrices, float f, int x, int y) { RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); - this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); + this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + this.blit(matrices, this.leftPos, this.topPos + 93, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bindTexture(RES_LOC); - this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93); + this.getMinecraft().getTextureManager().bind(RES_LOC); + this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 93); String mining = this.miner.onlyMineOres ? "Only Mining Ores" : "Mining Everything"; - this.font.drawString(matrices, mining, this.guiLeft + this.xSize / 2 - this.font.getStringWidth(mining) / 2, this.guiTop + 8, StringUtil.DECIMAL_COLOR_GRAY_TEXT); + this.font.draw(matrices, mining, this.leftPos + this.imageWidth / 2 - this.font.width(mining) / 2, this.topPos + 8, StringUtil.DECIMAL_COLOR_GRAY_TEXT); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiOilGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiOilGenerator.java index acdb4823e..c61033008 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiOilGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiOilGenerator.java @@ -36,15 +36,15 @@ public class GuiOilGenerator extends GuiWtfMojang { public GuiOilGenerator(ContainerOilGenerator container, PlayerInventory inventory, ITextComponent title) { super(container, inventory); this.generator = container.generator; - this.xSize = 176; - this.ySize = 93 + 86; + this.imageWidth = 176; + this.imageHeight = 93 + 86; } @Override public void init() { super.init(); - this.energy = new EnergyDisplay(this.guiLeft + 42, this.guiTop + 5, this.generator.storage); - this.fluid = new FluidDisplay(this.guiLeft + 116, this.guiTop + 5, this.generator.tank); + this.energy = new EnergyDisplay(this.leftPos + 42, this.topPos + 5, this.generator.storage); + this.fluid = new FluidDisplay(this.leftPos + 116, this.topPos + 5, this.generator.tank); } @Override @@ -55,33 +55,33 @@ public class GuiOilGenerator extends GuiWtfMojang { } @Override - public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) { - AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.generator); + public void renderLabels(MatrixStack matrices, int x, int y) { + AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.generator); } @Override - public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) { + public void renderBg(MatrixStack matrices, float f, int x, int y) { RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); - this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); + this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + this.blit(matrices, this.leftPos, this.topPos + 93, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bindTexture(RES_LOC); - this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93); + this.getMinecraft().getTextureManager().bind(RES_LOC); + this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 93); if (this.generator.currentBurnTime > 0 && this.generator.maxBurnTime > 0) { int i = this.generator.getBurningScaled(13); - this.blit(matrices, this.guiLeft + 72, this.guiTop + 44 + 12 - i, 176, 96 - i, 14, i); + this.blit(matrices, this.leftPos + 72, this.topPos + 44 + 12 - i, 176, 96 - i, 14, i); } if (this.generator.maxBurnTime > 0 && this.generator.currentEnergyProduce > 0) { - drawCenteredString(matrices, this.font, this.generator.currentEnergyProduce + " " + I18n.format("actuallyadditions.cft"), this.guiLeft + 87, this.guiTop + 65, 0xFFFFFF); - drawCenteredString(matrices, this.font, "for " + this.generator.maxBurnTime + " t", this.guiLeft + 87, this.guiTop + 75, 0xFFFFFF); - matrices.push(); + drawCenteredString(matrices, this.font, this.generator.currentEnergyProduce + " " + I18n.get("actuallyadditions.cft"), this.leftPos + 87, this.topPos + 65, 0xFFFFFF); + drawCenteredString(matrices, this.font, "for " + this.generator.maxBurnTime + " t", this.leftPos + 87, this.topPos + 75, 0xFFFFFF); + matrices.pushPose(); matrices.scale(0.75F, 0.75F, 1F); - float xS = (this.guiLeft + 87) * 1.365F - this.font.getStringWidth("(per 50 mB)") / 2F; - StringUtil.renderScaledAsciiString(this.font, "(per 50 mB)", xS, (this.guiTop + 85) * 1.345F, 0xFFFFFF, true, 0.75F); - matrices.pop(); + float xS = (this.leftPos + 87) * 1.365F - this.font.width("(per 50 mB)") / 2F; + StringUtil.renderScaledAsciiString(this.font, "(per 50 mB)", xS, (this.topPos + 85) * 1.345F, 0xFFFFFF, true, 0.75F); + matrices.popPose(); } this.energy.draw(matrices); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiPhantomPlacer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiPhantomPlacer.java index 39b597206..b24803b65 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiPhantomPlacer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiPhantomPlacer.java @@ -39,8 +39,8 @@ public class GuiPhantomPlacer extends GuiWtfMojang { public GuiPhantomPlacer(ContainerPhantomPlacer container, PlayerInventory inventory, ITextComponent title) { super(container, inventory); this.placer = container.placer; - this.xSize = 176; - this.ySize = 93 + 86; + this.imageWidth = 176; + this.imageHeight = 93 + 86; } @Override @@ -48,7 +48,7 @@ public class GuiPhantomPlacer extends GuiWtfMojang { super.init(); if (!this.placer.isBreaker) { - this.addButton(new Button(0, this.guiLeft + 63, this.guiTop + 75, 50, 20, this.getSide())); + this.addButton(new Button(0, this.leftPos + 63, this.topPos + 75, 50, 20, this.getSide())); } } @@ -87,18 +87,18 @@ public class GuiPhantomPlacer extends GuiWtfMojang { } @Override - public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) { - AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.placer); + public void renderLabels(MatrixStack matrices, int x, int y) { + AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.placer); } @Override - public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) { + public void renderBg(MatrixStack matrices, float f, int x, int y) { RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); - this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); + this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + this.blit(matrices, this.leftPos, this.topPos + 93, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bindTexture(RES_LOC); - this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93); + this.getMinecraft().getTextureManager().bind(RES_LOC); + this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 93); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiRangedCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiRangedCollector.java index 0d46bb530..417a09402 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiRangedCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiRangedCollector.java @@ -35,15 +35,15 @@ public class GuiRangedCollector extends GuiWtfMojang { public GuiRangedCollector(ContainerRangedCollector container, PlayerInventory inventory, ITextComponent title) { super(container, inventory); this.collector = container.collector; - this.xSize = 176; - this.ySize = 86 + 86; + this.imageWidth = 176; + this.imageHeight = 86 + 86; } @Override public void init() { super.init(); - this.filter = new FilterSettingsGui(this.collector.filter, this.guiLeft + 3, this.guiTop + 6, this.buttonList); + this.filter = new FilterSettingsGui(this.collector.filter, this.leftPos + 3, this.topPos + 6, this.buttonList); } @Override @@ -61,19 +61,19 @@ public class GuiRangedCollector extends GuiWtfMojang { } @Override - public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) { - AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.collector); + public void renderLabels(MatrixStack matrices, int x, int y) { + AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.collector); } @Override - public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) { + public void renderBg(MatrixStack matrices, float f, int x, int y) { RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); - this.blit(matrices, this.guiLeft, this.guiTop + 86, 0, 0, 176, 86); + this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + this.blit(matrices, this.leftPos, this.topPos + 86, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bindTexture(RES_LOC); - this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 86); + this.getMinecraft().getTextureManager().bind(RES_LOC); + this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 86); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiWtfMojang.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiWtfMojang.java index e26a4ea05..0b942d570 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiWtfMojang.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiWtfMojang.java @@ -26,6 +26,6 @@ public abstract class GuiWtfMojang extends ContainerScreen< public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { this.renderBackground(matrixStack); super.render(matrixStack, mouseX, mouseY, partialTicks); - this.renderHoveredTooltip(matrixStack, mouseX, mouseY); + this.renderTooltip(matrixStack, mouseX, mouseY); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiXPSolidifier.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiXPSolidifier.java index 2ba72868f..a77c002a7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiXPSolidifier.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiXPSolidifier.java @@ -36,31 +36,31 @@ public class GuiXPSolidifier extends GuiWtfMojang { public GuiXPSolidifier(ContainerXPSolidifier container, PlayerInventory inventory, ITextComponent title) { super(container, inventory); this.solidifier = container.solidifier; - this.xSize = 176; - this.ySize = 93 + 86; + this.imageWidth = 176; + this.imageHeight = 93 + 86; } @Override public void init() { super.init(); - Button buttonOne = new GuiInputter.SmallerButton(this.guiLeft + 62, this.guiTop + 44, new StringTextComponent("1"), btn -> { + Button buttonOne = new GuiInputter.SmallerButton(this.leftPos + 62, this.topPos + 44, new StringTextComponent("1"), btn -> { }); - Button buttonFive = new GuiInputter.SmallerButton(this.guiLeft + 80, this.guiTop + 44, new StringTextComponent("5"), btn -> { + Button buttonFive = new GuiInputter.SmallerButton(this.leftPos + 80, this.topPos + 44, new StringTextComponent("5"), btn -> { }); - Button buttonTen = new GuiInputter.SmallerButton(this.guiLeft + 99, this.guiTop + 44, new StringTextComponent("10"), btn -> { + Button buttonTen = new GuiInputter.SmallerButton(this.leftPos + 99, this.topPos + 44, new StringTextComponent("10"), btn -> { }); - Button buttonTwenty = new GuiInputter.SmallerButton(this.guiLeft + 62, this.guiTop + 61, new StringTextComponent("20"), btn -> { + Button buttonTwenty = new GuiInputter.SmallerButton(this.leftPos + 62, this.topPos + 61, new StringTextComponent("20"), btn -> { }); - Button buttonThirty = new GuiInputter.SmallerButton(this.guiLeft + 80, this.guiTop + 61, new StringTextComponent("30"), btn -> { + Button buttonThirty = new GuiInputter.SmallerButton(this.leftPos + 80, this.topPos + 61, new StringTextComponent("30"), btn -> { }); - Button buttonForty = new GuiInputter.SmallerButton(this.guiLeft + 99, this.guiTop + 61, new StringTextComponent("40"), btn -> { + Button buttonForty = new GuiInputter.SmallerButton(this.leftPos + 99, this.topPos + 61, new StringTextComponent("40"), btn -> { }); - Button buttonFifty = new GuiInputter.SmallerButton(this.guiLeft + 62, this.guiTop + 78, new StringTextComponent("50"), btn -> { + Button buttonFifty = new GuiInputter.SmallerButton(this.leftPos + 62, this.topPos + 78, new StringTextComponent("50"), btn -> { }); - Button buttonSixtyFour = new GuiInputter.SmallerButton(this.guiLeft + 80, this.guiTop + 78, new StringTextComponent("64"), btn -> { + Button buttonSixtyFour = new GuiInputter.SmallerButton(this.leftPos + 80, this.topPos + 78, new StringTextComponent("64"), btn -> { }); - Button buttonAll = new GuiInputter.SmallerButton(this.guiLeft + 99, this.guiTop + 78, new StringTextComponent("All"), btn -> { + Button buttonAll = new GuiInputter.SmallerButton(this.leftPos + 99, this.topPos + 78, new StringTextComponent("All"), btn -> { }); this.addButton(buttonOne); @@ -75,21 +75,21 @@ public class GuiXPSolidifier extends GuiWtfMojang { } @Override - public void drawGuiContainerForegroundLayer(MatrixStack matrices, int x, int y) { - AssetUtil.displayNameString(matrices, this.font, this.xSize, -10, this.solidifier); + public void renderLabels(MatrixStack matrices, int x, int y) { + AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.solidifier); } @Override - public void drawGuiContainerBackgroundLayer(MatrixStack matrices, float f, int x, int y) { + public void renderBg(MatrixStack matrices, float f, int x, int y) { RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - this.getMinecraft().getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); - this.blit(matrices, this.guiLeft, this.guiTop + 93, 0, 0, 176, 86); + this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); + this.blit(matrices, this.leftPos, this.topPos + 93, 0, 0, 176, 86); - this.getMinecraft().getTextureManager().bindTexture(RES_LOC); - this.blit(matrices, this.guiLeft, this.guiTop, 0, 0, 176, 93); + this.getMinecraft().getTextureManager().bind(RES_LOC); + this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 93); - drawCenteredString(matrices, this.font, Integer.toString(this.solidifier.amount), this.guiLeft + 88, this.guiTop + 30, StringUtil.DECIMAL_COLOR_WHITE); + drawCenteredString(matrices, this.font, Integer.toString(this.solidifier.amount), this.leftPos + 88, this.topPos + 30, StringUtil.DECIMAL_COLOR_WHITE); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/TexturedButton.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/TexturedButton.java index b216553e1..a972365b4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/TexturedButton.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/TexturedButton.java @@ -25,6 +25,8 @@ import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; +import net.minecraft.client.gui.widget.button.Button.IPressable; + @OnlyIn(Dist.CLIENT) public class TexturedButton extends Button { @@ -48,16 +50,16 @@ public class TexturedButton extends Button { @Override public void render(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) { if (this.visible) { - Minecraft.getInstance().getTextureManager().bindTexture(this.resLoc); + Minecraft.getInstance().getTextureManager().bind(this.resLoc); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); this.isHovered = mouseX >= this.x && mouseY >= this.y && this.x < this.x + this.width && this.y < this.y + this.height; int k = this.isHovered ? 1 : 0; - GlStateManager.enableBlend(); - GlStateManager.blendFuncSeparate(770, 771, 1, 0); - GlStateManager.blendFunc(770, 771); + GlStateManager._enableBlend(); + GlStateManager._blendFuncSeparate(770, 771, 1, 0); + GlStateManager._blendFunc(770, 771); this.blit(matrices, this.x, this.y, this.texturePosX, this.texturePosY - this.height + k * this.height, this.width, this.height); // this.mouseDragged(minecraft, x, y); } @@ -66,7 +68,7 @@ public class TexturedButton extends Button { public void drawHover(MatrixStack matrices, int x, int y) { if (this.isMouseOver(x, y)) { Minecraft mc = Minecraft.getInstance(); - GuiUtils.drawHoveringText(matrices, this.textList.stream().map(StringTextComponent::new).collect(Collectors.toList()), x, y, mc.currentScreen.width, mc.currentScreen.height, -1, mc.fontRenderer); + GuiUtils.drawHoveringText(matrices, this.textList.stream().map(StringTextComponent::new).collect(Collectors.toList()), x, y, mc.screen.width, mc.screen.height, -1, mc.font); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotDeletion.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotDeletion.java index eaa9b6a5a..d721fd1f9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotDeletion.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotDeletion.java @@ -20,7 +20,7 @@ public class SlotDeletion extends SlotItemHandlerUnconditioned { } @Override - public void putStack(ItemStack stack) { - this.onSlotChanged(); + public void set(ItemStack stack) { + this.setChanged(); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotFilter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotFilter.java index 16d7ffab6..c4af9d689 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotFilter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotFilter.java @@ -30,7 +30,7 @@ public class SlotFilter extends SlotItemHandlerUnconditioned { } public static boolean checkFilter(Container container, int slotId, PlayerEntity player) { - if (slotId >= 0 && slotId < container.inventorySlots.size()) { + if (slotId >= 0 && slotId < container.slots.size()) { Slot slot = container.getSlot(slotId); if (slot instanceof SlotFilter) { ((SlotFilter) slot).slotClick(player); @@ -45,20 +45,20 @@ public class SlotFilter extends SlotItemHandlerUnconditioned { } private void slotClick(PlayerEntity player) { - ItemStack heldStack = player.inventory.getItemStack(); - ItemStack stackInSlot = this.getStack(); + ItemStack heldStack = player.inventory.getCarried(); + ItemStack stackInSlot = this.getItem(); if (StackUtil.isValid(stackInSlot) && !StackUtil.isValid(heldStack)) { if (isFilter(stackInSlot)) { - player.inventory.setItemStack(stackInSlot); + player.inventory.setCarried(stackInSlot); } - this.putStack(StackUtil.getEmpty()); + this.set(StackUtil.getEmpty()); } else if (StackUtil.isValid(heldStack)) { if (!isFilter(stackInSlot)) { ItemStack s = heldStack.copy(); s.setCount(1); - this.putStack(s); + this.set(s); if (isFilter(heldStack)) { heldStack.shrink(1); @@ -68,17 +68,17 @@ public class SlotFilter extends SlotItemHandlerUnconditioned { } @Override - public boolean isItemValid(ItemStack stack) { + public boolean mayPlace(ItemStack stack) { return false; } @Override - public void putStack(ItemStack stack) { - super.putStack(stack.copy()); + public void set(ItemStack stack) { + super.set(stack.copy()); } @Override - public boolean canTakeStack(PlayerEntity player) { + public boolean mayPickup(PlayerEntity player) { return false; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotImmovable.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotImmovable.java index 0b881de30..1031968ce 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotImmovable.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotImmovable.java @@ -22,22 +22,22 @@ public class SlotImmovable extends Slot { } @Override - public boolean isItemValid(ItemStack stack) { + public boolean mayPlace(ItemStack stack) { return false; } @Override - public void putStack(ItemStack stack) { + public void set(ItemStack stack) { } @Override - public ItemStack decrStackSize(int i) { + public ItemStack remove(int i) { return ItemStack.EMPTY; } @Override - public boolean canTakeStack(PlayerEntity player) { + public boolean mayPickup(PlayerEntity player) { return false; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotItemHandlerUnconditioned.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotItemHandlerUnconditioned.java index 3f9fcdf2d..1fc736267 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotItemHandlerUnconditioned.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotItemHandlerUnconditioned.java @@ -27,7 +27,7 @@ public class SlotItemHandlerUnconditioned extends SlotItemHandler { } @Override - public boolean isItemValid(ItemStack stack) { + public boolean mayPlace(ItemStack stack) { if (stack.isEmpty() || !this.inv.canAccept(this.getSlotIndex(), stack, false)) return false; ItemStack currentStack = this.inv.getStackInSlot(this.getSlotIndex()); @@ -42,18 +42,18 @@ public class SlotItemHandlerUnconditioned extends SlotItemHandler { */ @Override @Nonnull - public ItemStack getStack() { + public ItemStack getItem() { return this.inv.getStackInSlot(this.getSlotIndex()); } @Override - public void putStack(ItemStack stack) { + public void set(ItemStack stack) { this.inv.setStackInSlot(this.getSlotIndex(), stack); - this.onSlotChanged(); + this.setChanged(); } @Override - public int getItemStackLimit(ItemStack stack) { + public int getMaxStackSize(ItemStack stack) { ItemStack maxAdd = stack.copy(); maxAdd.setCount(stack.getMaxStackSize()); ItemStack currentStack = this.inv.getStackInSlot(this.getSlotIndex()); @@ -64,12 +64,12 @@ public class SlotItemHandlerUnconditioned extends SlotItemHandler { } @Override - public boolean canTakeStack(PlayerEntity playerIn) { + public boolean mayPickup(PlayerEntity playerIn) { return !this.inv.extractItem(this.getSlotIndex(), 1, true, false).isEmpty(); } @Override - public ItemStack decrStackSize(int amount) { + public ItemStack remove(int amount) { return this.inv.extractItem(this.getSlotIndex(), amount, false, false); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotOutput.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotOutput.java index 564b8a3ae..7b05345f8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotOutput.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotOutput.java @@ -20,7 +20,7 @@ public class SlotOutput extends SlotItemHandlerUnconditioned { } @Override - public boolean isItemValid(ItemStack stack) { + public boolean mayPlace(ItemStack stack) { return false; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ActuallyItems.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ActuallyItems.java index deef53141..dd79b285b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ActuallyItems.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ActuallyItems.java @@ -98,7 +98,7 @@ public final class ActuallyItems { public static final RegistryObject FILTER = ITEMS.register("filter", ItemFilter::new); public static final RegistryObject WATER_BOWL = ITEMS.register("water_bowl", ItemWaterBowl::new); public static final RegistryObject SPAWNER_CHANGER = ITEMS.register("spawner_changer", ItemSpawnerChanger::new); - public static final RegistryObject CRATE_KEEPER = ITEMS.register("crate_keeper", () -> new ItemGeneric(defaultProps().maxStackSize(1))); + public static final RegistryObject CRATE_KEEPER = ITEMS.register("crate_keeper", () -> new ItemGeneric(defaultProps().stacksTo(1))); public static final RegistryObject COLOR_LENS = ITEMS.register("color_lens", () -> new ItemLens(ActuallyAdditionsAPI.lensColor)); public static final RegistryObject EXPLOSION_LENS = ITEMS.register("explosion_lens", () -> new ItemLens(ActuallyAdditionsAPI.lensDetonation)); public static final RegistryObject DAMAGE_LENS = ITEMS.register("damage_lens", () -> new ItemLens(ActuallyAdditionsAPI.lensDeath)); @@ -240,10 +240,10 @@ public final class ActuallyItems { public static final RegistryObject PAXEL_CRYSTAL_ENORI = ITEMS.register("paxel_crystal_enori", () -> new ItemAllToolAA(ToolMaterials.ENORI)); public static Item.Properties defaultProps() { - return new Item.Properties().group(ActuallyAdditions.GROUP); + return new Item.Properties().tab(ActuallyAdditions.GROUP); } public static Item.Properties defaultNonStacking() { - return defaultProps().maxStackSize(1); + return defaultProps().stacksTo(1); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemAllToolAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemAllToolAA.java index 1ab2b2f41..bfb365352 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemAllToolAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemAllToolAA.java @@ -44,8 +44,8 @@ public class ItemAllToolAA extends ItemToolAA implements IColorProvidingItem { super(4.0F, -2F, toolMat, this.repairItem, unlocalizedName, this.rarity, new HashSet<>()); this.color = this.color; - this.setMaxDamage(toolMat.getMaxUses() * 4); - this.setHarvestLevels(toolMat.getHarvestLevel()); + this.setMaxDamage(toolMat.getUses() * 4); + this.setHarvestLevels(toolMat.getLevel()); } private void setHarvestLevels(int amount) { @@ -61,7 +61,7 @@ public class ItemAllToolAA extends ItemToolAA implements IColorProvidingItem { @Override public EnumActionResult onItemUse(PlayerEntity playerIn, World worldIn, BlockPos pos, Hand hand, Direction side, float hitX, float hitY, float hitZ) { - if (!playerIn.isSneaking()) { + if (!playerIn.isShiftKeyDown()) { return Items.IRON_HOE.onItemUse(playerIn, worldIn, pos, hand, side, hitX, hitY, hitZ); } return Items.IRON_SHOVEL.onItemUse(playerIn, worldIn, pos, hand, side, hitX, hitY, hitZ); @@ -77,7 +77,7 @@ public class ItemAllToolAA extends ItemToolAA implements IColorProvidingItem { ? state.getBlock() != Blocks.IRON_BLOCK && state.getBlock() != Blocks.IRON_ORE ? state.getBlock() != Blocks.LAPIS_BLOCK && state.getBlock() != Blocks.LAPIS_ORE ? state.getBlock() != Blocks.REDSTONE_ORE && state.getBlock() != Blocks.LIT_REDSTONE_ORE - ? state.getMaterial() == Material.ROCK || state.getMaterial() == Material.IRON || state.getMaterial() == Material.ANVIL + ? state.getMaterial() == Material.STONE || state.getMaterial() == Material.METAL || state.getMaterial() == Material.HEAVY_METAL : this.toolMaterial.getHarvestLevel() >= 2 : this.toolMaterial.getHarvestLevel() >= 1 : this.toolMaterial.getHarvestLevel() >= 1 @@ -107,7 +107,7 @@ public class ItemAllToolAA extends ItemToolAA implements IColorProvidingItem { return 15.0F; } else { return this.hasExtraWhitelist(state.getBlock()) || state.getBlock().getHarvestTool(state) == null || state.getBlock().getHarvestTool(state).isEmpty() || this.getToolClasses(stack).contains(state.getBlock().getHarvestTool(state)) - ? this.efficiency + ? this.speed : 1.0F; } } @@ -122,6 +122,6 @@ public class ItemAllToolAA extends ItemToolAA implements IColorProvidingItem { @Override public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment) { - return super.canApplyAtEnchantingTable(stack, enchantment) || enchantment.type.canEnchantItem(Items.DIAMOND_SWORD); + return super.canApplyAtEnchantingTable(stack, enchantment) || enchantment.category.canEnchant(Items.DIAMOND_SWORD); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemAxeAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemAxeAA.java index 2e1b12eb0..72b08e008 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemAxeAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemAxeAA.java @@ -28,15 +28,15 @@ public class ItemAxeAA extends ItemToolAA { public ItemAxeAA(IItemTier material) { super(6.0F, -3.0F, material, this.repairItem, unlocalizedName, this.rarity, EFFECTIVE_ON); - this.setHarvestLevel("axe", material.getHarvestLevel()); + this.setHarvestLevel("axe", material.getLevel()); } @Override public float getDestroySpeed(ItemStack stack, BlockState state) { Material material = state.getMaterial(); - return material != Material.WOOD && material != Material.PLANTS && material != Material.VINE + return material != Material.WOOD && material != Material.PLANT && material != Material.VINE ? super.getDestroySpeed(stack, state) - : this.efficiency; + : this.speed; } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBag.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBag.java index 72283d1ca..d93e253ff 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBag.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBag.java @@ -35,20 +35,20 @@ public class ItemBag extends ItemBase { public final boolean isVoid; public ItemBag(boolean isVoid) { - super(ActuallyItems.defaultProps().maxStackSize(1)); + super(ActuallyItems.defaultProps().stacksTo(1)); this.isVoid = isVoid; } @Override - public ActionResultType onItemUse(ItemUseContext context) { - ItemStack stack = context.getPlayer().getHeldItem(context.getHand()); + public ActionResultType useOn(ItemUseContext context) { + ItemStack stack = context.getPlayer().getItemInHand(context.getHand()); if (!this.isVoid) { - TileEntity tile = context.getWorld().getTileEntity(context.getPos()); + TileEntity tile = context.getLevel().getBlockEntity(context.getClickedPos()); if (tile != null) { - if (!context.getWorld().isRemote) { + if (!context.getLevel().isClientSide) { ItemStackHandlerAA inv = new ItemStackHandlerAA(ContainerBag.getSlotAmount(this.isVoid)); - boolean changed = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, context.getFace()) + boolean changed = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, context.getClickedFace()) .map(cap -> { boolean localChanged = false; ItemDrill.loadSlotsFromNBT(inv, stack); @@ -58,7 +58,7 @@ public class ItemBag extends ItemBase { if (StackUtil.isValid(invStack)) { for (int i = 0; i < cap.getSlots(); i++) { ItemStack remain = cap.insertItem(i, invStack, false); - if (!ItemStack.areItemStacksEqual(remain, invStack)) { + if (!ItemStack.matches(remain, invStack)) { inv.setStackInSlot(j, remain.copy()); localChanged = true; if (!StackUtil.isValid(remain)) { @@ -84,14 +84,14 @@ public class ItemBag extends ItemBase { } @Override - public ActionResult onItemRightClick(World world, PlayerEntity player, Hand hand) { - if (!world.isRemote && hand == Hand.MAIN_HAND) { - NetworkHooks.openGui((ServerPlayerEntity) player, new SimpleNamedContainerProvider((windowId, playerInventory, playerEntity) -> new ContainerBag(windowId, playerInventory, playerEntity.getHeldItem(hand), this.isVoid), StringTextComponent.EMPTY)); + public ActionResult use(World world, PlayerEntity player, Hand hand) { + if (!world.isClientSide && hand == Hand.MAIN_HAND) { + NetworkHooks.openGui((ServerPlayerEntity) player, new SimpleNamedContainerProvider((windowId, playerInventory, playerEntity) -> new ContainerBag(windowId, playerInventory, playerEntity.getItemInHand(hand), this.isVoid), StringTextComponent.EMPTY)); // player.openGui(ActuallyAdditions.INSTANCE, (this.isVoid // ? GuiTypes.VOID_BAG // : GuiTypes.BAG).ordinal(), world, (int) player.posX, (int) player.posY, (int) player.posZ); } - return ActionResult.resultPass(player.getHeldItem(hand)); + return ActionResult.pass(player.getItemInHand(hand)); } // TODO: [port] confirm this is correct diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBattery.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBattery.java index 3428d96c9..62c682e16 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBattery.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBattery.java @@ -35,16 +35,16 @@ public class ItemBattery extends ItemEnergy { } @Override - public boolean hasEffect(ItemStack stack) { + public boolean isFoil(ItemStack stack) { return ItemUtil.isEnabled(stack); } @Override public void inventoryTick(ItemStack stack, World world, Entity entity, int itemSlot, boolean isSelected) { - if (!world.isRemote && entity instanceof PlayerEntity && ItemUtil.isEnabled(stack) && !isSelected) { + if (!world.isClientSide && entity instanceof PlayerEntity && ItemUtil.isEnabled(stack) && !isSelected) { PlayerEntity player = (PlayerEntity) entity; - for (int i = 0; i < player.inventory.getSizeInventory(); i++) { - ItemStack slot = player.inventory.getStackInSlot(i); + for (int i = 0; i < player.inventory.getContainerSize(); i++) { + ItemStack slot = player.inventory.getItem(i); if (StackUtil.isValid(slot) && slot.getCount() == 1) { int extractable = this.extractEnergy(stack, Integer.MAX_VALUE, true); int received = slot.getCapability(CapabilityEnergy.ENERGY).map(e -> e.receiveEnergy(extractable, false)).orElse(0); @@ -58,17 +58,17 @@ public class ItemBattery extends ItemEnergy { } @Override - public ActionResult onItemRightClick(World worldIn, PlayerEntity player, Hand hand) { - if (!worldIn.isRemote && player.isSneaking()) { + public ActionResult use(World worldIn, PlayerEntity player, Hand hand) { + if (!worldIn.isClientSide && player.isShiftKeyDown()) { ItemUtil.changeEnabled(player, hand); - return ActionResult.resultSuccess(player.getHeldItem(hand)); + return ActionResult.success(player.getItemInHand(hand)); } - return super.onItemRightClick(worldIn, player, hand); + return super.use(worldIn, player, hand); } @Override - public void addInformation(ItemStack stack, @Nullable World playerIn, List list, ITooltipFlag advanced) { - super.addInformation(stack, playerIn, list, advanced); + public void appendHoverText(ItemStack stack, @Nullable World playerIn, List list, ITooltipFlag advanced) { + super.appendHoverText(stack, playerIn, list, advanced); list.add(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".battery." + (ItemUtil.isEnabled(stack) ? "discharge" : "noDischarge"))); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBooklet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBooklet.java index 1ee08ee87..519bb9e85 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBooklet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBooklet.java @@ -48,21 +48,21 @@ public class ItemBooklet extends ItemBase implements IHudDisplay { public static IBookletPage forcedPage; public ItemBooklet() { - super(ActuallyItems.defaultProps().maxStackSize(1)); + super(ActuallyItems.defaultProps().stacksTo(1)); } @Override - public ActionResultType onItemUse(ItemUseContext context) { - if (context.getPlayer().isSneaking()) { - BlockState state = context.getWorld().getBlockState(context.getPos()); + public ActionResultType useOn(ItemUseContext context) { + if (context.getPlayer().isShiftKeyDown()) { + BlockState state = context.getLevel().getBlockState(context.getClickedPos()); Block block = state.getBlock(); ItemStack blockStack = new ItemStack(block); IBookletPage page = BookletUtils.findFirstPageForStack(blockStack); if (page != null) { - if (context.getWorld().isRemote) { + if (context.getLevel().isClientSide) { forcedPage = page; } - this.onItemRightClick(context.getWorld(), context.getPlayer(), context.getHand()); + this.use(context.getLevel(), context.getPlayer(), context.getHand()); return ActionResultType.SUCCESS; } } @@ -70,25 +70,25 @@ public class ItemBooklet extends ItemBase implements IHudDisplay { } @Override - public ActionResult onItemRightClick(World world, PlayerEntity player, Hand hand) { + public ActionResult use(World world, PlayerEntity player, Hand hand) { player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.BOOK.ordinal(), world, (int) player.posX, (int) player.posY, (int) player.posZ); - if (!world.isRemote) { + if (!world.isClientSide) { //TheAchievements.OPEN_BOOKLET.get(player); //TheAchievements.OPEN_BOOKLET_MILESTONE.get(player); } - return ActionResult.resultSuccess(player.getHeldItem(hand)); + return ActionResult.success(player.getItemInHand(hand)); } @Override - public void addInformation(ItemStack stack, @Nullable World playerIn, List tooltip, ITooltipFlag advanced) { - tooltip.add(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + "." + this.getName().getString() + ".desc")); + public void appendHoverText(ItemStack stack, @Nullable World playerIn, List tooltip, ITooltipFlag advanced) { + tooltip.add(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + "." + this.getDescription().getString() + ".desc")); // TODO: this is bad for (int i = 1; i <= 4; i++) { - tooltip.add(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + "." + this.getName().getString() + ".sub." + i).mergeStyle(i == 4 + tooltip.add(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + "." + this.getDescription().getString() + ".sub." + i).withStyle(i == 4 ? TextFormatting.GOLD - : TextFormatting.RESET).mergeStyle(i == 4 + : TextFormatting.RESET).withStyle(i == 4 ? TextFormatting.ITALIC : TextFormatting.RESET)); } @@ -98,12 +98,12 @@ public class ItemBooklet extends ItemBase implements IHudDisplay { @OnlyIn(Dist.CLIENT) public void displayHud(MatrixStack matrices, Minecraft minecraft, PlayerEntity player, ItemStack stack, RayTraceResult rayCast, MainWindow resolution) { if (rayCast != null && rayCast.getBlockPos() != null) { - BlockState state = minecraft.world.getBlockState(rayCast.getBlockPos()); + BlockState state = minecraft.level.getBlockState(rayCast.getBlockPos()); Block block = state.getBlock(); - if (block != null && !block.isAir(minecraft.world.getBlockState(rayCast.getBlockPos()), minecraft.world, rayCast.getBlockPos())) { + if (block != null && !block.isAir(minecraft.level.getBlockState(rayCast.getBlockPos()), minecraft.level, rayCast.getBlockPos())) { ItemStack blockStack = new ItemStack(block, 1, block.getMetaFromState(state)); - int height = resolution.getScaledHeight() / 5 * 3; - if (player.isSneaking()) { + int height = resolution.getGuiScaledHeight() / 5 * 3; + if (player.isShiftKeyDown()) { IBookletPage page = BookletUtils.findFirstPageForStack(blockStack); if (page != null) { String strg1 = page.getChapter().getLocalizedName(); @@ -112,18 +112,18 @@ public class ItemBooklet extends ItemBase implements IHudDisplay { AssetUtil.renderStackToGui(StackUtil.isValid(page.getChapter().getDisplayItemStack()) ? page.getChapter().getDisplayItemStack() - : new ItemStack(ActuallyItems.ITEM_BOOKLET.get()), resolution.getScaledWidth() / 2 - 10, height + 41, 1F); - minecraft.fontRenderer.drawStringWithShadow(TextFormatting.YELLOW + "" + TextFormatting.ITALIC + strg1, resolution.getScaledWidth() / 2 - minecraft.fontRenderer.getStringWidth(strg1) / 2, height + 20, StringUtil.DECIMAL_COLOR_WHITE); - minecraft.fontRenderer.drawStringWithShadow(TextFormatting.YELLOW + "" + TextFormatting.ITALIC + strg2, resolution.getScaledWidth() / 2 - minecraft.fontRenderer.getStringWidth(strg2) / 2, height + 30, StringUtil.DECIMAL_COLOR_WHITE); - minecraft.fontRenderer.drawStringWithShadow(TextFormatting.GOLD + strg3, resolution.getScaledWidth() / 2 - minecraft.fontRenderer.getStringWidth(strg3) / 2, height + 60, StringUtil.DECIMAL_COLOR_WHITE); + : new ItemStack(ActuallyItems.ITEM_BOOKLET.get()), resolution.getGuiScaledWidth() / 2 - 10, height + 41, 1F); + minecraft.font.drawShadow(TextFormatting.YELLOW + "" + TextFormatting.ITALIC + strg1, resolution.getGuiScaledWidth() / 2 - minecraft.font.width(strg1) / 2, height + 20, StringUtil.DECIMAL_COLOR_WHITE); + minecraft.font.drawShadow(TextFormatting.YELLOW + "" + TextFormatting.ITALIC + strg2, resolution.getGuiScaledWidth() / 2 - minecraft.font.width(strg2) / 2, height + 30, StringUtil.DECIMAL_COLOR_WHITE); + minecraft.font.drawShadow(TextFormatting.GOLD + strg3, resolution.getGuiScaledWidth() / 2 - minecraft.font.width(strg3) / 2, height + 60, StringUtil.DECIMAL_COLOR_WHITE); } else { String strg1 = TextFormatting.DARK_RED + StringUtil.localize("info." + ActuallyAdditions.MODID + ".booklet.hudDisplay.noInfo"); String strg2 = TextFormatting.DARK_GREEN + "" + TextFormatting.ITALIC + StringUtil.localize("info." + ActuallyAdditions.MODID + ".booklet.hudDisplay.noInfo.desc.1"); String strg3 = TextFormatting.DARK_GREEN + "" + TextFormatting.ITALIC + StringUtil.localize("info." + ActuallyAdditions.MODID + ".booklet.hudDisplay.noInfo.desc.2"); - minecraft.fontRenderer.drawStringWithShadow(strg1, resolution.getScaledWidth() / 2 - minecraft.fontRenderer.getStringWidth(strg1) / 2, height + 30, StringUtil.DECIMAL_COLOR_WHITE); - minecraft.fontRenderer.drawStringWithShadow(strg2, resolution.getScaledWidth() / 2 - minecraft.fontRenderer.getStringWidth(strg2) / 2, height + 50, StringUtil.DECIMAL_COLOR_WHITE); - minecraft.fontRenderer.drawStringWithShadow(strg3, resolution.getScaledWidth() / 2 - minecraft.fontRenderer.getStringWidth(strg3) / 2, height + 60, StringUtil.DECIMAL_COLOR_WHITE); + minecraft.font.drawShadow(strg1, resolution.getGuiScaledWidth() / 2 - minecraft.font.width(strg1) / 2, height + 30, StringUtil.DECIMAL_COLOR_WHITE); + minecraft.font.drawShadow(strg2, resolution.getGuiScaledWidth() / 2 - minecraft.font.width(strg2) / 2, height + 50, StringUtil.DECIMAL_COLOR_WHITE); + minecraft.font.drawShadow(strg3, resolution.getGuiScaledWidth() / 2 - minecraft.font.width(strg3) / 2, height + 60, StringUtil.DECIMAL_COLOR_WHITE); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCoffee.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCoffee.java index 07f9c525e..82a17e5cd 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCoffee.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCoffee.java @@ -55,13 +55,13 @@ public class ItemCoffee extends ItemFoodBase { } } - ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(Ingredient.fromItems(Items.SUGAR), 4, new PotionEffect(MobEffects.SPEED, 30, 0))); - ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(Ingredient.fromItems(Items.MAGMA_CREAM), 2, new PotionEffect(MobEffects.FIRE_RESISTANCE, 20, 0))); - ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(Ingredient.fromStacks(new ItemStack(Items.FISH, 1, 3)), 2, new PotionEffect(MobEffects.WATER_BREATHING, 10, 0))); - ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(Ingredient.fromItems(Items.GOLDEN_CARROT), 2, new PotionEffect(MobEffects.NIGHT_VISION, 30, 0))); - ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(Ingredient.fromItems(Items.GHAST_TEAR), 3, new PotionEffect(MobEffects.REGENERATION, 5, 0))); - ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(Ingredient.fromItems(Items.BLAZE_POWDER), 4, new PotionEffect(MobEffects.STRENGTH, 15, 0))); - ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(Ingredient.fromItems(Items.FERMENTED_SPIDER_EYE), 2, new PotionEffect(MobEffects.INVISIBILITY, 25, 0))); + ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(Ingredient.of(Items.SUGAR), 4, new PotionEffect(MobEffects.SPEED, 30, 0))); + ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(Ingredient.of(Items.MAGMA_CREAM), 2, new PotionEffect(MobEffects.FIRE_RESISTANCE, 20, 0))); + ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(Ingredient.of(new ItemStack(Items.FISH, 1, 3)), 2, new PotionEffect(MobEffects.WATER_BREATHING, 10, 0))); + ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(Ingredient.of(Items.GOLDEN_CARROT), 2, new PotionEffect(MobEffects.NIGHT_VISION, 30, 0))); + ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(Ingredient.of(Items.GHAST_TEAR), 3, new PotionEffect(MobEffects.REGENERATION, 5, 0))); + ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(Ingredient.of(Items.BLAZE_POWDER), 4, new PotionEffect(MobEffects.STRENGTH, 15, 0))); + ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(Ingredient.of(Items.FERMENTED_SPIDER_EYE), 2, new PotionEffect(MobEffects.INVISIBILITY, 25, 0))); } @Nullable @@ -86,7 +86,7 @@ public class ItemCoffee extends ItemFoodBase { @Override public ItemStack onItemUseFinish(ItemStack stack, World world, EntityLivingBase player) { ItemStack theStack = stack.copy(); - super.onItemUseFinish(stack, world, player); + super.finishUsingItem(stack, world, player); applyPotionEffectsFromStack(stack, player); theStack.setItemDamage(theStack.getItemDamage() + 1); if (theStack.getMaxDamage() - theStack.getItemDamage() < 0) { @@ -112,7 +112,7 @@ public class ItemCoffee extends ItemFoodBase { PotionEffect[] effects = ActuallyAdditionsAPI.methodHandler.getEffectsFromStack(stack); if (effects != null) { for (PotionEffect effect : effects) { - tooltip.add(StringUtil.localize(effect.getEffectName()) + " " + (effect.getAmplifier() + 1) + ", " + StringUtils.ticksToElapsedTime(effect.getDuration() * 20)); + tooltip.add(StringUtil.localize(effect.getEffectName()) + " " + (effect.getAmplifier() + 1) + ", " + StringUtils.formatTickDuration(effect.getDuration() * 20)); } } else { tooltip.add(StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".coffeeCup.noEffect")); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrafterOnAStick.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrafterOnAStick.java index 037a234cf..f7d391c84 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrafterOnAStick.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrafterOnAStick.java @@ -29,11 +29,11 @@ public class ItemCrafterOnAStick extends ItemBase { } @Override - public ActionResult onItemRightClick(World world, PlayerEntity player, Hand hand) { - if (!world.isRemote) { + public ActionResult use(World world, PlayerEntity player, Hand hand) { + if (!world.isClientSide) { player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.CRAFTER.ordinal(), world, (int) player.posX, (int) player.posY, (int) player.posZ); } - return new ActionResult<>(EnumActionResult.SUCCESS, player.getHeldItem(hand)); + return new ActionResult<>(EnumActionResult.SUCCESS, player.getItemInHand(hand)); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystal.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystal.java index 4683e77ee..32deb7557 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystal.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystal.java @@ -26,7 +26,7 @@ public class ItemCrystal extends ItemBase { } @Override - public boolean hasEffect(ItemStack stack) { + public boolean isFoil(ItemStack stack) { return this.isEmpowered; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystalShard.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystalShard.java index bde6ac480..131c88dee 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystalShard.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystalShard.java @@ -37,10 +37,10 @@ public class ItemCrystalShard extends ItemBase implements IColorProvidingItem { } @Override - public String getTranslationKey(ItemStack stack) { + public String getDescriptionId(ItemStack stack) { return stack.getItemDamage() >= BlockCrystal.ALL_CRYSTALS.length ? StringUtil.BUGGED_ITEM_NAME - : this.getTranslationKey() + "_" + BlockCrystal.ALL_CRYSTALS[stack.getItemDamage()].name; + : this.getDescriptionId() + "_" + BlockCrystal.ALL_CRYSTALS[stack.getItemDamage()].name; } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrill.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrill.java index d789fbae6..e00388282 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrill.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrill.java @@ -91,12 +91,12 @@ public class ItemDrill extends ItemEnergy { @Override //Places Blocks if the Placing Upgrade is installed public EnumActionResult onItemUse(PlayerEntity player, World world, BlockPos pos, Hand hand, EnumFacing side, float hitX, float hitY, float hitZ) { - ItemStack stack = player.getHeldItem(hand); + ItemStack stack = player.getItemInHand(hand); ItemStack upgrade = this.getHasUpgradeAsStack(stack, ItemDrillUpgrade.UpgradeType.PLACER); if (StackUtil.isValid(upgrade)) { int slot = ItemDrillUpgrade.getSlotToPlaceFrom(upgrade); if (slot >= 0 && slot < PlayerInventory.getHotbarSize()) { - ItemStack equip = player.inventory.getStackInSlot(slot); + ItemStack equip = player.inventory.getItem(slot); if (StackUtil.isValid(equip) && equip != stack) { ItemStack toPlaceStack = equip.copy(); @@ -116,7 +116,7 @@ public class ItemDrill extends ItemEnergy { ActuallyAdditions.LOGGER.error("Player " + player.getName() + " who should place a Block using a Drill at " + player.posX + ", " + player.posY + ", " + player.posZ + " in World " + world.provider.getDimension() + " threw an Exception! Don't let that happen again!"); } - player.inventory.setInventorySlotContents(slot, player.getHeldItem(hand)); + player.inventory.setItem(slot, player.getItemInHand(hand)); WorldUtil.setHandItemWithoutAnnoyingSound(player, hand, stack); return EnumActionResult.SUCCESS; @@ -154,11 +154,11 @@ public class ItemDrill extends ItemEnergy { } @Override - public ActionResult onItemRightClick(World world, PlayerEntity player, Hand hand) { - if (!world.isRemote && player.isSneaking() && hand == Hand.MAIN_HAND) { + public ActionResult use(World world, PlayerEntity player, Hand hand) { + if (!world.isClientSide && player.isShiftKeyDown() && hand == Hand.MAIN_HAND) { player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.DRILL.ordinal(), world, (int) player.posX, (int) player.posY, (int) player.posZ); } - return new ActionResult<>(EnumActionResult.PASS, player.getHeldItem(hand)); + return new ActionResult<>(EnumActionResult.PASS, player.getItemInHand(hand)); } @Override @@ -187,10 +187,10 @@ public class ItemDrill extends ItemEnergy { Multimap map = super.getAttributeModifiers(slot, stack); if (slot == EntityEquipmentSlot.MAINHAND) { - map.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Drill Modifier", this.getEnergyStored(stack) >= ENERGY_USE + map.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(BASE_ATTACK_DAMAGE_UUID, "Drill Modifier", this.getEnergyStored(stack) >= ENERGY_USE ? 8.0F : 0.1F, 0)); - map.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Tool Modifier", -2.5F, 0)); + map.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(BASE_ATTACK_SPEED_UUID, "Tool Modifier", -2.5F, 0)); } return map; @@ -215,30 +215,30 @@ public class ItemDrill extends ItemEnergy { ItemUtil.addEnchantment(stack, Enchantments.SILK_TOUCH, 1); } else { if (this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FORTUNE)) { - ItemUtil.addEnchantment(stack, Enchantments.FORTUNE, this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FORTUNE_II) + ItemUtil.addEnchantment(stack, Enchantments.BLOCK_FORTUNE, this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FORTUNE_II) ? 3 : 1); } } //Block hit - RayTraceResult ray = WorldUtil.getNearestBlockWithDefaultReachDistance(player.world, player); + RayTraceResult ray = WorldUtil.getNearestBlockWithDefaultReachDistance(player.level, player); if (ray != null) { //Breaks the Blocks - if (!player.isSneaking() && this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.THREE_BY_THREE)) { + if (!player.isShiftKeyDown() && this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.THREE_BY_THREE)) { if (this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FIVE_BY_FIVE)) { - toReturn = this.breakBlocks(stack, 2, player.world, pos, ray.sideHit, player); + toReturn = this.breakBlocks(stack, 2, player.level, pos, ray.sideHit, player); } else { - toReturn = this.breakBlocks(stack, 1, player.world, pos, ray.sideHit, player); + toReturn = this.breakBlocks(stack, 1, player.level, pos, ray.sideHit, player); } } else { - toReturn = this.breakBlocks(stack, 0, player.world, pos, ray.sideHit, player); + toReturn = this.breakBlocks(stack, 0, player.level, pos, ray.sideHit, player); } //Removes Enchantments added above ItemUtil.removeEnchantment(stack, Enchantments.SILK_TOUCH); - ItemUtil.removeEnchantment(stack, Enchantments.FORTUNE); + ItemUtil.removeEnchantment(stack, Enchantments.BLOCK_FORTUNE); } } return toReturn; @@ -255,7 +255,7 @@ public class ItemDrill extends ItemEnergy { ? block != Blocks.IRON_BLOCK && block != Blocks.IRON_ORE ? block != Blocks.LAPIS_BLOCK && block != Blocks.LAPIS_ORE ? block != Blocks.REDSTONE_ORE && block != Blocks.LIT_REDSTONE_ORE - ? state.getMaterial() == Material.ROCK || state.getMaterial() == Material.IRON || state.getMaterial() == Material.ANVIL + ? state.getMaterial() == Material.STONE || state.getMaterial() == Material.METAL || state.getMaterial() == Material.HEAVY_METAL : HARVEST_LEVEL >= 2 : HARVEST_LEVEL >= 1 : HARVEST_LEVEL >= 1 @@ -417,7 +417,7 @@ public class ItemDrill extends ItemEnergy { //Not defined later because main Block is getting broken below BlockState state = world.getBlockState(aPos); - float mainHardness = state.getBlockHardness(world, aPos); + float mainHardness = state.getDestroySpeed(world, aPos); //Break Middle Block first int use = this.getEnergyUsePerBlock(stack); @@ -430,9 +430,9 @@ public class ItemDrill extends ItemEnergy { } if (radius == 2 && side.getAxis() != Axis.Y) { - aPos = aPos.up(); + aPos = aPos.above(); BlockState theState = world.getBlockState(aPos); - if (theState.getBlockHardness(world, aPos) <= mainHardness + 5.0F) { + if (theState.getDestroySpeed(world, aPos) <= mainHardness + 5.0F) { this.tryHarvestBlock(world, aPos, true, stack, player, use); } } @@ -447,7 +447,7 @@ public class ItemDrill extends ItemEnergy { //Only break Blocks around that are (about) as hard or softer BlockPos thePos = new BlockPos(xPos, yPos, zPos); BlockState theState = world.getBlockState(thePos); - if (theState.getBlockHardness(world, thePos) <= mainHardness + 5.0F) { + if (theState.getDestroySpeed(world, thePos) <= mainHardness + 5.0F) { this.tryHarvestBlock(world, thePos, true, stack, player, use); } } else { @@ -475,7 +475,7 @@ public class ItemDrill extends ItemEnergy { private boolean tryHarvestBlock(World world, BlockPos pos, boolean isExtra, ItemStack stack, PlayerEntity player, int use) { BlockState state = world.getBlockState(pos); Block block = state.getBlock(); - float hardness = state.getBlockHardness(world, pos); + float hardness = state.getDestroySpeed(world, pos); boolean canHarvest = (ForgeHooks.canHarvestBlock(block, player, world, pos) || this.canHarvestBlock(state, stack)) && (!isExtra || this.getDestroySpeed(stack, world.getBlockState(pos)) > 1.0F); if (hardness >= 0.0F && (!isExtra || canHarvest && !block.hasTileEntity(world.getBlockState(pos)))) { if (!player.isCreative()) { @@ -506,6 +506,6 @@ public class ItemDrill extends ItemEnergy { @Override public boolean shouldCauseBlockBreakReset(ItemStack oldStack, ItemStack newStack) { - return !newStack.isItemEqual(oldStack); + return !newStack.sameItem(oldStack); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrillUpgrade.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrillUpgrade.java index 443c1c38e..86a7bb116 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrillUpgrade.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrillUpgrade.java @@ -24,7 +24,7 @@ public class ItemDrillUpgrade extends ItemBase { public final UpgradeType type; public ItemDrillUpgrade(UpgradeType type) { - super(ActuallyItems.defaultProps().maxStackSize(1)); + super(ActuallyItems.defaultProps().stacksTo(1)); this.type = type; } @@ -37,10 +37,10 @@ public class ItemDrillUpgrade extends ItemBase { } @Override - public ActionResult onItemRightClick(World world, PlayerEntity player, Hand hand) { - ItemStack stack = player.getHeldItem(hand); - if (!world.isRemote && this.type == UpgradeType.PLACER) { - this.setSlotToPlaceFrom(stack, player.inventory.currentItem); + public ActionResult use(World world, PlayerEntity player, Hand hand) { + ItemStack stack = player.getItemInHand(hand); + if (!world.isClientSide && this.type == UpgradeType.PLACER) { + this.setSlotToPlaceFrom(stack, player.inventory.selected); return new ActionResult<>(EnumActionResult.SUCCESS, stack); } return new ActionResult<>(EnumActionResult.FAIL, stack); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDust.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDust.java index 109afa26d..2d98a64df 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDust.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDust.java @@ -37,10 +37,10 @@ public class ItemDust extends ItemBase implements IColorProvidingItem { } @Override - public String getTranslationKey(ItemStack stack) { + public String getDescriptionId(ItemStack stack) { return stack.getItemDamage() >= ALL_DUSTS.length ? StringUtil.BUGGED_ITEM_NAME - : this.getTranslationKey() + "_" + ALL_DUSTS[stack.getItemDamage()].name; + : this.getDescriptionId() + "_" + ALL_DUSTS[stack.getItemDamage()].name; } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemEngineerGoggles.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemEngineerGoggles.java index 2106d987a..e5b27b7c9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemEngineerGoggles.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemEngineerGoggles.java @@ -37,14 +37,14 @@ public class ItemEngineerGoggles extends ItemArmorAA implements IGoggles { private final boolean displayMobs; public ItemEngineerGoggles(boolean displayMobs) { - super(ArmorMaterials.GOGGLES, EquipmentSlotType.HEAD, ActuallyItems.defaultProps().setNoRepair().maxDamage(0)); + super(ArmorMaterials.GOGGLES, EquipmentSlotType.HEAD, ActuallyItems.defaultProps().setNoRepair().durability(0)); this.displayMobs = displayMobs; MinecraftForge.EVENT_BUS.register(this); } public static boolean isWearing(PlayerEntity player) { - ItemStack face = player.inventory.armorInventory.get(3); + ItemStack face = player.inventory.armor.get(3); return StackUtil.isValid(face) && face.getItem() instanceof IGoggles; } @@ -53,18 +53,18 @@ public class ItemEngineerGoggles extends ItemArmorAA implements IGoggles { public void onClientTick(TickEvent.ClientTickEvent event) { PlayerEntity player = ClientProxy.getCurrentPlayer(); if (player != null && isWearing(player)) { - ItemStack face = player.inventory.armorInventory.get(3); + ItemStack face = player.inventory.armor.get(3); if (((IGoggles) face.getItem()).displaySpectralMobs()) { double range = 8; - AxisAlignedBB aabb = new AxisAlignedBB(player.getPosX() - range, player.getPosY() - range, player.getPosZ() - range, player.getPosX() + range, player.getPosY() + range, player.getPosZ() + range); - List entities = player.world.getEntitiesWithinAABB(Entity.class, aabb); + AxisAlignedBB aabb = new AxisAlignedBB(player.getX() - range, player.getY() - range, player.getZ() - range, player.getX() + range, player.getY() + range, player.getZ() + range); + List entities = player.level.getEntitiesOfClass(Entity.class, aabb); if (entities != null && !entities.isEmpty()) { this.cachedGlowingEntities.addAll(entities); } if (!this.cachedGlowingEntities.isEmpty()) { for (Entity entity : this.cachedGlowingEntities) { - if (!entity.isAlive() || entity.getDistanceSq(player.getPosX(), player.getPosY(), player.getPosZ()) > range * range) { + if (!entity.isAlive() || entity.distanceToSqr(player.getX(), player.getY(), player.getZ()) > range * range) { entity.setGlowing(false); this.cachedGlowingEntities.remove(entity); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFertilizer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFertilizer.java index 82bed4670..9b762d17f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFertilizer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFertilizer.java @@ -28,19 +28,19 @@ public class ItemFertilizer extends ItemBase { public ItemFertilizer() { super(name); - DispenserBlock.registerDispenseBehavior(this, new DispenserHandlerFertilize()); + DispenserBlock.registerBehavior(this, new DispenserHandlerFertilize()); } @Override public EnumActionResult onItemUse(PlayerEntity player, World world, BlockPos pos, Hand hand, Direction side, float par8, float par9, float par10) { - ItemStack stack = player.getHeldItem(hand); + ItemStack stack = player.getItemInHand(hand); if (ItemDye.applyBonemeal(stack, world, pos, player, hand)) { - if (!world.isRemote) { - world.playEvent(2005, pos, 0); + if (!world.isClientSide) { + world.levelEvent(2005, pos, 0); } return EnumActionResult.SUCCESS; } - return super.onItemUse(player, world, pos, hand, side, par8, par9, par10); + return super.useOn(player, world, pos, hand, side, par8, par9, par10); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFillingWand.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFillingWand.java index cb623713f..3b87c0a2d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFillingWand.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFillingWand.java @@ -49,12 +49,12 @@ public class ItemFillingWand extends ItemEnergy { ItemStack stack = new ItemStack(block, 1); if (StackUtil.isValid(stack)) { - for (int i = 0; i < player.inventory.getSizeInventory(); i++) { - ItemStack slot = player.inventory.getStackInSlot(i); - if (StackUtil.isValid(slot) && slot.isItemEqual(stack)) { + for (int i = 0; i < player.inventory.getContainerSize(); i++) { + ItemStack slot = player.inventory.getItem(i); + if (StackUtil.isValid(slot) && slot.sameItem(stack)) { slot.shrink(1); if (!StackUtil.isValid(slot)) { - player.inventory.setInventorySlotContents(i, StackUtil.getEmpty()); + player.inventory.setItem(i, StackUtil.getEmpty()); } return true; @@ -78,43 +78,43 @@ public class ItemFillingWand extends ItemEnergy { } @Override - public ActionResultType onItemUse(ItemUseContext context) { + public ActionResultType useOn(ItemUseContext context) { if (context.getPlayer() == null) { return ActionResultType.PASS; } - ItemStack stack = context.getPlayer().getHeldItem(context.getHand()); - if (!context.getWorld().isRemote && context.getPlayer().getItemInUseCount() <= 0) { - if (context.getPlayer().isSneaking()) { - BlockState state = context.getWorld().getBlockState(context.getPos()); + ItemStack stack = context.getPlayer().getItemInHand(context.getHand()); + if (!context.getLevel().isClientSide && context.getPlayer().getUseItemRemainingTicks() <= 0) { + if (context.getPlayer().isShiftKeyDown()) { + BlockState state = context.getLevel().getBlockState(context.getClickedPos()); saveData(state, stack); return ActionResultType.SUCCESS; } else if (loadData(stack).isPresent()) { CompoundNBT compound = stack.getOrCreateTag(); if (compound.getInt("CurrX") == 0 && compound.getInt("CurrY") == 0 && compound.getInt("CurrZ") == 0) { - compound.putInt("FirstX", context.getPos().getX()); - compound.putInt("FirstY", context.getPos().getY()); - compound.putInt("FirstZ", context.getPos().getZ()); + compound.putInt("FirstX", context.getClickedPos().getX()); + compound.putInt("FirstY", context.getClickedPos().getY()); + compound.putInt("FirstZ", context.getClickedPos().getZ()); - context.getPlayer().setActiveHand(context.getHand()); + context.getPlayer().startUsingItem(context.getHand()); return ActionResultType.SUCCESS; } } } - return super.onItemUse(context); + return super.useOn(context); } @Override - public void onPlayerStoppedUsing(ItemStack stack, World world, LivingEntity entity, int timeLeft) { - if (!world.isRemote) { + public void releaseUsing(ItemStack stack, World world, LivingEntity entity, int timeLeft) { + if (!world.isClientSide) { boolean clear = true; if (entity instanceof PlayerEntity) { RayTraceResult result = WorldUtil.getNearestBlockWithDefaultReachDistance(world, (PlayerEntity) entity); if (result instanceof BlockRayTraceResult) { CompoundNBT compound = stack.getOrCreateTag(); - BlockPos pos = ((BlockRayTraceResult) result).getPos(); + BlockPos pos = ((BlockRayTraceResult) result).getBlockPos(); compound.putInt("SecondX", pos.getX()); compound.putInt("SecondY", pos.getY()); compound.putInt("SecondZ", pos.getZ()); @@ -128,7 +128,7 @@ public class ItemFillingWand extends ItemEnergy { } } - super.onPlayerStoppedUsing(stack, world, entity, timeLeft); + super.releaseUsing(stack, world, entity, timeLeft); } @Override @@ -136,7 +136,7 @@ public class ItemFillingWand extends ItemEnergy { super.inventoryTick(stack, world, entity, itemSlot, isSelected); - if (!world.isRemote) { + if (!world.isClientSide) { boolean shouldClear = false; if (isSelected) { @@ -166,9 +166,9 @@ public class ItemFillingWand extends ItemEnergy { BlockPos pos = new BlockPos(lowestX + currX, lowestY + currY, lowestZ + currZ); BlockState state = world.getBlockState(pos); - if (state.getMaterial().isReplaceable() && replaceState.isValidPosition(world, pos)) { + if (state.getMaterial().isReplaceable() && replaceState.canSurvive(world, pos)) { if (creative || removeFittingItem(replaceState, player)) { - world.setBlockState(pos, replaceState, 2); + world.setBlock(pos, replaceState, 2); SoundType sound = replaceState.getBlock().getSoundType(replaceState, world, pos, player); world.playSound(null, pos, sound.getPlaceSound(), SoundCategory.BLOCKS, sound.getVolume() / 2F + .5F, sound.getPitch() * 0.8F); @@ -219,11 +219,11 @@ public class ItemFillingWand extends ItemEnergy { } @Override - public void addInformation(ItemStack stack, @Nullable World worldIn, List tooltip, ITooltipFlag flagIn) { - super.addInformation(stack, worldIn, tooltip, flagIn); + public void appendHoverText(ItemStack stack, @Nullable World worldIn, List tooltip, ITooltipFlag flagIn) { + super.appendHoverText(stack, worldIn, tooltip, flagIn); IFormattableTextComponent display = loadData(stack) - .map(state -> state.getBlock().getTranslatedName()) + .map(state -> state.getBlock().getName()) .orElse(Lang.trans("tooltip", "item_filling_wand.selectedBlock.none")); tooltip.add(Lang.trans("tooltip", "item_filling_wand.selectedBlock", display.getString())); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFilter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFilter.java index 00104b64a..2b023c251 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFilter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFilter.java @@ -32,28 +32,28 @@ import java.util.List; public class ItemFilter extends ItemBase { public ItemFilter() { - super(ActuallyItems.defaultProps().maxStackSize(1)); + super(ActuallyItems.defaultProps().stacksTo(1)); } @Override - public ActionResult onItemRightClick(World world, PlayerEntity player, Hand hand) { - if (!world.isRemote && hand == Hand.MAIN_HAND) { + public ActionResult use(World world, PlayerEntity player, Hand hand) { + if (!world.isClientSide && hand == Hand.MAIN_HAND) { NetworkHooks.openGui((ServerPlayerEntity) player, new SimpleNamedContainerProvider((windowId, inv, playerEnt) -> new ContainerFilter(windowId, inv), StringTextComponent.EMPTY)); // player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.FILTER.ordinal(), world, (int) player.posX, (int) player.posY, (int) player.posZ); } - return ActionResult.resultPass(player.getHeldItem(hand)); + return ActionResult.pass(player.getItemInHand(hand)); } @Override - public void addInformation(ItemStack stack, @Nullable World worldIn, List tooltip, ITooltipFlag flagIn) { - super.addInformation(stack, worldIn, tooltip, flagIn); + public void appendHoverText(ItemStack stack, @Nullable World worldIn, List tooltip, ITooltipFlag flagIn) { + super.appendHoverText(stack, worldIn, tooltip, flagIn); ItemStackHandlerAA inv = new ItemStackHandlerAA(ContainerFilter.SLOT_AMOUNT); ItemDrill.loadSlotsFromNBT(inv, stack); for (int i = 0; i < inv.getSlots(); i++) { ItemStack slot = inv.getStackInSlot(i); if (StackUtil.isValid(slot)) { - tooltip.add(slot.getItem().getDisplayName(slot)); + tooltip.add(slot.getItem().getName(slot)); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFoods.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFoods.java index 007605e09..6465a0668 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFoods.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFoods.java @@ -40,15 +40,15 @@ public class ItemFoods extends ItemFoodBase { @Override public ItemStack onItemUseFinish(ItemStack stack, World world, EntityLivingBase player) { - ItemStack stackToReturn = super.onItemUseFinish(stack, world, player); + ItemStack stackToReturn = super.finishUsingItem(stack, world, player); ItemStack returnItem = stack.getItemDamage() >= ALL_FOODS.length ? null : ALL_FOODS[stack.getItemDamage()].returnItem; if (StackUtil.isValid(returnItem) && player instanceof PlayerEntity) { - if (!((PlayerEntity) player).inventory.addItemStackToInventory(returnItem.copy())) { - if (!world.isRemote) { + if (!((PlayerEntity) player).inventory.add(returnItem.copy())) { + if (!world.isClientSide) { ItemEntity entityItem = new ItemEntity(player.world, player.posX, player.posY, player.posZ, returnItem.copy()); - entityItem.setPickupDelay(0); + entityItem.setPickUpDelay(0); player.world.addEntity(entityItem); } } @@ -92,10 +92,10 @@ public class ItemFoods extends ItemFoodBase { } @Override - public String getTranslationKey(ItemStack stack) { + public String getDescriptionId(ItemStack stack) { return stack.getItemDamage() >= ALL_FOODS.length ? StringUtil.BUGGED_ITEM_NAME - : this.getTranslationKey() + "_" + ALL_FOODS[stack.getItemDamage()].name; + : this.getDescriptionId() + "_" + ALL_FOODS[stack.getItemDamage()].name; } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGeneric.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGeneric.java index e7ac98a4c..a09850bd2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGeneric.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGeneric.java @@ -12,8 +12,10 @@ package de.ellpeck.actuallyadditions.mod.items; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; +import net.minecraft.item.Item.Properties; + public class ItemGeneric extends ItemBase { public ItemGeneric(Properties props) { - super(props.maxDamage(0)); + super(props.durability(0)); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGrowthRing.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGrowthRing.java index 78624b341..2a0eb22ca 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGrowthRing.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGrowthRing.java @@ -36,26 +36,26 @@ public class ItemGrowthRing extends ItemEnergy { @Override public void inventoryTick(ItemStack stack, World world, Entity entity, int itemSlot, boolean isSelected) { - if (!(entity instanceof PlayerEntity) || world.isRemote || entity.isSneaking()) { + if (!(entity instanceof PlayerEntity) || world.isClientSide || entity.isShiftKeyDown()) { return; } PlayerEntity player = (PlayerEntity) entity; - ItemStack equipped = player.getHeldItemMainhand(); + ItemStack equipped = player.getMainHandItem(); int energyUse = 300; if (StackUtil.isValid(equipped) && equipped == stack && this.getEnergyStored(stack) >= energyUse) { List blocks = new ArrayList<>(); //Adding all possible Blocks - if (player.world.getGameTime() % 30 == 0) { + if (player.level.getGameTime() % 30 == 0) { int range = 3; for (int x = -range; x < range + 1; x++) { for (int z = -range; z < range + 1; z++) { for (int y = -range; y < range + 1; y++) { - int theX = MathHelper.floor(player.getPosX() + x); - int theY = MathHelper.floor(player.getPosY() + y); - int theZ = MathHelper.floor(player.getPosZ() + z); + int theX = MathHelper.floor(player.getX() + x); + int theY = MathHelper.floor(player.getY() + y); + int theZ = MathHelper.floor(player.getZ() + z); BlockPos posInQuestion = new BlockPos(theX, theY, theZ); Block theBlock = world.getBlockState(posInQuestion).getBlock(); if ((theBlock instanceof IGrowable || theBlock instanceof IPlantable) && !(theBlock instanceof GrassBlock)) { @@ -69,16 +69,16 @@ public class ItemGrowthRing extends ItemEnergy { if (!blocks.isEmpty()) { for (int i = 0; i < 45; i++) { if (this.getEnergyStored(stack) >= energyUse) { - BlockPos pos = blocks.get(world.rand.nextInt(blocks.size())); + BlockPos pos = blocks.get(world.random.nextInt(blocks.size())); BlockState state = world.getBlockState(pos); Block block = state.getBlock(); - block.tick(world.getBlockState(pos), (ServerWorld) world, pos, world.rand); + block.tick(world.getBlockState(pos), (ServerWorld) world, pos, world.random); //Show Particles if Metadata changed BlockState newState = world.getBlockState(pos); if (newState != state) { - world.playEvent(2005, pos, 0); + world.levelEvent(2005, pos, 0); } if (!player.isCreative()) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemHairBall.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemHairBall.java index 066013da0..44792f553 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemHairBall.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemHairBall.java @@ -43,11 +43,11 @@ public class ItemHairBall extends ItemBase { @SubscribeEvent public void livingUpdateEvent(LivingEvent.LivingUpdateEvent event) { //Ocelots dropping Hair Balls - if (ConfigBoolValues.DO_CAT_DROPS.isEnabled() && event.getEntityLiving() != null && event.getEntityLiving().world != null && !event.getEntityLiving().world.isRemote) { - if (event.getEntityLiving() instanceof OcelotEntity && catIsTamedReflection((OcelotEntity) event.getEntityLiving()) || event.getEntityLiving() instanceof PlayerEntity && event.getEntityLiving().getUniqueID().equals(this.KittyVanCatUUID)) { - if (event.getEntityLiving().world.rand.nextInt(ConfigIntValues.FUR_CHANCE.getValue()) == 0) { - ItemEntity item = new ItemEntity(event.getEntityLiving().world, event.getEntityLiving().getPosX() + 0.5, event.getEntityLiving().getPosY() + 0.5, event.getEntityLiving().getPosZ() + 0.5, new ItemStack(ActuallyItems.HAIRY_BALL.get())); - event.getEntityLiving().world.addEntity(item); + if (ConfigBoolValues.DO_CAT_DROPS.isEnabled() && event.getEntityLiving() != null && event.getEntityLiving().level != null && !event.getEntityLiving().level.isClientSide) { + if (event.getEntityLiving() instanceof OcelotEntity && catIsTamedReflection((OcelotEntity) event.getEntityLiving()) || event.getEntityLiving() instanceof PlayerEntity && event.getEntityLiving().getUUID().equals(this.KittyVanCatUUID)) { + if (event.getEntityLiving().level.random.nextInt(ConfigIntValues.FUR_CHANCE.getValue()) == 0) { + ItemEntity item = new ItemEntity(event.getEntityLiving().level, event.getEntityLiving().getX() + 0.5, event.getEntityLiving().getY() + 0.5, event.getEntityLiving().getZ() + 0.5, new ItemStack(ActuallyItems.HAIRY_BALL.get())); + event.getEntityLiving().level.addFreshEntity(item); } } } @@ -65,20 +65,20 @@ public class ItemHairBall extends ItemBase { } @Override - public ActionResult onItemRightClick(World world, PlayerEntity player, Hand hand) { - ItemStack stack = player.getHeldItem(hand); - if (!world.isRemote) { - ItemStack returnItem = this.getRandomReturnItem(world.rand); - if (!player.inventory.addItemStackToInventory(returnItem)) { - ItemEntity entityItem = new ItemEntity(player.world, player.getPosX(), player.getPosY(), player.getPosZ(), returnItem); - entityItem.setPickupDelay(0); - player.world.addEntity(entityItem); + public ActionResult use(World world, PlayerEntity player, Hand hand) { + ItemStack stack = player.getItemInHand(hand); + if (!world.isClientSide) { + ItemStack returnItem = this.getRandomReturnItem(world.random); + if (!player.inventory.add(returnItem)) { + ItemEntity entityItem = new ItemEntity(player.level, player.getX(), player.getY(), player.getZ(), returnItem); + entityItem.setPickUpDelay(0); + player.level.addFreshEntity(entityItem); } stack.shrink(1); - world.playSound(null, player.getPosX(), player.getPosY(), player.getPosZ(), SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.PLAYERS, 0.2F, world.rand.nextFloat() * 0.1F + 0.9F); + world.playSound(null, player.getX(), player.getY(), player.getZ(), SoundEvents.ITEM_PICKUP, SoundCategory.PLAYERS, 0.2F, world.random.nextFloat() * 0.1F + 0.9F); } - return ActionResult.resultSuccess(stack); + return ActionResult.success(stack); } public ItemStack getRandomReturnItem(Random rand) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemJams.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemJams.java index 2380ea7a5..5ab7ad576 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemJams.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemJams.java @@ -46,10 +46,10 @@ public class ItemJams extends ItemFoodBase implements IColorProvidingItem { } @Override - public String getTranslationKey(ItemStack stack) { + public String getDescriptionId(ItemStack stack) { return stack.getItemDamage() >= ALL_JAMS.length ? StringUtil.BUGGED_ITEM_NAME - : this.getTranslationKey() + "_" + ALL_JAMS[stack.getItemDamage()].name; + : this.getDescriptionId() + "_" + ALL_JAMS[stack.getItemDamage()].name; } @Override @@ -71,9 +71,9 @@ public class ItemJams extends ItemFoodBase implements IColorProvidingItem { @Override public ItemStack onItemUseFinish(ItemStack stack, World world, EntityLivingBase player) { - ItemStack stackToReturn = super.onItemUseFinish(stack, world, player); + ItemStack stackToReturn = super.finishUsingItem(stack, world, player); - if (player instanceof PlayerEntity && !world.isRemote && stack.getItemDamage() < ALL_JAMS.length) { + if (player instanceof PlayerEntity && !world.isClientSide && stack.getItemDamage() < ALL_JAMS.length) { PotionEffect firstEffectToGet = new PotionEffect(Potion.getPotionById(ALL_JAMS[stack.getItemDamage()].firstEffectToGet), 200); player.addPotionEffect(firstEffectToGet); @@ -81,9 +81,9 @@ public class ItemJams extends ItemFoodBase implements IColorProvidingItem { player.addPotionEffect(secondEffectToGet); ItemStack returnItem = new ItemStack(Items.GLASS_BOTTLE); - if (!((PlayerEntity) player).inventory.addItemStackToInventory(returnItem.copy())) { + if (!((PlayerEntity) player).inventory.add(returnItem.copy())) { ItemEntity entityItem = new ItemEntity(player.world, player.posX, player.posY, player.posZ, returnItem.copy()); - entityItem.setPickupDelay(0); + entityItem.setPickUpDelay(0); player.world.addEntity(entityItem); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemKnife.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemKnife.java index 4b2e3354f..859e30fa3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemKnife.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemKnife.java @@ -21,7 +21,7 @@ import net.minecraft.item.ItemStack; public class ItemKnife extends ItemBase { public ItemKnife() { - super(ActuallyItems.defaultNonStacking().defaultMaxDamage(100).setNoRepair()); + super(ActuallyItems.defaultNonStacking().defaultDurability(100).setNoRepair()); } @@ -44,7 +44,7 @@ public class ItemKnife extends ItemBase { @Override public ItemStack getContainerItem(ItemStack stack) { ItemStack theStack = stack.copy(); - theStack.setDamage(theStack.getDamage() + 1); + theStack.setDamageValue(theStack.getDamageValue() + 1); return theStack; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLaserWrench.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLaserWrench.java index 169f9f836..70fefe604 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLaserWrench.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLaserWrench.java @@ -36,42 +36,42 @@ public class ItemLaserWrench extends ItemBase { } @Override - public ActionResultType onItemUse(ItemUseContext context) { - BlockPos pos = context.getPos(); - World world = context.getWorld(); + public ActionResultType useOn(ItemUseContext context) { + BlockPos pos = context.getClickedPos(); + World world = context.getLevel(); PlayerEntity player = context.getPlayer(); - ItemStack stack = player.getHeldItem(context.getHand()); - TileEntity tile = world.getTileEntity(pos); + ItemStack stack = player.getItemInHand(context.getHand()); + TileEntity tile = world.getBlockEntity(pos); if (tile instanceof TileEntityLaserRelay) { TileEntityLaserRelay relay = (TileEntityLaserRelay) tile; - if (!world.isRemote) { + if (!world.isClientSide) { if (ItemPhantomConnector.getStoredPosition(stack) == null) { ItemPhantomConnector.storeConnection(stack, pos.getX(), pos.getY(), pos.getZ(), world); - player.sendStatusMessage(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".laser.stored.desc"), true); + player.displayClientMessage(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".laser.stored.desc"), true); } else { BlockPos savedPos = ItemPhantomConnector.getStoredPosition(stack); if (savedPos != null) { - TileEntity savedTile = world.getTileEntity(savedPos); + TileEntity savedTile = world.getBlockEntity(savedPos); if (savedTile instanceof TileEntityLaserRelay) { - int distanceSq = (int) savedPos.distanceSq(pos); + int distanceSq = (int) savedPos.distSqr(pos); TileEntityLaserRelay savedRelay = (TileEntityLaserRelay) savedTile; int lowestRange = Math.min(relay.getMaxRange(), savedRelay.getMaxRange()); int range = lowestRange * lowestRange; - if (ItemPhantomConnector.getStoredWorld(stack) == world.getDimensionKey() && savedRelay.type == relay.type && distanceSq <= range && ActuallyAdditionsAPI.connectionHandler.addConnection(savedPos, pos, relay.type, world, false, true)) { + if (ItemPhantomConnector.getStoredWorld(stack) == world.dimension() && savedRelay.type == relay.type && distanceSq <= range && ActuallyAdditionsAPI.connectionHandler.addConnection(savedPos, pos, relay.type, world, false, true)) { ItemPhantomConnector.clearStorage(stack, "XCoordOfTileStored", "YCoordOfTileStored", "ZCoordOfTileStored", "WorldOfTileStored"); ((TileEntityLaserRelay) savedTile).sendUpdate(); relay.sendUpdate(); - player.sendStatusMessage(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".laser.connected.desc"), true); + player.displayClientMessage(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".laser.connected.desc"), true); return ActionResultType.SUCCESS; } } - player.sendStatusMessage(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".laser.cantConnect.desc"), false); + player.displayClientMessage(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".laser.cantConnect.desc"), false); ItemPhantomConnector.clearStorage(stack, "XCoordOfTileStored", "YCoordOfTileStored", "ZCoordOfTileStored", "WorldOfTileStored"); } } @@ -89,14 +89,14 @@ public class ItemLaserWrench extends ItemBase { // } @Override - public void addInformation(ItemStack stack, World playerIn, List list, ITooltipFlag advanced) { + public void appendHoverText(ItemStack stack, World playerIn, List list, ITooltipFlag advanced) { BlockPos coords = ItemPhantomConnector.getStoredPosition(stack); if (coords != null) { - list.add(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".boundTo.desc").appendString(":")); + list.add(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".boundTo.desc").append(":")); list.add(new StringTextComponent("X: " + coords.getX())); list.add(new StringTextComponent("Y: " + coords.getY())); list.add(new StringTextComponent("Z: " + coords.getZ())); - list.add(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".clearStorage.desc").mergeStyle(TextFormatting.ITALIC)); + list.add(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".clearStorage.desc").withStyle(TextFormatting.ITALIC)); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java index a87dab069..1418a31a3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java @@ -35,18 +35,18 @@ public class ItemLeafBlower extends ItemBase implements IDisplayStandItem { private final boolean isAdvanced; public ItemLeafBlower(boolean isAdvanced) { - super(ActuallyItems.defaultProps().maxStackSize(1)); + super(ActuallyItems.defaultProps().stacksTo(1)); this.isAdvanced = isAdvanced; } @Override - public ActionResult onItemRightClick(World world, PlayerEntity player, Hand hand) { - player.setActiveHand(hand); - return ActionResult.resultSuccess(player.getHeldItem(hand)); + public ActionResult use(World world, PlayerEntity player, Hand hand) { + player.startUsingItem(hand); + return ActionResult.success(player.getItemInHand(hand)); } @Override - public UseAction getUseAction(ItemStack stack) { + public UseAction getUseAnimation(ItemStack stack) { return UseAction.BOW; } @@ -57,16 +57,16 @@ public class ItemLeafBlower extends ItemBase implements IDisplayStandItem { @Override public void onUsingTick(ItemStack stack, LivingEntity player, int count) { - this.doUpdate(player.world, MathHelper.floor(player.getPosX()), MathHelper.floor(player.getPosY()), MathHelper.floor(player.getPosZ()), count, stack); + this.doUpdate(player.level, MathHelper.floor(player.getX()), MathHelper.floor(player.getY()), MathHelper.floor(player.getZ()), count, stack); } private boolean doUpdate(World world, int x, int y, int z, int time, ItemStack stack) { - if (!world.isRemote) { + if (!world.isClientSide) { if (time <= this.getUseDuration(stack) && (this.isAdvanced || time % 3 == 0)) { //Breaks the Blocks boolean broke = this.breakStuff(world, x, y, z); //Plays a Minecart sounds (It really sounds like a Leaf Blower!) - world.playSound(null, x, y, z, SoundEvents.ENTITY_MINECART_RIDING, SoundCategory.PLAYERS, 0.3F, 0.001F); + world.playSound(null, x, y, z, SoundEvents.MINECART_RIDING, SoundCategory.PLAYERS, 0.3F, 0.001F); return broke; } } @@ -113,10 +113,10 @@ public class ItemLeafBlower extends ItemBase implements IDisplayStandItem { world.destroyBlock(theCoord, true); // theState.getBlock().dropBlockAsItem(world, theCoord, theState, 0); //Plays the Breaking Sound - world.playEvent(2001, theCoord, Block.getStateId(theState)); + world.levelEvent(2001, theCoord, Block.getId(theState)); //Deletes the Block - world.setBlockState(theCoord, Blocks.AIR.getDefaultState()); + world.setBlockAndUpdate(theCoord, Blocks.AIR.defaultBlockState()); return true; } @@ -125,7 +125,7 @@ public class ItemLeafBlower extends ItemBase implements IDisplayStandItem { @Override public boolean update(ItemStack stack, TileEntity tile, int elapsedTicks) { - return this.doUpdate(tile.getWorld(), tile.getPos().getX(), tile.getPos().getY(), tile.getPos().getZ(), elapsedTicks, stack); + return this.doUpdate(tile.getLevel(), tile.getBlockPos().getX(), tile.getBlockPos().getY(), tile.getBlockPos().getZ(), elapsedTicks, stack); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMagnetRing.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMagnetRing.java index aea90c052..1ce41f081 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMagnetRing.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMagnetRing.java @@ -30,37 +30,37 @@ public class ItemMagnetRing extends ItemEnergy { } @Override - public boolean hasEffect(ItemStack stack) { + public boolean isFoil(ItemStack stack) { return !ItemUtil.isEnabled(stack); } @Override public void inventoryTick(ItemStack stack, World world, Entity entity, int itemSlot, boolean isSelected) { - if (entity instanceof PlayerEntity && !world.isRemote && !ItemUtil.isEnabled(stack)) { + if (entity instanceof PlayerEntity && !world.isClientSide && !ItemUtil.isEnabled(stack)) { PlayerEntity player = (PlayerEntity) entity; if (player.isCreative() || player.isSpectator()) { return; } - if (!entity.isSneaking()) { + if (!entity.isShiftKeyDown()) { //Get all the Items in the area int range = 5; - List items = world.getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(entity.getPosX() - range, entity.getPosY() - range, entity.getPosZ() - range, entity.getPosX() + range, entity.getPosY() + range, entity.getPosZ() + range)); + List items = world.getEntitiesOfClass(ItemEntity.class, new AxisAlignedBB(entity.getX() - range, entity.getY() - range, entity.getZ() - range, entity.getX() + range, entity.getY() + range, entity.getZ() + range)); if (!items.isEmpty()) { for (ItemEntity item : items) { // TODO: [port] check this data is being saved on the time if (item.getPersistentData().getBoolean("PreventRemoteMovement")) { continue; } - if (item.isAlive() && !item.cannotPickup()) { + if (item.isAlive() && !item.hasPickUpDelay()) { int energyForItem = 50 * item.getItem().getCount(); if (this.getEnergyStored(stack) >= energyForItem) { ItemStack oldItem = item.getItem().copy(); - item.onCollideWithPlayer(player); + item.playerTouch(player); if (!player.isCreative()) { - if (!item.isAlive() || !ItemStack.areItemStacksEqual(item.getItem(), oldItem)) { + if (!item.isAlive() || !ItemStack.matches(item.getItem(), oldItem)) { this.extractEnergyInternal(stack, energyForItem, false); } } @@ -73,12 +73,12 @@ public class ItemMagnetRing extends ItemEnergy { } @Override - public ActionResult onItemRightClick(World worldIn, PlayerEntity player, Hand hand) { - if (!worldIn.isRemote && player.isSneaking()) { + public ActionResult use(World worldIn, PlayerEntity player, Hand hand) { + if (!worldIn.isClientSide && player.isShiftKeyDown()) { ItemUtil.changeEnabled(player, hand); - return ActionResult.resultSuccess(player.getHeldItem(hand)); + return ActionResult.success(player.getItemInHand(hand)); } - return super.onItemRightClick(worldIn, player, hand); + return super.use(worldIn, player, hand); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPhantomConnector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPhantomConnector.java index 4f7942db5..eeef98196 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPhantomConnector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPhantomConnector.java @@ -45,7 +45,7 @@ public class ItemPhantomConnector extends ItemBase { return null; } - return RegistryKey.getOrCreateKey(Registry.WORLD_KEY, new ResourceLocation(tag.getString("WorldOfTileStored"))); + return RegistryKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation(tag.getString("WorldOfTileStored"))); } public static BlockPos getStoredPosition(ItemStack stack) { @@ -73,35 +73,35 @@ public class ItemPhantomConnector extends ItemBase { tag.putInt("XCoordOfTileStored", x); tag.putInt("YCoordOfTileStored", y); tag.putInt("ZCoordOfTileStored", z); - tag.putString("WorldOfTileStored", world.getDimensionKey().getLocation().toString()); + tag.putString("WorldOfTileStored", world.dimension().location().toString()); } @Override - public ActionResultType onItemUse(ItemUseContext context) { - ItemStack stack = context.getPlayer().getHeldItem(context.getHand()); - if (!context.getWorld().isRemote) { + public ActionResultType useOn(ItemUseContext context) { + ItemStack stack = context.getPlayer().getItemInHand(context.getHand()); + if (!context.getLevel().isClientSide) { //Passing Data to Phantoms - BlockPos pos = context.getPos(); - TileEntity tile = context.getWorld().getTileEntity(pos); + BlockPos pos = context.getClickedPos(); + TileEntity tile = context.getLevel().getBlockEntity(pos); if (tile != null) { //Passing to Phantom if (tile instanceof IPhantomTile) { BlockPos stored = getStoredPosition(stack); - if (stored != null && getStoredWorld(stack) == context.getWorld().getDimensionKey()) { + if (stored != null && getStoredWorld(stack) == context.getLevel().dimension()) { ((IPhantomTile) tile).setBoundPosition(stored); if (tile instanceof TileEntityBase) { ((TileEntityBase) tile).sendUpdate(); } clearStorage(stack, "XCoordOfTileStored", "YCoordOfTileStored", "ZCoordOfTileStored", "WorldOfTileStored"); - context.getPlayer().sendStatusMessage(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".phantom.connected.desc"), true); + context.getPlayer().displayClientMessage(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".phantom.connected.desc"), true); return ActionResultType.SUCCESS; } return ActionResultType.FAIL; } } //Storing Connections - storeConnection(stack, pos.getX(), pos.getY(), pos.getZ(), context.getWorld()); - context.getPlayer().sendStatusMessage(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".phantom.stored.desc"), true); + storeConnection(stack, pos.getX(), pos.getY(), pos.getZ(), context.getLevel()); + context.getPlayer().displayClientMessage(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".phantom.stored.desc"), true); } return ActionResultType.SUCCESS; } @@ -113,14 +113,14 @@ public class ItemPhantomConnector extends ItemBase { } @Override - public void addInformation(ItemStack stack, @Nullable World playerIn, List list, ITooltipFlag advanced) { + public void appendHoverText(ItemStack stack, @Nullable World playerIn, List list, ITooltipFlag advanced) { BlockPos coords = getStoredPosition(stack); if (coords != null) { - list.add(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".boundTo.desc").appendString(":")); + list.add(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".boundTo.desc").append(":")); list.add(new StringTextComponent("X: " + coords.getX())); list.add(new StringTextComponent("Y: " + coords.getY())); list.add(new StringTextComponent("Z: " + coords.getZ())); - list.add(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".clearStorage.desc").mergeStyle(TextFormatting.ITALIC)); + list.add(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".clearStorage.desc").withStyle(TextFormatting.ITALIC)); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPickaxeAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPickaxeAA.java index 09ffa43d2..12dd43b63 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPickaxeAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPickaxeAA.java @@ -28,11 +28,11 @@ public class ItemPickaxeAA extends ItemToolAA { public ItemPickaxeAA(IItemTier material) { super(1.0F, -2.8F, material, this.repairItem, unlocalizedName, this.rarity, EFFECTIVE_ON); - this.setHarvestLevel("pickaxe", material.getHarvestLevel()); + this.setHarvestLevel("pickaxe", material.getLevel()); } @Override - public boolean canHarvestBlock(BlockState blockIn) { + public boolean isCorrectToolForDrops(BlockState blockIn) { Block block = blockIn.getBlock(); if (block == Blocks.OBSIDIAN) { @@ -44,7 +44,7 @@ public class ItemPickaxeAA extends ItemToolAA { if (block != Blocks.LAPIS_BLOCK && block != Blocks.LAPIS_ORE) { if (block != Blocks.REDSTONE_ORE && block != Blocks.LIT_REDSTONE_ORE) { Material material = blockIn.getMaterial(); - return material == Material.ROCK || material == Material.IRON || material == Material.ANVIL; + return material == Material.STONE || material == Material.METAL || material == Material.HEAVY_METAL; } else { return this.toolMaterial.getHarvestLevel() >= 2; } @@ -68,9 +68,9 @@ public class ItemPickaxeAA extends ItemToolAA { @Override public float getDestroySpeed(ItemStack stack, BlockState state) { Material material = state.getMaterial(); - return material != Material.IRON && material != Material.ANVIL && material != Material.ROCK + return material != Material.METAL && material != Material.HEAVY_METAL && material != Material.STONE ? super.getDestroySpeed(stack, state) - : this.efficiency; + : this.speed; } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPlayerProbe.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPlayerProbe.java index 4e0cd786d..0c4dd0240 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPlayerProbe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPlayerProbe.java @@ -35,49 +35,49 @@ import java.util.UUID; public class ItemPlayerProbe extends ItemBase { public ItemPlayerProbe() { - super(ActuallyItems.defaultProps().maxStackSize(1)); + super(ActuallyItems.defaultProps().stacksTo(1)); } // TODO: [port] might be the wrong event @Override public void inventoryTick(ItemStack stack, World world, Entity entity, int itemSlot, boolean isSelected) { - if (!world.isRemote) { + if (!world.isClientSide) { CompoundNBT compound = stack.getOrCreateTag(); if (compound.contains("UUIDMost")) { - UUID id = compound.getUniqueId("UUID"); - PlayerEntity player = world.getPlayerByUuid(id); + UUID id = compound.getUUID("UUID"); + PlayerEntity player = world.getPlayerByUUID(id); if (player != null) { - if (player.isSneaking()) { + if (player.isShiftKeyDown()) { ItemPhantomConnector.clearStorage(stack, "UUIDLeast", "UUIDMost", "Name"); - ((PlayerEntity) entity).sendStatusMessage(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".playerProbe.disconnect.1"), false); - player.sendStatusMessage(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".playerProbe.notice"), false); + ((PlayerEntity) entity).displayClientMessage(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".playerProbe.disconnect.1"), false); + player.displayClientMessage(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".playerProbe.notice"), false); //TheAchievements.GET_UNPROBED.get(player); } } else { ItemPhantomConnector.clearStorage(stack, "UUIDLeast", "UUIDMost", "Name"); - ((PlayerEntity) entity).sendStatusMessage(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".playerProbe.disconnect.2"), false); + ((PlayerEntity) entity).displayClientMessage(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".playerProbe.disconnect.2"), false); } } } } @Override - public ActionResultType onItemUse(ItemUseContext context) { + public ActionResultType useOn(ItemUseContext context) { PlayerEntity player = context.getPlayer(); if (player == null) { return ActionResultType.FAIL; } - ItemStack stack = player.getHeldItem(context.getHand()); - TileEntity tile = context.getWorld().getTileEntity(context.getPos()); + ItemStack stack = player.getItemInHand(context.getHand()); + TileEntity tile = context.getLevel().getBlockEntity(context.getClickedPos()); if (tile instanceof TileEntityPlayerInterface) { CompoundNBT compound = stack.getOrCreateTag(); if (compound.contains("UUIDMost")) { - if (!context.getWorld().isRemote) { + if (!context.getLevel().isClientSide) { TileEntityPlayerInterface face = (TileEntityPlayerInterface) tile; - face.connectedPlayer = compound.getUniqueId("UUID"); + face.connectedPlayer = compound.getUUID("UUID"); face.playerName = compound.getString("Name"); - face.markDirty(); + face.setChanged(); face.sendUpdate(); ItemPhantomConnector.clearStorage(stack, "UUIDLeast", "UUIDMost", "Name"); @@ -89,17 +89,17 @@ public class ItemPlayerProbe extends ItemBase { } @Override - public ActionResultType itemInteractionForEntity(ItemStack aStack, PlayerEntity player, LivingEntity entity, Hand hand) { - if (!player.world.isRemote) { - ItemStack stack = player.getHeldItemMainhand(); + public ActionResultType interactLivingEntity(ItemStack aStack, PlayerEntity player, LivingEntity entity, Hand hand) { + if (!player.level.isClientSide) { + ItemStack stack = player.getMainHandItem(); if (StackUtil.isValid(stack) && stack.getItem() == this) { if (entity instanceof PlayerEntity) { PlayerEntity playerHit = (PlayerEntity) entity; - if (!playerHit.isSneaking()) { + if (!playerHit.isShiftKeyDown()) { CompoundNBT compound = stack.getOrCreateTag(); compound.putString("Name", playerHit.getName().getString()); - compound.putUniqueId("UUID", playerHit.getUniqueID()); + compound.putUUID("UUID", playerHit.getUUID()); return ActionResultType.SUCCESS; } } @@ -109,10 +109,10 @@ public class ItemPlayerProbe extends ItemBase { } @Override - public void addInformation(ItemStack stack, @Nullable World playerIn, List tooltip, ITooltipFlag advanced) { + public void appendHoverText(ItemStack stack, @Nullable World playerIn, List tooltip, ITooltipFlag advanced) { if (stack.getOrCreateTag().contains("Name")) { String name = stack.getOrCreateTag().getString("Name"); - tooltip.add(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".playerProbe.probing").appendString(": " + name)); + tooltip.add(new TranslationTextComponent("tooltip." + ActuallyAdditions.MODID + ".playerProbe.probing").append(": " + name)); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPotionRing.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPotionRing.java index 32f8bebb0..9a66271bb 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPotionRing.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPotionRing.java @@ -49,7 +49,7 @@ public class ItemPotionRing extends ItemBase implements IColorProvidingItem, IDi private final boolean isAdvanced; public ItemPotionRing(boolean isAdvanced) { - super(ActuallyItems.defaultProps().maxStackSize(1)); + super(ActuallyItems.defaultProps().stacksTo(1)); this.isAdvanced = isAdvanced; } @@ -84,14 +84,14 @@ public class ItemPotionRing extends ItemBase implements IColorProvidingItem, IDi @Override public int getRGBDurabilityForDisplay(ItemStack stack) { int curr = getStoredBlaze(stack); - return MathHelper.hsvToRGB(Math.max(0.0F, (float) curr / MAX_BLAZE) / 3.0F, 1.0F, 1.0F); + return MathHelper.hsvToRgb(Math.max(0.0F, (float) curr / MAX_BLAZE) / 3.0F, 1.0F, 1.0F); } @Override - public String getTranslationKey(ItemStack stack) { + public String getDescriptionId(ItemStack stack) { return stack.getItemDamage() >= ALL_RINGS.length ? StringUtil.BUGGED_ITEM_NAME - : this.getTranslationKey() + ALL_RINGS[stack.getItemDamage()].name; + : this.getDescriptionId() + ALL_RINGS[stack.getItemDamage()].name; } @Override @@ -103,14 +103,14 @@ public class ItemPotionRing extends ItemBase implements IColorProvidingItem, IDi public void onUpdate(ItemStack stack, World world, Entity player, int par4, boolean par5) { super.onUpdate(stack, world, player, par4, par5); - if (!world.isRemote && stack.getItemDamage() < ALL_RINGS.length) { + if (!world.isClientSide && stack.getItemDamage() < ALL_RINGS.length) { if (player instanceof PlayerEntity) { PlayerEntity thePlayer = (PlayerEntity) player; int storedBlaze = getStoredBlaze(stack); if (storedBlaze > 0) { - ItemStack equippedStack = thePlayer.getHeldItemMainhand(); - ItemStack offhandStack = thePlayer.getHeldItemOffhand(); + ItemStack equippedStack = thePlayer.getMainHandItem(); + ItemStack offhandStack = thePlayer.getOffhandItem(); if (this.effectEntity(thePlayer, stack, StackUtil.isValid(equippedStack) && stack == equippedStack || StackUtil.isValid(offhandStack) && stack == offhandStack)) { if (world.getTotalWorldTime() % 10 == 0) { @@ -124,20 +124,20 @@ public class ItemPotionRing extends ItemBase implements IColorProvidingItem, IDi @Override public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) { - return slotChanged || !ItemStack.areItemsEqual(oldStack, newStack); + return slotChanged || !ItemStack.isSame(oldStack, newStack); } @Override public String getItemStackDisplayName(ItemStack stack) { if (Util.isClient()) { - String standardName = StringUtil.localize(this.getTranslationKey() + ".name"); + String standardName = StringUtil.localize(this.getDescriptionId() + ".name"); if (stack.getItemDamage() < ALL_RINGS.length) { String effect = StringUtil.localize(ALL_RINGS[stack.getItemDamage()].name); return standardName + " " + effect; } return standardName; } - String standardName = StringUtil.localizeIllegallyOnTheServerDontUseMePls(this.getTranslationKey() + ".name"); + String standardName = StringUtil.localizeIllegallyOnTheServerDontUseMePls(this.getDescriptionId() + ".name"); if (stack.getItemDamage() < ALL_RINGS.length) { String effect = StringUtil.localizeIllegallyOnTheServerDontUseMePls(ALL_RINGS[stack.getItemDamage()].name); return standardName + " " + effect; @@ -187,7 +187,7 @@ public class ItemPotionRing extends ItemBase implements IColorProvidingItem, IDi int range = advanced ? 48 : 16; - List entities = tile.getWorld().getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(tile.getPos().getX() - range, tile.getPos().getY() - range, tile.getPos().getZ() - range, tile.getPos().getX() + range, tile.getPos().getY() + range, tile.getPos().getZ() + range)); + List entities = tile.getLevel().getEntitiesOfClass(EntityLivingBase.class, new AxisAlignedBB(tile.getBlockPos().getX() - range, tile.getBlockPos().getY() - range, tile.getBlockPos().getZ() - range, tile.getBlockPos().getX() + range, tile.getBlockPos().getY() + range, tile.getBlockPos().getZ() + range)); if (entities != null && !entities.isEmpty()) { if (advanced) { //Give all entities the effect @@ -200,7 +200,7 @@ public class ItemPotionRing extends ItemBase implements IColorProvidingItem, IDi for (EntityLivingBase entity : entities) { if (entity.isPotionActive(potion)) { //Sometimes make the effect switch to someone else - if (tile.getWorld().rand.nextInt(100) <= 0) { + if (tile.getLevel().random.nextInt(100) <= 0) { entity.removePotionEffect(potion); break; } else { @@ -246,7 +246,7 @@ public class ItemPotionRing extends ItemBase implements IColorProvidingItem, IDi @Override public void addInformation(ItemStack stack, @Nullable World playerIn, List tooltip, ITooltipFlag advanced) { - super.addInformation(stack, playerIn, tooltip, advanced); + super.appendHoverText(stack, playerIn, tooltip, advanced); tooltip.add(String.format("%d/%d %s", getStoredBlaze(stack), MAX_BLAZE, StringUtil.localize("item." + ActuallyAdditions.MODID + ".item_misc_ring.storage"))); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemResonantRice.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemResonantRice.java index b86a80611..1aca91d91 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemResonantRice.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemResonantRice.java @@ -25,12 +25,12 @@ public class ItemResonantRice extends ItemBase { } @Override - public ActionResult onItemRightClick(World world, PlayerEntity player, Hand hand) { - ItemStack stack = player.getHeldItem(hand); - if (!world.isRemote) { + public ActionResult use(World world, PlayerEntity player, Hand hand) { + ItemStack stack = player.getItemInHand(hand); + if (!world.isClientSide) { stack.shrink(1); - world.createExplosion(null, player.getPosX(), player.getPosY(), player.getPosZ(), 0.5F, Explosion.Mode.DESTROY); + world.explode(null, player.getX(), player.getY(), player.getZ(), 0.5F, Explosion.Mode.DESTROY); } - return ActionResult.resultSuccess(stack); + return ActionResult.success(stack); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemShovelAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemShovelAA.java index 4240e6498..0d82a3d36 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemShovelAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemShovelAA.java @@ -34,11 +34,11 @@ public class ItemShovelAA extends ItemToolAA { public ItemShovelAA(IItemTier material) { super(1.5F, -3.0F, material, this.repairItem, unlocalizedName, this.rarity, EFFECTIVE_ON); - this.setHarvestLevel("shovel", material.getHarvestLevel()); + this.setHarvestLevel("shovel", material.getLevel()); } @Override - public boolean canHarvestBlock(BlockState blockIn) { + public boolean isCorrectToolForDrops(BlockState blockIn) { Block block = blockIn.getBlock(); return block == Blocks.SNOW_LAYER || block == Blocks.SNOW; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemSolidifiedExperience.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemSolidifiedExperience.java index 3d72248ef..4576976eb 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemSolidifiedExperience.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemSolidifiedExperience.java @@ -41,11 +41,11 @@ public class ItemSolidifiedExperience extends ItemBase { @SubscribeEvent public void onEntityDropEvent(LivingDropsEvent event) { if (ConfigBoolValues.DO_XP_DROPS.isEnabled()) { - if (event.getEntityLiving().world != null && !event.getEntityLiving().world.isRemote && event.getSource().getTrueSource() instanceof PlayerEntity && event.getEntityLiving().world.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) { + if (event.getEntityLiving().level != null && !event.getEntityLiving().level.isClientSide && event.getSource().getEntity() instanceof PlayerEntity && event.getEntityLiving().level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { //Drop Solidified XP if (event.getEntityLiving() instanceof CreatureEntity) { - if (event.getEntityLiving().world.rand.nextInt(10) <= event.getLootingLevel() * 2) { - event.getDrops().add(new ItemEntity(event.getEntityLiving().world, event.getEntityLiving().getPosX(), event.getEntityLiving().getPosY(), event.getEntityLiving().getPosZ(), new ItemStack(ActuallyItems.SOLIDIFIED_EXPERIENCE.get(), event.getEntityLiving().world.rand.nextInt(2 + event.getLootingLevel()) + 1))); + if (event.getEntityLiving().level.random.nextInt(10) <= event.getLootingLevel() * 2) { + event.getDrops().add(new ItemEntity(event.getEntityLiving().level, event.getEntityLiving().getX(), event.getEntityLiving().getY(), event.getEntityLiving().getZ(), new ItemStack(ActuallyItems.SOLIDIFIED_EXPERIENCE.get(), event.getEntityLiving().level.random.nextInt(2 + event.getLootingLevel()) + 1))); } } } @@ -53,11 +53,11 @@ public class ItemSolidifiedExperience extends ItemBase { } @Override - public ActionResult onItemRightClick(World world, PlayerEntity player, Hand hand) { - ItemStack stack = player.getHeldItem(hand); - if (!world.isRemote) { + public ActionResult use(World world, PlayerEntity player, Hand hand) { + ItemStack stack = player.getItemInHand(hand); + if (!world.isClientSide) { int amount; - if (!player.isSneaking()) { + if (!player.isShiftKeyDown()) { amount = SOLID_XP_AMOUNT; if (!player.isCreative()) { stack.shrink(1); @@ -70,13 +70,13 @@ public class ItemSolidifiedExperience extends ItemBase { } if (ConfigBoolValues.SOLID_XP_ALWAYS_ORBS.currentValue || player instanceof FakePlayer) { - ExperienceOrbEntity orb = new ExperienceOrbEntity(world, player.getPosX() + 0.5, player.getPosY() + 0.5, player.getPosZ() + 0.5, amount); + ExperienceOrbEntity orb = new ExperienceOrbEntity(world, player.getX() + 0.5, player.getY() + 0.5, player.getZ() + 0.5, amount); orb.getPersistentData().putBoolean(ActuallyAdditions.MODID + "FromSolidified", true); - world.addEntity(orb); + world.addFreshEntity(orb); } else { - player.addExperienceLevel(amount); + player.giveExperienceLevels(amount); } } - return ActionResult.resultSuccess(stack); + return ActionResult.success(stack); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemTeleStaff.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemTeleStaff.java index 39c44f8f0..523a9560c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemTeleStaff.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemTeleStaff.java @@ -31,28 +31,28 @@ public class ItemTeleStaff extends ItemEnergy { } @Override - public ActionResult onItemRightClick(World world, PlayerEntity player, Hand hand) { - ItemStack stack = player.getHeldItem(hand); - if (!world.isRemote) { + public ActionResult use(World world, PlayerEntity player, Hand hand) { + ItemStack stack = player.getItemInHand(hand); + if (!world.isClientSide) { RayTraceResult rayTraceResult = player.pick(100,0,false); - if (rayTraceResult != null && (rayTraceResult.getType() == RayTraceResult.Type.BLOCK || player.rotationPitch >= -5)) { + if (rayTraceResult != null && (rayTraceResult.getType() == RayTraceResult.Type.BLOCK || player.xRot >= -5)) { BlockRayTraceResult res = (BlockRayTraceResult)rayTraceResult; - BlockPos pos = res.getPos().offset(res.getFace()); + BlockPos pos = res.getBlockPos().relative(res.getDirection()); int baseUse = 200; - int use = baseUse + (int) (baseUse * rayTraceResult.getHitVec().distanceTo(new Vector3d(player.getPosX(), player.getPosY() + (player.getEyeHeight() - player.getEyeHeight()), player.getPosZ()))); + int use = baseUse + (int) (baseUse * rayTraceResult.getLocation().distanceTo(new Vector3d(player.getX(), player.getY() + (player.getEyeHeight() - player.getEyeHeight()), player.getZ()))); if (this.getEnergyStored(stack) >= use) { - ((ServerPlayerEntity) player).connection.setPlayerLocation(pos.getX(), pos.getY(), pos.getY(), player.rotationYaw, player.rotationPitch); - player.dismount(); - world.playSound(null, player.getPosX(), player.getPosY(), player.getPosZ(), SoundEvents.ENTITY_ENDERMAN_TELEPORT, SoundCategory.PLAYERS, 1.0F, 1.0F); + ((ServerPlayerEntity) player).connection.teleport(pos.getX(), pos.getY(), pos.getY(), player.yRot, player.xRot); + player.removeVehicle(); + world.playSound(null, player.getX(), player.getY(), player.getZ(), SoundEvents.ENDERMAN_TELEPORT, SoundCategory.PLAYERS, 1.0F, 1.0F); if (!player.isCreative()) { this.extractEnergyInternal(stack, use, false); - player.getCooldownTracker().setCooldown(this, 50); + player.getCooldowns().addCooldown(this, 50); } - return ActionResult.resultSuccess(stack); + return ActionResult.success(stack); } } } - player.swingArm(hand); - return ActionResult.resultFail(stack); + player.swing(hand); + return ActionResult.fail(stack); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWaterBowl.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWaterBowl.java index 6dc9edf44..548033329 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWaterBowl.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWaterBowl.java @@ -39,7 +39,7 @@ import net.minecraftforge.eventbus.api.SubscribeEvent; public class ItemWaterBowl extends ItemBase { public ItemWaterBowl() { - super(ActuallyItems.defaultProps().maxStackSize(1)); + super(ActuallyItems.defaultProps().stacksTo(1)); MinecraftForge.EVENT_BUS.register(this); } @@ -56,25 +56,25 @@ public class ItemWaterBowl extends ItemBase { BlockRayTraceResult trace = (BlockRayTraceResult) rayTrace; ActionResult result = ForgeEventFactory.onBucketUse(event.getPlayer(), event.getWorld(), event.getItemStack(), trace); if (result == null) { - if (event.getPlayer().canPlayerEdit(trace.getPos().offset(trace.getFace()), trace.getFace(), event.getItemStack())) { - BlockState state = event.getWorld().getBlockState(trace.getPos()); + if (event.getPlayer().mayUseItemAt(trace.getBlockPos().relative(trace.getDirection()), trace.getDirection(), event.getItemStack())) { + BlockState state = event.getWorld().getBlockState(trace.getBlockPos()); Block block = state.getBlock(); // TODO: Validate fluid check - if ((block == Blocks.WATER) && state.get(BlockStateProperties.LEVEL_0_15) == 0) { - event.getPlayer().playSound(SoundEvents.ITEM_BUCKET_FILL, 1.0F, 1.0F); + if ((block == Blocks.WATER) && state.getValue(BlockStateProperties.LEVEL) == 0) { + event.getPlayer().playSound(SoundEvents.BUCKET_FILL, 1.0F, 1.0F); - if (!event.getWorld().isRemote) { - event.getWorld().setBlockState(trace.getPos(), Blocks.AIR.getDefaultState(), 11); + if (!event.getWorld().isClientSide) { + event.getWorld().setBlock(trace.getBlockPos(), Blocks.AIR.defaultBlockState(), 11); ItemStack reduced = StackUtil.shrink(event.getItemStack(), 1); ItemStack bowl = new ItemStack(ActuallyItems.WATER_BOWL.get()); if (!StackUtil.isValid(reduced)) { - event.getPlayer().setHeldItem(event.getHand(), bowl); - } else if (!event.getPlayer().inventory.addItemStackToInventory(bowl.copy())) { - ItemEntity entityItem = new ItemEntity(event.getWorld(), event.getPlayer().getPosX(), event.getPlayer().getPosY(), event.getPlayer().getPosZ(), bowl.copy()); - entityItem.setPickupDelay(0); - event.getWorld().addEntity(entityItem); + event.getPlayer().setItemInHand(event.getHand(), bowl); + } else if (!event.getPlayer().inventory.add(bowl.copy())) { + ItemEntity entityItem = new ItemEntity(event.getWorld(), event.getPlayer().getX(), event.getPlayer().getY(), event.getPlayer().getZ(), bowl.copy()); + entityItem.setPickUpDelay(0); + event.getWorld().addFreshEntity(entityItem); } } } @@ -86,8 +86,8 @@ public class ItemWaterBowl extends ItemBase { } @Override - public ActionResult onItemRightClick(World world, PlayerEntity player, Hand hand) { - ItemStack stack = player.getHeldItem(hand); + public ActionResult use(World world, PlayerEntity player, Hand hand) { + ItemStack stack = player.getItemInHand(hand); RayTraceResult trace = WorldUtil.getNearestBlockWithDefaultReachDistance(world, player); ActionResult result = ForgeEventFactory.onBucketUse(player, world, stack, trace); @@ -96,28 +96,28 @@ public class ItemWaterBowl extends ItemBase { } if (trace == null) { - return ActionResult.resultPass(stack); + return ActionResult.pass(stack); } else if (trace.getType() != RayTraceResult.Type.BLOCK) { - return ActionResult.resultPass(stack); + return ActionResult.pass(stack); } else { BlockRayTraceResult blockTrace = (BlockRayTraceResult) trace; - BlockPos pos = blockTrace.getPos(); + BlockPos pos = blockTrace.getBlockPos(); - if (!world.isBlockModifiable(player, pos)) { - return ActionResult.resultFail(stack); + if (!world.mayInteract(player, pos)) { + return ActionResult.fail(stack); } else { - BlockPos pos1 = world.getBlockState(pos).getMaterial().isReplaceable() && blockTrace.getFace() == Direction.UP + BlockPos pos1 = world.getBlockState(pos).getMaterial().isReplaceable() && blockTrace.getDirection() == Direction.UP ? pos - : pos.offset(blockTrace.getFace()); + : pos.relative(blockTrace.getDirection()); - if (!player.canPlayerEdit(pos1, blockTrace.getFace(), stack)) { - return ActionResult.resultFail(stack); + if (!player.mayUseItemAt(pos1, blockTrace.getDirection(), stack)) { + return ActionResult.fail(stack); } else if (this.tryPlaceContainedLiquid(player, world, pos1, false)) { return !player.isCreative() - ? ActionResult.resultSuccess(new ItemStack(Items.BOWL)) - : ActionResult.resultSuccess(stack); + ? ActionResult.success(new ItemStack(Items.BOWL)) + : ActionResult.success(stack); } else { - return ActionResult.resultFail(stack); + return ActionResult.fail(stack); } } } @@ -125,9 +125,9 @@ public class ItemWaterBowl extends ItemBase { @Override public void inventoryTick(ItemStack stack, World world, Entity entity, int itemSlot, boolean isSelected) { - if (!world.isRemote) { + if (!world.isClientSide) { if (ConfigBoolValues.WATER_BOWL_LOSS.isEnabled()) { - if (world.getGameTime() % 10 == 0 && world.rand.nextFloat() >= 0.5F) { + if (world.getGameTime() % 10 == 0 && world.random.nextFloat() >= 0.5F) { int lastX = 0; int lastY = 0; @@ -138,11 +138,11 @@ public class ItemWaterBowl extends ItemBase { } boolean change = false; - if (lastX != 0 && lastX != (int) entity.getPosX() || lastY != 0 && lastY != (int) entity.getPosY()) { - if (!entity.isSneaking()) { + if (lastX != 0 && lastX != (int) entity.getX() || lastY != 0 && lastY != (int) entity.getY()) { + if (!entity.isShiftKeyDown()) { if (entity instanceof PlayerEntity) { PlayerEntity player = (PlayerEntity) entity; - if (this.tryPlaceContainedLiquid(player, world, player.getPosition(), true)) { + if (this.tryPlaceContainedLiquid(player, world, player.blockPosition(), true)) { this.checkReplace(player, stack, new ItemStack(Items.BOWL), itemSlot); } } @@ -152,8 +152,8 @@ public class ItemWaterBowl extends ItemBase { if (change || lastX == 0 || lastY == 0) { CompoundNBT compound = stack.getOrCreateTag(); - compound.putInt("lastX", (int) entity.getPosX()); - compound.putInt("lastY", (int) entity.getPosY()); + compound.putInt("lastX", (int) entity.getX()); + compound.putInt("lastY", (int) entity.getY()); } } } @@ -161,16 +161,16 @@ public class ItemWaterBowl extends ItemBase { } private void checkReplace(PlayerEntity player, ItemStack old, ItemStack stack, int slot) { - if (player.inventory.getStackInSlot(slot) == old) { - player.inventory.setInventorySlotContents(slot, stack); - } else if (player.inventory.offHandInventory.get(slot) == old) { - player.inventory.offHandInventory.set(slot, stack); + if (player.inventory.getItem(slot) == old) { + player.inventory.setItem(slot, stack); + } else if (player.inventory.offhand.get(slot) == old) { + player.inventory.offhand.set(slot, stack); } } @Override public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) { - return !ItemStack.areItemsEqual(oldStack, newStack); + return !ItemStack.isSame(oldStack, newStack); } public boolean tryPlaceContainedLiquid(PlayerEntity player, World world, BlockPos pos, boolean finite) { @@ -179,24 +179,24 @@ public class ItemWaterBowl extends ItemBase { boolean nonSolid = !material.isSolid(); boolean replaceable = state.getMaterial().isReplaceable(); - if (!world.isAirBlock(pos) && !nonSolid && !replaceable) { + if (!world.isEmptyBlock(pos) && !nonSolid && !replaceable) { return false; } else { - if (world.getDimensionType().isUltrawarm()) { - world.playSound(player, pos, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F); + if (world.dimensionType().ultraWarm()) { + world.playSound(player, pos, SoundEvents.FIRE_EXTINGUISH, SoundCategory.BLOCKS, 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F); for (int k = 0; k < 8; k++) { world.addParticle(ParticleTypes.LARGE_SMOKE, pos.getX() + Math.random(), pos.getY() + Math.random(), pos.getZ() + Math.random(), 0.0D, 0.0D, 0.0D); } } else { - if (!world.isRemote && (nonSolid || replaceable) && !material.isLiquid()) { + if (!world.isClientSide && (nonSolid || replaceable) && !material.isLiquid()) { world.destroyBlock(pos, true); } - world.playSound(player, pos, SoundEvents.ITEM_BUCKET_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F); + world.playSound(player, pos, SoundEvents.BUCKET_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F); - BlockState placeState = Blocks.WATER.getDefaultState(); - world.setBlockState(pos, placeState, 3); + BlockState placeState = Blocks.WATER.defaultBlockState(); + world.setBlock(pos, placeState, 3); } return true; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWaterRemovalRing.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWaterRemovalRing.java index 6597adfef..a344b4e91 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWaterRemovalRing.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWaterRemovalRing.java @@ -29,11 +29,11 @@ public class ItemWaterRemovalRing extends ItemEnergy { @Override public void inventoryTick(ItemStack stack, World world, Entity player, int itemSlot, boolean isSelected) { - if (!(player instanceof PlayerEntity) || player.world.isRemote || player.isSneaking()) { + if (!(player instanceof PlayerEntity) || player.level.isClientSide || player.isShiftKeyDown()) { return; } - ItemStack equipped = ((PlayerEntity) player).getHeldItemMainhand(); + ItemStack equipped = ((PlayerEntity) player).getMainHandItem(); int energyUse = 150; if (StackUtil.isValid(equipped) && equipped == stack && this.getEnergyStored(stack) >= energyUse) { @@ -43,16 +43,16 @@ public class ItemWaterRemovalRing extends ItemEnergy { for (int x = -range; x < range + 1; x++) { for (int z = -range; z < range + 1; z++) { for (int y = -range; y < range + 1; y++) { - int theX = MathHelper.floor(player.getPosX() + x); - int theY = MathHelper.floor(player.getPosY() + y); - int theZ = MathHelper.floor(player.getPosZ() + z); + int theX = MathHelper.floor(player.getX() + x); + int theY = MathHelper.floor(player.getY() + y); + int theZ = MathHelper.floor(player.getZ() + z); //Remove Water BlockPos pos = new BlockPos(theX, theY, theZ); Block block = world.getBlockState(pos).getBlock(); // TODO: Ensure water check is correct if ((block == Blocks.WATER) && this.getEnergyStored(stack) >= energyUse) { - world.setBlockState(pos, Blocks.AIR.getDefaultState()); + world.setBlockAndUpdate(pos, Blocks.AIR.defaultBlockState()); if (!((PlayerEntity) player).isCreative()) { this.extractEnergyInternal(stack, energyUse, false); @@ -61,7 +61,7 @@ public class ItemWaterRemovalRing extends ItemEnergy { //Remove Lava // TODO: Ensure lava check is correct else if ((block == Blocks.LAVA) && this.getEnergyStored(stack) >= energyUse * 2) { - world.setBlockState(pos, Blocks.AIR.getDefaultState()); + world.setBlockAndUpdate(pos, Blocks.AIR.defaultBlockState()); if (!((PlayerEntity) player).isCreative()) { this.extractEnergyInternal(stack, energyUse * 2, false); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWingsOfTheBats.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWingsOfTheBats.java index 54cf4bb1d..465591f68 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWingsOfTheBats.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWingsOfTheBats.java @@ -38,7 +38,7 @@ public class ItemWingsOfTheBats extends ItemBase { public static final int MAX_FLY_TIME = 800; public ItemWingsOfTheBats() { - super(ActuallyItems.defaultProps().maxStackSize(1)); + super(ActuallyItems.defaultProps().stacksTo(1)); // TODO: Lets move this somewhere global. Don't like event logic in a single place. MinecraftForge.EVENT_BUS.register(this); @@ -52,9 +52,9 @@ public class ItemWingsOfTheBats extends ItemBase { * @return The Wings */ public static ItemStack getWingItem(PlayerEntity player) { - for (int i = 0; i < player.inventory.getSizeInventory(); i++) { - if (StackUtil.isValid(player.inventory.getStackInSlot(i)) && player.inventory.getStackInSlot(i).getItem() instanceof ItemWingsOfTheBats) { - return player.inventory.getStackInSlot(i); + for (int i = 0; i < player.inventory.getContainerSize(); i++) { + if (StackUtil.isValid(player.inventory.getItem(i)) && player.inventory.getItem(i).getItem() instanceof ItemWingsOfTheBats) { + return player.inventory.getItem(i); } } return StackUtil.getEmpty(); @@ -82,32 +82,32 @@ public class ItemWingsOfTheBats extends ItemBase { if (player != null) { PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(player); int curr = data.batWingsFlyTime; - return MathHelper.hsvToRGB(Math.max(0.0F, 1 - (float) curr / MAX_FLY_TIME) / 3.0F, 1.0F, 1.0F); + return MathHelper.hsvToRgb(Math.max(0.0F, 1 - (float) curr / MAX_FLY_TIME) / 3.0F, 1.0F, 1.0F); } return super.getRGBDurabilityForDisplay(stack); } @SubscribeEvent public void onEntityDropEvent(LivingDropsEvent event) { - Entity source = event.getSource().getTrueSource(); + Entity source = event.getSource().getEntity(); - if (event.getEntityLiving().world != null && !event.getEntityLiving().world.isRemote && source instanceof PlayerEntity) { + if (event.getEntityLiving().level != null && !event.getEntityLiving().level.isClientSide && source instanceof PlayerEntity) { //Drop Wings from Bats if (ConfigBoolValues.DO_BAT_DROPS.isEnabled() && event.getEntityLiving() instanceof BatEntity) { int looting = event.getLootingLevel(); - Iterable equip = source.getHeldEquipment(); + Iterable equip = source.getHandSlots(); for (ItemStack stack : equip) { // Todo: [port] this might not work anymore due to the way things are checked - if (StackUtil.isValid(stack) && ItemWingsOfTheBats.THE_BAT_BAT.equalsIgnoreCase(stack.getDisplayName().getString()) && stack.getItem() instanceof SwordItem) { + if (StackUtil.isValid(stack) && ItemWingsOfTheBats.THE_BAT_BAT.equalsIgnoreCase(stack.getHoverName().getString()) && stack.getItem() instanceof SwordItem) { looting += 3; break; } } - if (event.getEntityLiving().world.rand.nextInt(15) <= looting * 2) { + if (event.getEntityLiving().level.random.nextInt(15) <= looting * 2) { LivingEntity entityLiving = event.getEntityLiving(); - event.getDrops().add(new ItemEntity(event.getEntityLiving().world, entityLiving.getPosX(), entityLiving.getPosY(), entityLiving.getPosZ(), new ItemStack(ActuallyItems.BAT_WING.get(), event.getEntityLiving().world.rand.nextInt(2 + looting) + 1))); + event.getDrops().add(new ItemEntity(event.getEntityLiving().level, entityLiving.getX(), entityLiving.getY(), entityLiving.getZ(), new ItemStack(ActuallyItems.BAT_WING.get(), event.getEntityLiving().level.random.nextInt(2 + looting) + 1))); } } } @@ -121,7 +121,7 @@ public class ItemWingsOfTheBats extends ItemBase { if (!player.isCreative() && !player.isSpectator()) { PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(player); - if (!player.world.isRemote) { + if (!player.level.isClientSide) { boolean tryDeduct = false; boolean shouldSend = false; @@ -137,12 +137,12 @@ public class ItemWingsOfTheBats extends ItemBase { } } else { if (wingsEquipped && data.batWingsFlyTime < MAX_FLY_TIME) { - player.abilities.allowFlying = true; + player.abilities.mayfly = true; - if (player.abilities.isFlying) { + if (player.abilities.flying) { data.batWingsFlyTime++; - if (player.world.getWorldInfo().getGameTime() % 10 == 0) { + if (player.level.getLevelData().getGameTime() % 10 == 0) { shouldSend = true; } } @@ -153,21 +153,21 @@ public class ItemWingsOfTheBats extends ItemBase { data.shouldDisableBatWings = true; shouldSend = true; - player.abilities.allowFlying = false; - player.abilities.isFlying = false; - player.abilities.disableDamage = false; + player.abilities.mayfly = false; + player.abilities.flying = false; + player.abilities.invulnerable = false; } } if (tryDeduct && data.batWingsFlyTime > 0) { int deductTime = 0; - if (!player.abilities.isFlying) { + if (!player.abilities.flying) { deductTime = 2; } else { - BlockPos pos = new BlockPos(player.getPosX(), player.getPosY() + player.getHeight(), player.getPosZ()); - BlockState state = player.world.getBlockState(pos); - if (state.isSolidSide(player.world, pos, Direction.DOWN)) { + BlockPos pos = new BlockPos(player.getX(), player.getY() + player.getBbHeight(), player.getZ()); + BlockState state = player.level.getBlockState(pos); + if (state.isFaceSturdy(player.level, pos, Direction.DOWN)) { deductTime = 10; } } @@ -175,7 +175,7 @@ public class ItemWingsOfTheBats extends ItemBase { if (deductTime > 0) { data.batWingsFlyTime = Math.max(0, data.batWingsFlyTime - deductTime); - if (player.world.getWorldInfo().getGameTime() % 10 == 0) { + if (player.level.getLevelData().getGameTime() % 10 == 0) { shouldSend = true; } } @@ -187,13 +187,13 @@ public class ItemWingsOfTheBats extends ItemBase { } } else { if (data.hasBatWings) { - player.abilities.allowFlying = true; + player.abilities.mayfly = true; } else if (data.shouldDisableBatWings) { //so that other modded flying won't be disabled data.shouldDisableBatWings = false; - player.abilities.allowFlying = false; - player.abilities.isFlying = false; - player.abilities.disableDamage = false; + player.abilities.mayfly = false; + player.abilities.flying = false; + player.abilities.invulnerable = false; } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWorm.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWorm.java index f6b643123..c26d17aa0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWorm.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWorm.java @@ -43,18 +43,18 @@ public class ItemWorm extends ItemBase { } @Override - public ActionResultType onItemUse(ItemUseContext context) { - BlockPos pos = context.getPos(); - ItemStack stack = context.getPlayer().getHeldItem(context.getHand()); - BlockState state = context.getWorld().getBlockState(pos); - if (EntityWorm.canWormify(context.getWorld(), context.getPos(), state)) { - List worms = context.getWorld().getEntitiesWithinAABB(EntityWorm.class, new AxisAlignedBB(pos.getX() - 1, pos.getY(), pos.getZ() - 1, pos.getX() + 2, pos.getY() + 1, pos.getZ() + 2)); + public ActionResultType useOn(ItemUseContext context) { + BlockPos pos = context.getClickedPos(); + ItemStack stack = context.getPlayer().getItemInHand(context.getHand()); + BlockState state = context.getLevel().getBlockState(pos); + if (EntityWorm.canWormify(context.getLevel(), context.getClickedPos(), state)) { + List worms = context.getLevel().getEntitiesOfClass(EntityWorm.class, new AxisAlignedBB(pos.getX() - 1, pos.getY(), pos.getZ() - 1, pos.getX() + 2, pos.getY() + 1, pos.getZ() + 2)); if (worms.isEmpty()) { - if (!context.getWorld().isRemote) { - EntityWorm worm = new EntityWorm(context.getWorld()); - worm.setPosition(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5); - worm.setCustomName(stack.getDisplayName()); // TODO: WHAT DOES THIS EVEN DO? - context.getWorld().addEntity(worm); + if (!context.getLevel().isClientSide) { + EntityWorm worm = new EntityWorm(context.getLevel()); + worm.setPos(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5); + worm.setCustomName(stack.getHoverName()); // TODO: WHAT DOES THIS EVEN DO? + context.getLevel().addFreshEntity(worm); if (!context.getPlayer().isCreative()) { stack.shrink(1); } @@ -62,21 +62,21 @@ public class ItemWorm extends ItemBase { return ActionResultType.SUCCESS; } } - return super.onItemUse(context); + return super.useOn(context); } @SubscribeEvent(priority = EventPriority.LOW) public void onHoe(UseHoeEvent event) { if (ConfigBoolValues.WORMS.isEnabled() && event.getResult() != Event.Result.DENY) { - World world = event.getEntity().world; - if (!world.isRemote) { - BlockPos pos = event.getContext().getPos(); - if (world.isAirBlock(pos.up())) { + World world = event.getEntity().level; + if (!world.isClientSide) { + BlockPos pos = event.getContext().getClickedPos(); + if (world.isEmptyBlock(pos.above())) { BlockState state = world.getBlockState(pos); - if (state.getBlock() == Blocks.GRASS && world.rand.nextFloat() >= 0.95F) { - ItemStack stack = new ItemStack(ActuallyItems.WORM.get(), world.rand.nextInt(2) + 1); + if (state.getBlock() == Blocks.GRASS && world.random.nextFloat() >= 0.95F) { + ItemStack stack = new ItemStack(ActuallyItems.WORM.get(), world.random.nextInt(2) + 1); ItemEntity item = new ItemEntity(world, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, stack); - world.addEntity(item); + world.addFreshEntity(item); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemArmorAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemArmorAA.java index 140f288e5..cc6533b1f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemArmorAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemArmorAA.java @@ -16,6 +16,8 @@ import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.item.ArmorItem; import net.minecraft.item.IArmorMaterial; +import net.minecraft.item.Item.Properties; + public class ItemArmorAA extends ArmorItem implements IDisableableItem { private final boolean disabled; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemBase.java index 12a31cdf4..3ef106511 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemBase.java @@ -13,6 +13,8 @@ package de.ellpeck.actuallyadditions.mod.items.base; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; import net.minecraft.item.Item; +import net.minecraft.item.Item.Properties; + public class ItemBase extends Item { public ItemBase(Properties props) { super(props); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemEnergy.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemEnergy.java index 096a84d52..e945d5e6e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemEnergy.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemEnergy.java @@ -44,7 +44,7 @@ public abstract class ItemEnergy extends ItemBase { private final int transfer; public ItemEnergy(int maxPower, int transfer) { - super(ActuallyItems.defaultProps().maxStackSize(1)); + super(ActuallyItems.defaultProps().stacksTo(1)); this.maxPower = maxPower; this.transfer = transfer; } @@ -63,8 +63,8 @@ public abstract class ItemEnergy extends ItemBase { @Override - public void addInformation(ItemStack stack, @Nullable World worldIn, List tooltip, ITooltipFlag flagIn) { - super.addInformation(stack, worldIn, tooltip, flagIn); + public void appendHoverText(ItemStack stack, @Nullable World worldIn, List tooltip, ITooltipFlag flagIn) { + super.appendHoverText(stack, worldIn, tooltip, flagIn); stack.getCapability(CapabilityEnergy.ENERGY, null).ifPresent(storage -> { NumberFormat format = NumberFormat.getInstance(); tooltip.add(Lang.trans("misc", "power_long", format.format(storage.getEnergyStored()), format.format(storage.getMaxEnergyStored()))); @@ -73,14 +73,14 @@ public abstract class ItemEnergy extends ItemBase { @Override @OnlyIn(Dist.CLIENT) - public boolean hasEffect(ItemStack stack) { + public boolean isFoil(ItemStack stack) { return false; } @Override - public void fillItemGroup(ItemGroup group, NonNullList items) { - super.fillItemGroup(group, items); - if (!this.isInGroup(group)) { + public void fillItemCategory(ItemGroup group, NonNullList items) { + super.fillItemCategory(group, items); + if (!this.allowdedIn(group)) { return; } @@ -108,9 +108,9 @@ public abstract class ItemEnergy extends ItemBase { @Override public int getRGBDurabilityForDisplay(ItemStack stack) { PlayerEntity player = ClientProxy.getCurrentPlayer(); - if (player != null && player.world != null) { - float[] color = AssetUtil.getWheelColor(player.world.getGameTime() % 256); - return MathHelper.rgb(color[0] / 255F, color[1] / 255F, color[2] / 255F); + if (player != null && player.level != null) { + float[] color = AssetUtil.getWheelColor(player.level.getGameTime() % 256); + return MathHelper.color(color[0] / 255F, color[1] / 255F, color[2] / 255F); } return super.getRGBDurabilityForDisplay(stack); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemFoodSeed.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemFoodSeed.java index 6950a90a3..5a44b04a9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemFoodSeed.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemFoodSeed.java @@ -46,6 +46,6 @@ public class ItemFoodSeed extends ItemSeedFood { @Override public BlockState getPlant(IBlockAccess world, BlockPos pos) { - return this.plant.getDefaultState(); + return this.plant.defaultBlockState(); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemHoeAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemHoeAA.java index 46e6c6f3a..a84f54f09 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemHoeAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemHoeAA.java @@ -36,7 +36,7 @@ public class ItemHoeAA extends HoeItem implements IDisableableItem { } @Override - public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack) { + public boolean isValidRepairItem(ItemStack itemToRepair, ItemStack stack) { return ItemUtil.areItemsEqual(this.repairItem, stack, false); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSeed.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSeed.java index e0aafa6b6..1c997768b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSeed.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSeed.java @@ -36,6 +36,6 @@ public class ItemSeed extends ItemSeeds { @Override public BlockState getPlant(IBlockAccess world, BlockPos pos) { - return this.plant.getDefaultState(); + return this.plant.defaultBlockState(); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSwordAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSwordAA.java index 890af8dc3..b92458482 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSwordAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSwordAA.java @@ -41,7 +41,7 @@ public class ItemSwordAA extends SwordItem implements IDisableableItem { } @Override - public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack) { + public boolean isValidRepairItem(ItemStack itemToRepair, ItemStack stack) { return ItemUtil.areItemsEqual(this.repairItem, stack, false); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemToolAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemToolAA.java index 85baf40d7..e60ae35e7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemToolAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemToolAA.java @@ -51,7 +51,7 @@ public class ItemToolAA extends ToolItem implements IDisableableItem { } @Override - public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack) { + public boolean isValidRepairItem(ItemStack itemToRepair, ItemStack stack) { if (StackUtil.isValid(this.repairItem)) { return ItemUtil.areItemsEqual(this.repairItem, stack, false); } else if (this.repairOredict != null) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/ItemLens.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/ItemLens.java index 5a7b63f54..29a23e049 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/ItemLens.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/ItemLens.java @@ -20,7 +20,7 @@ public class ItemLens extends ItemBase implements ILensItem { private final Lens type; public ItemLens(Lens type) { - super(ActuallyItems.defaultProps().maxStackSize(1)); + super(ActuallyItems.defaultProps().stacksTo(1)); this.type = type; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensColor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensColor.java index e0ac37a0b..09a0bdd9a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensColor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensColor.java @@ -60,22 +60,22 @@ public class LensColor extends Lens { // int meta = block.getMetaFromState(state); ItemStack returnStack = this.tryConvert(new ItemStack(block), hitState, hitBlock, tile); if (returnStack != null && returnStack.getItem() instanceof BlockItem) { - Block toPlace = Block.getBlockFromItem(returnStack.getItem()); + Block toPlace = Block.byItem(returnStack.getItem()); BlockState state2Place = toPlace.getStateForPlacement(tile.getWorldObject(), hitBlock, Direction.UP, 0, 0, 0, returnStack.getMetadata(), FakePlayerFactory.getMinecraft((ServerWorld) tile.getWorldObject()), Hand.MAIN_HAND); - tile.getWorldObject().setBlockState(hitBlock, state2Place, 2); + tile.getWorldObject().setBlock(hitBlock, state2Place, 2); tile.extractEnergy(ENERGY_USE); } } - List items = tile.getWorldObject().getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), hitBlock.getX() + 1, hitBlock.getY() + 1, hitBlock.getZ() + 1)); + List items = tile.getWorldObject().getEntitiesOfClass(ItemEntity.class, new AxisAlignedBB(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), hitBlock.getX() + 1, hitBlock.getY() + 1, hitBlock.getZ() + 1)); for (ItemEntity item : items) { if (item.isAlive() && StackUtil.isValid(item.getItem()) && tile.getEnergy() >= ENERGY_USE) { ItemStack newStack = this.tryConvert(item.getItem(), hitState, hitBlock, tile); if (StackUtil.isValid(newStack)) { item.remove(); - ItemEntity newItem = new ItemEntity(tile.getWorldObject(), item.getPosX(), item.getPosY(), item.getPosZ(), newStack); - tile.getWorldObject().addEntity(newItem); + ItemEntity newItem = new ItemEntity(tile.getWorldObject(), item.getX(), item.getY(), item.getZ(), newStack); + tile.getWorldObject().addFreshEntity(newItem); tile.extractEnergy(ENERGY_USE); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDeath.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDeath.java index 9699dce7e..db18bec61 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDeath.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDeath.java @@ -24,7 +24,7 @@ public class LensDeath extends Lens { @Override public boolean invoke(BlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile) { - List entities = tile.getWorldObject().getEntitiesWithinAABB(LivingEntity.class, new AxisAlignedBB(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), hitBlock.getX() + 1, hitBlock.getY() + 1, hitBlock.getZ() + 1)); + List entities = tile.getWorldObject().getEntitiesOfClass(LivingEntity.class, new AxisAlignedBB(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), hitBlock.getX() + 1, hitBlock.getY() + 1, hitBlock.getZ() + 1)); for (LivingEntity entity : entities) { int use = this.getUsePerEntity(); if (tile.getEnergy() >= use) { @@ -38,7 +38,7 @@ public class LensDeath extends Lens { } protected void onAttacked(LivingEntity entity, IAtomicReconstructor tile) { - entity.attackEntityFrom(DamageSources.DAMAGE_ATOMIC_RECONSTRUCTOR, 20F); + entity.hurt(DamageSources.DAMAGE_ATOMIC_RECONSTRUCTOR, 20F); } protected int getUsePerEntity() { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDetonation.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDetonation.java index 2618cc7b0..628ac4b82 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDetonation.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDetonation.java @@ -25,7 +25,7 @@ public class LensDetonation extends Lens { public boolean invoke(BlockState state, BlockPos hitBlock, IAtomicReconstructor tile) { if (hitBlock != null && !state.getBlock().isAir(state, tile.getWorldObject(), hitBlock)) { if (tile.getEnergy() >= ENERGY_USE) { - tile.getWorldObject().createExplosion(null, hitBlock.getX() + 0.5, hitBlock.getY() + 0.5, hitBlock.getZ() + 0.5, 10F, true, Explosion.Mode.NONE); // TODO: [port][test] make sure this is the right explosion mode + tile.getWorldObject().explode(null, hitBlock.getX() + 0.5, hitBlock.getY() + 0.5, hitBlock.getZ() + 0.5, 10F, true, Explosion.Mode.NONE); // TODO: [port][test] make sure this is the right explosion mode tile.extractEnergy(ENERGY_USE); } return true; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDisenchanting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDisenchanting.java index 08de25c1d..610e8e644 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDisenchanting.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDisenchanting.java @@ -37,7 +37,7 @@ public class LensDisenchanting extends Lens { @Override public boolean invoke(BlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile) { if (tile.getEnergy() >= ENERGY_USE) { - List items = tile.getWorldObject().getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), hitBlock.getX() + 1, hitBlock.getY() + 1, hitBlock.getZ() + 1)); + List items = tile.getWorldObject().getEntitiesOfClass(ItemEntity.class, new AxisAlignedBB(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), hitBlock.getX() + 1, hitBlock.getY() + 1, hitBlock.getZ() + 1)); if (items != null && !items.isEmpty()) { ItemEntity book = null; ItemEntity toDisenchant = null; @@ -86,12 +86,12 @@ public class LensDisenchanting extends Lens { ItemUtil.removeEnchantment(newDisenchantStack, enchant); EnchantedBookItem.addEnchantment(newBookStack, new EnchantmentData(enchant, level)); - ItemEntity disenchanted = new ItemEntity(toDisenchant.getEntityWorld(), toDisenchant.getPosX(), toDisenchant.getPosY(), toDisenchant.getPosZ(), newDisenchantStack); - ItemEntity newBook = new ItemEntity(book.getEntityWorld(), book.getPosX(), book.getPosY(), book.getPosZ(), newBookStack); + ItemEntity disenchanted = new ItemEntity(toDisenchant.getCommandSenderWorld(), toDisenchant.getX(), toDisenchant.getY(), toDisenchant.getZ(), newDisenchantStack); + ItemEntity newBook = new ItemEntity(book.getCommandSenderWorld(), book.getX(), book.getY(), book.getZ(), newBookStack); toDisenchant.remove(); book.remove(); - tile.getWorldObject().addEntity(newBook); - tile.getWorldObject().addEntity(disenchanted); + tile.getWorldObject().addFreshEntity(newBook); + tile.getWorldObject().addFreshEntity(disenchanted); tile.extractEnergy(ENERGY_USE); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDisruption.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDisruption.java index 5e6ecf60e..7227bfe66 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDisruption.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDisruption.java @@ -37,7 +37,7 @@ public class LensDisruption extends Lens { public boolean invoke(BlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile) { if (ConfigIntValues.ELEVEN.getValue() == 11 && tile.getEnergy() >= ENERGY_USE && hitBlock != null && !hitState.getBlock().isAir(hitState, tile.getWorldObject(), hitBlock)) { int range = 2; - ArrayList items = (ArrayList) tile.getWorldObject().getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(hitBlock.getX() - range, hitBlock.getY() - range, hitBlock.getZ() - range, hitBlock.getX() + range, hitBlock.getY() + range, hitBlock.getZ() + range)); + ArrayList items = (ArrayList) tile.getWorldObject().getEntitiesOfClass(ItemEntity.class, new AxisAlignedBB(hitBlock.getX() - range, hitBlock.getY() - range, hitBlock.getZ() - range, hitBlock.getX() + range, hitBlock.getY() + range, hitBlock.getZ() + range)); for (ItemEntity item : items) { ItemStack stack = item.getItem(); if (item.isAlive() && StackUtil.isValid(stack)) { @@ -45,10 +45,10 @@ public class LensDisruption extends Lens { ItemStack newStack; do { - if (tile.getWorldObject().rand.nextBoolean()) { - newStack = this.getRandomItemFromRegistry(tile.getWorldObject().rand);//new ItemStack(Item.REGISTRY.getRandomObject(tile.getWorldObject().rand)); + if (tile.getWorldObject().random.nextBoolean()) { + newStack = this.getRandomItemFromRegistry(tile.getWorldObject().random);//new ItemStack(Item.REGISTRY.getRandomObject(tile.getWorldObject().rand)); } else { - newStack = this.getRandomBlockFromRegistry(tile.getWorldObject().rand);//new ItemStack(Block.REGISTRY.getRandomObject(tile.getWorldObject().rand)); + newStack = this.getRandomBlockFromRegistry(tile.getWorldObject().random);//new ItemStack(Block.REGISTRY.getRandomObject(tile.getWorldObject().rand)); } } while (!StackUtil.isValid(newStack)); @@ -57,8 +57,8 @@ public class LensDisruption extends Lens { item.remove(); - ItemEntity newItem = new ItemEntity(tile.getWorldObject(), item.getPosX(), item.getPosY(), item.getPosZ(), newStack); - tile.getWorldObject().addEntity(newItem); + ItemEntity newItem = new ItemEntity(tile.getWorldObject(), item.getX(), item.getY(), item.getZ(), newStack); + tile.getWorldObject().addFreshEntity(newItem); tile.extractEnergy(ENERGY_USE); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensKiller.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensKiller.java index e69a4c407..f763a94ef 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensKiller.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensKiller.java @@ -20,8 +20,8 @@ public class LensKiller extends LensDeath { @Override protected void onAttacked(LivingEntity entity, IAtomicReconstructor tile) { - if (!tile.getWorldObject().isRemote) { - entity.attackEntityFrom(DamageSource.causePlayerDamage(FakePlayerFactory.getMinecraft((ServerWorld) tile.getWorldObject())), 20); + if (!tile.getWorldObject().isClientSide) { + entity.hurt(DamageSource.playerAttack(FakePlayerFactory.getMinecraft((ServerWorld) tile.getWorldObject())), 20); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensMining.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensMining.java index 4375a2a9d..9ce83cfb7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensMining.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensMining.java @@ -119,7 +119,7 @@ public class LensMining extends Lens { @Override public boolean invoke(BlockState hitState, BlockPos hitPos, IAtomicReconstructor tile) { - if (!tile.getWorldObject().isAirBlock(hitPos)) { + if (!tile.getWorldObject().isEmptyBlock(hitPos)) { if (tile.getEnergy() >= ConfigIntValues.MINING_LENS_USE.getValue()) { int adaptedUse = ConfigIntValues.MINING_LENS_USE.getValue(); @@ -138,14 +138,14 @@ public class LensMining extends Lens { boolean found = false; while (!found) { - WeightedOre ore = WeightedRandom.getRandomItem(tile.getWorldObject().rand, ores, totalWeight); + WeightedOre ore = WeightedRandom.getRandomItem(tile.getWorldObject().random, ores, totalWeight); if (ore != null) { List stacks = OreDictionary.getOres(ore.name, false); if (stacks != null && !stacks.isEmpty()) { for (ItemStack aStack : stacks) { if (StackUtil.isValid(aStack) && !CrusherRecipeRegistry.hasBlacklistedOutput(aStack, ConfigStringListValues.MINING_LENS_BLACKLIST.getValue()) && aStack.getItem() instanceof ItemBlock) { if (ConfigBoolValues.MINING_LENS_ADAPTED_USE.isEnabled()) { - adaptedUse += (totalWeight - ore.itemWeight) % 40000; + adaptedUse += (totalWeight - ore.weight) % 40000; } stack = aStack; @@ -158,12 +158,12 @@ public class LensMining extends Lens { } if (tile.getEnergy() >= adaptedUse) { - Block block = Block.getBlockFromItem(stack.getItem()); + Block block = Block.byItem(stack.getItem()); if (block != Blocks.AIR) { BlockState state = block.getStateForPlacement(tile.getWorldObject(), hitPos, Direction.UP, 0, 0, 0, stack.getMetadata(), FakePlayerFactory.getMinecraft((WorldServer) tile.getWorldObject()), Hand.MAIN_HAND); - tile.getWorldObject().setBlockState(hitPos, state, 2); + tile.getWorldObject().setBlock(hitPos, state, 2); - tile.getWorldObject().playEvent(2001, hitPos, Block.getStateId(state)); + tile.getWorldObject().levelEvent(2001, hitPos, Block.getId(state)); tile.extractEnergy(adaptedUse); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/TheCrystals.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/TheCrystals.java index 7d9465470..c22858c96 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/TheCrystals.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/TheCrystals.java @@ -33,7 +33,7 @@ public enum TheCrystals implements IStringSerializable { } @Override - public String getString() { + public String getSerializedName() { return this.name; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/material/ArmorMaterials.java b/src/main/java/de/ellpeck/actuallyadditions/mod/material/ArmorMaterials.java index 1227080e7..e2211df6d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/material/ArmorMaterials.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/material/ArmorMaterials.java @@ -22,14 +22,14 @@ public enum ArmorMaterials implements IArmorMaterial { // EMERALD("emerald_armor_material", 30, new int[] { 5, 8, 9, 4 }, 15, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 2, 0f, () -> Ingredient.fromItems(Items.EMERALD)), // OBSIDIAN("obsidian_armor_material", 28, new int[] { 1, 3, 4, 3 }, 10, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 1, 0f, () -> Ingredient.fromItems(Items.OBSIDIAN)), - QUARTZ("quartz_armor_material", 15, new int[]{3, 5, 6, 3}, 8, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 1, 0f, () -> Ingredient.fromItems(ActuallyItems.BLACK_QUARTZ.get())), - RESTONIA("restonia_armor_material", 18, new int[]{3, 6, 7, 3}, 9, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 0, 0f, () -> Ingredient.fromItems(ActuallyItems.RESTONIA_CRYSTAL.get())), - PALIS("palis_armor_material", 10, new int[]{3, 6, 7, 3}, 10, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 0, 0f, () -> Ingredient.fromItems(ActuallyItems.PALIS_CRYSTAL.get())), - DIAMATINE("diamatine_armor_material", 36, new int[]{4, 7, 8, 4}, 12, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 3, 0f, () -> Ingredient.fromItems(ActuallyItems.DIAMATINE_CRYSTAL.get())), - VOID("void_armor_material", 23, new int[]{1, 3, 4, 1}, 13, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 0, 0f, () -> Ingredient.fromItems(ActuallyItems.VOID_CRYSTAL.get())), - EMERADIC("emeradic_armor_material", 32, new int[]{6, 9, 9, 4}, 18, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 3, 0f, () -> Ingredient.fromItems(ActuallyItems.EMERADIC_CRYSTAL.get())), - ENORI("enori_armor_material", 24, new int[]{3, 6, 6, 3}, 11, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 0, 0f, () -> Ingredient.fromItems(ActuallyItems.ENORI_CRYSTAL.get())), - GOGGLES("goggles_armor_material", 0, new int[]{0, 0, 0, 0}, 0, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 0, 0f, () -> Ingredient.EMPTY); + QUARTZ("quartz_armor_material", 15, new int[]{3, 5, 6, 3}, 8, SoundEvents.ARMOR_EQUIP_GENERIC, 1, 0f, () -> Ingredient.of(ActuallyItems.BLACK_QUARTZ.get())), + RESTONIA("restonia_armor_material", 18, new int[]{3, 6, 7, 3}, 9, SoundEvents.ARMOR_EQUIP_GENERIC, 0, 0f, () -> Ingredient.of(ActuallyItems.RESTONIA_CRYSTAL.get())), + PALIS("palis_armor_material", 10, new int[]{3, 6, 7, 3}, 10, SoundEvents.ARMOR_EQUIP_GENERIC, 0, 0f, () -> Ingredient.of(ActuallyItems.PALIS_CRYSTAL.get())), + DIAMATINE("diamatine_armor_material", 36, new int[]{4, 7, 8, 4}, 12, SoundEvents.ARMOR_EQUIP_GENERIC, 3, 0f, () -> Ingredient.of(ActuallyItems.DIAMATINE_CRYSTAL.get())), + VOID("void_armor_material", 23, new int[]{1, 3, 4, 1}, 13, SoundEvents.ARMOR_EQUIP_GENERIC, 0, 0f, () -> Ingredient.of(ActuallyItems.VOID_CRYSTAL.get())), + EMERADIC("emeradic_armor_material", 32, new int[]{6, 9, 9, 4}, 18, SoundEvents.ARMOR_EQUIP_GENERIC, 3, 0f, () -> Ingredient.of(ActuallyItems.EMERADIC_CRYSTAL.get())), + ENORI("enori_armor_material", 24, new int[]{3, 6, 6, 3}, 11, SoundEvents.ARMOR_EQUIP_GENERIC, 0, 0f, () -> Ingredient.of(ActuallyItems.ENORI_CRYSTAL.get())), + GOGGLES("goggles_armor_material", 0, new int[]{0, 0, 0, 0}, 0, SoundEvents.ARMOR_EQUIP_GENERIC, 0, 0f, () -> Ingredient.EMPTY); // HMMM Tasty stolen code from MC, how lovely. private static final int[] MAX_DAMAGE_ARRAY = new int[]{13, 15, 16, 11}; @@ -54,28 +54,28 @@ public enum ArmorMaterials implements IArmorMaterial { } @Override - public int getDurability(EquipmentSlotType slotIn) { + public int getDurabilityForSlot(EquipmentSlotType slotIn) { return MAX_DAMAGE_ARRAY[slotIn.getIndex()] * this.maxDamageFactor; } @Override - public int getDamageReductionAmount(EquipmentSlotType slotIn) { + public int getDefenseForSlot(EquipmentSlotType slotIn) { return this.damageReductionAmountArray[slotIn.getIndex()]; } @Override - public int getEnchantability() { + public int getEnchantmentValue() { return this.enchantability; } @Override - public SoundEvent getSoundEvent() { + public SoundEvent getEquipSound() { return this.soundEvent; } @Override - public Ingredient getRepairMaterial() { - return this.repairMaterial.getValue(); + public Ingredient getRepairIngredient() { + return this.repairMaterial.get(); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/material/ToolMaterials.java b/src/main/java/de/ellpeck/actuallyadditions/mod/material/ToolMaterials.java index 835a94ae5..8a4882e73 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/material/ToolMaterials.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/material/ToolMaterials.java @@ -13,13 +13,13 @@ import java.util.function.Supplier; * todo: review to ensure all values act as intended */ public enum ToolMaterials implements IItemTier { - QUARTZ(2, 280, 6.5f, 2.0f, 10, () -> Ingredient.fromItems(ActuallyItems.BLACK_QUARTZ.get())), - RESTONIA(2, 300, 7.0f, 2.25f, 12, () -> Ingredient.fromItems(ActuallyItems.RESTONIA_CRYSTAL.get())), - PALIS(2, 300, 7.0f, 2.25f, 12, () -> Ingredient.fromItems(ActuallyItems.PALIS_CRYSTAL.get())), - DIAMATINE(3, 1600, 9.0f, 4.0f, 14, () -> Ingredient.fromItems(ActuallyItems.DIAMATINE_CRYSTAL.get())), - VOID(2, 280, 6.0f, 2.0f, 8, () -> Ingredient.fromItems(ActuallyItems.VOID_CRYSTAL.get())), - EMERADIC(4, 2200, 9.5f, 5.55f, 18, () -> Ingredient.fromItems(ActuallyItems.EMERADIC_CRYSTAL.get())), - ENORI(2, 280, 6.25f, 6.25f, 15, () -> Ingredient.fromItems(ActuallyItems.ENORI_CRYSTAL.get())); + QUARTZ(2, 280, 6.5f, 2.0f, 10, () -> Ingredient.of(ActuallyItems.BLACK_QUARTZ.get())), + RESTONIA(2, 300, 7.0f, 2.25f, 12, () -> Ingredient.of(ActuallyItems.RESTONIA_CRYSTAL.get())), + PALIS(2, 300, 7.0f, 2.25f, 12, () -> Ingredient.of(ActuallyItems.PALIS_CRYSTAL.get())), + DIAMATINE(3, 1600, 9.0f, 4.0f, 14, () -> Ingredient.of(ActuallyItems.DIAMATINE_CRYSTAL.get())), + VOID(2, 280, 6.0f, 2.0f, 8, () -> Ingredient.of(ActuallyItems.VOID_CRYSTAL.get())), + EMERADIC(4, 2200, 9.5f, 5.55f, 18, () -> Ingredient.of(ActuallyItems.EMERADIC_CRYSTAL.get())), + ENORI(2, 280, 6.25f, 6.25f, 15, () -> Ingredient.of(ActuallyItems.ENORI_CRYSTAL.get())); private final int harvestLevel; private final int maxUses; @@ -38,32 +38,32 @@ public enum ToolMaterials implements IItemTier { } @Override - public int getMaxUses() { + public int getUses() { return this.maxUses; } @Override - public float getEfficiency() { + public float getSpeed() { return this.efficiency; } @Override - public float getAttackDamage() { + public float getAttackDamageBonus() { return this.attackDamage; } @Override - public int getHarvestLevel() { + public int getLevel() { return this.harvestLevel; } @Override - public int getEnchantability() { + public int getEnchantmentValue() { return this.enchantability; } @Override - public Ingredient getRepairMaterial() { - return this.repairMaterial.getValue(); + public Ingredient getRepairIngredient() { + return this.repairMaterial.get(); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DamageSources.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DamageSources.java index c2024ff85..e9a815d81 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DamageSources.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DamageSources.java @@ -18,7 +18,7 @@ import net.minecraft.util.text.TranslationTextComponent; public class DamageSources extends DamageSource { - public static final DamageSource DAMAGE_ATOMIC_RECONSTRUCTOR = new DamageSources("atomicReconstructor", 5).setDamageBypassesArmor(); + public static final DamageSource DAMAGE_ATOMIC_RECONSTRUCTOR = new DamageSources("atomicReconstructor", 5).bypassArmor(); private final int messageCount; @@ -28,8 +28,8 @@ public class DamageSources extends DamageSource { } @Override - public ITextComponent getDeathMessage(LivingEntity entity) { - String locTag = "death." + ActuallyAdditions.MODID + "." + this.damageType + "." + (entity.world.rand.nextInt(this.messageCount) + 1); + public ITextComponent getLocalizedDeathMessage(LivingEntity entity) { + String locTag = "death." + ActuallyAdditions.MODID + "." + this.msgId + "." + (entity.level.random.nextInt(this.messageCount) + 1); return new TranslationTextComponent(locTag, entity.getName()); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DispenserHandlerFertilize.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DispenserHandlerFertilize.java index 8fbdfb4ae..835865981 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DispenserHandlerFertilize.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DispenserHandlerFertilize.java @@ -22,12 +22,12 @@ import net.minecraft.util.math.BlockPos; public class DispenserHandlerFertilize extends DefaultDispenseItemBehavior { @Override - public ItemStack dispenseStack(IBlockSource source, ItemStack stack) { - Direction facing = source.getBlockState().get(BlockStateProperties.FACING); - BlockPos pos = source.getBlockPos().offset(facing); + public ItemStack execute(IBlockSource source, ItemStack stack) { + Direction facing = source.getBlockState().getValue(BlockStateProperties.FACING); + BlockPos pos = source.getPos().relative(facing); - if (BoneMealItem.applyBonemeal(stack, source.getWorld(), pos)) { - source.getWorld().playEvent(2005, pos, 0); + if (BoneMealItem.growCrop(stack, source.getLevel(), pos)) { + source.getLevel().levelEvent(2005, pos, 0); } return stack; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/LaserRelayConnectionHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/LaserRelayConnectionHandler.java index f73c3f607..5be23870c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/LaserRelayConnectionHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/LaserRelayConnectionHandler.java @@ -60,7 +60,7 @@ public final class LaserRelayConnectionHandler implements ILaserRelayConnectionH WorldData data = WorldData.get(world); secondNetwork.changeAmount++; data.laserRelayNetworks.remove(secondNetwork); - data.markDirty(); + data.setDirty(); //System.out.println("Merged Two Networks!"); } @@ -92,7 +92,7 @@ public final class LaserRelayConnectionHandler implements ILaserRelayConnectionH //Setup new network (so that splitting a network will cause it to break into two) WorldData data = WorldData.get(world); data.laserRelayNetworks.remove(network); - data.markDirty(); + data.setDirty(); for (IConnectionPair pair : network.connections) { if (!pair.contains(relay)) { this.addConnection(pair.getPositions()[0], pair.getPositions()[1], pair.getType(), world, pair.doesSuppressRender()); @@ -178,7 +178,7 @@ public final class LaserRelayConnectionHandler implements ILaserRelayConnectionH //System.out.println("Connected "+firstRelay.toString()+" to "+secondRelay.toString()); //System.out.println(firstNetwork == null ? secondNetwork.toString() : firstNetwork.toString()); //System.out.println(laserRelayNetworks); - data.markDirty(); + data.setDirty(); return true; } @@ -192,7 +192,7 @@ public final class LaserRelayConnectionHandler implements ILaserRelayConnectionH WorldData data = WorldData.get(world); data.laserRelayNetworks.remove(network); - data.markDirty(); + data.setDirty(); for (IConnectionPair pair : network.connections) { if (!pair.contains(firstRelay) || !pair.contains(secondRelay)) { @@ -214,7 +214,7 @@ public final class LaserRelayConnectionHandler implements ILaserRelayConnectionH @Override public LaserType getTypeFromLaser(BlockPos pos, World world) { - return this.getTypeFromLaser(world.getTileEntity(pos)); + return this.getTypeFromLaser(world.getBlockEntity(pos)); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/MethodHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/MethodHandler.java index 303b3b692..160fd97a7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/MethodHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/MethodHandler.java @@ -81,7 +81,7 @@ public class MethodHandler implements IMethodHandler { EffectInstance[] effectsStack = this.getEffectsFromStack(stack); if (effectsStack != null && effectsStack.length > 0) { for (EffectInstance effectStack : effectsStack) { - if (effect.getPotion() == effectStack.getPotion()) { + if (effect.getEffect() == effectStack.getEffect()) { return effectStack; } } @@ -94,8 +94,8 @@ public class MethodHandler implements IMethodHandler { EffectInstance[] effects = this.getEffectsFromStack(stack); stack.setTag(new CompoundNBT()); for (int i = 0; i < effects.length; i++) { - if (effects[i].getPotion() == effect.getPotion()) { - effects[i] = new EffectInstance(effects[i].getPotion(), effects[i].getDuration() + (addDur + if (effects[i].getEffect() == effect.getEffect()) { + effects[i] = new EffectInstance(effects[i].getEffect(), effects[i].getDuration() + (addDur ? effect.getDuration() : 0), effects[i].getAmplifier() + (addAmp ? effect.getAmplifier() > 0 @@ -113,7 +113,7 @@ public class MethodHandler implements IMethodHandler { int prevCounter = tag.putInt("Counter"); CompoundNBT compound = new CompoundNBT(); - compound.putInt("ID", Potion.getIdFromPotion(effect.getPotion())); + compound.putInt("ID", Potion.getIdFromPotion(effect.getEffect())); compound.putInt("Duration", effect.getDuration()); compound.putInt("Amplifier", effect.getAmplifier()); @@ -167,7 +167,7 @@ public class MethodHandler implements IMethodHandler { for (int reachZ = -rangeZ; reachZ <= rangeZ; reachZ++) { for (int reachY = -rangeY; reachY <= rangeY; reachY++) { BlockPos pos = new BlockPos(hitBlock.getX() + reachX, hitBlock.getY() + reachY, hitBlock.getZ() + reachZ); - if (!tile.getWorldObject().isAirBlock(pos)) { + if (!tile.getWorldObject().isEmptyBlock(pos)) { BlockState state = tile.getWorldObject().getBlockState(pos); if (state.getBlock() instanceof BlockLaserRelay) { continue; @@ -176,16 +176,16 @@ public class MethodHandler implements IMethodHandler { if (recipe != null && tile.getEnergy() >= recipe.getEnergyUsed()) { ItemStack output = recipe.getOutput(); if (StackUtil.isValid(output)) { - tile.getWorldObject().playEvent(2001, pos, Block.getStateId(state)); + tile.getWorldObject().levelEvent(2001, pos, Block.getId(state)); recipe.transformHook(ItemStack.EMPTY, state, pos, tile); if (output.getItem() instanceof ItemBlock) { - Block toPlace = Block.getBlockFromItem(output.getItem()); + Block toPlace = Block.byItem(output.getItem()); BlockState state2Place = toPlace.getStateForPlacement(tile.getWorldObject(), pos, facing, 0, 0, 0, output.getMetadata(), FakePlayerFactory.getMinecraft((WorldServer) tile.getWorldObject()), Hand.MAIN_HAND); - tile.getWorldObject().setBlockState(pos, state2Place, 2); + tile.getWorldObject().setBlock(pos, state2Place, 2); } else { ItemEntity item = new ItemEntity(tile.getWorldObject(), pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, output.copy()); - tile.getWorldObject().addEntity(item); - tile.getWorldObject().setBlockState(pos, Blocks.AIR.getDefaultState()); + tile.getWorldObject().addFreshEntity(item); + tile.getWorldObject().setBlockAndUpdate(pos, Blocks.AIR.defaultBlockState()); } tile.extractEnergy(recipe.getEnergyUsed()); @@ -199,9 +199,9 @@ public class MethodHandler implements IMethodHandler { //Converting the Items AxisAlignedBB aabb = new AxisAlignedBB(tile.getPosition().getX(), tile.getPosition().getY(), tile.getPosition().getZ(), hitBlock.getX() + 1, hitBlock.getY() + 1, hitBlock.getZ() + 1); - Vector3i dir = tile.getOrientation().getDirectionVec(); - aabb = aabb.grow(0.02, 0.02, 0.02).expand(dir.getX(), dir.getY(), dir.getZ()); - List items = tile.getWorldObject().getEntitiesWithinAABB(ItemEntity.class, aabb); + Vector3i dir = tile.getOrientation().getNormal(); + aabb = aabb.inflate(0.02, 0.02, 0.02).expandTowards(dir.getX(), dir.getY(), dir.getZ()); + List items = tile.getWorldObject().getEntitiesOfClass(ItemEntity.class, aabb); for (ItemEntity item : items) { ItemStack stack = item.getItem(); if (item.isAlive() && StackUtil.isValid(stack) && !item.getEntityData().getBoolean("aa_cnv")) { @@ -210,23 +210,23 @@ public class MethodHandler implements IMethodHandler { int itemsPossible = Math.min(tile.getEnergy() / recipe.getEnergyUsed(), stack.getCount()); if (itemsPossible > 0) { - recipe.transformHook(item.getItem(), null, item.getPosition(), tile); + recipe.transformHook(item.getItem(), null, item.blockPosition(), tile); item.remove(); if (stack.getCount() - itemsPossible > 0) { ItemStack stackCopy = stack.copy(); stackCopy.shrink(itemsPossible); - ItemEntity inputLeft = new ItemEntity(tile.getWorldObject(), item.getPosX(), item.getPosY(), item.getPosZ(), stackCopy); - tile.getWorldObject().addEntity(inputLeft); + ItemEntity inputLeft = new ItemEntity(tile.getWorldObject(), item.getX(), item.getY(), item.getZ(), stackCopy); + tile.getWorldObject().addFreshEntity(inputLeft); } ItemStack outputCopy = recipe.getOutput().copy(); outputCopy.setCount(itemsPossible); - ItemEntity newItem = new ItemEntity(tile.getWorldObject(), item.getPosX(), item.getPosY(), item.getPosZ(), outputCopy); + ItemEntity newItem = new ItemEntity(tile.getWorldObject(), item.getX(), item.getY(), item.getZ(), outputCopy); newItem.getEntityData().putBoolean("aa_cnv", true); - tile.getWorldObject().addEntity(newItem); + tile.getWorldObject().addFreshEntity(newItem); tile.extractEnergy(recipe.getEnergyUsed() * itemsPossible); break; @@ -249,7 +249,7 @@ public class MethodHandler implements IMethodHandler { int distance = currentLens.getDistance(); for (int i = 0; i < distance; i++) { - BlockPos hitBlock = tile.getPosition().offset(sideToManipulate, i + 1); + BlockPos hitBlock = tile.getPosition().relative(sideToManipulate, i + 1); if (currentLens.invoke(tile.getWorldObject().getBlockState(hitBlock), hitBlock, tile) || i >= distance - 1) { TileEntityAtomicReconstructor.shootLaser(tile.getWorldObject(), tile.getX(), tile.getY(), tile.getZ(), hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), currentLens); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/CactusFarmerBehavior.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/CactusFarmerBehavior.java index d70e3e1e7..0c18815de 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/CactusFarmerBehavior.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/CactusFarmerBehavior.java @@ -31,12 +31,12 @@ public class CactusFarmerBehavior implements IFarmerBehavior { if (farmer.getEnergy() >= use) { Item item = seed.getItem(); if (item instanceof BlockItem) { - Block block = Block.getBlockFromItem(item); + Block block = Block.byItem(item); if (block == Blocks.CACTUS) { - if (block.getDefaultState().isValidPosition(world, pos)) { - BlockState state = block.getDefaultState(); - world.setBlockState(pos, state, 2); - world.playEvent(2001, pos, Block.getStateId(state)); + if (block.defaultBlockState().canSurvive(world, pos)) { + BlockState state = block.defaultBlockState(); + world.setBlock(pos, state, 2); + world.levelEvent(2001, pos, Block.getId(state)); farmer.extractEnergy(use); return FarmerResult.SUCCESS; @@ -58,7 +58,7 @@ public class CactusFarmerBehavior implements IFarmerBehavior { for (int i = 2; i >= 1; i--) { if (farmer.getEnergy() >= use) { - BlockPos up = pos.up(i); + BlockPos up = pos.above(i); BlockState upState = world.getBlockState(up); if (upState.getBlock() == Blocks.CACTUS) { NonNullList drops = NonNullList.create(); @@ -66,8 +66,8 @@ public class CactusFarmerBehavior implements IFarmerBehavior { if (!drops.isEmpty()) { if (farmer.canAddToOutput(drops)) { - world.playEvent(2001, up, Block.getStateId(upState)); - world.setBlockState(up, Blocks.AIR.getDefaultState()); + world.levelEvent(2001, up, Block.getId(upState)); + world.setBlockAndUpdate(up, Blocks.AIR.defaultBlockState()); farmer.extractEnergy(use); farmer.addToOutput(drops); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/DefaultFarmerBehavior.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/DefaultFarmerBehavior.java index b15e6ff51..217a13fd8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/DefaultFarmerBehavior.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/DefaultFarmerBehavior.java @@ -35,12 +35,12 @@ public class DefaultFarmerBehavior implements IFarmerBehavior { public static boolean defaultPlant(World world, BlockPos pos, BlockState toPlant, IFarmer farmer, int use) { if (toPlant != null) { - BlockPos farmland = pos.down(); + BlockPos farmland = pos.below(); Block farmlandBlock = world.getBlockState(farmland).getBlock(); if (Tags.Blocks.DIRT.contains(farmlandBlock) || farmlandBlock == Blocks.GRASS) { - world.setBlockState(pos, Blocks.AIR.getDefaultState()); + world.setBlockAndUpdate(pos, Blocks.AIR.defaultBlockState()); useHoeAt(world, farmland); - world.playSound(null, farmland, SoundEvents.ITEM_HOE_TILL, SoundCategory.BLOCKS, 1.0F, 1.0F); + world.playSound(null, farmland, SoundEvents.HOE_TILL, SoundCategory.BLOCKS, 1.0F, 1.0F); farmer.extractEnergy(use); } @@ -53,8 +53,8 @@ public class DefaultFarmerBehavior implements IFarmerBehavior { } private static boolean tryPlant(BlockState toPlant, World world, BlockPos pos) { - if (toPlant.isValidPosition(world, pos)) { - world.setBlockState(pos, toPlant); + if (toPlant.canSurvive(world, pos)) { + world.setBlockAndUpdate(pos, toPlant); return true; } return false; @@ -119,8 +119,8 @@ public class DefaultFarmerBehavior implements IFarmerBehavior { farmer.addToSeeds(seeds); } - world.playEvent(2001, pos, Block.getStateId(state)); - world.setBlockState(pos, Blocks.AIR.getDefaultState()); + world.levelEvent(2001, pos, Block.getId(state)); + world.setBlockAndUpdate(pos, Blocks.AIR.defaultBlockState()); farmer.extractEnergy(250); return FarmerResult.SUCCESS; @@ -151,7 +151,7 @@ public class DefaultFarmerBehavior implements IFarmerBehavior { if (item instanceof IPlantable) { return (IPlantable) item; } else if (item instanceof BlockItem) { - Block block = Block.getBlockFromItem(item); + Block block = Block.byItem(item); if (block instanceof IPlantable) { return (IPlantable) block; } @@ -174,7 +174,7 @@ public class DefaultFarmerBehavior implements IFarmerBehavior { ItemStack itemstack = getHoeStack(); - if (!player.canPlayerEdit(pos.offset(Direction.UP), Direction.UP, itemstack)) { + if (!player.mayUseItemAt(pos.relative(Direction.UP), Direction.UP, itemstack)) { return ActionResultType.FAIL; } else { int hook = net.minecraftforge.event.ForgeEventFactory.onHoeUse(itemstack, player, world, pos); @@ -187,19 +187,19 @@ public class DefaultFarmerBehavior implements IFarmerBehavior { BlockState iblockstate = world.getBlockState(pos); Block block = iblockstate.getBlock(); - if (world.isAirBlock(pos.up())) { + if (world.isEmptyBlock(pos.above())) { if (block == Blocks.GRASS || block == Blocks.GRASS_PATH) { - world.setBlockState(pos, Blocks.FARMLAND.getDefaultState()); + world.setBlockAndUpdate(pos, Blocks.FARMLAND.defaultBlockState()); return ActionResultType.SUCCESS; } if (block == Blocks.DIRT) { - switch (iblockstate.get(BlockDirt.VARIANT)) { + switch (iblockstate.getValue(BlockDirt.VARIANT)) { case DIRT: - world.setBlockState(pos, Blocks.FARMLAND.getDefaultState()); + world.setBlockAndUpdate(pos, Blocks.FARMLAND.defaultBlockState()); return ActionResultType.SUCCESS; case COARSE_DIRT: - world.setBlockState(pos, Blocks.DIRT.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT)); + world.setBlockAndUpdate(pos, Blocks.DIRT.defaultBlockState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT)); return ActionResultType.SUCCESS; default: } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/MelonPumpkinFarmerBehavior.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/MelonPumpkinFarmerBehavior.java index 6b9fed690..50e3a91e2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/MelonPumpkinFarmerBehavior.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/MelonPumpkinFarmerBehavior.java @@ -37,7 +37,7 @@ public class MelonPumpkinFarmerBehavior implements IFarmerBehavior { if (pos.getX() % 2 == 0 == (pos.getZ() % 2 == 0)) { BlockState toPlant = (isPumpkin ? Blocks.PUMPKIN_STEM - : Blocks.MELON_STEM).getDefaultState(); + : Blocks.MELON_STEM).defaultBlockState(); if (DefaultFarmerBehavior.defaultPlant(world, pos, toPlant, farmer, use)) { return FarmerResult.SUCCESS; } @@ -61,8 +61,8 @@ public class MelonPumpkinFarmerBehavior implements IFarmerBehavior { block.getDrops(drops, world, pos, state, 0); if (!drops.isEmpty()) { if (farmer.canAddToOutput(drops)) { - world.playEvent(2001, pos, Block.getStateId(state)); - world.setBlockState(pos, Blocks.AIR.getDefaultState()); + world.levelEvent(2001, pos, Block.getId(state)); + world.setBlockAndUpdate(pos, Blocks.AIR.defaultBlockState()); farmer.extractEnergy(use); farmer.addToOutput(drops); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/NetherWartFarmerBehavior.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/NetherWartFarmerBehavior.java index 8cea77dc7..3a8e74ce4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/NetherWartFarmerBehavior.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/NetherWartFarmerBehavior.java @@ -33,8 +33,8 @@ public class NetherWartFarmerBehavior implements IFarmerBehavior { int use = 500; if (farmer.getEnergy() >= use) { if (seed.getItem() == Items.NETHER_WART) { - if (world.getBlockState(pos.down()).getBlock().canSustainPlant(world.getBlockState(pos.down()), world, pos.down(), Direction.UP, (IPlantable) Items.NETHER_WART)) { - world.setBlockState(pos, Blocks.NETHER_WART.getDefaultState(), 2); + if (world.getBlockState(pos.below()).getBlock().canSustainPlant(world.getBlockState(pos.below()), world, pos.below(), Direction.UP, (IPlantable) Items.NETHER_WART)) { + world.setBlock(pos, Blocks.NETHER_WART.defaultBlockState(), 2); farmer.extractEnergy(use); return FarmerResult.SUCCESS; } @@ -50,14 +50,14 @@ public class NetherWartFarmerBehavior implements IFarmerBehavior { if (farmer.getEnergy() >= use) { BlockState state = world.getBlockState(pos); if (state.getBlock() instanceof NetherWartBlock) { - if (state.get(BlockStateProperties.AGE_0_3) >= 3) { + if (state.getValue(BlockStateProperties.AGE_3) >= 3) { NonNullList drops = NonNullList.create(); state.getBlock().getDrops(drops, world, pos, state, 0); if (!drops.isEmpty()) { boolean toInput = farmer.canAddToSeeds(drops); if (toInput || farmer.canAddToOutput(drops)) { - world.playEvent(2001, pos, Block.getStateId(state)); - world.setBlockState(pos, Blocks.AIR.getDefaultState()); + world.levelEvent(2001, pos, Block.getId(state)); + world.setBlockAndUpdate(pos, Blocks.AIR.defaultBlockState()); if (toInput) { farmer.addToSeeds(drops); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/ReedFarmerBehavior.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/ReedFarmerBehavior.java index f0413337e..f57dc80a7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/ReedFarmerBehavior.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/ReedFarmerBehavior.java @@ -30,8 +30,8 @@ public class ReedFarmerBehavior implements IFarmerBehavior { int use = 250; if (farmer.getEnergy() >= use) { if (seed.getItem() == Items.SUGAR_CANE) { - if (Blocks.SUGAR_CANE.getDefaultState().isValidPosition(world, pos)) { - world.setBlockState(pos, Blocks.SUGAR_CANE.getDefaultState(), 2); + if (Blocks.SUGAR_CANE.defaultBlockState().canSurvive(world, pos)) { + world.setBlock(pos, Blocks.SUGAR_CANE.defaultBlockState(), 2); farmer.extractEnergy(use); return FarmerResult.SUCCESS; } @@ -51,7 +51,7 @@ public class ReedFarmerBehavior implements IFarmerBehavior { for (int i = 2; i >= 1; --i) { if (farmer.getEnergy() >= use) { - BlockPos up = pos.up(i); + BlockPos up = pos.above(i); BlockState upState = world.getBlockState(up); if (upState.getBlock() instanceof SugarCaneBlock) { NonNullList drops = NonNullList.create(); @@ -59,8 +59,8 @@ public class ReedFarmerBehavior implements IFarmerBehavior { if (!drops.isEmpty()) { if (farmer.canAddToOutput(drops)) { - world.playEvent(2001, up, Block.getStateId(upState)); - world.setBlockState(up, Blocks.AIR.getDefaultState()); + world.levelEvent(2001, up, Block.getId(upState)); + world.setBlockAndUpdate(up, Blocks.AIR.defaultBlockState()); farmer.extractEnergy(use); farmer.addToOutput(drops); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/RenderSpecial.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/RenderSpecial.java index c12d30bd2..32222e9f6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/RenderSpecial.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/RenderSpecial.java @@ -33,58 +33,58 @@ public class RenderSpecial { } public void render(MatrixStack matrices, IRenderTypeBuffer buffer, int combinedLight, PlayerEntity player, float partialTicks) { - if (player.isInvisible() || !player.isWearing(PlayerModelPart.CAPE) || player.isElytraFlying()) { + if (player.isInvisible() || !player.isModelPartShown(PlayerModelPart.CAPE) || player.isFallFlying()) { return; } - GlStateManager.pushMatrix(); + GlStateManager._pushMatrix(); Vector3d currentPos = Minecraft.getInstance().player.getEyePosition(partialTicks); Vector3d playerPos = player.getEyePosition(partialTicks); - GlStateManager.translated(playerPos.x - currentPos.x, playerPos.y - currentPos.y, playerPos.z - currentPos.z); - GlStateManager.translated(0D, 2.575D - (player.isSneaking() + GlStateManager._translated(playerPos.x - currentPos.x, playerPos.y - currentPos.y, playerPos.z - currentPos.z); + GlStateManager._translated(0D, 2.575D - (player.isShiftKeyDown() ? 0.125D : 0D), 0D); this.render(matrices, buffer, combinedLight); - GlStateManager.popMatrix(); + GlStateManager._popMatrix(); } public void render(MatrixStack matrices, IRenderTypeBuffer buffer, int combinedLight) { if (StackUtil.isValid(this.theThingToRender)) { boolean isBlock = this.theThingToRender.getItem() instanceof BlockItem; - GlStateManager.pushMatrix(); + GlStateManager._pushMatrix(); if (isBlock) { - GlStateManager.translated(0D, -0.1875D, 0D); + GlStateManager._translated(0D, -0.1875D, 0D); } - GlStateManager.rotatef(180F, 1.0F, 0.0F, 1.0F); + GlStateManager._rotatef(180F, 1.0F, 0.0F, 1.0F); float size = isBlock ? 0.5F : 0.4F; - GlStateManager.scalef(size, size, size); + GlStateManager._scalef(size, size, size); //Make the floaty stuff look nice using sine waves \o/ -xdjackiexd //Peck edit: What do you mean by "nice" you jackass? >_> - double boop = Util.milliTime() / 1000D; - GlStateManager.translated(0D, Math.sin(boop % (2 * Math.PI)) * 0.25, 0D); - GlStateManager.rotatef((float) (boop * 40D % 360), 0, 1, 0); + double boop = Util.getMillis() / 1000D; + GlStateManager._translated(0D, Math.sin(boop % (2 * Math.PI)) * 0.25, 0D); + GlStateManager._rotatef((float) (boop * 40D % 360), 0, 1, 0); - GlStateManager.disableLighting(); - GlStateManager.pushMatrix(); + GlStateManager._disableLighting(); + GlStateManager._pushMatrix(); if (!isBlock) { - GlStateManager.translated(0D, 0.5D, 0D); + GlStateManager._translated(0D, 0.5D, 0D); } - GlStateManager.rotatef(180F, 1F, 0F, 0F); + GlStateManager._rotatef(180F, 1F, 0F, 0F); AssetUtil.renderItemInWorld(this.theThingToRender, combinedLight, OverlayTexture.NO_OVERLAY, matrices, buffer); - GlStateManager.popMatrix(); + GlStateManager._popMatrix(); - GlStateManager.enableLighting(); + GlStateManager._enableLighting(); - GlStateManager.popMatrix(); + GlStateManager._popMatrix(); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketClientToServer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketClientToServer.java index 1320a375d..7e2a00dc3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketClientToServer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketClientToServer.java @@ -37,7 +37,7 @@ public class PacketClientToServer { public void fromBytes(ByteBuf buf) { PacketBuffer buffer = new PacketBuffer(buf); try { - this.data = buffer.readCompoundTag(); + this.data = buffer.readNbt(); int handlerId = buffer.readInt(); if (handlerId >= 0 && handlerId < PacketHandler.DATA_HANDLERS.size()) { @@ -52,7 +52,7 @@ public class PacketClientToServer { public void toBytes(ByteBuf buf) { PacketBuffer buffer = new PacketBuffer(buf); - buffer.writeCompoundTag(this.data); + buffer.writeNbt(this.data); buffer.writeInt(PacketHandler.DATA_HANDLERS.indexOf(this.handler)); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketHandler.java index 6cb6cf61e..a1bf47d05 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketHandler.java @@ -56,9 +56,9 @@ public final class PacketHandler { @Override @OnlyIn(Dist.CLIENT) public void handleData(CompoundNBT compound, MessageContext context) { - World world = Minecraft.getInstance().world; + World world = Minecraft.getInstance().level; if (world != null) { - TileEntity tile = world.getTileEntity(new BlockPos(compound.getInt("X"), compound.getInt("Y"), compound.getInt("Z"))); + TileEntity tile = world.getBlockEntity(new BlockPos(compound.getInt("X"), compound.getInt("Y"), compound.getInt("Z"))); if (tile instanceof TileEntityBase) { ((TileEntityBase) tile).readSyncableNBT(compound.getCompoundTag("Data"), TileEntityBase.NBTType.SYNC); } @@ -80,17 +80,17 @@ public final class PacketHandler { double outY = compound.getDouble("OutY") + 0.525; double outZ = compound.getDouble("OutZ") + 0.5; - Particle fx = new ParticleLaserItem(mc.world, outX, outY, outZ, stack, 0.025, inX, inY, inZ); + Particle fx = new ParticleLaserItem(mc.level, outX, outY, outZ, stack, 0.025, inX, inY, inZ); mc.effectRenderer.addEffect(fx); } }; public static final IDataHandler GUI_BUTTON_TO_TILE_HANDLER = (compound, context) -> { World world = DimensionManager.getWorld(compound.getInt("WorldID")); - TileEntity tile = world.getTileEntity(new BlockPos(compound.getInt("X"), compound.getInt("Y"), compound.getInt("Z"))); + TileEntity tile = world.getBlockEntity(new BlockPos(compound.getInt("X"), compound.getInt("Y"), compound.getInt("Z"))); if (tile instanceof IButtonReactor) { IButtonReactor reactor = (IButtonReactor) tile; - Entity entity = world.getEntityByID(compound.getInt("PlayerID")); + Entity entity = world.getEntity(compound.getInt("PlayerID")); if (entity instanceof PlayerEntity) { reactor.onButtonPressed(compound.getInt("ButtonID"), (PlayerEntity) entity); } @@ -98,9 +98,9 @@ public final class PacketHandler { }; public static final IDataHandler GUI_BUTTON_TO_CONTAINER_HANDLER = (compound, context) -> { World world = DimensionManager.getWorld(compound.getInt("WorldID")); - Entity entity = world.getEntityByID(compound.getInt("PlayerID")); + Entity entity = world.getEntity(compound.getInt("PlayerID")); if (entity instanceof PlayerEntity) { - Container container = ((PlayerEntity) entity).openContainer; + Container container = ((PlayerEntity) entity).containerMenu; if (container instanceof IButtonReactor) { ((IButtonReactor) container).onButtonPressed(compound.getInt("ButtonID"), (PlayerEntity) entity); } @@ -108,20 +108,20 @@ public final class PacketHandler { }; public static final IDataHandler GUI_NUMBER_TO_TILE_HANDLER = (compound, context) -> { World world = DimensionManager.getWorld(compound.getInt("WorldID")); - TileEntity tile = world.getTileEntity(new BlockPos(compound.getInt("X"), compound.getInt("Y"), compound.getInt("Z"))); + TileEntity tile = world.getBlockEntity(new BlockPos(compound.getInt("X"), compound.getInt("Y"), compound.getInt("Z"))); if (tile instanceof INumberReactor) { INumberReactor reactor = (INumberReactor) tile; - reactor.onNumberReceived(compound.getDouble("Number"), compound.getInt("NumberID"), (PlayerEntity) world.getEntityByID(compound.getInt("PlayerID"))); + reactor.onNumberReceived(compound.getDouble("Number"), compound.getInt("NumberID"), (PlayerEntity) world.getEntity(compound.getInt("PlayerID"))); } }; public static final IDataHandler GUI_STRING_TO_TILE_HANDLER = (compound, context) -> { World world = DimensionManager.getWorld(compound.getInt("WorldID")); - TileEntity tile = world.getTileEntity(new BlockPos(compound.getInt("X"), compound.getInt("Y"), compound.getInt("Z"))); + TileEntity tile = world.getBlockEntity(new BlockPos(compound.getInt("X"), compound.getInt("Y"), compound.getInt("Z"))); if (tile instanceof IStringReactor) { IStringReactor reactor = (IStringReactor) tile; - reactor.onTextReceived(compound.getString("Text"), compound.getInt("TextID"), (PlayerEntity) world.getEntityByID(compound.getInt("PlayerID"))); + reactor.onTextReceived(compound.getString("Text"), compound.getInt("TextID"), (PlayerEntity) world.getEntity(compound.getInt("PlayerID"))); } }; public static final IDataHandler SYNC_PLAYER_DATA = new IDataHandler() { @@ -144,7 +144,7 @@ public final class PacketHandler { }; public static final IDataHandler PLAYER_DATA_TO_SERVER = (compound, context) -> { World world = DimensionManager.getWorld(compound.getInt("World")); - PlayerEntity player = world.getPlayerEntityByUUID(compound.getUniqueId("UUID")); + PlayerEntity player = world.getPlayerEntityByUUID(compound.getUUID("UUID")); if (player != null) { PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(player); @@ -160,13 +160,13 @@ public final class PacketHandler { //TheAchievements.COMPLETE_TRIALS.get(player); } } - WorldData.get(world).markDirty(); + WorldData.get(world).setDirty(); if (compound.getBoolean("Log")) { ActuallyAdditions.LOGGER.info("Receiving changed Player Data for player " + player.getName() + "."); } } else { - ActuallyAdditions.LOGGER.error("Tried to receive Player Data for UUID " + compound.getUniqueId("UUID") + ", but he doesn't seem to be present!"); + ActuallyAdditions.LOGGER.error("Tried to receive Player Data for UUID " + compound.getUUID("UUID") + ", but he doesn't seem to be present!"); } }; @@ -195,7 +195,7 @@ public final class PacketHandler { public static void sendTo(Object msg, ServerPlayerEntity player) { if (!(player instanceof FakePlayer)) { - THE_NETWORK.sendTo(msg, player.connection.getNetworkManager(), NetworkDirection.PLAY_TO_CLIENT); + THE_NETWORK.sendTo(msg, player.connection.getConnection(), NetworkDirection.PLAY_TO_CLIENT); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketHandlerHelper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketHandlerHelper.java index 1b22c0151..4552cbd4c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketHandlerHelper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketHandlerHelper.java @@ -29,12 +29,12 @@ public final class PacketHandlerHelper { @OnlyIn(Dist.CLIENT) public static void sendButtonPacket(TileEntity tile, int buttonId) { CompoundNBT compound = new CompoundNBT(); - BlockPos pos = tile.getPos(); + BlockPos pos = tile.getBlockPos(); compound.putInt("X", pos.getX()); compound.putInt("Y", pos.getY()); compound.putInt("Z", pos.getZ()); - compound.putInt("WorldID", tile.getWorld().provider.getDimension()); - compound.putInt("PlayerID", Minecraft.getInstance().player.getEntityId()); + compound.putInt("WorldID", tile.getLevel().provider.getDimension()); + compound.putInt("PlayerID", Minecraft.getInstance().player.getId()); compound.putInt("ButtonID", buttonId); PacketHandler.THE_NETWORK.sendToServer(new PacketClientToServer(compound, PacketHandler.GUI_BUTTON_TO_TILE_HANDLER)); } @@ -60,8 +60,8 @@ public final class PacketHandlerHelper { PlayerEntity player = Minecraft.getInstance().player; if (player != null) { - compound.putInt("World", player.world.provider.getDimension()); - compound.setUniqueId("UUID", player.getUniqueID()); + compound.putInt("World", player.level.provider.getDimension()); + compound.setUniqueId("UUID", player.getUUID()); PlayerSave data = PlayerData.getDataFromPlayer(player); @@ -91,11 +91,11 @@ public final class PacketHandlerHelper { @OnlyIn(Dist.CLIENT) public static void sendNumberPacket(TileEntity tile, double number, int id) { CompoundNBT compound = new CompoundNBT(); - compound.putInt("X", tile.getPos().getX()); - compound.putInt("Y", tile.getPos().getY()); - compound.putInt("Z", tile.getPos().getZ()); - compound.putInt("WorldID", tile.getWorld().provider.getDimension()); - compound.putInt("PlayerID", Minecraft.getInstance().player.getEntityId()); + compound.putInt("X", tile.getBlockPos().getX()); + compound.putInt("Y", tile.getBlockPos().getY()); + compound.putInt("Z", tile.getBlockPos().getZ()); + compound.putInt("WorldID", tile.getLevel().provider.getDimension()); + compound.putInt("PlayerID", Minecraft.getInstance().player.getId()); compound.putInt("NumberID", id); compound.putDouble("Number", number); PacketHandler.THE_NETWORK.sendToServer(new PacketClientToServer(compound, PacketHandler.GUI_NUMBER_TO_TILE_HANDLER)); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketServerToClient.java b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketServerToClient.java index fed82fa7c..78b260992 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketServerToClient.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketServerToClient.java @@ -38,7 +38,7 @@ public class PacketServerToClient implements IMessage { public void fromBytes(ByteBuf buf) { PacketBuffer buffer = new PacketBuffer(buf); try { - this.data = buffer.readCompoundTag(); + this.data = buffer.readNbt(); int handlerId = buffer.readInt(); if (handlerId >= 0 && handlerId < PacketHandler.DATA_HANDLERS.size()) { @@ -53,7 +53,7 @@ public class PacketServerToClient implements IMessage { public void toBytes(ByteBuf buf) { PacketBuffer buffer = new PacketBuffer(buf); - buffer.writeCompoundTag(this.data); + buffer.writeNbt(this.data); buffer.writeInt(PacketHandler.DATA_HANDLERS.indexOf(this.handler)); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ParticleBeam.java b/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ParticleBeam.java index fc34a4c44..dd957e6c3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ParticleBeam.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ParticleBeam.java @@ -35,15 +35,15 @@ public class ParticleBeam extends Particle { this.color = color; this.rotationTime = rotationTime; this.size = size; - this.maxAge = maxAge; + this.lifetime = maxAge; this.alpha = alpha; } @Override - public void renderParticle(IVertexBuilder buffer, ActiveRenderInfo renderInfo, float partialTicks) { - float ageRatio = (float) this.age / (float) this.maxAge; + public void render(IVertexBuilder buffer, ActiveRenderInfo renderInfo, float partialTicks) { + float ageRatio = (float) this.age / (float) this.lifetime; float currAlpha = this.alpha - ageRatio * this.alpha; - AssetUtil.renderLaser(this.posX + 0.5, this.posY + 0.5, this.posZ + 0.5, this.endX + 0.5, this.endY + 0.5, this.endZ + 0.5, this.rotationTime, currAlpha, this.size, this.color); + AssetUtil.renderLaser(this.x + 0.5, this.y + 0.5, this.z + 0.5, this.endX + 0.5, this.endY + 0.5, this.endZ + 0.5, this.rotationTime, currAlpha, this.size, this.color); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ParticleLaserItem.java b/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ParticleLaserItem.java index 4a84bc3d8..e5a1b3e60 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ParticleLaserItem.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/particle/ParticleLaserItem.java @@ -37,54 +37,54 @@ public class ParticleLaserItem extends Particle { } public ParticleLaserItem(ClientWorld world, double posX, double posY, double posZ, ItemStack stack, double motionY, double otherX, double otherY, double otherZ) { - super(world, posX + (world.rand.nextDouble() - 0.5) / 8, posY, posZ + (world.rand.nextDouble() - 0.5) / 8); + super(world, posX + (world.random.nextDouble() - 0.5) / 8, posY, posZ + (world.random.nextDouble() - 0.5) / 8); this.stack = stack; this.otherX = otherX; this.otherY = otherY; this.otherZ = otherZ; - this.motionX = 0; - this.motionY = motionY; - this.motionZ = 0; + this.xd = 0; + this.yd = motionY; + this.zd = 0; - this.maxAge = 10; - this.canCollide = false; + this.lifetime = 10; + this.hasPhysics = false; } @Override - public void setExpired() { - super.setExpired(); + public void remove() { + super.remove(); if (this.otherX != 0 || this.otherY != 0 || this.otherZ != 0) { - Particle fx = new ParticleLaserItem(this.world, this.otherX, this.otherY, this.otherZ, this.stack, -0.025); - Minecraft.getInstance().particles.addEffect(fx); + Particle fx = new ParticleLaserItem(this.level, this.otherX, this.otherY, this.otherZ, this.stack, -0.025); + Minecraft.getInstance().particleEngine.add(fx); } } @Override - public void renderParticle(IVertexBuilder buffer, ActiveRenderInfo renderInfo, float partialTicks) { + public void render(IVertexBuilder buffer, ActiveRenderInfo renderInfo, float partialTicks) { RenderSystem.pushMatrix(); - RenderHelper.enableStandardItemLighting(); + RenderHelper.turnBackOn(); - Vector3d cam = renderInfo.getProjectedView(); - RenderSystem.translated(this.posX - cam.getX(), this.posY - cam.getY(), this.posZ - cam.getZ()); + Vector3d cam = renderInfo.getPosition(); + RenderSystem.translated(this.x - cam.x(), this.y - cam.y(), this.z - cam.z()); RenderSystem.scalef(0.3F, 0.3F, 0.3F); - double boop = Util.milliTime() / 600D; + double boop = Util.getMillis() / 600D; RenderSystem.rotatef((float) (boop * 40D % 360), 0, 1, 0); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA.param, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA.param, GlStateManager.SourceFactor.ONE.param, GlStateManager.DestFactor.ZERO.param); + RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA.value, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA.value, GlStateManager.SourceFactor.ONE.value, GlStateManager.DestFactor.ZERO.value); - float ageRatio = (float) this.age / (float) this.maxAge; - float color = this.motionY < 0 + float ageRatio = (float) this.age / (float) this.lifetime; + float color = this.yd < 0 ? 1F - ageRatio : ageRatio; GL14.glBlendColor(color, color, color, color); AssetUtil.renderItemWithoutScrewingWithColors(this.stack); - RenderHelper.disableStandardItemLighting(); + RenderHelper.turnOff(); RenderSystem.popMatrix(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/EnchBookConversion.java b/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/EnchBookConversion.java index de6f17ce4..0aeb87774 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/EnchBookConversion.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/EnchBookConversion.java @@ -19,7 +19,7 @@ import java.util.Map; public class EnchBookConversion extends LensConversionRecipe { public EnchBookConversion() { - super(Ingredient.fromItems(Items.ENCHANTED_BOOK), ItemStack.EMPTY, 155000, ActuallyAdditionsAPI.lensDefaultConversion); + super(Ingredient.of(Items.ENCHANTED_BOOK), ItemStack.EMPTY, 155000, ActuallyAdditionsAPI.lensDefaultConversion); } @Override @@ -28,7 +28,7 @@ public class EnchBookConversion extends LensConversionRecipe { ItemStack book = new ItemStack(Items.ENCHANTED_BOOK); Map ench = ImmutableMap.of(e.getKey(), e.getValue()); EnchantmentHelper.setEnchantments(ench, book); - Block.spawnAsEntity(tile.getWorldObject(), pos, book); + Block.popResource(tile.getWorldObject(), pos, book); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/ActuallyTiles.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/ActuallyTiles.java index 9d0cdafa1..789d35255 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/ActuallyTiles.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/ActuallyTiles.java @@ -11,58 +11,58 @@ public class ActuallyTiles { public static final DeferredRegister> TILES = DeferredRegister.create(ForgeRegistries.TILE_ENTITIES, ActuallyAdditions.MODID); // public static final RegistryObject<,> COMPOST_TILE = TILES.register("compost", () -> TileEntityType.Builder.create(TileEntityCompost::new, InitBlocks.blockCompost.get()).build(null)); - public static final RegistryObject> FEEDER_TILE = TILES.register("feeder", () -> TileEntityType.Builder.create(TileEntityFeeder::new, ActuallyBlocks.FEEDER.get()).build(null)); + public static final RegistryObject> FEEDER_TILE = TILES.register("feeder", () -> TileEntityType.Builder.of(TileEntityFeeder::new, ActuallyBlocks.FEEDER.get()).build(null)); // public static final RegistryObject> GIANTCHEST_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityGiantChest::new, ).build(null)); // public static final RegistryObject> GIANTCHESTMEDIUM_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityGiantChestMedium::new, ).build(null)); // public static final RegistryObject> GIANTCHESTLARGE_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntityGiantChestLarge::new, ).build(null)); - public static final RegistryObject> GRINDER_TILE = TILES.register("grinder", () -> TileEntityType.Builder.create(TileEntityGrinder::new, ActuallyBlocks.GRINDER.get()).build(null)); - public static final RegistryObject> FURNACE_DOUBLE_TILE = TILES.register("furnaceDouble", () -> TileEntityType.Builder.create(TileEntityFurnaceDouble::new, ActuallyBlocks.FURNACE_DOUBLE.get()).build(null)); - public static final RegistryObject> INPUTTER_TILE = TILES.register("inputter", () -> TileEntityType.Builder.create(TileEntityInputter::new, ActuallyBlocks.INPUTTER.get()).build(null)); + public static final RegistryObject> GRINDER_TILE = TILES.register("grinder", () -> TileEntityType.Builder.of(TileEntityGrinder::new, ActuallyBlocks.GRINDER.get()).build(null)); + public static final RegistryObject> FURNACE_DOUBLE_TILE = TILES.register("furnaceDouble", () -> TileEntityType.Builder.of(TileEntityFurnaceDouble::new, ActuallyBlocks.FURNACE_DOUBLE.get()).build(null)); + public static final RegistryObject> INPUTTER_TILE = TILES.register("inputter", () -> TileEntityType.Builder.of(TileEntityInputter::new, ActuallyBlocks.INPUTTER.get()).build(null)); // public static final RegistryObject> SOLAR_TILE = TILES.register("solarPanel", () -> TileEntityType.Builder.create(TileEntityFurnaceSolar::new, ActuallyBlocks.blockFurnaceSolar.get()).build(null)); - public static final RegistryObject> HEATCOLLECTOR_TILE = TILES.register("heatCollector", () -> TileEntityType.Builder.create(TileEntityHeatCollector::new, ActuallyBlocks.HEAT_COLLECTOR.get()).build(null)); - public static final RegistryObject> BREAKER_TILE = TILES.register("breaker", () -> TileEntityType.Builder.create(TileEntityBreaker::new, ActuallyBlocks.BREAKER.get()).build(null)); - public static final RegistryObject> DROPPER_TILE = TILES.register("dropper", () -> TileEntityType.Builder.create(TileEntityDropper::new, ActuallyBlocks.DROPPER.get()).build(null)); - public static final RegistryObject> INPUTTERADVANCED_TILE = TILES.register("inputterAdvanced", () -> TileEntityType.Builder.create(TileEntityInputterAdvanced::new, ActuallyBlocks.INPUTTER_ADVANCED.get()).build(null)); - public static final RegistryObject> PLACER_TILE = TILES.register("placer", () -> TileEntityType.Builder.create(TileEntityPlacer::new, ActuallyBlocks.PLACER.get()).build(null)); - public static final RegistryObject> GRINDER_DOUBLE_TILE = TILES.register("grinderDouble", () -> TileEntityType.Builder.create(TileEntityGrinderDouble::new, ActuallyBlocks.GRINDER_DOUBLE.get()).build(null)); - public static final RegistryObject> CANOLAPRESS_TILE = TILES.register("canolaPress", () -> TileEntityType.Builder.create(TileEntityCanolaPress::new, ActuallyBlocks.CANOLA_PRESS.get()).build(null)); - public static final RegistryObject> FERMENTINGBARREL_TILE = TILES.register("fermentingBarrel", () -> TileEntityType.Builder.create(TileEntityFermentingBarrel::new, ActuallyBlocks.FERMENTING_BARREL.get()).build(null)); - public static final RegistryObject> OILGENERATOR_TILE = TILES.register("oilGenerator", () -> TileEntityType.Builder.create(TileEntityOilGenerator::new, ActuallyBlocks.OIL_GENERATOR.get()).build(null)); - public static final RegistryObject> COALGENERATOR_TILE = TILES.register("coalGenerator", () -> TileEntityType.Builder.create(TileEntityCoalGenerator::new, ActuallyBlocks.COAL_GENERATOR.get()).build(null)); - public static final RegistryObject> PHANTOMITEMFACE_TILE = TILES.register("phantomface", () -> TileEntityType.Builder.create(TileEntityPhantomItemface::new, ActuallyBlocks.PHANTOMFACE.get()).build(null)); - public static final RegistryObject> PHANTOMLIQUIFACE_TILE = TILES.register("liquiface", () -> TileEntityType.Builder.create(TileEntityPhantomLiquiface::new, ActuallyBlocks.PHANTOM_LIQUIFACE.get()).build(null)); - public static final RegistryObject> PHANTOMENERGYFACE_TILE = TILES.register("energyface", () -> TileEntityType.Builder.create(TileEntityPhantomEnergyface::new, ActuallyBlocks.PHANTOM_ENERGYFACE.get()).build(null)); - public static final RegistryObject> PLAYERINTERFACE_TILE = TILES.register("playerInterface", () -> TileEntityType.Builder.create(TileEntityPlayerInterface::new, ActuallyBlocks.PLAYER_INTERFACE.get()).build(null)); - public static final RegistryObject> PHANTOMPLACER_TILE = TILES.register("phantomPlacer", () -> TileEntityType.Builder.create(TileEntityPhantomPlacer::new, ActuallyBlocks.PHANTOM_PLACER.get()).build(null)); - public static final RegistryObject> PHANTOMBREAKER_TILE = TILES.register("phantomBreaker", () -> TileEntityType.Builder.create(TileEntityPhantomBreaker::new, ActuallyBlocks.PHANTOM_BREAKER.get()).build(null)); - public static final RegistryObject> FLUIDCOLLECTOR_TILE = TILES.register("fluidCollector", () -> TileEntityType.Builder.create(TileEntityFluidCollector::new, ActuallyBlocks.FLUID_COLLECTOR.get()).build(null)); - public static final RegistryObject> FLUIDPLACER_TILE = TILES.register("fluidPlacer", () -> TileEntityType.Builder.create(TileEntityFluidPlacer::new, ActuallyBlocks.FLUID_PLACER.get()).build(null)); - public static final RegistryObject> LAVAFACTORYCONTROLLER_TILE = TILES.register("lavaFactory", () -> TileEntityType.Builder.create(TileEntityLavaFactoryController::new, ActuallyBlocks.LAVA_FACTORY_CONTROLLER.get()).build(null)); - public static final RegistryObject> COFFEEMACHINE_TILE = TILES.register("coffeeMachine", () -> TileEntityType.Builder.create(TileEntityCoffeeMachine::new, ActuallyBlocks.COFFEE_MACHINE.get()).build(null)); - public static final RegistryObject> PHANTOM_BOOSTER_TILE = TILES.register("phantomBooster", () -> TileEntityType.Builder.create(TileEntityPhantomBooster::new, ActuallyBlocks.PHANTOM_BOOSTER.get()).build(null)); - public static final RegistryObject> ENERGIZER_TILE = TILES.register("energizer", () -> TileEntityType.Builder.create(TileEntityEnergizer::new, ActuallyBlocks.ENERGIZER.get()).build(null)); - public static final RegistryObject> ENERVATOR_TILE = TILES.register("enervator", () -> TileEntityType.Builder.create(TileEntityEnervator::new, ActuallyBlocks.ENERVATOR.get()).build(null)); - public static final RegistryObject> XPSOLIDIFIER_TILE = TILES.register("xpSolidifier", () -> TileEntityType.Builder.create(TileEntityXPSolidifier::new, ActuallyBlocks.XP_SOLIDIFIER.get()).build(null)); + public static final RegistryObject> HEATCOLLECTOR_TILE = TILES.register("heatCollector", () -> TileEntityType.Builder.of(TileEntityHeatCollector::new, ActuallyBlocks.HEAT_COLLECTOR.get()).build(null)); + public static final RegistryObject> BREAKER_TILE = TILES.register("breaker", () -> TileEntityType.Builder.of(TileEntityBreaker::new, ActuallyBlocks.BREAKER.get()).build(null)); + public static final RegistryObject> DROPPER_TILE = TILES.register("dropper", () -> TileEntityType.Builder.of(TileEntityDropper::new, ActuallyBlocks.DROPPER.get()).build(null)); + public static final RegistryObject> INPUTTERADVANCED_TILE = TILES.register("inputterAdvanced", () -> TileEntityType.Builder.of(TileEntityInputterAdvanced::new, ActuallyBlocks.INPUTTER_ADVANCED.get()).build(null)); + public static final RegistryObject> PLACER_TILE = TILES.register("placer", () -> TileEntityType.Builder.of(TileEntityPlacer::new, ActuallyBlocks.PLACER.get()).build(null)); + public static final RegistryObject> GRINDER_DOUBLE_TILE = TILES.register("grinderDouble", () -> TileEntityType.Builder.of(TileEntityGrinderDouble::new, ActuallyBlocks.GRINDER_DOUBLE.get()).build(null)); + public static final RegistryObject> CANOLAPRESS_TILE = TILES.register("canolaPress", () -> TileEntityType.Builder.of(TileEntityCanolaPress::new, ActuallyBlocks.CANOLA_PRESS.get()).build(null)); + public static final RegistryObject> FERMENTINGBARREL_TILE = TILES.register("fermentingBarrel", () -> TileEntityType.Builder.of(TileEntityFermentingBarrel::new, ActuallyBlocks.FERMENTING_BARREL.get()).build(null)); + public static final RegistryObject> OILGENERATOR_TILE = TILES.register("oilGenerator", () -> TileEntityType.Builder.of(TileEntityOilGenerator::new, ActuallyBlocks.OIL_GENERATOR.get()).build(null)); + public static final RegistryObject> COALGENERATOR_TILE = TILES.register("coalGenerator", () -> TileEntityType.Builder.of(TileEntityCoalGenerator::new, ActuallyBlocks.COAL_GENERATOR.get()).build(null)); + public static final RegistryObject> PHANTOMITEMFACE_TILE = TILES.register("phantomface", () -> TileEntityType.Builder.of(TileEntityPhantomItemface::new, ActuallyBlocks.PHANTOMFACE.get()).build(null)); + public static final RegistryObject> PHANTOMLIQUIFACE_TILE = TILES.register("liquiface", () -> TileEntityType.Builder.of(TileEntityPhantomLiquiface::new, ActuallyBlocks.PHANTOM_LIQUIFACE.get()).build(null)); + public static final RegistryObject> PHANTOMENERGYFACE_TILE = TILES.register("energyface", () -> TileEntityType.Builder.of(TileEntityPhantomEnergyface::new, ActuallyBlocks.PHANTOM_ENERGYFACE.get()).build(null)); + public static final RegistryObject> PLAYERINTERFACE_TILE = TILES.register("playerInterface", () -> TileEntityType.Builder.of(TileEntityPlayerInterface::new, ActuallyBlocks.PLAYER_INTERFACE.get()).build(null)); + public static final RegistryObject> PHANTOMPLACER_TILE = TILES.register("phantomPlacer", () -> TileEntityType.Builder.of(TileEntityPhantomPlacer::new, ActuallyBlocks.PHANTOM_PLACER.get()).build(null)); + public static final RegistryObject> PHANTOMBREAKER_TILE = TILES.register("phantomBreaker", () -> TileEntityType.Builder.of(TileEntityPhantomBreaker::new, ActuallyBlocks.PHANTOM_BREAKER.get()).build(null)); + public static final RegistryObject> FLUIDCOLLECTOR_TILE = TILES.register("fluidCollector", () -> TileEntityType.Builder.of(TileEntityFluidCollector::new, ActuallyBlocks.FLUID_COLLECTOR.get()).build(null)); + public static final RegistryObject> FLUIDPLACER_TILE = TILES.register("fluidPlacer", () -> TileEntityType.Builder.of(TileEntityFluidPlacer::new, ActuallyBlocks.FLUID_PLACER.get()).build(null)); + public static final RegistryObject> LAVAFACTORYCONTROLLER_TILE = TILES.register("lavaFactory", () -> TileEntityType.Builder.of(TileEntityLavaFactoryController::new, ActuallyBlocks.LAVA_FACTORY_CONTROLLER.get()).build(null)); + public static final RegistryObject> COFFEEMACHINE_TILE = TILES.register("coffeeMachine", () -> TileEntityType.Builder.of(TileEntityCoffeeMachine::new, ActuallyBlocks.COFFEE_MACHINE.get()).build(null)); + public static final RegistryObject> PHANTOM_BOOSTER_TILE = TILES.register("phantomBooster", () -> TileEntityType.Builder.of(TileEntityPhantomBooster::new, ActuallyBlocks.PHANTOM_BOOSTER.get()).build(null)); + public static final RegistryObject> ENERGIZER_TILE = TILES.register("energizer", () -> TileEntityType.Builder.of(TileEntityEnergizer::new, ActuallyBlocks.ENERGIZER.get()).build(null)); + public static final RegistryObject> ENERVATOR_TILE = TILES.register("enervator", () -> TileEntityType.Builder.of(TileEntityEnervator::new, ActuallyBlocks.ENERVATOR.get()).build(null)); + public static final RegistryObject> XPSOLIDIFIER_TILE = TILES.register("xpSolidifier", () -> TileEntityType.Builder.of(TileEntityXPSolidifier::new, ActuallyBlocks.XP_SOLIDIFIER.get()).build(null)); // public static final RegistryObject<.> SMILEYCLOUD_TILE = TILES.register("", () -> TileEntityType.Builder.create(TileEntitySmileyCloud::new, InitBlocks.blockSmileyCloud.get()).build(null)); - public static final RegistryObject> LEAFGENERATOR_TILE = TILES.register("leafGenerator", () -> TileEntityType.Builder.create(TileEntityLeafGenerator::new, ActuallyBlocks.LEAF_GENERATOR.get()).build(null)); - public static final RegistryObject> DIRECTIONALBREAKER_TILE = TILES.register("directionalBreaker", () -> TileEntityType.Builder.create(TileEntityDirectionalBreaker::new, ActuallyBlocks.DIRECTIONAL_BREAKER.get()).build(null)); - public static final RegistryObject> RANGEDCOLLECTOR_TILE = TILES.register("rangedCollector", () -> TileEntityType.Builder.create(TileEntityRangedCollector::new, ActuallyBlocks.RANGED_COLLECTOR.get()).build(null)); - public static final RegistryObject> ATOMICRECONSTRUCTOR_TILE = TILES.register("reconstructor", () -> TileEntityType.Builder.create(TileEntityAtomicReconstructor::new, ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get()).build(null)); - public static final RegistryObject> MINER_TILE = TILES.register("miner", () -> TileEntityType.Builder.create(TileEntityMiner::new, ActuallyBlocks.MINER.get()).build(null)); - public static final RegistryObject> FIREWORKBOX_TILE = TILES.register("fireworkBox", () -> TileEntityType.Builder.create(TileEntityFireworkBox::new, ActuallyBlocks.FIREWORK_BOX.get()).build(null)); - public static final RegistryObject> PHANTOMREDSTONEFACE_TILE = TILES.register("redstoneface", () -> TileEntityType.Builder.create(TileEntityPhantomRedstoneface::new, ActuallyBlocks.PHANTOM_REDSTONEFACE.get()).build(null)); - public static final RegistryObject> LASERRELAYITEM_TILE = TILES.register("laserRelayItem", () -> TileEntityType.Builder.create(TileEntityLaserRelayItem::new, ActuallyBlocks.LASER_RELAY_ITEM.get()).build(null)); - public static final RegistryObject> LASERRELAYENERGY_TILE = TILES.register("laserRelay", () -> TileEntityType.Builder.create(TileEntityLaserRelayEnergy::new, ActuallyBlocks.LASER_RELAY.get()).build(null)); - public static final RegistryObject> LASERRELAYENERGYADVANCED_TILE = TILES.register("laserRelayAdvanced", () -> TileEntityType.Builder.create(TileEntityLaserRelayEnergyAdvanced::new, ActuallyBlocks.LASER_RELAY_ADVANCED.get()).build(null)); - public static final RegistryObject> LASERRELAYENERGYEXTREME_TILE = TILES.register("laserRelayExtreme", () -> TileEntityType.Builder.create(TileEntityLaserRelayEnergyExtreme::new, ActuallyBlocks.LASER_RELAY_EXTREME.get()).build(null)); - public static final RegistryObject> LASERRELAYITEMWHITELIST_TILE = TILES.register("laserRelayItemWhitelist", () -> TileEntityType.Builder.create(TileEntityLaserRelayItemWhitelist::new, ActuallyBlocks.LASER_RELAY_ITEM_WHITELIST.get()).build(null)); - public static final RegistryObject> ITEMVIEWER_TILE = TILES.register("itemViewer", () -> TileEntityType.Builder.create(TileEntityItemViewer::new, ActuallyBlocks.ITEM_VIEWER.get()).build(null)); - public static final RegistryObject> DISPLAYSTAND_TILE = TILES.register("displayStand", () -> TileEntityType.Builder.create(TileEntityDisplayStand::new, ActuallyBlocks.DISPLAY_STAND.get()).build(null)); - public static final RegistryObject> SHOCKSUPPRESSOR_TILE = TILES.register("shockSuppressor", () -> TileEntityType.Builder.create(TileEntityShockSuppressor::new, ActuallyBlocks.SHOCK_SUPPRESSOR.get()).build(null)); - public static final RegistryObject> EMPOWERER_TILE = TILES.register("empowerer", () -> TileEntityType.Builder.create(TileEntityEmpowerer::new, ActuallyBlocks.EMPOWERER.get()).build(null)); - public static final RegistryObject> LASERRELAYFLUIDS_TILE = TILES.register("laserRelayFluids", () -> TileEntityType.Builder.create(TileEntityLaserRelayFluids::new, ActuallyBlocks.LASER_RELAY_FLUIDS.get()).build(null)); - public static final RegistryObject> BIOREACTOR_TILE = TILES.register("bioReactor", () -> TileEntityType.Builder.create(TileEntityBioReactor::new, ActuallyBlocks.BIOREACTOR.get()).build(null)); - public static final RegistryObject> FARMER_TILE = TILES.register("farmer", () -> TileEntityType.Builder.create(TileEntityFarmer::new, ActuallyBlocks.FARMER.get()).build(null)); - public static final RegistryObject> ITEMVIEWERHOPPING_TILE = TILES.register("itemViewerHopping", () -> TileEntityType.Builder.create(TileEntityItemViewerHopping::new, ActuallyBlocks.ITEM_VIEWER.get()).build(null)); - public static final RegistryObject> BATTERYBOX_TILE = TILES.register("batteryBox", () -> TileEntityType.Builder.create(TileEntityBatteryBox::new, ActuallyBlocks.BATTERY_BOX.get()).build(null)); + public static final RegistryObject> LEAFGENERATOR_TILE = TILES.register("leafGenerator", () -> TileEntityType.Builder.of(TileEntityLeafGenerator::new, ActuallyBlocks.LEAF_GENERATOR.get()).build(null)); + public static final RegistryObject> DIRECTIONALBREAKER_TILE = TILES.register("directionalBreaker", () -> TileEntityType.Builder.of(TileEntityDirectionalBreaker::new, ActuallyBlocks.DIRECTIONAL_BREAKER.get()).build(null)); + public static final RegistryObject> RANGEDCOLLECTOR_TILE = TILES.register("rangedCollector", () -> TileEntityType.Builder.of(TileEntityRangedCollector::new, ActuallyBlocks.RANGED_COLLECTOR.get()).build(null)); + public static final RegistryObject> ATOMICRECONSTRUCTOR_TILE = TILES.register("reconstructor", () -> TileEntityType.Builder.of(TileEntityAtomicReconstructor::new, ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get()).build(null)); + public static final RegistryObject> MINER_TILE = TILES.register("miner", () -> TileEntityType.Builder.of(TileEntityMiner::new, ActuallyBlocks.MINER.get()).build(null)); + public static final RegistryObject> FIREWORKBOX_TILE = TILES.register("fireworkBox", () -> TileEntityType.Builder.of(TileEntityFireworkBox::new, ActuallyBlocks.FIREWORK_BOX.get()).build(null)); + public static final RegistryObject> PHANTOMREDSTONEFACE_TILE = TILES.register("redstoneface", () -> TileEntityType.Builder.of(TileEntityPhantomRedstoneface::new, ActuallyBlocks.PHANTOM_REDSTONEFACE.get()).build(null)); + public static final RegistryObject> LASERRELAYITEM_TILE = TILES.register("laserRelayItem", () -> TileEntityType.Builder.of(TileEntityLaserRelayItem::new, ActuallyBlocks.LASER_RELAY_ITEM.get()).build(null)); + public static final RegistryObject> LASERRELAYENERGY_TILE = TILES.register("laserRelay", () -> TileEntityType.Builder.of(TileEntityLaserRelayEnergy::new, ActuallyBlocks.LASER_RELAY.get()).build(null)); + public static final RegistryObject> LASERRELAYENERGYADVANCED_TILE = TILES.register("laserRelayAdvanced", () -> TileEntityType.Builder.of(TileEntityLaserRelayEnergyAdvanced::new, ActuallyBlocks.LASER_RELAY_ADVANCED.get()).build(null)); + public static final RegistryObject> LASERRELAYENERGYEXTREME_TILE = TILES.register("laserRelayExtreme", () -> TileEntityType.Builder.of(TileEntityLaserRelayEnergyExtreme::new, ActuallyBlocks.LASER_RELAY_EXTREME.get()).build(null)); + public static final RegistryObject> LASERRELAYITEMWHITELIST_TILE = TILES.register("laserRelayItemWhitelist", () -> TileEntityType.Builder.of(TileEntityLaserRelayItemWhitelist::new, ActuallyBlocks.LASER_RELAY_ITEM_WHITELIST.get()).build(null)); + public static final RegistryObject> ITEMVIEWER_TILE = TILES.register("itemViewer", () -> TileEntityType.Builder.of(TileEntityItemViewer::new, ActuallyBlocks.ITEM_VIEWER.get()).build(null)); + public static final RegistryObject> DISPLAYSTAND_TILE = TILES.register("displayStand", () -> TileEntityType.Builder.of(TileEntityDisplayStand::new, ActuallyBlocks.DISPLAY_STAND.get()).build(null)); + public static final RegistryObject> SHOCKSUPPRESSOR_TILE = TILES.register("shockSuppressor", () -> TileEntityType.Builder.of(TileEntityShockSuppressor::new, ActuallyBlocks.SHOCK_SUPPRESSOR.get()).build(null)); + public static final RegistryObject> EMPOWERER_TILE = TILES.register("empowerer", () -> TileEntityType.Builder.of(TileEntityEmpowerer::new, ActuallyBlocks.EMPOWERER.get()).build(null)); + public static final RegistryObject> LASERRELAYFLUIDS_TILE = TILES.register("laserRelayFluids", () -> TileEntityType.Builder.of(TileEntityLaserRelayFluids::new, ActuallyBlocks.LASER_RELAY_FLUIDS.get()).build(null)); + public static final RegistryObject> BIOREACTOR_TILE = TILES.register("bioReactor", () -> TileEntityType.Builder.of(TileEntityBioReactor::new, ActuallyBlocks.BIOREACTOR.get()).build(null)); + public static final RegistryObject> FARMER_TILE = TILES.register("farmer", () -> TileEntityType.Builder.of(TileEntityFarmer::new, ActuallyBlocks.FARMER.get()).build(null)); + public static final RegistryObject> ITEMVIEWERHOPPING_TILE = TILES.register("itemViewerHopping", () -> TileEntityType.Builder.of(TileEntityItemViewerHopping::new, ActuallyBlocks.ITEM_VIEWER.get()).build(null)); + public static final RegistryObject> BATTERYBOX_TILE = TILES.register("batteryBox", () -> TileEntityType.Builder.of(TileEntityBatteryBox::new, ActuallyBlocks.BATTERY_BOX.get()).build(null)); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/FilterSettings.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/FilterSettings.java index 40d49e52c..ff220db40 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/FilterSettings.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/FilterSettings.java @@ -124,7 +124,7 @@ public class FilterSettings { } boolean metaFine = !meta || first.getItemDamage() == second.getItemDamage(); - boolean nbtFine = !nbt || ItemStack.areItemStackTagsEqual(first, second); + boolean nbtFine = !nbt || ItemStack.tagMatches(first, second); if (metaFine && nbtFine) { return true; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java index 7ef59fea8..123058df9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java @@ -32,6 +32,8 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.energy.IEnergyStorage; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; + public class TileEntityAtomicReconstructor extends TileEntityInventoryBase implements IEnergyDisplay, IAtomicReconstructor { public static final int ENERGY_USE = 1000; @@ -82,7 +84,7 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple @Override public void updateEntity() { super.updateEntity(); - if (!this.world.isRemote) { + if (!this.level.isClientSide) { if (!this.isRedstonePowered && !this.isPulseMode) { if (this.currentTime > 0) { this.currentTime--; @@ -96,7 +98,7 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple if (this.oldEnergy != this.storage.getEnergyStored() && this.sendUpdateWithInterval()) { this.oldEnergy = this.storage.getEnergyStored(); - this.world.updateComparatorOutputLevel(this.pos, ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get()); + this.level.updateNeighbourForOutputSignal(this.worldPosition, ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get()); } } @@ -115,33 +117,33 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple @Override public Direction getOrientation() { - BlockState state = this.world.getBlockState(this.pos); + BlockState state = this.level.getBlockState(this.worldPosition); return WorldUtil.getDirectionByPistonRotation(state); } @Override public BlockPos getPosition() { - return this.pos; + return this.worldPosition; } @Override public int getX() { - return this.getPos().getX(); + return this.getBlockPos().getX(); } @Override public int getY() { - return this.getPos().getY(); + return this.getBlockPos().getY(); } @Override public int getZ() { - return this.getPos().getZ(); + return this.getBlockPos().getZ(); } @Override public World getWorldObject() { - return this.getWorld(); + return this.getLevel(); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java index 2c1b1840b..e09925598 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java @@ -60,7 +60,7 @@ public abstract class TileEntityBase extends TileEntity implements ITickable { } @Override - public CompoundNBT write(CompoundNBT compound) { + public CompoundNBT save(CompoundNBT compound) { this.writeSyncableNBT(compound, NBTType.SAVE_TILE); return compound; } @@ -73,7 +73,7 @@ public abstract class TileEntityBase extends TileEntity implements ITickable { // } @Override - public void read(BlockState state, CompoundNBT compound) { + public void load(BlockState state, CompoundNBT compound) { this.readSyncableNBT(compound, NBTType.SAVE_TILE); } @@ -88,12 +88,12 @@ public abstract class TileEntityBase extends TileEntity implements ITickable { public SUpdateTileEntityPacket getUpdatePacket() { CompoundNBT compound = new CompoundNBT(); this.writeSyncableNBT(compound, NBTType.SYNC); - return new SUpdateTileEntityPacket(this.pos, -1, compound); + return new SUpdateTileEntityPacket(this.worldPosition, -1, compound); } @Override public void onDataPacket(NetworkManager net, SUpdateTileEntityPacket pkt) { - this.readSyncableNBT(pkt.getNbtCompound(), NBTType.SYNC); + this.readSyncableNBT(pkt.getTag(), NBTType.SYNC); } @Override @@ -109,7 +109,7 @@ public abstract class TileEntityBase extends TileEntity implements ITickable { } public final void sendUpdate() { - if (this.world != null && !this.world.isRemote) { + if (this.level != null && !this.level.isClientSide) { VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this); } /* @@ -128,7 +128,7 @@ public abstract class TileEntityBase extends TileEntity implements ITickable { public void writeSyncableNBT(CompoundNBT compound, NBTType type) { if (type != NBTType.SAVE_BLOCK) { - super.write(compound); + super.save(compound); } if (type == NBTType.SAVE_TILE) { @@ -146,7 +146,7 @@ public abstract class TileEntityBase extends TileEntity implements ITickable { public void readSyncableNBT(CompoundNBT compound, NBTType type) { if (type != NBTType.SAVE_BLOCK) { - super.read(null, compound); // FIXME: [port] flag as possible crash source + super.load(null, compound); // FIXME: [port] flag as possible crash source } if (type == NBTType.SAVE_TILE) { @@ -193,7 +193,7 @@ public abstract class TileEntityBase extends TileEntity implements ITickable { public void updateEntity() { this.ticksElapsed++; - if (!this.world.isRemote) { + if (!this.level.isClientSide) { if (this.shareEnergy) { ISharingEnergyProvider provider = (ISharingEnergyProvider) this; if (provider.doesShareEnergy()) { @@ -250,9 +250,9 @@ public abstract class TileEntityBase extends TileEntity implements ITickable { public void saveDataOnChangeOrWorldStart() { for (Direction side : Direction.values()) { - BlockPos pos = this.pos.offset(side); - if (this.world.isBlockLoaded(pos)) { - this.tilesAround[side.ordinal()] = this.world.getTileEntity(pos); + BlockPos pos = this.worldPosition.relative(side); + if (this.level.hasChunkAt(pos)) { + this.tilesAround[side.ordinal()] = this.level.getBlockEntity(pos); } } } @@ -263,11 +263,11 @@ public abstract class TileEntityBase extends TileEntity implements ITickable { public void setRedstonePowered(boolean powered) { this.isRedstonePowered = powered; - this.markDirty(); + this.setChanged(); } public boolean canPlayerUse(PlayerEntity player) { - return player.getDistanceSq(this.getPos().getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D) <= 64 && !this.isRemoved() && this.world.getTileEntity(this.pos) == this; + return player.distanceToSqr(this.getBlockPos().getX() + 0.5D, this.worldPosition.getY() + 0.5D, this.worldPosition.getZ() + 0.5D) <= 64 && !this.isRemoved() && this.level.getBlockEntity(this.worldPosition) == this; } protected boolean sendUpdateWithInterval() { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBatteryBox.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBatteryBox.java index b85804d77..e1d65bbb2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBatteryBox.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBatteryBox.java @@ -46,7 +46,7 @@ public class TileEntityBatteryBox extends TileEntityInventoryBase implements ISh public void updateEntity() { super.updateEntity(); - if (!this.world.isRemote) { + if (!this.level.isClientSide) { LazyOptional cap = this.getEnergyStorage(null); int currStorage = cap.map(storage -> { ItemStack stack = this.inv.getStackInSlot(0); @@ -83,7 +83,7 @@ public class TileEntityBatteryBox extends TileEntityInventoryBase implements ISh if (this.lastCompare != this.getComparatorStrength()) { this.lastCompare = this.getComparatorStrength(); - this.markDirty(); + this.setChanged(); } if (this.lastEnergyStored != currStorage && this.sendUpdateWithInterval()) { @@ -109,7 +109,7 @@ public class TileEntityBatteryBox extends TileEntityInventoryBase implements ISh ItemStack stack = this.inv.getStackInSlot(0); if (StackUtil.isValid(stack)) { ItemUtil.changeEnabled(stack); - this.markDirty(); + this.setChanged(); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBioReactor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBioReactor.java index b8ed470de..60b3ab338 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBioReactor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBioReactor.java @@ -36,6 +36,8 @@ import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; + public class TileEntityBioReactor extends TileEntityInventoryBase implements INamedContainerProvider, ISharingEnergyProvider { public final CustomEnergyStorage storage = new CustomEnergyStorage(200000, 0, 800); @@ -55,10 +57,10 @@ public class TileEntityBioReactor extends TileEntityInventoryBase implements INa public static boolean isValidItem(ItemStack stack) { if (StackUtil.isValid(stack)) { Item item = stack.getItem(); - if (item.isFood()) { + if (item.isEdible()) { return true; } else if (item instanceof BlockItem) { - return isValid(Block.getBlockFromItem(item)); + return isValid(Block.byItem(item)); } } return false; @@ -91,7 +93,7 @@ public class TileEntityBioReactor extends TileEntityInventoryBase implements INa } } - this.markDirty(); + this.setChanged(); } if (types != null && !types.isEmpty()) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBreaker.java index 8f701f42c..222b87fb9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBreaker.java @@ -34,6 +34,8 @@ import net.minecraftforge.fluids.IFluidBlock; import javax.annotation.Nullable; import java.util.List; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; + public class TileEntityBreaker extends TileEntityInventoryBase implements INamedContainerProvider { public boolean isPlacer; @@ -67,7 +69,7 @@ public class TileEntityBreaker extends TileEntityInventoryBase implements INamed @Override public void updateEntity() { super.updateEntity(); - if (!this.world.isRemote) { + if (!this.level.isClientSide) { if (!this.isRedstonePowered && !this.isPulseMode) { if (this.currentTime > 0) { this.currentTime--; @@ -87,20 +89,20 @@ public class TileEntityBreaker extends TileEntityInventoryBase implements INamed } private void doWork() { - Direction side = WorldUtil.getDirectionByPistonRotation(this.world.getBlockState(this.pos)); - BlockPos breakCoords = this.pos.offset(side); - BlockState stateToBreak = this.world.getBlockState(breakCoords); + Direction side = WorldUtil.getDirectionByPistonRotation(this.level.getBlockState(this.worldPosition)); + BlockPos breakCoords = this.worldPosition.relative(side); + BlockState stateToBreak = this.level.getBlockState(breakCoords); Block blockToBreak = stateToBreak.getBlock(); - if (!this.isPlacer && blockToBreak != Blocks.AIR && !(blockToBreak instanceof IFluidBlock) && stateToBreak.getBlockHardness(this.world, breakCoords) >= 0.0F) { - List drops = Block.getDrops(stateToBreak, (ServerWorld) this.world, breakCoords, this.world.getTileEntity(breakCoords)); - float chance = WorldUtil.fireFakeHarvestEventsForDropChance(this, drops, this.world, breakCoords); + if (!this.isPlacer && blockToBreak != Blocks.AIR && !(blockToBreak instanceof IFluidBlock) && stateToBreak.getDestroySpeed(this.level, breakCoords) >= 0.0F) { + List drops = Block.getDrops(stateToBreak, (ServerWorld) this.level, breakCoords, this.level.getBlockEntity(breakCoords)); + float chance = WorldUtil.fireFakeHarvestEventsForDropChance(this, drops, this.level, breakCoords); - if (chance > 0 && this.world.rand.nextFloat() <= chance) { + if (chance > 0 && this.level.random.nextFloat() <= chance) { if (StackUtil.canAddAll(this.inv, drops, false)) { - this.world.destroyBlock(breakCoords, false); + this.level.destroyBlock(breakCoords, false); StackUtil.addAll(this.inv, drops, false); - this.markDirty(); + this.setChanged(); } } } else if (this.isPlacer) { @@ -108,7 +110,7 @@ public class TileEntityBreaker extends TileEntityInventoryBase implements INamed if (slot == -1) { return; } - this.inv.setStackInSlot(slot, WorldUtil.useItemAtSide(side, this.world, this.pos, this.inv.getStackInSlot(slot))); + this.inv.setStackInSlot(slot, WorldUtil.useItemAtSide(side, this.level, this.worldPosition, this.inv.getStackInSlot(slot))); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCanolaPress.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCanolaPress.java index f866a30da..3d7d24fb7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCanolaPress.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCanolaPress.java @@ -36,6 +36,8 @@ import net.minecraftforge.fluids.capability.templates.FluidTank; import javax.annotation.Nullable; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; + public class TileEntityCanolaPress extends TileEntityInventoryBase implements INamedContainerProvider, ISharingFluidHandler { public static final int PRODUCE = 80; @@ -100,7 +102,7 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IN @Override public void updateEntity() { super.updateEntity(); - if (!this.world.isRemote) { + if (!this.level.isClientSide) { if (isCanola(this.inv.getStackInSlot(0)) && PRODUCE <= this.tank.getCapacity() - this.tank.getFluidAmount()) { if (this.storage.getEnergyStored() >= ENERGY_USE) { this.currentProcessTime++; @@ -111,7 +113,7 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IN this.inv.setStackInSlot(0, StackUtil.shrink(this.inv.getStackInSlot(0), 1)); this.tank.fill(new FluidStack(InitFluids.fluidCanolaOil.get(), PRODUCE), IFluidHandler.FluidAction.EXECUTE); - this.markDirty(); + this.setChanged(); } } } else { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoalGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoalGenerator.java index dc217a8da..3c43b524f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoalGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoalGenerator.java @@ -33,6 +33,8 @@ import net.minecraftforge.energy.IEnergyStorage; import javax.annotation.Nullable; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; + public class TileEntityCoalGenerator extends TileEntityInventoryBase implements INamedContainerProvider, ISharingEnergyProvider { public final CustomEnergyStorage storage = new CustomEnergyStorage(60000, 0, 80); @@ -83,7 +85,7 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements @Override public void updateEntity() { super.updateEntity(); - if (!this.world.isRemote) { + if (!this.level.isClientSide) { boolean flag = this.currentBurnTime > 0; if (this.currentBurnTime > 0) { @@ -111,7 +113,7 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements if (flag != this.currentBurnTime > 0 || this.lastCompare != this.getComparatorStrength()) { this.lastCompare = this.getComparatorStrength(); - this.markDirty(); + this.setChanged(); } if ((this.storage.getEnergyStored() != this.lastEnergy || this.currentBurnTime != this.lastCurrentBurnTime || this.lastBurnTime != this.maxBurnTime) && this.sendUpdateWithInterval()) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java index ce077ac61..bd0e976bf 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java @@ -43,6 +43,9 @@ import net.minecraftforge.fluids.capability.templates.FluidTank; import javax.annotation.Nonnull; import javax.annotation.Nullable; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; +import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction; + public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements INamedContainerProvider, IButtonReactor, ISharingFluidHandler { public static final int SLOT_COFFEE_BEANS = 0; @@ -133,7 +136,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements @Override public void updateEntity() { super.updateEntity(); - if (!this.world.isRemote) { + if (!this.level.isClientSide) { this.storeCoffee(); if (this.brewTime > 0 || this.isRedstonePowered) { @@ -170,7 +173,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements } public void brew() { - if (this.world.isRemote) { + if (this.level.isClientSide) { return; } @@ -178,7 +181,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements if (StackUtil.isValid(input) && input.getItem() == ActuallyItems.COFFEE_CUP.get() && !StackUtil.isValid(this.inv.getStackInSlot(SLOT_OUTPUT)) && this.coffeeCacheAmount >= CACHE_USE && this.tank.getFluid().getFluid() == Fluids.WATER && this.tank.getFluidAmount() >= WATER_USE) { if (this.storage.getEnergyStored() >= ENERGY_USED) { if (this.brewTime % 30 == 0) { - this.world.playSound(null, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), SoundHandler.coffeeMachine, SoundCategory.BLOCKS, 0.1F, 1.0F); + this.level.playSound(null, this.getBlockPos().getX(), this.getBlockPos().getY(), this.getBlockPos().getZ(), SoundHandler.coffeeMachine, SoundCategory.BLOCKS, 0.1F, 1.0F); } this.brewTime++; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDirectionalBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDirectionalBreaker.java index 1987cd915..77bb4a3f4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDirectionalBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDirectionalBreaker.java @@ -34,6 +34,8 @@ import net.minecraftforge.energy.IEnergyStorage; import javax.annotation.Nullable; import java.util.List; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; + public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implements INamedContainerProvider { public static final int RANGE = 8; @@ -68,7 +70,7 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem @Override public void updateEntity() { super.updateEntity(); - if (!this.world.isRemote) { + if (!this.level.isClientSide) { if (!this.isRedstonePowered && !this.isPulseMode) { if (this.currentTime > 0) { this.currentTime--; @@ -88,24 +90,24 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem private void doWork() { if (this.storage.getEnergyStored() >= ENERGY_USE * RANGE) { - BlockState state = this.world.getBlockState(this.pos); + BlockState state = this.level.getBlockState(this.worldPosition); Direction sideToManipulate = WorldUtil.getDirectionByPistonRotation(state); for (int i = 0; i < RANGE; i++) { - BlockPos coordsBlock = this.pos.offset(sideToManipulate, i + 1); - BlockState breakState = this.world.getBlockState(coordsBlock); + BlockPos coordsBlock = this.worldPosition.relative(sideToManipulate, i + 1); + BlockState breakState = this.level.getBlockState(coordsBlock); Block blockToBreak = breakState.getBlock(); - if (blockToBreak != null && !this.world.isAirBlock(coordsBlock) && this.world.getBlockState(coordsBlock).getBlockHardness(this.world, coordsBlock) > -1.0F) { - List drops = Block.getDrops(breakState, (ServerWorld) this.world, coordsBlock, this.world.getTileEntity(coordsBlock)); - float chance = WorldUtil.fireFakeHarvestEventsForDropChance(this, drops, this.world, coordsBlock); + if (blockToBreak != null && !this.level.isEmptyBlock(coordsBlock) && this.level.getBlockState(coordsBlock).getDestroySpeed(this.level, coordsBlock) > -1.0F) { + List drops = Block.getDrops(breakState, (ServerWorld) this.level, coordsBlock, this.level.getBlockEntity(coordsBlock)); + float chance = WorldUtil.fireFakeHarvestEventsForDropChance(this, drops, this.level, coordsBlock); - if (chance > 0 && this.world.rand.nextFloat() <= chance) { + if (chance > 0 && this.level.random.nextFloat() <= chance) { if (StackUtil.canAddAll(this.inv, drops, false)) { - this.world.playEvent(2001, coordsBlock, Block.getStateId(this.world.getBlockState(coordsBlock))); - this.world.setBlockState(coordsBlock, Blocks.AIR.getDefaultState()); + this.level.levelEvent(2001, coordsBlock, Block.getId(this.level.getBlockState(coordsBlock))); + this.level.setBlockAndUpdate(coordsBlock, Blocks.AIR.defaultBlockState()); StackUtil.addAll(this.inv, drops, false); this.storage.extractEnergyInternal(ENERGY_USE, false); - this.markDirty(); + this.setChanged(); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDisplayStand.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDisplayStand.java index 7f6b21438..ae7d8ff61 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDisplayStand.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDisplayStand.java @@ -21,6 +21,8 @@ import net.minecraft.util.Direction; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.energy.IEnergyStorage; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; + public class TileEntityDisplayStand extends TileEntityInventoryBase implements IEnergyDisplay { public final CustomEnergyStorage storage = new CustomEnergyStorage(80000, 1000, 0); @@ -35,7 +37,7 @@ public class TileEntityDisplayStand extends TileEntityInventoryBase implements I public void updateEntity() { super.updateEntity(); - if (!this.world.isRemote) { + if (!this.level.isClientSide) { if (StackUtil.isValid(this.inv.getStackInSlot(0)) && !this.isRedstonePowered) { IDisplayStandItem item = this.convertToDisplayStandItem(this.inv.getStackInSlot(0).getItem()); if (item != null) { @@ -75,7 +77,7 @@ public class TileEntityDisplayStand extends TileEntityInventoryBase implements I if (item instanceof IDisplayStandItem) { return (IDisplayStandItem) item; } else if (item instanceof BlockItem) { - Block block = Block.getBlockFromItem(item); + Block block = Block.byItem(item); if (block instanceof IDisplayStandItem) { return (IDisplayStandItem) block; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDropper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDropper.java index af206decd..f45f8040e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDropper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDropper.java @@ -25,6 +25,8 @@ import net.minecraft.util.text.StringTextComponent; import javax.annotation.Nullable; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; + public class TileEntityDropper extends TileEntityInventoryBase implements INamedContainerProvider { private int currentTime; @@ -52,7 +54,7 @@ public class TileEntityDropper extends TileEntityInventoryBase implements INamed @Override public void updateEntity() { super.updateEntity(); - if (!this.world.isRemote) { + if (!this.level.isClientSide) { if (!this.isRedstonePowered && !this.isPulseMode) { if (this.currentTime > 0) { this.currentTime--; @@ -69,10 +71,10 @@ public class TileEntityDropper extends TileEntityInventoryBase implements INamed private void doWork() { ItemStack theoreticalRemove = this.removeFromInventory(false); if (StackUtil.isValid(theoreticalRemove)) { - BlockState state = this.world.getBlockState(this.pos); + BlockState state = this.level.getBlockState(this.worldPosition); ItemStack drop = theoreticalRemove.copy(); drop.setCount(1); - WorldUtil.dropItemAtSide(WorldUtil.getDirectionByPistonRotation(state), this.world, this.pos, drop); + WorldUtil.dropItemAtSide(WorldUtil.getDirectionByPistonRotation(state), this.level, this.worldPosition, drop); this.removeFromInventory(true); } } @@ -83,7 +85,7 @@ public class TileEntityDropper extends TileEntityInventoryBase implements INamed ItemStack slot = this.inv.getStackInSlot(i).copy(); if (actuallyDo) { this.inv.setStackInSlot(i, StackUtil.shrink(this.inv.getStackInSlot(i), 1)); - this.markDirty(); + this.setChanged(); } return slot; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEmpowerer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEmpowerer.java index 5706d72dc..303e69ba3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEmpowerer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEmpowerer.java @@ -27,6 +27,8 @@ import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; + public class TileEntityEmpowerer extends TileEntityInventoryBase { public int processTime; @@ -75,7 +77,7 @@ public class TileEntityEmpowerer extends TileEntityInventoryBase { public void updateEntity() { super.updateEntity(); - if (!this.world.isRemote) { + if (!this.level.isClientSide) { TileEntityDisplayStand[] stands = this.getNearbyStands(); if (stands != null) { EmpowererRecipe recipe = findMatchingRecipe(this.inv.getStackInSlot(0), stands[0].getStack(), stands[1].getStack(), stands[2].getStack(), stands[3].getStack()); @@ -100,19 +102,19 @@ public class TileEntityEmpowerer extends TileEntityInventoryBase { if (done) { stand.inv.getStackInSlot(0).shrink(1); - stand.markDirty(); + stand.setChanged(); } } - if (this.processTime % 5 == 0 && this.world instanceof ServerWorld) { - ((ServerWorld) this.world).spawnParticle(ParticleTypes.FIREWORK, this.pos.getX() + 0.5, this.pos.getY() + 1.1, this.pos.getZ() + 0.5, 2, 0, 0, 0, 0.1D); + if (this.processTime % 5 == 0 && this.level instanceof ServerWorld) { + ((ServerWorld) this.level).sendParticles(ParticleTypes.FIREWORK, this.worldPosition.getX() + 0.5, this.worldPosition.getY() + 1.1, this.worldPosition.getZ() + 0.5, 2, 0, 0, 0, 0.1D); } if (done) { - ((ServerWorld) this.world).spawnParticle(ParticleTypes.END_ROD, this.pos.getX() + 0.5, this.pos.getY() + 1.1, this.pos.getZ() + 0.5, 100, 0, 0, 0, 0.25D); + ((ServerWorld) this.level).sendParticles(ParticleTypes.END_ROD, this.worldPosition.getX() + 0.5, this.worldPosition.getY() + 1.1, this.worldPosition.getZ() + 0.5, 100, 0, 0, 0, 0.25D); this.inv.setStackInSlot(0, recipe.getOutput().copy()); - this.markDirty(); + this.setChanged(); this.processTime = 0; this.recipeForRenderIndex = -1; @@ -136,9 +138,9 @@ public class TileEntityEmpowerer extends TileEntityInventoryBase { // TODO: [port] validate this for (int i = 0; i < 3; i++) { - Direction facing = Direction.byHorizontalIndex(i); - BlockPos offset = this.pos.offset(facing, 3); - TileEntity tile = this.world.getTileEntity(offset); + Direction facing = Direction.from2DDataValue(i); + BlockPos offset = this.worldPosition.relative(facing, 3); + TileEntity tile = this.level.getBlockEntity(offset); if (tile instanceof TileEntityDisplayStand) { stands[i] = (TileEntityDisplayStand) tile; } else { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnergizer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnergizer.java index 90f7a98f4..21b3b5437 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnergizer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnergizer.java @@ -29,6 +29,8 @@ import net.minecraftforge.energy.IEnergyStorage; import javax.annotation.Nullable; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; + public class TileEntityEnergizer extends TileEntityInventoryBase implements INamedContainerProvider { public final CustomEnergyStorage storage = new CustomEnergyStorage(50000, 1000, 0); @@ -54,7 +56,7 @@ public class TileEntityEnergizer extends TileEntityInventoryBase implements INam @Override public void updateEntity() { super.updateEntity(); - if (!this.world.isRemote) { + if (!this.level.isClientSide) { if (StackUtil.isValid(this.inv.getStackInSlot(0)) && !StackUtil.isValid(this.inv.getStackInSlot(1))) { if (this.storage.getEnergyStored() > 0) { int received = this.inv.getStackInSlot(0).getCapability(CapabilityEnergy.ENERGY, null).map(cap -> cap.receiveEnergy(this.storage.getEnergyStored(), false)).orElse(0); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnervator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnervator.java index 883c764e2..13f16f6d4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnervator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnervator.java @@ -29,6 +29,8 @@ import net.minecraftforge.energy.IEnergyStorage; import javax.annotation.Nullable; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; + public class TileEntityEnervator extends TileEntityInventoryBase implements ISharingEnergyProvider, INamedContainerProvider { public final CustomEnergyStorage storage = new CustomEnergyStorage(50000, 0, 1000); @@ -54,7 +56,7 @@ public class TileEntityEnervator extends TileEntityInventoryBase implements ISha @Override public void updateEntity() { super.updateEntity(); - if (!this.world.isRemote) { + if (!this.level.isClientSide) { if (StackUtil.isValid(this.inv.getStackInSlot(0)) && !StackUtil.isValid(this.inv.getStackInSlot(1))) { if (this.storage.getEnergyStored() < this.storage.getMaxEnergyStored()) { LazyOptional capability = this.inv.getStackInSlot(0).getCapability(CapabilityEnergy.ENERGY, null); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFarmer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFarmer.java index ec4768ddf..1293d3444 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFarmer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFarmer.java @@ -41,6 +41,8 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; + public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer, INamedContainerProvider { private static final List SORTED_FARMER_BEHAVIORS = new ArrayList<>(); @@ -85,7 +87,7 @@ public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer @Override public void updateEntity() { super.updateEntity(); - if (!this.world.isRemote) { + if (!this.level.isClientSide) { if (!this.isRedstonePowered && this.storage.getEnergyStored() > 0) { if (this.waitTime > 0) { this.waitTime--; @@ -97,10 +99,10 @@ public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer } int radius = area / 2; - BlockState state = this.world.getBlockState(this.pos); - BlockPos center = this.pos.offset(state.get(BlockStateProperties.HORIZONTAL_FACING), radius + 1); + BlockState state = this.level.getBlockState(this.worldPosition); + BlockPos center = this.worldPosition.relative(state.getValue(BlockStateProperties.HORIZONTAL_FACING), radius + 1); - BlockPos query = center.add(this.checkX, 0, this.checkY); + BlockPos query = center.offset(this.checkX, 0, this.checkY); this.checkBehaviors(query); this.checkX++; @@ -137,15 +139,15 @@ public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer } for (IFarmerBehavior behavior : SORTED_FARMER_BEHAVIORS) { - FarmerResult harvestResult = behavior.tryHarvestPlant(this.world, query, this); + FarmerResult harvestResult = behavior.tryHarvestPlant(this.level, query, this); if (harvestResult == FarmerResult.STOP_PROCESSING) { return; } for (int i = 0; i < 6; i++) { //Process seed slots only ItemStack stack = this.inv.getStackInSlot(i); - BlockState state = this.world.getBlockState(query); + BlockState state = this.level.getBlockState(query); if (StackUtil.isValid(stack) && state.getMaterial().isReplaceable()) { - FarmerResult plantResult = behavior.tryPlantSeed(stack, this.world, query, this); + FarmerResult plantResult = behavior.tryPlantSeed(stack, this.level, query, this); if (plantResult == FarmerResult.SUCCESS) { this.inv.getStackInSlot(i).shrink(1); return; @@ -175,33 +177,33 @@ public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer @Override public Direction getOrientation() { - BlockState state = this.world.getBlockState(this.pos); + BlockState state = this.level.getBlockState(this.worldPosition); return WorldUtil.getDirectionByPistonRotation(state); } @Override public BlockPos getPosition() { - return this.pos; + return this.worldPosition; } @Override public int getX() { - return this.pos.getX(); + return this.worldPosition.getX(); } @Override public int getY() { - return this.pos.getY(); + return this.worldPosition.getY(); } @Override public int getZ() { - return this.pos.getZ(); + return this.worldPosition.getZ(); } @Override public World getWorldObject() { - return this.world; + return this.level; } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFeeder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFeeder.java index 30a05421f..258301a64 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFeeder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFeeder.java @@ -32,6 +32,8 @@ import javax.annotation.Nullable; import java.util.List; import java.util.Optional; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; + public class TileEntityFeeder extends TileEntityInventoryBase implements INamedContainerProvider { public static final int THRESHOLD = 30; @@ -71,13 +73,13 @@ public class TileEntityFeeder extends TileEntityInventoryBase implements INamedC public void updateEntity() { super.updateEntity(); this.currentTimer = MathHelper.clamp(++this.currentTimer, 0, 100); - if (this.world.isRemote) { + if (this.level.isClientSide) { return; } int range = 5; ItemStack stack = this.inv.getStackInSlot(0); if (!stack.isEmpty() && this.currentTimer >= TIME) { - List animals = this.world.getEntitiesWithinAABB(AnimalEntity.class, new AxisAlignedBB(this.pos.getX() - range, this.pos.getY() - range, this.pos.getZ() - range, this.pos.getX() + range, this.pos.getY() + range, this.pos.getZ() + range)); + List animals = this.level.getEntitiesOfClass(AnimalEntity.class, new AxisAlignedBB(this.worldPosition.getX() - range, this.worldPosition.getY() - range, this.worldPosition.getZ() - range, this.worldPosition.getX() + range, this.worldPosition.getY() + range, this.worldPosition.getZ() + range)); this.currentAnimalAmount = animals.size(); if (this.currentAnimalAmount >= 2 && this.currentAnimalAmount < THRESHOLD) { Optional opt = animals.stream().filter((e) -> canBeFed(stack, e)).findAny(); @@ -85,7 +87,7 @@ public class TileEntityFeeder extends TileEntityInventoryBase implements INamedC feedAnimal(opt.get()); stack.shrink(1); this.currentTimer = 0; - this.markDirty(); + this.setChanged(); } } } @@ -103,19 +105,19 @@ public class TileEntityFeeder extends TileEntityInventoryBase implements INamedC private static void feedAnimal(AnimalEntity animal) { animal.setInLove(null); for (int i = 0; i < 7; i++) { - double d = animal.world.rand.nextGaussian() * 0.02D; - double d1 = animal.world.rand.nextGaussian() * 0.02D; - double d2 = animal.world.rand.nextGaussian() * 0.02D; - animal.world.addParticle(ParticleTypes.HEART, animal.getPosX() + animal.world.rand.nextFloat() * animal.getWidth() * 2.0F - animal.getWidth(), animal.getPosY() + 0.5D + animal.world.rand.nextFloat() * animal.getHeight(), animal.getPosZ() + animal.world.rand.nextFloat() * animal.getWidth() * 2.0F - animal.getWidth(), d, d1, d2); + double d = animal.level.random.nextGaussian() * 0.02D; + double d1 = animal.level.random.nextGaussian() * 0.02D; + double d2 = animal.level.random.nextGaussian() * 0.02D; + animal.level.addParticle(ParticleTypes.HEART, animal.getX() + animal.level.random.nextFloat() * animal.getBbWidth() * 2.0F - animal.getBbWidth(), animal.getY() + 0.5D + animal.level.random.nextFloat() * animal.getBbHeight(), animal.getZ() + animal.level.random.nextFloat() * animal.getBbWidth() * 2.0F - animal.getBbWidth(), d, d1, d2); } } private static boolean canBeFed(ItemStack stack, AnimalEntity animal) { - if (animal instanceof HorseEntity && ((HorseEntity) animal).isTame()) { + if (animal instanceof HorseEntity && ((HorseEntity) animal).isTamed()) { Item item = stack.getItem(); - return animal.getGrowingAge() == 0 && !animal.isInLove() && (item == Items.GOLDEN_APPLE || item == Items.GOLDEN_CARROT); + return animal.getAge() == 0 && !animal.isInLove() && (item == Items.GOLDEN_APPLE || item == Items.GOLDEN_CARROT); } - return animal.getGrowingAge() == 0 && !animal.isInLove() && animal.isBreedingItem(stack); + return animal.getAge() == 0 && !animal.isInLove() && animal.isFood(stack); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFermentingBarrel.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFermentingBarrel.java index f5cb55820..dcfece418 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFermentingBarrel.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFermentingBarrel.java @@ -29,6 +29,8 @@ import net.minecraftforge.fluids.capability.templates.FluidTank; import javax.annotation.Nullable; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; + public class TileEntityFermentingBarrel extends TileEntityBase implements ISharingFluidHandler, INamedContainerProvider { private static final int PROCESS_TIME = 100; @@ -89,7 +91,7 @@ public class TileEntityFermentingBarrel extends TileEntityBase implements IShari @Override public void updateEntity() { super.updateEntity(); - if (!this.world.isRemote) { + if (!this.level.isClientSide) { int produce = 80; if (this.canolaTank.getFluidAmount() >= produce && produce <= this.oilTank.getCapacity() - this.oilTank.getFluidAmount()) { this.currentProcessTime++; @@ -107,7 +109,7 @@ public class TileEntityFermentingBarrel extends TileEntityBase implements IShari if (compare != this.lastCompare) { this.lastCompare = compare; - this.markDirty(); + this.setChanged(); } if ((this.canolaTank.getFluidAmount() != this.lastCanola || this.oilTank.getFluidAmount() != this.lastOil || this.currentProcessTime != this.lastProcessTime) && this.sendUpdateWithInterval()) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFireworkBox.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFireworkBox.java index 94f748e34..35fe069f6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFireworkBox.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFireworkBox.java @@ -36,6 +36,8 @@ import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; + public class TileEntityFireworkBox extends TileEntityBase implements IEnergyDisplay, INumberReactor, INamedContainerProvider { public static final int USE_PER_SHOT = 500; @@ -152,9 +154,9 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyDisp double newX = x + this.getRandomAoe(); double newZ = z + this.getRandomAoe(); - if (world.isBlockLoaded(new BlockPos(newX, y, newZ))) { + if (world.hasChunkAt(new BlockPos(newX, y, newZ))) { FireworkRocketEntity rocket = new FireworkRocketEntity(world, newX, y + 1, newZ, firework); - world.addEntity(rocket); + world.addFreshEntity(rocket); } } @@ -162,7 +164,7 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyDisp if (this.areaOfEffect <= 0) { return 0.5; } else { - return MathHelper.nextDouble(this.world.rand, 0, this.areaOfEffect * 2) - this.areaOfEffect; + return MathHelper.nextDouble(this.level.random, 0, this.areaOfEffect * 2) - this.areaOfEffect; } } @@ -188,8 +190,8 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyDisp private CompoundNBT makeFireworkCharge() { CompoundNBT compound = new CompoundNBT(); - if (this.world.rand.nextFloat() <= this.trailOrFlickerChance) { - if (this.world.rand.nextFloat() <= this.flickerChance) { + if (this.level.random.nextFloat() <= this.trailOrFlickerChance) { + if (this.level.random.nextFloat() <= this.flickerChance) { compound.putBoolean("Flicker", true); } else { compound.putBoolean("Trail", true); @@ -199,7 +201,7 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyDisp // TODO: [port] Validate this is the correct way to get colors int[] colors = new int[this.getRandomWithPlay(this.colorAmount)]; for (int i = 0; i < colors.length; i++) { - colors[i] = DyeColor.values()[this.world.rand.nextInt(DyeColor.values().length)].getColorValue(); + colors[i] = DyeColor.values()[this.level.random.nextInt(DyeColor.values().length)].getColorValue(); } compound.putIntArray("Colors", colors); @@ -209,7 +211,7 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyDisp } private int getRandomWithPlay(int value) { - return MathHelper.clamp(MathHelper.nextInt(this.world.rand, value - this.intValuePlay, value + this.intValuePlay), 1, 6); + return MathHelper.clamp(MathHelper.nextInt(this.level.random, value - this.intValuePlay, value + this.intValuePlay), 1, 6); } private int getRandomType() { @@ -225,7 +227,7 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyDisp if (weight <= 0) { return 0; } else { - return WeightedRandom.getRandomItem(this.world.rand, possible, weight).type; + return WeightedRandom.getRandomItem(this.level.random, possible, weight).type; } } @@ -233,7 +235,7 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyDisp public void updateEntity() { super.updateEntity(); - if (!this.world.isRemote) { + if (!this.level.isClientSide) { if (!this.isRedstonePowered && !this.isPulseMode) { if (this.timeUntilNextFirework > 0) { this.timeUntilNextFirework--; @@ -253,7 +255,7 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyDisp private void doWork() { if (this.storage.getEnergyStored() >= USE_PER_SHOT) { - this.spawnFireworks(this.world, this.pos.getX(), this.pos.getY(), this.pos.getZ()); + this.spawnFireworks(this.level, this.worldPosition.getX(), this.worldPosition.getY(), this.worldPosition.getZ()); this.storage.extractEnergyInternal(USE_PER_SHOT, false); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFluidCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFluidCollector.java index 018b78036..4e406d397 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFluidCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFluidCollector.java @@ -41,6 +41,9 @@ import net.minecraftforge.fluids.capability.templates.FluidTank; import javax.annotation.Nonnull; import javax.annotation.Nullable; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; +import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction; + public class TileEntityFluidCollector extends TileEntityBase implements ISharingFluidHandler, INamedContainerProvider { public boolean isPlacer; @@ -97,49 +100,49 @@ public class TileEntityFluidCollector extends TileEntityBase implements ISharing // TODO: [port] big old check on this entire functionality, I've not worked with fluids before private void doWork() { - BlockState state = this.world.getBlockState(this.pos); + BlockState state = this.level.getBlockState(this.worldPosition); Direction sideToManipulate = WorldUtil.getDirectionByPistonRotation(state); - BlockPos coordsBlock = this.pos.offset(sideToManipulate); + BlockPos coordsBlock = this.worldPosition.relative(sideToManipulate); - BlockState stateToBreak = this.world.getBlockState(coordsBlock); + BlockState stateToBreak = this.level.getBlockState(coordsBlock); Block blockToBreak = stateToBreak.getBlock(); if (!this.isPlacer && Util.BUCKET <= this.tank.getCapacity() - this.tank.getFluidAmount()) { if (blockToBreak instanceof IFluidBlock && ((IFluidBlock) blockToBreak).getFluid() != null) { if (this.tank.fill(new FluidStack(((IFluidBlock) blockToBreak).getFluid(), Util.BUCKET), IFluidHandler.FluidAction.SIMULATE) >= Util.BUCKET) { this.tank.fill(new FluidStack(((IFluidBlock) blockToBreak).getFluid(), Util.BUCKET), IFluidHandler.FluidAction.EXECUTE); - this.world.setBlockState(coordsBlock, Blocks.AIR.getDefaultState()); + this.level.setBlockAndUpdate(coordsBlock, Blocks.AIR.defaultBlockState()); } } else if (blockToBreak == Blocks.LAVA) { if (this.tank.fill(new FluidStack(Fluids.LAVA, Util.BUCKET), IFluidHandler.FluidAction.SIMULATE) >= Util.BUCKET) { this.tank.fill(new FluidStack(Fluids.LAVA, Util.BUCKET), IFluidHandler.FluidAction.EXECUTE); - this.world.setBlockState(coordsBlock, Blocks.AIR.getDefaultState()); + this.level.setBlockAndUpdate(coordsBlock, Blocks.AIR.defaultBlockState()); } } else if (blockToBreak == Blocks.WATER) { if (this.tank.fill(new FluidStack(Fluids.WATER, Util.BUCKET), IFluidHandler.FluidAction.SIMULATE) >= Util.BUCKET) { this.tank.fill(new FluidStack(Fluids.WATER, Util.BUCKET), IFluidHandler.FluidAction.EXECUTE); - this.world.setBlockState(coordsBlock, Blocks.AIR.getDefaultState()); + this.level.setBlockAndUpdate(coordsBlock, Blocks.AIR.defaultBlockState()); } } - } else if (this.isPlacer && blockToBreak.getDefaultState().getMaterial().isReplaceable()) { + } else if (this.isPlacer && blockToBreak.defaultBlockState().getMaterial().isReplaceable()) { if (this.tank.getFluidAmount() >= Util.BUCKET) { FluidStack stack = this.tank.getFluid(); - Block fluid = stack.getFluid().getDefaultState().getBlockState().getBlock(); + Block fluid = stack.getFluid().defaultFluidState().createLegacyBlock().getBlock(); if (fluid != null) { - BlockPos offsetPos = this.pos.offset(sideToManipulate); - boolean placeable = !(blockToBreak instanceof IFluidBlock) && blockToBreak.getDefaultState().getMaterial().isReplaceable(); + BlockPos offsetPos = this.worldPosition.relative(sideToManipulate); + boolean placeable = !(blockToBreak instanceof IFluidBlock) && blockToBreak.defaultBlockState().getMaterial().isReplaceable(); if (placeable) { this.tank.drain(Util.BUCKET, IFluidHandler.FluidAction.EXECUTE); // TODO: [port] validate this check is still valid. - if (this.world.getDimensionType().isUltrawarm() && fluid.getDefaultState().getMaterial() == Material.WATER) { - this.world.playSound(null, offsetPos, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 0.5F, 2.6F + (this.world.rand.nextFloat() - this.world.rand.nextFloat()) * 0.8F); + if (this.level.dimensionType().ultraWarm() && fluid.defaultBlockState().getMaterial() == Material.WATER) { + this.level.playSound(null, offsetPos, SoundEvents.FIRE_EXTINGUISH, SoundCategory.BLOCKS, 0.5F, 2.6F + (this.level.random.nextFloat() - this.level.random.nextFloat()) * 0.8F); - if (this.world instanceof ServerWorld) { + if (this.level instanceof ServerWorld) { for (int l = 0; l < 8; ++l) { - ((ServerWorld) this.world).spawnParticle(ParticleTypes.SMOKE, offsetPos.getX() + Math.random(), offsetPos.getY() + Math.random(), offsetPos.getZ() + Math.random(), 1, 0.0D, 0.0D, 0.0D, 0); + ((ServerWorld) this.level).sendParticles(ParticleTypes.SMOKE, offsetPos.getX() + Math.random(), offsetPos.getY() + Math.random(), offsetPos.getZ() + Math.random(), 1, 0.0D, 0.0D, 0.0D, 0); } } } else { - this.world.setBlockState(offsetPos, fluid.getDefaultState(), 3); + this.level.setBlock(offsetPos, fluid.defaultBlockState(), 3); } } } @@ -179,7 +182,7 @@ public class TileEntityFluidCollector extends TileEntityBase implements ISharing @Override public void updateEntity() { super.updateEntity(); - if (!this.world.isRemote) { + if (!this.level.isClientSide) { if (!this.isRedstonePowered && !this.isPulseMode) { if (this.currentTime > 0) { this.currentTime--; @@ -194,7 +197,7 @@ public class TileEntityFluidCollector extends TileEntityBase implements ISharing if (this.lastCompare != this.getComparatorStrength()) { this.lastCompare = this.getComparatorStrength(); - this.markDirty(); + this.setChanged(); } if (this.lastTankAmount != this.tank.getFluidAmount() && this.sendUpdateWithInterval()) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceDouble.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceDouble.java index 338f26a3d..5c275cb9c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceDouble.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceDouble.java @@ -35,6 +35,8 @@ import net.minecraftforge.energy.IEnergyStorage; import javax.annotation.Nullable; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; + public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements IButtonReactor, INamedContainerProvider { public static final int SLOT_INPUT_1 = 0; @@ -111,7 +113,7 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements @Override public void updateEntity() { super.updateEntity(); - if (!this.world.isRemote) { + if (!this.level.isClientSide) { if (this.isAutoSplit) { autoSplit(this.inv, SLOT_INPUT_1, SLOT_INPUT_2); } @@ -149,8 +151,8 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements this.secondSmeltTime = 0; } - BlockState currState = this.world.getBlockState(this.pos); - boolean current = currState.get(BlockStateProperties.LIT); + BlockState currState = this.level.getBlockState(this.worldPosition); + boolean current = currState.getValue(BlockStateProperties.LIT); boolean changeTo = current; if (this.lastSmelted != smelted) { changeTo = smelted; @@ -163,7 +165,7 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements } if (changeTo != current) { - this.world.setBlockState(this.pos, currState.with(BlockStateProperties.LIT, changeTo)); + this.level.setBlockAndUpdate(this.worldPosition, currState.setValue(BlockStateProperties.LIT, changeTo)); } this.lastSmelted = smelted; @@ -191,7 +193,7 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements if (StackUtil.isValid(this.inv.getStackInSlot(theInput))) { ItemStack output = FurnaceRecipes.instance().getSmeltingResult(this.inv.getStackInSlot(theInput)); if (StackUtil.isValid(output)) { - if (!StackUtil.isValid(this.inv.getStackInSlot(theOutput)) || this.inv.getStackInSlot(theOutput).isItemEqual(output) && this.inv.getStackInSlot(theOutput).getCount() <= this.inv.getStackInSlot(theOutput).getMaxStackSize() - output.getCount()) { + if (!StackUtil.isValid(this.inv.getStackInSlot(theOutput)) || this.inv.getStackInSlot(theOutput).sameItem(output) && this.inv.getStackInSlot(theOutput).getCount() <= this.inv.getStackInSlot(theOutput).getMaxStackSize() - output.getCount()) { return true; } } @@ -223,7 +225,7 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements public void onButtonPressed(int buttonID, PlayerEntity player) { if (buttonID == 0) { this.isAutoSplit = !this.isAutoSplit; - this.markDirty(); + this.setChanged(); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceSolar.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceSolar.java index 2c4a35524..034503bed 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceSolar.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceSolar.java @@ -18,6 +18,8 @@ import net.minecraft.util.math.BlockPos; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.energy.IEnergyStorage; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; + public class TileEntityFurnaceSolar extends TileEntityBase implements ISharingEnergyProvider, IEnergyDisplay { public static final int PRODUCE = 8; @@ -44,12 +46,12 @@ public class TileEntityFurnaceSolar extends TileEntityBase implements ISharingEn @Override public void updateEntity() { super.updateEntity(); - if (!this.world.isRemote) { + if (!this.level.isClientSide) { int power = this.getPowerToGenerate(PRODUCE); - if (this.world.isDaytime() && power > 0) { + if (this.level.isDay() && power > 0) { if (power <= this.storage.getMaxEnergyStored() - this.storage.getEnergyStored()) { this.storage.receiveEnergyInternal(power, false); - this.markDirty(); + this.setChanged(); } } @@ -60,14 +62,14 @@ public class TileEntityFurnaceSolar extends TileEntityBase implements ISharingEn } public int getPowerToGenerate(int power) { - for (int y = 1; y <= this.world.getHeight() - this.pos.getY(); y++) { + for (int y = 1; y <= this.level.getMaxBuildHeight() - this.worldPosition.getY(); y++) { if (power > 0) { - BlockPos pos = this.pos.up(y); - BlockState state = this.world.getBlockState(pos); + BlockPos pos = this.worldPosition.above(y); + BlockState state = this.level.getBlockState(pos); - if (state.getMaterial().isOpaque()) { + if (state.getMaterial().isSolidBlocking()) { power = 0; - } else if (!state.getBlock().isAir(state, this.world, pos)) { + } else if (!state.getBlock().isAir(state, this.level, pos)) { power--; } } else { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinder.java index cd1bb4cc8..b8b64edb5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinder.java @@ -37,6 +37,8 @@ import net.minecraftforge.energy.IEnergyStorage; import javax.annotation.Nullable; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; + public class TileEntityGrinder extends TileEntityInventoryBase implements IButtonReactor, INamedContainerProvider { public static final int SLOT_INPUT_1 = 0; @@ -92,7 +94,7 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IButto @Override public void updateEntity() { super.updateEntity(); - if (!this.world.isRemote) { + if (!this.level.isClientSide) { if (this.isDouble && this.isAutoSplit) { TileEntityFurnaceDouble.autoSplit(this.inv, SLOT_INPUT_1, SLOT_INPUT_2); } @@ -143,8 +145,8 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IButto } } - BlockState currState = this.world.getBlockState(this.pos); - boolean current = currState.get(BlockFurnaceDouble.IS_ON); + BlockState currState = this.level.getBlockState(this.worldPosition); + boolean current = currState.getValue(BlockFurnaceDouble.IS_ON); boolean changeTo = current; if (this.lastCrushed != crushed) { changeTo = crushed; @@ -157,7 +159,7 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IButto } if (changeTo != current) { - this.world.setBlockState(this.pos, currState.with(BlockFurnaceDouble.IS_ON, changeTo)); + this.level.setBlockAndUpdate(this.worldPosition, currState.setValue(BlockFurnaceDouble.IS_ON, changeTo)); } this.lastCrushed = crushed; @@ -170,7 +172,7 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IButto } if (shouldPlaySound) { - this.world.playSound(null, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), SoundHandler.crusher, SoundCategory.BLOCKS, 0.025F, 1.0F); + this.level.playSound(null, this.getBlockPos().getX(), this.getBlockPos().getY(), this.getBlockPos().getZ(), SoundHandler.crusher, SoundCategory.BLOCKS, 0.025F, 1.0F); } } } @@ -194,13 +196,13 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IButto ItemStack outputOne = recipe.getOutputOne(); ItemStack outputTwo = recipe.getOutputTwo(); if (StackUtil.isValid(outputOne)) { - if (outputOne.getDamage() == Util.WILDCARD) { - outputOne.setDamage(0); + if (outputOne.getDamageValue() == Util.WILDCARD) { + outputOne.setDamageValue(0); } - if (StackUtil.isValid(outputTwo) && outputTwo.getDamage() == Util.WILDCARD) { - outputTwo.setDamage(0); + if (StackUtil.isValid(outputTwo) && outputTwo.getDamageValue() == Util.WILDCARD) { + outputTwo.setDamageValue(0); } - if ((!StackUtil.isValid(this.inv.getStackInSlot(theFirstOutput)) || this.inv.getStackInSlot(theFirstOutput).isItemEqual(outputOne) && this.inv.getStackInSlot(theFirstOutput).getCount() <= this.inv.getStackInSlot(theFirstOutput).getMaxStackSize() - outputOne.getCount()) && (!StackUtil.isValid(outputTwo) || !StackUtil.isValid(this.inv.getStackInSlot(theSecondOutput)) || this.inv.getStackInSlot(theSecondOutput).isItemEqual(outputTwo) && this.inv.getStackInSlot(theSecondOutput).getCount() <= this.inv.getStackInSlot(theSecondOutput).getMaxStackSize() - outputTwo.getCount())) { + if ((!StackUtil.isValid(this.inv.getStackInSlot(theFirstOutput)) || this.inv.getStackInSlot(theFirstOutput).sameItem(outputOne) && this.inv.getStackInSlot(theFirstOutput).getCount() <= this.inv.getStackInSlot(theFirstOutput).getMaxStackSize() - outputOne.getCount()) && (!StackUtil.isValid(outputTwo) || !StackUtil.isValid(this.inv.getStackInSlot(theSecondOutput)) || this.inv.getStackInSlot(theSecondOutput).sameItem(outputTwo) && this.inv.getStackInSlot(theSecondOutput).getCount() <= this.inv.getStackInSlot(theSecondOutput).getMaxStackSize() - outputTwo.getCount())) { return true; } } @@ -221,8 +223,8 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IButto } ItemStack outputOne = recipe.getOutputOne(); if (StackUtil.isValid(outputOne)) { - if (outputOne.getDamage() == Util.WILDCARD) { - outputOne.setDamage(0); + if (outputOne.getDamageValue() == Util.WILDCARD) { + outputOne.setDamageValue(0); } if (!StackUtil.isValid(this.inv.getStackInSlot(theFirstOutput))) { this.inv.setStackInSlot(theFirstOutput, outputOne.copy()); @@ -233,10 +235,10 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IButto ItemStack outputTwo = recipe.getOutputTwo(); if (StackUtil.isValid(outputTwo)) { - if (outputTwo.getDamage() == Util.WILDCARD) { - outputTwo.setDamage(0); + if (outputTwo.getDamageValue() == Util.WILDCARD) { + outputTwo.setDamageValue(0); } - int rand = this.world.rand.nextInt(100) + 1; + int rand = this.level.random.nextInt(100) + 1; if (rand <= recipe.getSecondChance()) { if (!StackUtil.isValid(this.inv.getStackInSlot(theSecondOutput))) { this.inv.setStackInSlot(theSecondOutput, outputTwo.copy()); @@ -265,7 +267,7 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IButto public void onButtonPressed(int buttonID, PlayerEntity player) { if (buttonID == 0) { this.isAutoSplit = !this.isAutoSplit; - this.markDirty(); + this.setChanged(); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityHeatCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityHeatCollector.java index 94a17d0c3..66e8e225e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityHeatCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityHeatCollector.java @@ -25,6 +25,8 @@ import net.minecraftforge.energy.IEnergyStorage; import java.util.ArrayList; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; + public class TileEntityHeatCollector extends TileEntityBase implements ISharingEnergyProvider, IEnergyDisplay { public static final int ENERGY_PRODUCE = 40; @@ -61,29 +63,29 @@ public class TileEntityHeatCollector extends TileEntityBase implements ISharingE @Override public void updateEntity() { super.updateEntity(); - if (!this.world.isRemote) { + if (!this.level.isClientSide) { ArrayList blocksAround = new ArrayList<>(); if (ENERGY_PRODUCE <= this.storage.getMaxEnergyStored() - this.storage.getEnergyStored()) { for (int i = 1; i <= 5; i++) { - BlockPos coords = this.pos.offset(WorldUtil.getDirectionBySidesInOrder(i)); - BlockState state = this.world.getBlockState(coords); + BlockPos coords = this.worldPosition.relative(WorldUtil.getDirectionBySidesInOrder(i)); + BlockState state = this.level.getBlockState(coords); Block block = state.getBlock(); - if (block != null && this.world.getBlockState(coords).getMaterial() == Material.LAVA || this.world.getBlockState(coords).getBlock() instanceof MagmaBlock) { + if (block != null && this.level.getBlockState(coords).getMaterial() == Material.LAVA || this.level.getBlockState(coords).getBlock() instanceof MagmaBlock) { blocksAround.add(i); } } if (blocksAround.size() >= BLOCKS_NEEDED) { this.storage.receiveEnergyInternal(ENERGY_PRODUCE, false); - this.markDirty(); + this.setChanged(); this.disappearTime++; if (this.disappearTime >= 1000) { this.disappearTime = 0; - if (this.world.rand.nextInt(200) == 0) { - int randomSide = blocksAround.get(this.world.rand.nextInt(blocksAround.size())); - this.world.setBlockState(this.pos.offset(WorldUtil.getDirectionBySidesInOrder(randomSide)), Blocks.AIR.getDefaultState()); + if (this.level.random.nextInt(200) == 0) { + int randomSide = blocksAround.get(this.level.random.nextInt(blocksAround.size())); + this.level.setBlockAndUpdate(this.worldPosition.relative(WorldUtil.getDirectionBySidesInOrder(randomSide)), Blocks.AIR.defaultBlockState()); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInputter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInputter.java index 1fccea4f6..2fdcd9d7a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInputter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInputter.java @@ -38,6 +38,8 @@ import javax.annotation.Nullable; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; + public class TileEntityInputter extends TileEntityInventoryBase implements IButtonReactor, INumberReactor, INamedContainerProvider { public static final int OKAY_BUTTON_ID = 133; @@ -88,7 +90,7 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt this.slotToPullEnd = Math.max(text, 0); } } - this.markDirty(); + this.setChanged(); } private boolean newPulling() { @@ -132,10 +134,10 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt if (this.sideToPull != -1) { Direction side = WorldUtil.getDirectionBySidesInOrder(this.sideToPull); - BlockPos offset = this.pos.offset(side); + BlockPos offset = this.worldPosition.relative(side); - if (this.world.isBlockLoaded(offset)) { - TileEntity tile = this.world.getTileEntity(offset); + if (this.level.hasChunkAt(offset)) { + TileEntity tile = this.level.getBlockEntity(offset); if (tile != null) { for (Direction facing : Direction.values()) { @@ -168,10 +170,10 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt if (this.sideToPut != -1) { Direction side = WorldUtil.getDirectionBySidesInOrder(this.sideToPut); - BlockPos offset = this.pos.offset(side); + BlockPos offset = this.worldPosition.relative(side); - if (this.world.isBlockLoaded(offset)) { - TileEntity tile = this.world.getTileEntity(offset); + if (this.level.hasChunkAt(offset)) { + TileEntity tile = this.level.getBlockEntity(offset); if (tile != null) { for (Direction facing : Direction.values()) { @@ -236,7 +238,7 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt this.sideToPull = 5; } - this.markDirty(); + this.setChanged(); this.saveDataOnChangeOrWorldStart(); } @@ -276,7 +278,7 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt @Override public void updateEntity() { super.updateEntity(); - if (!this.world.isRemote) { + if (!this.level.isClientSide) { //Is Block not powered by Redstone? if (!this.isRedstonePowered) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java index 98fc64e79..551156c09 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java @@ -24,6 +24,8 @@ import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemHandlerHelper; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; + public abstract class TileEntityInventoryBase extends TileEntityBase { public final ItemStackHandlerAA inv; @@ -42,7 +44,7 @@ public abstract class TileEntityInventoryBase extends TileEntityBase { ItemStack slot = slots.getStackInSlot(i); CompoundNBT tagCompound = new CompoundNBT(); if (StackUtil.isValid(slot)) { - slot.write(tagCompound); + slot.save(tagCompound); } tagList.add(tagCompound); } @@ -56,7 +58,7 @@ public abstract class TileEntityInventoryBase extends TileEntityBase { for (int i = 0; i < slots.getSlots(); i++) { CompoundNBT tagCompound = tagList.getCompound(i); slots.setStackInSlot(i, tagCompound.contains("id") - ? ItemStack.read(tagCompound) + ? ItemStack.of(tagCompound) : StackUtil.getEmpty()); } } @@ -92,8 +94,8 @@ public abstract class TileEntityInventoryBase extends TileEntityBase { } @Override - public void markDirty() { - super.markDirty(); + public void setChanged() { + super.setChanged(); if (this.shouldSyncSlots()) { this.sendUpdate(); @@ -137,7 +139,7 @@ public abstract class TileEntityInventoryBase extends TileEntityBase { @Override protected void onContentsChanged(int slot) { super.onContentsChanged(slot); - TileEntityInventoryBase.this.markDirty(); + TileEntityInventoryBase.this.setChanged(); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemViewer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemViewer.java index 5593004ca..286b6ff70 100755 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemViewer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemViewer.java @@ -66,9 +66,9 @@ public class TileEntityItemViewer extends TileEntityBase { IItemHandlerInfo info = TileEntityItemViewer.this.getSwitchedIndexHandler(slot); if (info != null && info.isLoaded() && TileEntityItemViewer.this.isWhitelisted(info, stack, false)) { ItemStack remain = info.handler.insertItem(info.switchedIndex, stack, simulate); - if (!ItemStack.areItemStacksEqual(remain, stack) && !simulate) { - TileEntityItemViewer.this.markDirty(); - TileEntityItemViewer.this.doItemParticle(stack, info.relayInQuestion.getPos(), TileEntityItemViewer.this.connectedRelay.getPos()); + if (!ItemStack.matches(remain, stack) && !simulate) { + TileEntityItemViewer.this.setChanged(); + TileEntityItemViewer.this.doItemParticle(stack, info.relayInQuestion.getBlockPos(), TileEntityItemViewer.this.connectedRelay.getBlockPos()); } return remain; } @@ -83,8 +83,8 @@ public class TileEntityItemViewer extends TileEntityBase { if (info != null && info.isLoaded() && TileEntityItemViewer.this.isWhitelisted(info, stackIn, true)) { ItemStack extracted = info.handler.extractItem(info.switchedIndex, amount, simulate); if (StackUtil.isValid(extracted) && !simulate) { - TileEntityItemViewer.this.markDirty(); - TileEntityItemViewer.this.doItemParticle(extracted, TileEntityItemViewer.this.connectedRelay.getPos(), info.relayInQuestion.getPos()); + TileEntityItemViewer.this.setChanged(); + TileEntityItemViewer.this.doItemParticle(extracted, TileEntityItemViewer.this.connectedRelay.getBlockPos(), info.relayInQuestion.getBlockPos()); } return extracted; } @@ -153,9 +153,9 @@ public class TileEntityItemViewer extends TileEntityBase { } public void doItemParticle(ItemStack stack, BlockPos input, BlockPos output) { - if (!this.world.isRemote) { + if (!this.level.isClientSide) { CompoundNBT compound = new CompoundNBT(); - stack.write(compound); + stack.save(compound); compound.putDouble("InX", input.getX()); compound.putDouble("InY", input.getY()); @@ -166,9 +166,9 @@ public class TileEntityItemViewer extends TileEntityBase { compound.putDouble("OutZ", output.getZ()); int rangeSq = 16 * 16; - for (PlayerEntity player : this.world.getPlayers()) { + for (PlayerEntity player : this.level.players()) { if (player instanceof ServerPlayerEntity) { - if (player.getDistanceSq(input.getX(), input.getY(), input.getZ()) <= rangeSq || player.getDistanceSq(output.getX(), output.getY(), output.getZ()) <= rangeSq) { + if (player.distanceToSqr(input.getX(), input.getY(), input.getZ()) <= rangeSq || player.distanceToSqr(output.getX(), output.getY(), output.getZ()) <= rangeSq) { PacketHandler.sendTo(new PacketServerToClient(compound, PacketHandler.LASER_PARTICLE_HANDLER), (ServerPlayerEntity) player); } } @@ -249,13 +249,13 @@ public class TileEntityItemViewer extends TileEntityBase { @Override public void saveDataOnChangeOrWorldStart() { TileEntityLaserRelayItem tileFound = null; - if (this.world != null) { //Why is that even possible..? + if (this.level != null) { //Why is that even possible..? for (int i = 0; i <= 5; i++) { Direction side = WorldUtil.getDirectionBySidesInOrder(i); - BlockPos pos = this.getPos().offset(side); + BlockPos pos = this.getBlockPos().relative(side); - if (this.world.isBlockLoaded(pos)) { - TileEntity tile = this.world.getTileEntity(pos); + if (this.level.hasChunkAt(pos)) { + TileEntity tile = this.level.getBlockEntity(pos); if (tile instanceof TileEntityLaserRelayItem) { if (tileFound != null) { @@ -312,7 +312,7 @@ public class TileEntityItemViewer extends TileEntityBase { } public boolean isLoaded() { - return this.relayInQuestion.hasWorld() && this.relayInQuestion.getWorld().isBlockLoaded(this.relayInQuestion.getPos()); + return this.relayInQuestion.hasLevel() && this.relayInQuestion.getLevel().hasChunkAt(this.relayInQuestion.getBlockPos()); } } @@ -326,7 +326,7 @@ public class TileEntityItemViewer extends TileEntityBase { } public boolean isLoaded() { - return this.relayInQuestion.hasWorld() && this.relayInQuestion.getWorld().isBlockLoaded(this.relayInQuestion.getPos()); + return this.relayInQuestion.hasLevel() && this.relayInQuestion.getLevel().hasChunkAt(this.relayInQuestion.getBlockPos()); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemViewerHopping.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemViewerHopping.java index 6792bdbf6..30734db77 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemViewerHopping.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemViewerHopping.java @@ -42,12 +42,12 @@ public class TileEntityItemViewerHopping extends TileEntityItemViewer { super.updateEntity(); // TODO: [port] validate this is the correct way to get total game time getGameTime - if (!this.world.isRemote && this.world.getWorldInfo().getGameTime() % 10 == 0) { + if (!this.level.isClientSide && this.level.getLevelData().getGameTime() % 10 == 0) { if (this.handlerToPullFrom != null) { WorldUtil.doItemInteraction(this.handlerToPullFrom, this.itemHandler, 4); } else { - if (this.world.getWorldInfo().getGameTime() % 20 == 0) { - List items = this.world.getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(this.pos.getX(), this.pos.getY() + 0.5, this.pos.getZ(), this.pos.getX() + 1, this.pos.getY() + 2, this.pos.getZ() + 1)); + if (this.level.getLevelData().getGameTime() % 20 == 0) { + List items = this.level.getEntitiesOfClass(ItemEntity.class, new AxisAlignedBB(this.worldPosition.getX(), this.worldPosition.getY() + 0.5, this.worldPosition.getZ(), this.worldPosition.getX() + 1, this.worldPosition.getY() + 2, this.worldPosition.getZ() + 1)); if (items != null && !items.isEmpty()) { for (ItemEntity item : items) { if (item != null && item.isAlive()) { @@ -96,7 +96,7 @@ public class TileEntityItemViewerHopping extends TileEntityItemViewer { this.handlerToPullFrom = null; this.handlerToPushTo = null; - TileEntity from = this.world.getTileEntity(this.pos.offset(Direction.UP)); + TileEntity from = this.level.getBlockEntity(this.worldPosition.relative(Direction.UP)); if (from != null && !(from instanceof TileEntityItemViewer)) { LazyOptional normal = from.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, Direction.DOWN); @@ -112,12 +112,12 @@ public class TileEntityItemViewerHopping extends TileEntityItemViewer { this.handlerToPullFrom = new SlotlessableItemHandlerWrapper(normal, slotless); } - BlockState state = this.world.getBlockState(this.pos); - Direction facing = state.get(BlockStateProperties.FACING); + BlockState state = this.level.getBlockState(this.worldPosition); + Direction facing = state.getValue(BlockStateProperties.FACING); - BlockPos toPos = this.pos.offset(facing); - if (this.world.isBlockLoaded(toPos)) { - TileEntity to = this.world.getTileEntity(toPos); + BlockPos toPos = this.worldPosition.relative(facing); + if (this.level.hasChunkAt(toPos)) { + TileEntity to = this.level.getBlockEntity(toPos); if (to != null && !(to instanceof TileEntityItemViewer)) { LazyOptional normal = to.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing.getOpposite()); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelay.java index 40af9cf8b..9b1c68520 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelay.java @@ -30,6 +30,8 @@ import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.items.IItemHandler; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; + public abstract class TileEntityLaserRelay extends TileEntityInventoryBase { public static final int MAX_DISTANCE = 15; @@ -51,14 +53,14 @@ public abstract class TileEntityLaserRelay extends TileEntityInventoryBase { super.readSyncableNBT(compound, type); if (type == NBTType.SYNC) { - ActuallyAdditionsAPI.connectionHandler.removeRelayFromNetwork(this.pos, this.world); + ActuallyAdditionsAPI.connectionHandler.removeRelayFromNetwork(this.worldPosition, this.level); ListNBT list = compound.getList("Connections", 10); if (!list.isEmpty()) { for (int i = 0; i < list.size(); i++) { ConnectionPair pair = new ConnectionPair(); pair.readFromNBT(list.getCompound(i)); - ActuallyAdditionsAPI.connectionHandler.addConnection(pair.getPositions()[0], pair.getPositions()[1], this.type, this.world, pair.doesSuppressRender()); + ActuallyAdditionsAPI.connectionHandler.addConnection(pair.getPositions()[0], pair.getPositions()[1], this.type, this.level, pair.doesSuppressRender()); } } } @@ -71,7 +73,7 @@ public abstract class TileEntityLaserRelay extends TileEntityInventoryBase { if (type == NBTType.SYNC) { ListNBT list = new ListNBT(); - ConcurrentSet connections = ActuallyAdditionsAPI.connectionHandler.getConnectionsFor(this.pos, this.world); + ConcurrentSet connections = ActuallyAdditionsAPI.connectionHandler.getConnectionsFor(this.worldPosition, this.level); if (connections != null && !connections.isEmpty()) { for (IConnectionPair pair : connections) { CompoundNBT tag = new CompoundNBT(); @@ -90,12 +92,12 @@ public abstract class TileEntityLaserRelay extends TileEntityInventoryBase { int range = this.getMaxRange(); if (this.lastRange != range) { - ConcurrentSet connections = ActuallyAdditionsAPI.connectionHandler.getConnectionsFor(this.pos, this.world); + ConcurrentSet connections = ActuallyAdditionsAPI.connectionHandler.getConnectionsFor(this.worldPosition, this.level); if (connections != null && !connections.isEmpty()) { for (IConnectionPair pair : connections) { - int distanceSq = (int) pair.getPositions()[0].distanceSq(pair.getPositions()[1]); + int distanceSq = (int) pair.getPositions()[0].distSqr(pair.getPositions()[1]); if (distanceSq > range * range) { - ActuallyAdditionsAPI.connectionHandler.removeConnection(this.world, pair.getPositions()[0], pair.getPositions()[1]); + ActuallyAdditionsAPI.connectionHandler.removeConnection(this.level, pair.getPositions()[0], pair.getPositions()[1]); } } } @@ -138,7 +140,7 @@ public abstract class TileEntityLaserRelay extends TileEntityInventoryBase { public Network getNetwork() { if (this.cachedNetwork == null || this.cachedNetwork.changeAmount != this.changeAmountAtCaching) { - this.cachedNetwork = ActuallyAdditionsAPI.connectionHandler.getNetworkFor(this.pos, this.world); + this.cachedNetwork = ActuallyAdditionsAPI.connectionHandler.getNetworkFor(this.worldPosition, this.level); if (this.cachedNetwork != null) { this.changeAmountAtCaching = this.cachedNetwork.changeAmount; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayEnergy.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayEnergy.java index 4eadb7faa..64b26fff1 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayEnergy.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayEnergy.java @@ -36,6 +36,8 @@ import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; + public class TileEntityLaserRelayEnergy extends TileEntityLaserRelay { public static final int CAP = 1000; @@ -117,9 +119,9 @@ public class TileEntityLaserRelayEnergy extends TileEntityLaserRelay { this.receiversAround.clear(); for (Direction side : Direction.values()) { - BlockPos pos = this.getPos().offset(side); - if (this.world.isBlockLoaded(pos)) { - TileEntity tile = this.world.getTileEntity(pos); + BlockPos pos = this.getBlockPos().relative(side); + if (this.level.hasChunkAt(pos)) { + TileEntity tile = this.level.getBlockEntity(pos); if (tile != null && !(tile instanceof TileEntityLaserRelay)) { if (tile.getCapability(CapabilityEnergy.ENERGY, side.getOpposite()).isPresent()) { this.receiversAround.put(side, tile); @@ -151,9 +153,9 @@ public class TileEntityLaserRelayEnergy extends TileEntityLaserRelay { for (IConnectionPair pair : network.connections) { for (BlockPos relay : pair.getPositions()) { - if (relay != null && this.world.isBlockLoaded(relay) && !alreadyChecked.contains(relay)) { + if (relay != null && this.level.hasChunkAt(relay) && !alreadyChecked.contains(relay)) { alreadyChecked.add(relay); - TileEntity relayTile = this.world.getTileEntity(relay); + TileEntity relayTile = this.level.getBlockEntity(relay); if (relayTile instanceof TileEntityLaserRelayEnergy) { TileEntityLaserRelayEnergy theRelay = (TileEntityLaserRelayEnergy) relayTile; if (theRelay.mode != Mode.INPUT_ONLY) { @@ -196,8 +198,8 @@ public class TileEntityLaserRelayEnergy extends TileEntityLaserRelay { Direction side = receiver.getKey(); Direction opp = side.getOpposite(); TileEntity tile = receiver.getValue(); - if (!alreadyChecked.contains(tile.getPos())) { - alreadyChecked.add(tile.getPos()); + if (!alreadyChecked.contains(tile.getBlockPos())) { + alreadyChecked.add(tile.getBlockPos()); if (theRelay != this || side != from) { transmitted += tile.getCapability(CapabilityEnergy.ENERGY, opp).map(cap -> { int trans = 0; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayFluids.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayFluids.java index d38163e0c..75f29c20e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayFluids.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayFluids.java @@ -37,6 +37,9 @@ import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; +import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction; + public class TileEntityLaserRelayFluids extends TileEntityLaserRelay { public final ConcurrentHashMap handlersAround = new ConcurrentHashMap<>(); @@ -96,7 +99,7 @@ public class TileEntityLaserRelayFluids extends TileEntityLaserRelay { public void updateEntity() { super.updateEntity(); - if (!this.world.isRemote) { + if (!this.level.isClientSide) { if (this.mode == Mode.INPUT_ONLY) { for (Direction side : this.handlersAround.keySet()) { WorldUtil.doFluidInteraction(this.handlersAround.get(side), this, side.getOpposite(), Integer.MAX_VALUE); @@ -117,9 +120,9 @@ public class TileEntityLaserRelayFluids extends TileEntityLaserRelay { this.handlersAround.clear(); for (Direction side : Direction.values()) { - BlockPos pos = this.getPos().offset(side); - if (this.world.isBlockLoaded(pos)) { - TileEntity tile = this.world.getTileEntity(pos); + BlockPos pos = this.getBlockPos().relative(side); + if (this.level.hasChunkAt(pos)) { + TileEntity tile = this.level.getBlockEntity(pos); if (tile != null && !(tile instanceof TileEntityLaserRelay)) { if (tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side.getOpposite()).isPresent()) { this.handlersAround.put(side, tile); @@ -170,9 +173,9 @@ public class TileEntityLaserRelayFluids extends TileEntityLaserRelay { for (IConnectionPair pair : network.connections) { for (BlockPos relay : pair.getPositions()) { - if (relay != null && this.world.isBlockLoaded(relay) && !alreadyChecked.contains(relay)) { + if (relay != null && this.level.hasChunkAt(relay) && !alreadyChecked.contains(relay)) { alreadyChecked.add(relay); - TileEntity relayTile = this.world.getTileEntity(relay); + TileEntity relayTile = this.level.getBlockEntity(relay); if (relayTile instanceof TileEntityLaserRelayFluids) { TileEntityLaserRelayFluids theRelay = (TileEntityLaserRelayFluids) relayTile; if (theRelay.mode != Mode.INPUT_ONLY) { @@ -211,8 +214,8 @@ public class TileEntityLaserRelayFluids extends TileEntityLaserRelay { Direction side = receiver.getKey(); Direction opp = side.getOpposite(); TileEntity tile = receiver.getValue(); - if (!alreadyChecked.contains(tile.getPos())) { - alreadyChecked.add(tile.getPos()); + if (!alreadyChecked.contains(tile.getBlockPos())) { + alreadyChecked.add(tile.getBlockPos()); if (theRelay != this || side != from) { transmitted += tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, opp).map(cap -> { int trans = 0; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItem.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItem.java index 4d73255b9..c7f8f0d87 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItem.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItem.java @@ -35,6 +35,8 @@ import net.minecraftforge.items.IItemHandler; import java.util.*; import java.util.concurrent.ConcurrentHashMap; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; + public class TileEntityLaserRelayItem extends TileEntityLaserRelay { public final Map handlersAround = new ConcurrentHashMap<>(); @@ -69,9 +71,9 @@ public class TileEntityLaserRelayItem extends TileEntityLaserRelay { this.handlersAround.clear(); for (int i = 0; i <= 5; i++) { Direction side = WorldUtil.getDirectionBySidesInOrder(i); - BlockPos pos = this.getPos().offset(side); - if (this.world.isBlockLoaded(pos)) { - TileEntity tile = this.world.getTileEntity(pos); + BlockPos pos = this.getBlockPos().relative(side); + if (this.level.hasChunkAt(pos)) { + TileEntity tile = this.level.getBlockEntity(pos); if (tile != null && !(tile instanceof TileEntityItemViewer) && !(tile instanceof TileEntityLaserRelay)) { LazyOptional itemHandler = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side.getOpposite()); @@ -109,9 +111,9 @@ public class TileEntityLaserRelayItem extends TileEntityLaserRelay { for (IConnectionPair pair : network.connections) { for (BlockPos relay : pair.getPositions()) { - if (relay != null && this.world.isBlockLoaded(relay) && !alreadyChecked.contains(relay)) { + if (relay != null && this.level.hasChunkAt(relay) && !alreadyChecked.contains(relay)) { alreadyChecked.add(relay); - TileEntity aRelayTile = this.world.getTileEntity(relay); + TileEntity aRelayTile = this.level.getBlockEntity(relay); if (aRelayTile instanceof TileEntityLaserRelayItem) { TileEntityLaserRelayItem relayTile = (TileEntityLaserRelayItem) aRelayTile; GenericItemHandlerInfo info = new GenericItemHandlerInfo(relayTile); @@ -153,7 +155,7 @@ public class TileEntityLaserRelayItem extends TileEntityLaserRelay { @Override public void onCompassAction(PlayerEntity player) { - if (player.isSneaking()) { + if (player.isShiftKeyDown()) { this.priority--; } else { this.priority++; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItemWhitelist.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItemWhitelist.java index 1667af7bb..efc64f20d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItemWhitelist.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItemWhitelist.java @@ -29,6 +29,8 @@ import net.minecraft.util.text.StringTextComponent; import javax.annotation.Nullable; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; + public class TileEntityLaserRelayItemWhitelist extends TileEntityLaserRelayItem implements IButtonReactor, INamedContainerProvider { public FilterSettings leftFilter = new FilterSettings(12, true, true, false, false, 0, -1000); @@ -131,7 +133,7 @@ public class TileEntityLaserRelayItemWhitelist extends TileEntityLaserRelayItem public void updateEntity() { super.updateEntity(); - if (!this.world.isRemote) { + if (!this.level.isClientSide) { if ((this.leftFilter.needsUpdateSend() || this.rightFilter.needsUpdateSend()) && this.sendUpdateWithInterval()) { this.leftFilter.updateLasts(); this.rightFilter.updateLasts(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLavaFactoryController.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLavaFactoryController.java index 52ad361cf..dc436af6f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLavaFactoryController.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLavaFactoryController.java @@ -21,6 +21,8 @@ import net.minecraft.util.math.BlockPos; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.energy.IEnergyStorage; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; + public class TileEntityLavaFactoryController extends TileEntityBase implements IEnergyDisplay { public static final int NOT_MULTI = 0; @@ -58,12 +60,12 @@ public class TileEntityLavaFactoryController extends TileEntityBase implements I @Override public void updateEntity() { super.updateEntity(); - if (!this.world.isRemote) { + if (!this.level.isClientSide) { if (this.storage.getEnergyStored() >= ENERGY_USE && this.isMultiblock() == HAS_AIR) { this.currentWorkTime++; if (this.currentWorkTime >= 200) { this.currentWorkTime = 0; - this.world.setBlockState(this.pos.up(), Blocks.LAVA.getDefaultState(), 2); + this.level.setBlock(this.worldPosition.above(), Blocks.LAVA.defaultBlockState(), 2); this.storage.extractEnergyInternal(ENERGY_USE, false); } } else { @@ -77,17 +79,17 @@ public class TileEntityLavaFactoryController extends TileEntityBase implements I } public int isMultiblock() { - BlockPos thisPos = this.pos; - BlockPos[] positions = new BlockPos[]{thisPos.add(1, 1, 0), thisPos.add(-1, 1, 0), thisPos.add(0, 1, 1), thisPos.add(0, 1, -1)}; + BlockPos thisPos = this.worldPosition; + BlockPos[] positions = new BlockPos[]{thisPos.offset(1, 1, 0), thisPos.offset(-1, 1, 0), thisPos.offset(0, 1, 1), thisPos.offset(0, 1, -1)}; - if (this.world != null && WorldUtil.hasBlocksInPlacesGiven(positions, ActuallyBlocks.LAVA_CASING.get(), this.world)) { - BlockPos pos = thisPos.up(); - BlockState state = this.world.getBlockState(pos); + if (this.level != null && WorldUtil.hasBlocksInPlacesGiven(positions, ActuallyBlocks.LAVA_CASING.get(), this.level)) { + BlockPos pos = thisPos.above(); + BlockState state = this.level.getBlockState(pos); Block block = state.getBlock(); if (block == Blocks.LAVA) { return HAS_LAVA; } - if (this.world.isAirBlock(pos)) { + if (this.level.isEmptyBlock(pos)) { return HAS_AIR; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java index 53bd42196..f9bb892d5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java @@ -26,6 +26,8 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; + public class TileEntityLeafGenerator extends TileEntityBase implements ISharingEnergyProvider, IEnergyDisplay { public final CustomEnergyStorage storage = new CustomEnergyStorage(35000, 0, 450); @@ -52,7 +54,7 @@ public class TileEntityLeafGenerator extends TileEntityBase implements ISharingE @Override public void updateEntity() { super.updateEntity(); - if (!this.world.isRemote) { + if (!this.level.isClientSide) { if (!this.isRedstonePowered) { if (this.nextUseCounter >= ConfigIntValues.LEAF_GENERATOR_COOLDOWN.getValue()) { @@ -66,8 +68,8 @@ public class TileEntityLeafGenerator extends TileEntityBase implements ISharingE for (int reachX = -range; reachX < range + 1; reachX++) { for (int reachZ = -range; reachZ < range + 1; reachZ++) { for (int reachY = -range; reachY < range + 1; reachY++) { - BlockPos pos = this.pos.add(reachX, reachY, reachZ); - Block block = this.world.getBlockState(pos).getBlock(); + BlockPos pos = this.worldPosition.offset(reachX, reachY, reachZ); + Block block = this.level.getBlockState(pos).getBlock(); if (block instanceof LeavesBlock) { // TODO: [port] validate this is a good way of checking if something is a leaf breakPositions.add(pos); } @@ -79,13 +81,13 @@ public class TileEntityLeafGenerator extends TileEntityBase implements ISharingE Collections.shuffle(breakPositions); BlockPos theCoord = breakPositions.get(0); - this.world.playEvent(2001, theCoord, Block.getStateId(this.world.getBlockState(theCoord))); + this.level.levelEvent(2001, theCoord, Block.getId(this.level.getBlockState(theCoord))); - this.world.setBlockState(theCoord, Blocks.AIR.getDefaultState()); + this.level.setBlockAndUpdate(theCoord, Blocks.AIR.defaultBlockState()); this.storage.receiveEnergyInternal(energyProduced, false); - AssetUtil.spawnLaserWithTimeServer(this.world, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), theCoord.getX(), theCoord.getY(), theCoord.getZ(), new float[]{62F / 255F, 163F / 255F, 74F / 255F}, 25, 0, 0.075F, 0.8F); + AssetUtil.spawnLaserWithTimeServer(this.level, this.getBlockPos().getX(), this.getBlockPos().getY(), this.getBlockPos().getZ(), theCoord.getX(), theCoord.getY(), theCoord.getZ(), new float[]{62F / 255F, 163F / 255F, 74F / 255F}, 25, 0, 0.075F, 0.8F); } } } else { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityMiner.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityMiner.java index cf43c5ed1..e1bcfc205 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityMiner.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityMiner.java @@ -42,6 +42,8 @@ import net.minecraftforge.fluids.IFluidBlock; import javax.annotation.Nullable; import java.util.List; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; + public class TileEntityMiner extends TileEntityInventoryBase implements IButtonReactor, IEnergyDisplay, INamedContainerProvider { public static final int ENERGY_USE_PER_BLOCK = 650; @@ -90,13 +92,13 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IButtonR @Override public void updateEntity() { super.updateEntity(); - if (!this.world.isRemote) { + if (!this.level.isClientSide) { if (!this.isRedstonePowered && this.ticksElapsed % 5 == 0) { if (this.checkY != 0) { - int range = TileEntityPhantomface.upgradeRange(DEFAULT_RANGE, this.world, this.pos); + int range = TileEntityPhantomface.upgradeRange(DEFAULT_RANGE, this.level, this.worldPosition); if (this.checkY < 0) { - this.checkY = this.pos.getY() - 1; + this.checkY = this.worldPosition.getY() - 1; this.checkX = -range; this.checkZ = -range; } @@ -131,23 +133,23 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IButtonR ? 3 : 1); if (this.storage.getEnergyStored() >= actualUse) { - BlockPos pos = new BlockPos(this.pos.getX() + this.checkX, this.checkY, this.pos.getZ() + this.checkZ); + BlockPos pos = new BlockPos(this.worldPosition.getX() + this.checkX, this.checkY, this.worldPosition.getZ() + this.checkZ); - BlockState state = this.world.getBlockState(pos); + BlockState state = this.level.getBlockState(pos); Block block = state.getBlock(); - ItemStack stack = block.getPickBlock(state, new BlockRayTraceResult(new Vector3d(0, 0, 0), Direction.DOWN, pos, false), this.world, pos, FakePlayerFactory.getMinecraft((ServerWorld) this.world)); - if (!block.isAir(this.world.getBlockState(pos), this.world, pos)) { - if (block.getHarvestLevel(this.world.getBlockState(pos)) <= ItemDrill.HARVEST_LEVEL && state.getBlockHardness(this.world, pos) >= 0F && !(block instanceof IFluidBlock) && this.isMinable(block, stack)) { - List drops = Block.getDrops(state, (ServerWorld) this.world, pos, this.world.getTileEntity(pos)); - float chance = WorldUtil.fireFakeHarvestEventsForDropChance(this, drops, this.world, pos); + ItemStack stack = block.getPickBlock(state, new BlockRayTraceResult(new Vector3d(0, 0, 0), Direction.DOWN, pos, false), this.level, pos, FakePlayerFactory.getMinecraft((ServerWorld) this.level)); + if (!block.isAir(this.level.getBlockState(pos), this.level, pos)) { + if (block.getHarvestLevel(this.level.getBlockState(pos)) <= ItemDrill.HARVEST_LEVEL && state.getDestroySpeed(this.level, pos) >= 0F && !(block instanceof IFluidBlock) && this.isMinable(block, stack)) { + List drops = Block.getDrops(state, (ServerWorld) this.level, pos, this.level.getBlockEntity(pos)); + float chance = WorldUtil.fireFakeHarvestEventsForDropChance(this, drops, this.level, pos); - if (chance > 0 && this.world.rand.nextFloat() <= chance) { + if (chance > 0 && this.level.random.nextFloat() <= chance) { if (StackUtil.canAddAll(this.inv, drops, false)) { - this.world.playEvent(2001, pos, Block.getStateId(this.world.getBlockState(pos))); - this.world.setBlockState(pos, Blocks.AIR.getDefaultState()); + this.level.levelEvent(2001, pos, Block.getId(this.level.getBlockState(pos))); + this.level.setBlockAndUpdate(pos, Blocks.AIR.defaultBlockState()); StackUtil.addAll(this.inv, drops, false); - this.markDirty(); + this.setChanged(); this.storage.extractEnergyInternal(actualUse, false); this.shootParticles(pos.getX(), pos.getY(), pos.getZ()); @@ -196,7 +198,7 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IButtonR } private void shootParticles(int endX, int endY, int endZ) { - AssetUtil.spawnLaserWithTimeServer(this.world, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), endX, endY, endZ, new float[]{65F / 255F, 150F / 255F, 2F / 255F}, 10, 120, 0.1F, 0.8F); + AssetUtil.spawnLaserWithTimeServer(this.level, this.getBlockPos().getX(), this.getBlockPos().getY(), this.getBlockPos().getZ(), endX, endY, endZ, new float[]{65F / 255F, 150F / 255F, 2F / 255F}, 10, 120, 0.1F, 0.8F); } private boolean isBlacklisted(Block block) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityOilGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityOilGenerator.java index 45ed5d2bb..ebd5bb226 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityOilGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityOilGenerator.java @@ -36,6 +36,9 @@ import net.minecraftforge.fluids.capability.templates.FluidTank; import javax.annotation.Nonnull; import javax.annotation.Nullable; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; +import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction; + public class TileEntityOilGenerator extends TileEntityBase implements ISharingEnergyProvider, ISharingFluidHandler, INamedContainerProvider { int[] i = ConfigIntListValues.OIL_POWER.getValue(); @@ -132,7 +135,7 @@ public class TileEntityOilGenerator extends TileEntityBase implements ISharingEn @Override public void updateEntity() { super.updateEntity(); - if (!this.world.isRemote) { + if (!this.level.isClientSide) { boolean flag = this.currentBurnTime > 0; if (this.currentBurnTime > 0 && this.currentEnergyProduce > 0) { @@ -159,7 +162,7 @@ public class TileEntityOilGenerator extends TileEntityBase implements ISharingEn if (flag != this.currentBurnTime > 0 || this.lastCompare != this.getComparatorStrength()) { this.lastCompare = this.getComparatorStrength(); - this.markDirty(); + this.setChanged(); } if ((this.storage.getEnergyStored() != this.lastEnergy || this.tank.getFluidAmount() != this.lastTank || this.lastBurnTime != this.currentBurnTime || this.lastEnergyProduce != this.currentEnergyProduce || this.lastMaxBurnTime != this.maxBurnTime) && this.sendUpdateWithInterval()) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomEnergyface.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomEnergyface.java index dcc8e7826..3c09681ba 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomEnergyface.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomEnergyface.java @@ -26,7 +26,7 @@ public class TileEntityPhantomEnergyface extends TileEntityPhantomface implement @Override public boolean isBoundThingInRange() { if (super.isBoundThingInRange()) { - TileEntity tile = this.world.getTileEntity(this.boundPosition); + TileEntity tile = this.level.getBlockEntity(this.boundPosition); if (tile != null && !(tile instanceof TileEntityLaserRelayEnergy)) { for (Direction facing : Direction.values()) { if (tile.getCapability(CapabilityEnergy.ENERGY, facing).isPresent()) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomItemface.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomItemface.java index ee5cb06da..d68ff3f43 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomItemface.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomItemface.java @@ -33,7 +33,7 @@ public class TileEntityPhantomItemface extends TileEntityPhantomface { @Override public boolean isBoundThingInRange() { if (super.isBoundThingInRange()) { - TileEntity tile = this.world.getTileEntity(this.getBoundPosition()); + TileEntity tile = this.level.getBlockEntity(this.getBoundPosition()); if (tile != null) { for (Direction facing : Direction.values()) { if (tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing).isPresent()) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomLiquiface.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomLiquiface.java index 8f30b61a6..6357c4e16 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomLiquiface.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomLiquiface.java @@ -26,7 +26,7 @@ public class TileEntityPhantomLiquiface extends TileEntityPhantomface implements @Override public boolean isBoundThingInRange() { if (super.isBoundThingInRange()) { - TileEntity tile = this.world.getTileEntity(this.boundPosition); + TileEntity tile = this.level.getBlockEntity(this.boundPosition); if (tile != null && !(tile instanceof TileEntityLaserRelayFluids)) { for (Direction facing : Direction.values()) { if (tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, facing).isPresent()) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomPlacer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomPlacer.java index 3dc3269a2..f70d154b6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomPlacer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomPlacer.java @@ -38,6 +38,8 @@ import net.minecraft.world.server.ServerWorld; import javax.annotation.Nullable; import java.util.List; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; + public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements IPhantomTile, IButtonReactor, INamedContainerProvider { public static final int RANGE = 3; @@ -83,7 +85,7 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements this.range = compound.getInt("Range"); if (!(x == 0 && y == 0 && z == 0)) { this.boundPosition = new BlockPos(x, y, z); - this.markDirty(); + this.setChanged(); } if (!this.isBreaker) { this.side = compound.getInt("Side"); @@ -94,8 +96,8 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements @Override public void updateEntity() { super.updateEntity(); - if (!this.world.isRemote) { - this.range = TileEntityPhantomface.upgradeRange(RANGE, this.world, this.pos); + if (!this.level.isClientSide) { + this.range = TileEntityPhantomface.upgradeRange(RANGE, this.level, this.worldPosition); if (!this.hasBoundPosition()) { this.boundPosition = null; @@ -130,11 +132,11 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements @Override public boolean hasBoundPosition() { if (this.boundPosition != null) { - if (this.world.getTileEntity(this.boundPosition) instanceof IPhantomTile || this.getPos().getX() == this.boundPosition.getX() && this.getPos().getY() == this.boundPosition.getY() && this.getPos().getZ() == this.boundPosition.getZ() && this.world.getDimensionType() == this.world.getDimensionType()) { + if (this.level.getBlockEntity(this.boundPosition) instanceof IPhantomTile || this.getBlockPos().getX() == this.boundPosition.getX() && this.getBlockPos().getY() == this.boundPosition.getY() && this.getBlockPos().getZ() == this.boundPosition.getZ() && this.level.dimensionType() == this.level.dimensionType()) { this.boundPosition = null; return false; } - return this.world.getDimensionType() == this.world.getDimensionType(); + return this.level.dimensionType() == this.level.dimensionType(); } return false; } @@ -142,15 +144,15 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements private void doWork() { if (this.isBoundThingInRange()) { if (this.isBreaker) { - Block blockToBreak = this.world.getBlockState(this.boundPosition).getBlock(); - if (blockToBreak != null && this.world.getBlockState(this.boundPosition).getBlockHardness(this.world, this.boundPosition) > -1.0F) { - List drops = Block.getDrops(this.world.getBlockState(this.boundPosition), (ServerWorld) this.world, this.pos, this.world.getTileEntity(this.pos)); + Block blockToBreak = this.level.getBlockState(this.boundPosition).getBlock(); + if (blockToBreak != null && this.level.getBlockState(this.boundPosition).getDestroySpeed(this.level, this.boundPosition) > -1.0F) { + List drops = Block.getDrops(this.level.getBlockState(this.boundPosition), (ServerWorld) this.level, this.worldPosition, this.level.getBlockEntity(this.worldPosition)); if (StackUtil.canAddAll(this.inv, drops, false)) { - this.world.playEvent(2001, this.boundPosition, Block.getStateId(this.world.getBlockState(this.boundPosition))); - this.world.setBlockState(this.boundPosition, Blocks.AIR.getDefaultState()); + this.level.levelEvent(2001, this.boundPosition, Block.getId(this.level.getBlockState(this.boundPosition))); + this.level.setBlockAndUpdate(this.boundPosition, Blocks.AIR.defaultBlockState()); StackUtil.addAll(this.inv, drops, false); - this.markDirty(); + this.setChanged(); } } } else { @@ -158,28 +160,28 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements if (theSlot == -1) { return; } - this.inv.setStackInSlot(theSlot, WorldUtil.useItemAtSide(WorldUtil.getDirectionBySidesInOrder(this.side), this.world, this.boundPosition, this.inv.getStackInSlot(theSlot))); + this.inv.setStackInSlot(theSlot, WorldUtil.useItemAtSide(WorldUtil.getDirectionBySidesInOrder(this.side), this.level, this.boundPosition, this.inv.getStackInSlot(theSlot))); } } } public void renderParticles() { - if (this.world.rand.nextInt(2) == 0) { - double d1 = this.boundPosition.getY() + this.world.rand.nextFloat(); - int i1 = this.world.rand.nextInt(2) * 2 - 1; - int j1 = this.world.rand.nextInt(2) * 2 - 1; - double d4 = (this.world.rand.nextFloat() - 0.5D) * 0.125D; + if (this.level.random.nextInt(2) == 0) { + double d1 = this.boundPosition.getY() + this.level.random.nextFloat(); + int i1 = this.level.random.nextInt(2) * 2 - 1; + int j1 = this.level.random.nextInt(2) * 2 - 1; + double d4 = (this.level.random.nextFloat() - 0.5D) * 0.125D; double d2 = this.boundPosition.getZ() + 0.5D + 0.25D * j1; - double d5 = this.world.rand.nextFloat() * 1.0F * j1; + double d5 = this.level.random.nextFloat() * 1.0F * j1; double d0 = this.boundPosition.getX() + 0.5D + 0.25D * i1; - double d3 = this.world.rand.nextFloat() * 1.0F * i1; - this.world.addParticle(ParticleTypes.PORTAL, d0, d1, d2, d3, d4, d5); + double d3 = this.level.random.nextFloat() * 1.0F * i1; + this.level.addParticle(ParticleTypes.PORTAL, d0, d1, d2, d3, d4, d5); } } @Override public boolean isBoundThingInRange() { - return this.hasBoundPosition() && this.boundPosition.distanceSq(this.pos) <= this.range * this.range; + return this.hasBoundPosition() && this.boundPosition.distSqr(this.worldPosition) <= this.range * this.range; } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomRedstoneface.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomRedstoneface.java index 82aca9372..06ef0febb 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomRedstoneface.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomRedstoneface.java @@ -31,16 +31,16 @@ public class TileEntityPhantomRedstoneface extends TileEntityPhantomface { @Override public void updateEntity() { - if (!this.world.isRemote) { + if (!this.level.isClientSide) { if (this.isBoundThingInRange()) { - BlockState boundState = this.world.getBlockState(this.boundPosition); + BlockState boundState = this.level.getBlockState(this.boundPosition); if (boundState != null) { Block boundBlock = boundState.getBlock(); if (boundBlock != null) { for (int i = 0; i < Direction.values().length; i++) { Direction facing = Direction.values()[i]; - this.providesWeak[i] = boundState.getWeakPower(this.world, this.boundPosition, facing); - this.providesStrong[i] = boundState.getStrongPower(this.world, this.boundPosition, facing); + this.providesWeak[i] = boundState.getSignal(this.level, this.boundPosition, facing); + this.providesStrong[i] = boundState.getDirectSignal(this.level, this.boundPosition, facing); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomface.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomface.java index e502479bd..45fefcb31 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomface.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomface.java @@ -30,6 +30,8 @@ import net.minecraftforge.common.util.LazyOptional; import javax.annotation.Nonnull; import javax.annotation.Nullable; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; + public abstract class TileEntityPhantomface extends TileEntityInventoryBase implements IPhantomTile { public static final int RANGE = 16; @@ -48,7 +50,7 @@ public abstract class TileEntityPhantomface extends TileEntityInventoryBase impl public static int upgradeRange(int defaultRange, World world, BlockPos pos) { int newRange = defaultRange; for (int i = 0; i < 3; i++) { - Block block = world.getBlockState(pos.up(1 + i)).getBlock(); + Block block = world.getBlockState(pos.above(1 + i)).getBlock(); if (block == ActuallyBlocks.PHANTOM_BOOSTER.get()) { newRange = newRange * 2; } else { @@ -81,7 +83,7 @@ public abstract class TileEntityPhantomface extends TileEntityInventoryBase impl this.range = compound.getInt("Range"); if (!(x == 0 && y == 0 && z == 0)) { this.boundPosition = new BlockPos(x, y, z); - this.markDirty(); + this.setChanged(); } } } @@ -89,8 +91,8 @@ public abstract class TileEntityPhantomface extends TileEntityInventoryBase impl @Override public void updateEntity() { super.updateEntity(); - if (!this.world.isRemote) { - this.range = upgradeRange(RANGE, this.world, this.getPos()); + if (!this.level.isClientSide) { + this.range = upgradeRange(RANGE, this.level, this.getBlockPos()); if (!this.hasBoundPosition()) { this.boundPosition = null; @@ -104,7 +106,7 @@ public abstract class TileEntityPhantomface extends TileEntityInventoryBase impl if (this.lastStrength != strength) { this.lastStrength = strength; - this.markDirty(); + this.setChanged(); } } else { if (this.boundPosition != null) { @@ -114,7 +116,7 @@ public abstract class TileEntityPhantomface extends TileEntityInventoryBase impl } protected boolean doesNeedUpdateSend() { - return this.boundPosition != this.boundPosBefore || this.boundPosition != null && this.world.getBlockState(this.boundPosition).getBlock() != this.boundBlockBefore || this.rangeBefore != this.range; + return this.boundPosition != this.boundPosBefore || this.boundPosition != null && this.level.getBlockState(this.boundPosition).getBlock() != this.boundBlockBefore || this.rangeBefore != this.range; } protected void onUpdateSent() { @@ -122,20 +124,20 @@ public abstract class TileEntityPhantomface extends TileEntityInventoryBase impl this.boundPosBefore = this.boundPosition; this.boundBlockBefore = this.boundPosition == null ? null - : this.world.getBlockState(this.boundPosition).getBlock(); + : this.level.getBlockState(this.boundPosition).getBlock(); if (this.boundPosition != null) { - this.world.notifyNeighborsOfStateChange(this.pos, this.world.getBlockState(this.boundPosition).getBlock()); + this.level.updateNeighborsAt(this.worldPosition, this.level.getBlockState(this.boundPosition).getBlock()); } this.sendUpdate(); - this.markDirty(); + this.setChanged(); } @Override public boolean hasBoundPosition() { if (this.boundPosition != null) { - if (this.world.getTileEntity(this.boundPosition) instanceof IPhantomTile || this.getPos().getX() == this.boundPosition.getX() && this.getPos().getY() == this.boundPosition.getY() && this.getPos().getZ() == this.boundPosition.getZ()) { + if (this.level.getBlockEntity(this.boundPosition) instanceof IPhantomTile || this.getBlockPos().getX() == this.boundPosition.getX() && this.getBlockPos().getY() == this.boundPosition.getY() && this.getBlockPos().getZ() == this.boundPosition.getZ()) { this.boundPosition = null; return false; } @@ -146,22 +148,22 @@ public abstract class TileEntityPhantomface extends TileEntityInventoryBase impl @OnlyIn(Dist.CLIENT) public void renderParticles() { - if (this.world.rand.nextInt(2) == 0) { - double d1 = this.boundPosition.getY() + this.world.rand.nextFloat(); - int i1 = this.world.rand.nextInt(2) * 2 - 1; - int j1 = this.world.rand.nextInt(2) * 2 - 1; - double d4 = (this.world.rand.nextFloat() - 0.5D) * 0.125D; + if (this.level.random.nextInt(2) == 0) { + double d1 = this.boundPosition.getY() + this.level.random.nextFloat(); + int i1 = this.level.random.nextInt(2) * 2 - 1; + int j1 = this.level.random.nextInt(2) * 2 - 1; + double d4 = (this.level.random.nextFloat() - 0.5D) * 0.125D; double d2 = this.boundPosition.getZ() + 0.5D + 0.25D * j1; - double d5 = this.world.rand.nextFloat() * 1.0F * j1; + double d5 = this.level.random.nextFloat() * 1.0F * j1; double d0 = this.boundPosition.getX() + 0.5D + 0.25D * i1; - double d3 = this.world.rand.nextFloat() * 1.0F * i1; - this.world.addParticle(ParticleTypes.PORTAL, d0, d1, d2, d3, d4, d5); + double d3 = this.level.random.nextFloat() * 1.0F * i1; + this.level.addParticle(ParticleTypes.PORTAL, d0, d1, d2, d3, d4, d5); } } @Override public boolean isBoundThingInRange() { - return this.hasBoundPosition() && this.boundPosition.distanceSq(this.getPos()) <= this.range * this.range; + return this.hasBoundPosition() && this.boundPosition.distSqr(this.getBlockPos()) <= this.range * this.range; } @Override @@ -190,7 +192,7 @@ public abstract class TileEntityPhantomface extends TileEntityInventoryBase impl @Override public LazyOptional getCapability(@Nonnull Capability capability, @Nullable Direction side) { if (this.isBoundThingInRange() && this.isCapabilitySupported(capability)) { - TileEntity tile = this.world.getTileEntity(this.getBoundPosition()); + TileEntity tile = this.level.getBlockEntity(this.getBoundPosition()); if (tile != null) { return tile.getCapability(capability, side); } @@ -203,10 +205,10 @@ public abstract class TileEntityPhantomface extends TileEntityInventoryBase impl public int getComparatorStrength() { if (this.isBoundThingInRange()) { BlockPos pos = this.getBoundPosition(); - BlockState state = this.world.getBlockState(pos); + BlockState state = this.level.getBlockState(pos); - if (state.hasComparatorInputOverride()) { - return state.getComparatorInputOverride(this.world, pos); + if (state.hasAnalogOutputSignal()) { + return state.getAnalogOutputSignal(this.level, pos); } } return 0; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPlayerInterface.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPlayerInterface.java index 02f41dad3..91462576c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPlayerInterface.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPlayerInterface.java @@ -23,6 +23,8 @@ import net.minecraftforge.items.wrapper.PlayerInvWrapper; import java.util.UUID; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; + public class TileEntityPlayerInterface extends TileEntityBase implements IEnergyDisplay { public static final int DEFAULT_RANGE = 32; @@ -40,10 +42,10 @@ public class TileEntityPlayerInterface extends TileEntityBase implements IEnergy } private PlayerEntity getPlayer() { - if (this.connectedPlayer != null && this.world != null) { - PlayerEntity player = this.world.getPlayerByUuid(this.connectedPlayer); + if (this.connectedPlayer != null && this.level != null) { + PlayerEntity player = this.level.getPlayerByUUID(this.connectedPlayer); if (player != null) { - if (player.getDistanceSq(this.pos.getX(), this.pos.getY(), this.pos.getZ()) <= this.range) { + if (player.distanceToSqr(this.worldPosition.getX(), this.worldPosition.getY(), this.worldPosition.getZ()) <= this.range) { return player; } } @@ -70,16 +72,16 @@ public class TileEntityPlayerInterface extends TileEntityBase implements IEnergy @Override public void updateEntity() { super.updateEntity(); - if (!this.world.isRemote) { + if (!this.level.isClientSide) { boolean changed = false; - this.range = TileEntityPhantomface.upgradeRange(DEFAULT_RANGE, this.world, this.pos); + this.range = TileEntityPhantomface.upgradeRange(DEFAULT_RANGE, this.level, this.worldPosition); PlayerEntity player = this.getPlayer(); if (player != null) { - for (int i = 0; i < player.inventory.getSizeInventory(); i++) { + for (int i = 0; i < player.inventory.getContainerSize(); i++) { if (this.storage.getEnergyStored() > 0) { - ItemStack slot = player.inventory.getStackInSlot(i); + ItemStack slot = player.inventory.getItem(i); if (StackUtil.isValid(slot) && slot.getCount() == 1) { int received = slot.getCapability(CapabilityEnergy.ENERGY).map(cap -> cap.receiveEnergy(this.storage.getEnergyStored(), false)).orElse(0); @@ -94,7 +96,7 @@ public class TileEntityPlayerInterface extends TileEntityBase implements IEnergy } if (changed) { - this.markDirty(); + this.setChanged(); this.sendUpdate(); } @@ -110,7 +112,7 @@ public class TileEntityPlayerInterface extends TileEntityBase implements IEnergy this.storage.writeToNBT(compound); if (this.connectedPlayer != null && type != NBTType.SAVE_BLOCK) { - compound.putUniqueId("Player", this.connectedPlayer); + compound.putUUID("Player", this.connectedPlayer); compound.putString("PlayerName", this.playerName); } } @@ -121,7 +123,7 @@ public class TileEntityPlayerInterface extends TileEntityBase implements IEnergy this.storage.readFromNBT(compound); if (compound.contains("PlayerLeast") && type != NBTType.SAVE_BLOCK) { - this.connectedPlayer = compound.getUniqueId("Player"); + this.connectedPlayer = compound.getUUID("Player"); this.playerName = compound.getString("PlayerName"); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityRangedCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityRangedCollector.java index e6e7afc40..27be8e5ed 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityRangedCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityRangedCollector.java @@ -31,6 +31,8 @@ import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; + public class TileEntityRangedCollector extends TileEntityInventoryBase implements IButtonReactor, INamedContainerProvider { public static final int RANGE = 6; @@ -61,17 +63,17 @@ public class TileEntityRangedCollector extends TileEntityInventoryBase implement @Override public void activateOnPulse() { - List items = this.world.getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(this.pos.getX() - RANGE, this.pos.getY() - RANGE, this.pos.getZ() - RANGE, this.pos.getX() + RANGE, this.pos.getY() + RANGE, this.pos.getZ() + RANGE)); + List items = this.level.getEntitiesOfClass(ItemEntity.class, new AxisAlignedBB(this.worldPosition.getX() - RANGE, this.worldPosition.getY() - RANGE, this.worldPosition.getZ() - RANGE, this.worldPosition.getX() + RANGE, this.worldPosition.getY() + RANGE, this.worldPosition.getZ() + RANGE)); if (!items.isEmpty()) { for (ItemEntity item : items) { - if (item.isAlive() && !item.cannotPickup() && StackUtil.isValid(item.getItem())) { + if (item.isAlive() && !item.hasPickUpDelay() && StackUtil.isValid(item.getItem())) { ItemStack toAdd = item.getItem().copy(); if (this.filter.check(toAdd)) { ArrayList checkList = new ArrayList<>(); checkList.add(toAdd); if (StackUtil.canAddAll(this.inv, checkList, false)) { StackUtil.addAll(this.inv, checkList, false); - ((ServerWorld) this.world).spawnParticle(ParticleTypes.CLOUD, item.getPosX(), item.getPosY() + 0.45F, item.getPosZ(), 5, 0, 0, 0, 0.03D); + ((ServerWorld) this.level).sendParticles(ParticleTypes.CLOUD, item.getX(), item.getY() + 0.45F, item.getZ(), 5, 0, 0, 0, 0.03D); item.remove(); } } @@ -83,7 +85,7 @@ public class TileEntityRangedCollector extends TileEntityInventoryBase implement @Override public void updateEntity() { super.updateEntity(); - if (!this.world.isRemote) { + if (!this.level.isClientSide) { if (!this.isRedstonePowered && !this.isPulseMode) { this.activateOnPulse(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityShockSuppressor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityShockSuppressor.java index 9126a8d8f..82890b113 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityShockSuppressor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityShockSuppressor.java @@ -18,6 +18,8 @@ import net.minecraftforge.energy.IEnergyStorage; import java.util.ArrayList; import java.util.List; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; + public class TileEntityShockSuppressor extends TileEntityBase implements IEnergyDisplay { public static final List SUPPRESSORS = new ArrayList<>(); @@ -37,7 +39,7 @@ public class TileEntityShockSuppressor extends TileEntityBase implements IEnergy public void onChunkUnloaded() { super.onChunkUnloaded(); - if (!this.world.isRemote) { + if (!this.level.isClientSide) { SUPPRESSORS.remove(this); } } @@ -46,7 +48,7 @@ public class TileEntityShockSuppressor extends TileEntityBase implements IEnergy public void invalidateCaps() { super.invalidateCaps(); - if (!this.world.isRemote) { + if (!this.level.isClientSide) { SUPPRESSORS.remove(this); } } @@ -56,7 +58,7 @@ public class TileEntityShockSuppressor extends TileEntityBase implements IEnergy public void updateEntity() { super.updateEntity(); - if (!this.world.isRemote) { + if (!this.level.isClientSide) { if (!this.isRemoved() && !SUPPRESSORS.contains(this)) { SUPPRESSORS.add(this); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityXPSolidifier.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityXPSolidifier.java index c780bf59d..cc4cc229b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityXPSolidifier.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityXPSolidifier.java @@ -32,6 +32,8 @@ import net.minecraft.util.text.StringTextComponent; import javax.annotation.Nullable; import java.util.List; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType; + public class TileEntityXPSolidifier extends TileEntityInventoryBase implements IButtonReactor, INamedContainerProvider { private static final int[] XP_MAP = new int[256]; @@ -99,15 +101,15 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I } public static int getPlayerXP(PlayerEntity player) { - return (int) (getExperienceForLevel(player.experienceLevel) + player.experience * player.xpBarCap()); + return (int) (getExperienceForLevel(player.experienceLevel) + player.experienceProgress * player.getXpNeededForNextLevel()); } public static void addPlayerXP(PlayerEntity player, int amount) { int experience = Math.max(0, getPlayerXP(player) + amount); - player.experienceTotal = experience; + player.totalExperience = experience; player.experienceLevel = getLevelForExperience(experience); int expForLevel = getExperienceForLevel(player.experienceLevel); - player.experience = (float) (experience - expForLevel) / (float) player.xpBarCap(); + player.experienceProgress = (float) (experience - expForLevel) / (float) player.getXpNeededForNextLevel(); } @Override @@ -127,37 +129,37 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I @Override public void updateEntity() { super.updateEntity(); - if (!this.world.isRemote) { + if (!this.level.isClientSide) { if (this.amount > 0) { ItemStack stack = this.inv.getStackInSlot(0); if (stack.isEmpty()) { int toSet = Math.min(this.amount, 64); this.inv.setStackInSlot(0, new ItemStack(ActuallyItems.SOLIDIFIED_EXPERIENCE.get(), toSet)); this.amount -= toSet; - this.markDirty(); + this.setChanged(); } else if (stack.getCount() < 64) { int needed = 64 - stack.getCount(); int toAdd = Math.min(needed, this.amount); stack.grow(toAdd); this.amount -= toAdd; - this.markDirty(); + this.setChanged(); } } if (!this.isRedstonePowered) { int range = 5; - List orbs = this.world.getEntitiesWithinAABB(ExperienceOrbEntity.class, new AxisAlignedBB(this.pos.getX() - range, this.pos.getY() - range, this.pos.getZ() - range, this.pos.getX() + 1 + range, this.pos.getY() + 1 + range, this.pos.getZ() + 1 + range)); + List orbs = this.level.getEntitiesOfClass(ExperienceOrbEntity.class, new AxisAlignedBB(this.worldPosition.getX() - range, this.worldPosition.getY() - range, this.worldPosition.getZ() - range, this.worldPosition.getX() + 1 + range, this.worldPosition.getY() + 1 + range, this.worldPosition.getZ() + 1 + range)); if (orbs != null && !orbs.isEmpty()) { for (ExperienceOrbEntity orb : orbs) { // TODO: [port] validate the getPersistentData is correct if (orb != null && orb.isAlive() && !orb.getPersistentData().getBoolean(ActuallyAdditions.MODID + "FromSolidified")) { - this.singlePointAmount += orb.getXpValue(); + this.singlePointAmount += orb.getValue(); orb.remove(); if (this.singlePointAmount >= ItemSolidifiedExperience.SOLID_XP_AMOUNT) { this.amount += this.singlePointAmount / ItemSolidifiedExperience.SOLID_XP_AMOUNT; this.singlePointAmount = 0; - this.markDirty(); + this.setChanged(); } } } @@ -170,7 +172,7 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I if (stack.getCount() >= remainingSpace && remainingSpace != 0) { this.amount += remainingSpace; stack.shrink(remainingSpace); - this.markDirty(); + this.setChanged(); } } @@ -186,11 +188,11 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I } @Override - public void markDirty() { + public void setChanged() { if (this.amount < 0) { this.amount = Integer.MAX_VALUE; //don't u go negative on me weird number } - super.markDirty(); + super.setChanged(); } @Override @@ -203,7 +205,7 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I : this.buttonAmounts[buttonID]; if (this.amount < Integer.MAX_VALUE - xp && playerXP >= ItemSolidifiedExperience.SOLID_XP_AMOUNT * xp) { addPlayerXP(player, -(ItemSolidifiedExperience.SOLID_XP_AMOUNT * xp)); - if (!this.world.isRemote) { + if (!this.level.isClientSide) { this.amount += xp; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/update/UpdateChecker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/update/UpdateChecker.java index 1e1ba89a4..568908fe2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/update/UpdateChecker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/update/UpdateChecker.java @@ -47,11 +47,11 @@ public class UpdateChecker { if (Minecraft.getInstance().player != null) { PlayerEntity player = Minecraft.getInstance().player; if (UpdateChecker.checkFailed) { - player.sendStatusMessage(ITextComponent.Serializer.getComponentFromJson(StringUtil.localize("info." + ActuallyAdditions.MODID + ".update.failed")), false); + player.displayClientMessage(ITextComponent.Serializer.fromJson(StringUtil.localize("info." + ActuallyAdditions.MODID + ".update.failed")), false); } else if (UpdateChecker.needsUpdateNotify) { - player.sendStatusMessage(ITextComponent.Serializer.getComponentFromJson(StringUtil.localize("info." + ActuallyAdditions.MODID + ".update.generic")), false); - player.sendStatusMessage(ITextComponent.Serializer.getComponentFromJson(StringUtil.localizeFormatted("info." + ActuallyAdditions.MODID + ".update.versionCompare", ActuallyAdditions.VERSION, UpdateChecker.updateVersionString)), false); - player.sendStatusMessage(ITextComponent.Serializer.getComponentFromJson(StringUtil.localizeFormatted("info." + ActuallyAdditions.MODID + ".update.buttons", UpdateChecker.CHANGELOG_LINK, UpdateChecker.DOWNLOAD_LINK)), false); + player.displayClientMessage(ITextComponent.Serializer.fromJson(StringUtil.localize("info." + ActuallyAdditions.MODID + ".update.generic")), false); + player.displayClientMessage(ITextComponent.Serializer.fromJson(StringUtil.localizeFormatted("info." + ActuallyAdditions.MODID + ".update.versionCompare", ActuallyAdditions.VERSION, UpdateChecker.updateVersionString)), false); + player.displayClientMessage(ITextComponent.Serializer.fromJson(StringUtil.localizeFormatted("info." + ActuallyAdditions.MODID + ".update.buttons", UpdateChecker.CHANGELOG_LINK, UpdateChecker.DOWNLOAD_LINK)), false); } if (threadFinished) { MinecraftForge.EVENT_BUS.unregister(this); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java index cee03dcbe..406b4c9b0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java @@ -56,7 +56,7 @@ public final class AssetUtil { @OnlyIn(Dist.CLIENT) public static void displayNameString(MatrixStack matrices, FontRenderer font, int xSize, int yPositionOfMachineText, String text) { - font.drawString(matrices, text, xSize / 2f - font.getStringWidth(text) / 2f, yPositionOfMachineText, StringUtil.DECIMAL_COLOR_WHITE); + font.draw(matrices, text, xSize / 2f - font.width(text) / 2f, yPositionOfMachineText, StringUtil.DECIMAL_COLOR_WHITE); } @OnlyIn(Dist.CLIENT) @@ -71,7 +71,7 @@ public final class AssetUtil { @OnlyIn(Dist.CLIENT) public static void renderItemInWorld(ItemStack stack, int combinedLight, int combinedOverlay, MatrixStack matrices, IRenderTypeBuffer buffer) { if (StackUtil.isValid(stack)) { - Minecraft.getInstance().getItemRenderer().renderItem( + Minecraft.getInstance().getItemRenderer().renderStatic( stack, ItemCameraTransforms.TransformType.FIXED, combinedLight, combinedOverlay, matrices, buffer ); } @@ -100,42 +100,42 @@ public final class AssetUtil { IBakedModel model = renderer.getItemModelWithOverrides(stack, null, null); - manager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); + manager.bind(TextureMap.LOCATION_BLOCKS_TEXTURE); manager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false); - GlStateManager.enableRescaleNormal(); - GlStateManager.enableBlend(); - GlStateManager.pushMatrix(); + GlStateManager._enableRescaleNormal(); + GlStateManager._enableBlend(); + GlStateManager._pushMatrix(); model = ForgeHooksClient.handleCameraTransforms(model, TransformType.FIXED, false); renderer.renderItem(stack, model); GlStateManager.cullFace(GlStateManager.CullFace.BACK); - GlStateManager.popMatrix(); - GlStateManager.disableRescaleNormal(); - GlStateManager.disableBlend(); - manager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); + GlStateManager._popMatrix(); + GlStateManager._disableRescaleNormal(); + GlStateManager._disableBlend(); + manager.bind(TextureMap.LOCATION_BLOCKS_TEXTURE); manager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap(); } } @OnlyIn(Dist.CLIENT) public static void renderStackToGui(ItemStack stack, int x, int y, float scale) { - GlStateManager.pushMatrix(); - GlStateManager.enableBlend(); - GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GlStateManager._pushMatrix(); + GlStateManager._enableBlend(); + GlStateManager._blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); RenderHelper.enableGUIStandardItemLighting(); GlStateManager.enableDepth(); - GlStateManager.enableRescaleNormal(); + GlStateManager._enableRescaleNormal(); GlStateManager.translate(x, y, 0); GlStateManager.scale(scale, scale, scale); Minecraft mc = Minecraft.getInstance(); - boolean flagBefore = mc.fontRenderer.getUnicodeFlag(); - mc.fontRenderer.setUnicodeFlag(false); + boolean flagBefore = mc.font.getUnicodeFlag(); + mc.font.setUnicodeFlag(false); Minecraft.getInstance().getRenderItem().renderItemAndEffectIntoGUI(stack, 0, 0); - Minecraft.getInstance().getRenderItem().renderItemOverlayIntoGUI(mc.fontRenderer, stack, 0, 0, null); - mc.fontRenderer.setUnicodeFlag(flagBefore); + Minecraft.getInstance().getRenderItem().renderItemOverlayIntoGUI(mc.font, stack, 0, 0, null); + mc.font.setUnicodeFlag(flagBefore); - RenderHelper.disableStandardItemLighting(); - GlStateManager.popMatrix(); + RenderHelper.turnOff(); + GlStateManager._popMatrix(); } //Copied from Gui.class and changed @@ -150,64 +150,64 @@ public final class AssetUtil { float f6 = (endColor >> 8 & 255) / 255.0F; float f7 = (endColor & 255) / 255.0F; GlStateManager.disableTexture2D(); - GlStateManager.enableBlend(); + GlStateManager._enableBlend(); GlStateManager.disableAlpha(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - GlStateManager.shadeModel(7425); + GlStateManager._shadeModel(7425); Tessellator tessellator = Tessellator.getInstance(); - BufferBuilder renderer = tessellator.getBuffer(); + BufferBuilder renderer = tessellator.getBuilder(); renderer.begin(7, DefaultVertexFormats.POSITION_COLOR); - renderer.pos(left, top, zLevel).color(f1, f2, f3, f).endVertex(); - renderer.pos(left, bottom, zLevel).color(f1, f2, f3, f).endVertex(); - renderer.pos(right, bottom, zLevel).color(f5, f6, f7, f4).endVertex(); - renderer.pos(right, top, zLevel).color(f5, f6, f7, f4).endVertex(); - tessellator.draw(); - GlStateManager.shadeModel(7424); - GlStateManager.disableBlend(); + renderer.vertex(left, top, zLevel).color(f1, f2, f3, f).endVertex(); + renderer.vertex(left, bottom, zLevel).color(f1, f2, f3, f).endVertex(); + renderer.vertex(right, bottom, zLevel).color(f5, f6, f7, f4).endVertex(); + renderer.vertex(right, top, zLevel).color(f5, f6, f7, f4).endVertex(); + tessellator.end(); + GlStateManager._shadeModel(7424); + GlStateManager._disableBlend(); GlStateManager.enableAlpha(); GlStateManager.enableTexture2D(); } @OnlyIn(Dist.CLIENT) public static void renderNameTag(String tag, double x, double y, double z) { - FontRenderer fontrenderer = Minecraft.getInstance().fontRenderer; + FontRenderer fontrenderer = Minecraft.getInstance().font; float f = 1.6F; float f1 = 0.016666668F * f; - GlStateManager.pushMatrix(); + GlStateManager._pushMatrix(); GlStateManager.translate(x, y, z); GL11.glNormal3f(0.0F, 1.0F, 0.0F); - GlStateManager.rotate(-Minecraft.getInstance().getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F); - GlStateManager.rotate(Minecraft.getInstance().getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(-Minecraft.getInstance().getEntityRenderDispatcher().playerViewY, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(Minecraft.getInstance().getEntityRenderDispatcher().playerViewX, 1.0F, 0.0F, 0.0F); GlStateManager.scale(-f1, -f1, f1); - GlStateManager.disableLighting(); - GlStateManager.depthMask(false); + GlStateManager._disableLighting(); + GlStateManager._depthMask(false); GlStateManager.disableDepth(); - GlStateManager.enableBlend(); + GlStateManager._enableBlend(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); Tessellator tessellator = Tessellator.getInstance(); - BufferBuilder renderer = tessellator.getBuffer(); + BufferBuilder renderer = tessellator.getBuilder(); int i = 0; - int j = fontrenderer.getStringWidth(tag) / 2; + int j = fontrenderer.width(tag) / 2; GlStateManager.disableTexture2D(); renderer.begin(7, DefaultVertexFormats.POSITION_COLOR); - renderer.pos(-j - 1, -1 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); - renderer.pos(-j - 1, 8 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); - renderer.pos(j + 1, 8 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); - renderer.pos(j + 1, -1 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); - tessellator.draw(); + renderer.vertex(-j - 1, -1 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + renderer.vertex(-j - 1, 8 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + renderer.vertex(j + 1, 8 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + renderer.vertex(j + 1, -1 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + tessellator.end(); GlStateManager.enableTexture2D(); - fontrenderer.drawString(tag, -fontrenderer.getStringWidth(tag) / 2, i, 553648127); + fontrenderer.draw(tag, -fontrenderer.width(tag) / 2, i, 553648127); GlStateManager.enableDepth(); - GlStateManager.depthMask(true); - fontrenderer.drawString(tag, -fontrenderer.getStringWidth(tag) / 2, i, -1); - GlStateManager.enableLighting(); - GlStateManager.disableBlend(); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - GlStateManager.popMatrix(); + GlStateManager._depthMask(true); + fontrenderer.draw(tag, -fontrenderer.width(tag) / 2, i, -1); + GlStateManager._enableLighting(); + GlStateManager._disableBlend(); + GlStateManager.color3arg(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager._popMatrix(); } public static void spawnLaserWithTimeServer(World world, double startX, double startY, double startZ, double endX, double endY, double endZ, float[] color, int maxAge, double rotationTime, float size, float alpha) { - if (!world.isRemote) { + if (!world.isClientSide) { CompoundNBT data = new CompoundNBT(); data.setDouble("StartX", startX); data.setDouble("StartY", startY); @@ -230,8 +230,8 @@ public final class AssetUtil { public static void spawnLaserWithTimeClient(double startX, double startY, double startZ, double endX, double endY, double endZ, float[] color, int maxAge, double rotationTime, float size, float alpha) { Minecraft mc = Minecraft.getInstance(); - if (mc.player.getDistance(startX, startY, startZ) <= 64 || mc.player.getDistance(endX, endY, endZ) <= 64) { - Particle fx = new ParticleBeam(mc.world, startX, startY, startZ, endX, endY, endZ, color, maxAge, rotationTime, size, alpha); + if (mc.player.distanceTo(startX, startY, startZ) <= 64 || mc.player.distanceTo(endX, endY, endZ) <= 64) { + Particle fx = new ParticleBeam(mc.level, startX, startY, startZ, endX, endY, endZ, color, maxAge, rotationTime, size, alpha); mc.effectRenderer.addEffect(fx); } } @@ -241,8 +241,8 @@ public final class AssetUtil { @OnlyIn(Dist.CLIENT) public static void renderLaser(double firstX, double firstY, double firstZ, double secondX, double secondY, double secondZ, double rotationTime, float alpha, double beamWidth, float[] color) { Tessellator tessy = Tessellator.getInstance(); - BufferBuilder render = tessy.getBuffer(); - World world = Minecraft.getInstance().world; + BufferBuilder render = tessy.getBuilder(); + World world = Minecraft.getInstance().level; float r = color[0]; float g = color[1]; @@ -260,14 +260,14 @@ public final class AssetUtil { double length = combinedVec.length(); - GlStateManager.pushMatrix(); + GlStateManager._pushMatrix(); - GlStateManager.disableLighting(); - GlStateManager.enableBlend(); - GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE); + GlStateManager._disableLighting(); + GlStateManager._enableBlend(); + GlStateManager._blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE); int func = GL11.glGetInteger(GL11.GL_ALPHA_TEST_FUNC); float ref = GL11.glGetFloat(GL11.GL_ALPHA_TEST_REF); - GlStateManager.alphaFunc(GL11.GL_ALWAYS, 0); + GlStateManager._alphaFunc(GL11.GL_ALWAYS, 0); GlStateManager.translate(firstX - TileEntityRendererDispatcher.staticPlayerX, firstY - TileEntityRendererDispatcher.staticPlayerY, firstZ - TileEntityRendererDispatcher.staticPlayerZ); GlStateManager.rotate((float) (180 * yaw / Math.PI), 0, 1, 0); GlStateManager.rotate((float) (180 * pitch / Math.PI), 0, 0, 1); @@ -323,36 +323,36 @@ public final class AssetUtil { render.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_LMAP_COLOR); for (double i = 0; i < 4; i++) { double width = beamWidth * (i / 4.0); - render.pos(length, width, width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex(); - render.pos(0, width, width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex(); - render.pos(0, -width, width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex(); - render.pos(length, -width, width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex(); + render.vertex(length, width, width).uv(0, 0).uv2(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex(); + render.vertex(0, width, width).uv(0, 0).uv2(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex(); + render.vertex(0, -width, width).uv(0, 0).uv2(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex(); + render.vertex(length, -width, width).uv(0, 0).uv2(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex(); - render.pos(length, -width, -width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex(); - render.pos(0, -width, -width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex(); - render.pos(0, width, -width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex(); - render.pos(length, width, -width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex(); + render.vertex(length, -width, -width).uv(0, 0).uv2(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex(); + render.vertex(0, -width, -width).uv(0, 0).uv2(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex(); + render.vertex(0, width, -width).uv(0, 0).uv2(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex(); + render.vertex(length, width, -width).uv(0, 0).uv2(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex(); - render.pos(length, width, -width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex(); - render.pos(0, width, -width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex(); - render.pos(0, width, width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex(); - render.pos(length, width, width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex(); + render.vertex(length, width, -width).uv(0, 0).uv2(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex(); + render.vertex(0, width, -width).uv(0, 0).uv2(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex(); + render.vertex(0, width, width).uv(0, 0).uv2(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex(); + render.vertex(length, width, width).uv(0, 0).uv2(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex(); - render.pos(length, -width, width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex(); - render.pos(0, -width, width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex(); - render.pos(0, -width, -width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex(); - render.pos(length, -width, -width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex(); + render.vertex(length, -width, width).uv(0, 0).uv2(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex(); + render.vertex(0, -width, width).uv(0, 0).uv2(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex(); + render.vertex(0, -width, -width).uv(0, 0).uv2(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex(); + render.vertex(length, -width, -width).uv(0, 0).uv2(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex(); } - tessy.draw(); + tessy.end(); GlStateManager.enableTexture2D(); //} - GlStateManager.alphaFunc(func, ref); - GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA); - GlStateManager.disableBlend(); - GlStateManager.enableLighting(); - GlStateManager.popMatrix(); + GlStateManager._alphaFunc(func, ref); + GlStateManager._blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA); + GlStateManager._disableBlend(); + GlStateManager._enableLighting(); + GlStateManager._popMatrix(); } public static float[] getWheelColor(float pos) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/ItemUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/ItemUtil.java index 4489542c2..48c272e9c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/ItemUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/ItemUtil.java @@ -48,7 +48,7 @@ public final class ItemUtil { @Deprecated public static boolean areItemsEqual(ItemStack stack1, ItemStack stack2, boolean checkWildcard) { - return stack1.isItemEqual(stack2); + return stack1.sameItem(stack2); //return StackUtil.isValid(stack1) && StackUtil.isValid(stack2) && (stack1.isItemEqual(stack2) || checkWildcard && stack1.getItem() == stack2.getItem() && (stack1.getItemDamage() == Util.WILDCARD || stack2.getItemDamage() == Util.WILDCARD)); } @@ -62,7 +62,7 @@ public final class ItemUtil { @Deprecated public static void addEnchantment(ItemStack stack, Enchantment e, int level) { if (!EnchantmentHelper.getEnchantments(stack).containsKey(e)) { - stack.addEnchantment(e, level); + stack.enchant(e, level); } } @@ -75,7 +75,7 @@ public final class ItemUtil { } public static boolean canBeStacked(ItemStack stack1, ItemStack stack2) { - return ItemStack.areItemsEqual(stack1, stack2) && ItemStack.areItemStackTagsEqual(stack1, stack2); + return ItemStack.isSame(stack1, stack2) && ItemStack.tagMatches(stack1, stack2); } public static boolean isEnabled(ItemStack stack) { @@ -83,7 +83,7 @@ public final class ItemUtil { } public static void changeEnabled(PlayerEntity player, Hand hand) { - changeEnabled(player.getHeldItem(hand)); + changeEnabled(player.getItemInHand(hand)); } public static void changeEnabled(ItemStack stack) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/NetHandlerSpaghettiServer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/NetHandlerSpaghettiServer.java index 651d67554..a358ba7da 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/NetHandlerSpaghettiServer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/NetHandlerSpaghettiServer.java @@ -51,7 +51,7 @@ public class NetHandlerSpaghettiServer extends NetHandlerPlayServer { } @Override - public void func_194308_a(CPacketPlaceRecipe p_194308_1_) { + public void handlePlaceRecipe(CPacketPlaceRecipe p_194308_1_) { } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/StringUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/StringUtil.java index 87e42c03c..fc7f58573 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/StringUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/StringUtil.java @@ -34,7 +34,7 @@ public final class StringUtil { */ @OnlyIn(Dist.CLIENT) public static String localize(String text) { - return I18n.format(text); + return I18n.get(text); } /** @@ -42,7 +42,7 @@ public final class StringUtil { */ @OnlyIn(Dist.CLIENT) public static String localizeFormatted(String text, Object... replace) { - return I18n.format(text, replace); + return I18n.get(text, replace); } @SuppressWarnings("deprecation") @@ -56,28 +56,28 @@ public final class StringUtil { List list = renderer.listFormattedStringToWidth(strg, width); for (int i = 0; i < list.size(); i++) { String s1 = list.get(i); - renderer.drawString(s1, x, y + i * renderer.FONT_HEIGHT, color, shadow); + renderer.draw(s1, x, y + i * renderer.lineHeight, color, shadow); } } @OnlyIn(Dist.CLIENT) public static void renderScaledAsciiString(FontRenderer font, String text, float x, float y, int color, boolean shadow, float scale) { - GlStateManager.pushMatrix(); + GlStateManager._pushMatrix(); GlStateManager.scale(scale, scale, scale); boolean oldUnicode = font.getUnicodeFlag(); font.setUnicodeFlag(false); - font.drawString(text, x / scale, y / scale, color, shadow); + font.draw(text, x / scale, y / scale, color, shadow); font.setUnicodeFlag(oldUnicode); - GlStateManager.popMatrix(); + GlStateManager._popMatrix(); } @OnlyIn(Dist.CLIENT) public static void renderSplitScaledAsciiString(FontRenderer font, String text, int x, int y, int color, boolean shadow, float scale, int length) { List lines = font.listFormattedStringToWidth(text, (int) (length / scale)); for (int i = 0; i < lines.size(); i++) { - renderScaledAsciiString(font, lines.get(i), x, y + i * (int) (font.FONT_HEIGHT * scale + 3), color, shadow, scale); + renderScaledAsciiString(font, lines.get(i), x, y + i * (int) (font.lineHeight * scale + 3), color, shadow, scale); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/VanillaPacketDispatcher.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/VanillaPacketDispatcher.java index 32c66b65c..3673c12a5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/VanillaPacketDispatcher.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/VanillaPacketDispatcher.java @@ -10,21 +10,21 @@ public final class VanillaPacketDispatcher { //Don't call from the client. public static void dispatchTEToNearbyPlayers(TileEntity tile) { - ServerWorld world = (ServerWorld) tile.getWorld(); - PlayerChunkMapEntry entry = world.getPlayerChunkMap().getEntry(tile.getPos().getX() >> 4, tile.getPos().getZ() >> 4); + ServerWorld world = (ServerWorld) tile.getLevel(); + PlayerChunkMapEntry entry = world.getPlayerChunkMap().getEntry(tile.getBlockPos().getX() >> 4, tile.getBlockPos().getZ() >> 4); if (entry == null) { return; } for (ServerPlayerEntity player : entry.getWatchingPlayers()) { - player.connection.sendPacket(tile.getUpdatePacket()); + player.connection.send(tile.getUpdatePacket()); } } public static void dispatchTEToNearbyPlayers(World world, BlockPos pos) { - TileEntity tile = world.getTileEntity(pos); + TileEntity tile = world.getBlockEntity(pos); if (tile != null) { dispatchTEToNearbyPlayers(tile); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java index f2c2cf969..86ae9d3bb 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java @@ -61,7 +61,7 @@ public final class WorldUtil { ItemStack theoreticalExtract = extractItem(extractWrapper, maxExtract, true, extractSlotStart, extractSlotEnd, filter); if (StackUtil.isValid(theoreticalExtract)) { ItemStack remaining = StackUtil.insertItem(insertWrapper, theoreticalExtract, false, insertSlotStart, insertSlotEnd); - if (!ItemStack.areItemStacksEqual(remaining, theoreticalExtract)) { + if (!ItemStack.matches(remaining, theoreticalExtract)) { int toExtract = theoreticalExtract.getCount() - remaining.getCount(); extractItem(extractWrapper, toExtract, false, extractSlotStart, extractSlotEnd, filter); return true; @@ -166,21 +166,21 @@ public final class WorldUtil { public static ItemStack useItemAtSide(Direction side, World world, BlockPos pos, ItemStack stack) { if (world instanceof WorldServer && StackUtil.isValid(stack) && pos != null) { - BlockPos offsetPos = pos.offset(side); + BlockPos offsetPos = pos.relative(side); BlockState state = world.getBlockState(offsetPos); Block block = state.getBlock(); - boolean replaceable = block.isReplaceable(world, offsetPos); + boolean replaceable = block.canBeReplaced(world, offsetPos); //Redstone if (replaceable && stack.getItem() == Items.REDSTONE) { - world.setBlockState(offsetPos, Blocks.REDSTONE_WIRE.getDefaultState(), 2); + world.setBlock(offsetPos, Blocks.REDSTONE_WIRE.defaultBlockState(), 2); return StackUtil.shrink(stack, 1); } //Plants if (replaceable && stack.getItem() instanceof IPlantable) { if (((IPlantable) stack.getItem()).getPlant(world, offsetPos).getBlock().canPlaceBlockAt(world, offsetPos)) { - if (world.setBlockState(offsetPos, ((IPlantable) stack.getItem()).getPlant(world, offsetPos), 2)) { + if (world.setBlock(offsetPos, ((IPlantable) stack.getItem()).getPlant(world, offsetPos), 2)) { return StackUtil.shrink(stack, 1); } } @@ -192,10 +192,10 @@ public final class WorldUtil { if (fake.connection == null) { fake.connection = new NetHandlerSpaghettiServer(fake); } - ItemStack heldBefore = fake.getHeldItemMainhand(); + ItemStack heldBefore = fake.getMainHandItem(); setHandItemWithoutAnnoyingSound(fake, Hand.MAIN_HAND, stack.copy()); - fake.interactionManager.processRightClickBlock(fake, world, fake.getHeldItemMainhand(), Hand.MAIN_HAND, offsetPos, side.getOpposite(), 0.5F, 0.5F, 0.5F); - ItemStack result = fake.getHeldItem(Hand.MAIN_HAND); + fake.gameMode.processRightClickBlock(fake, world, fake.getMainHandItem(), Hand.MAIN_HAND, offsetPos, side.getOpposite(), 0.5F, 0.5F, 0.5F); + ItemStack result = fake.getItemInHand(Hand.MAIN_HAND); setHandItemWithoutAnnoyingSound(fake, Hand.MAIN_HAND, heldBefore); return result; } catch (Exception e) { @@ -206,8 +206,8 @@ public final class WorldUtil { } public static boolean dropItemAtSide(Direction side, World world, BlockPos pos, ItemStack stack) { - BlockPos coords = pos.offset(side); - if (world.isBlockLoaded(coords)) { + BlockPos coords = pos.relative(side); + if (world.hasChunkAt(coords)) { EntityItem item = new EntityItem(world, coords.getX() + 0.5, coords.getY() + 0.5, coords.getZ() + 0.5, stack); item.motionX = 0; item.motionY = 0; @@ -241,10 +241,10 @@ public final class WorldUtil { public static ArrayList getMaterialsAround(World world, BlockPos pos) { ArrayList blocks = new ArrayList<>(); - blocks.add(world.getBlockState(pos.offset(Direction.NORTH)).getMaterial()); - blocks.add(world.getBlockState(pos.offset(Direction.EAST)).getMaterial()); - blocks.add(world.getBlockState(pos.offset(Direction.SOUTH)).getMaterial()); - blocks.add(world.getBlockState(pos.offset(Direction.WEST)).getMaterial()); + blocks.add(world.getBlockState(pos.relative(Direction.NORTH)).getMaterial()); + blocks.add(world.getBlockState(pos.relative(Direction.EAST)).getMaterial()); + blocks.add(world.getBlockState(pos.relative(Direction.SOUTH)).getMaterial()); + blocks.add(world.getBlockState(pos.relative(Direction.WEST)).getMaterial()); return blocks; } @@ -253,8 +253,8 @@ public final class WorldUtil { } private static RayTraceResult getMovingObjectPosWithReachDistance(World world, PlayerEntity player, double distance, boolean p1, boolean p2, boolean p3) { - float f = player.rotationPitch; - float f1 = player.rotationYaw; + float f = player.xRot; + float f1 = player.yRot; double d0 = player.posX; double d1 = player.posY + player.getEyeHeight(); double d2 = player.posZ; @@ -266,7 +266,7 @@ public final class WorldUtil { float f6 = f3 * f4; float f7 = f2 * f4; Vec3d vec31 = vec3.add(f6 * distance, f5 * distance, f7 * distance); - return world.rayTraceBlocks(vec3, vec31, p1, p2, p3); + return world.clipWithInteractionOverride(vec3, vec31, p1, p2, p3); } public static RayTraceResult getNearestBlockWithDefaultReachDistance(World world, PlayerEntity player) { @@ -279,9 +279,9 @@ public final class WorldUtil { public static void setHandItemWithoutAnnoyingSound(PlayerEntity player, Hand hand, ItemStack stack) { if (hand == Hand.MAIN_HAND) { - player.inventory.mainInventory.set(player.inventory.currentItem, stack); + player.inventory.items.set(player.inventory.selected, stack); } else if (hand == Hand.OFF_HAND) { - player.inventory.offHandInventory.set(0, stack); + player.inventory.offhand.set(0, stack); } } @@ -289,8 +289,8 @@ public final class WorldUtil { public static float fireFakeHarvestEventsForDropChance(TileEntity caller, List drops, World world, BlockPos pos) { if (world instanceof ServerWorld) { FakePlayer fake = FakePlayerFactory.getMinecraft((ServerWorld) world); - BlockPos tePos = caller.getPos(); - fake.setPosition(tePos.getX() + 0.5, tePos.getY() + 0.5, tePos.getZ() + 0.5); + BlockPos tePos = caller.getBlockPos(); + fake.setPos(tePos.getX() + 0.5, tePos.getY() + 0.5, tePos.getZ() + 0.5); BlockState state = world.getBlockState(pos); BreakEvent event = new BreakEvent(world, pos, state, fake); @@ -317,36 +317,36 @@ public final class WorldUtil { if (player.isCreative()) { if (block.removedByPlayer(state, world, pos, player, false)) { - block.onPlayerDestroy(world, pos, state); + block.destroy(world, pos, state); } // send update to client - if (!world.isRemote) { - ((ServerPlayerEntity) player).connection.sendPacket(new SPacketBlockChange(world, pos)); + if (!world.isClientSide) { + ((ServerPlayerEntity) player).connection.send(new SPacketBlockChange(world, pos)); } return true; } // callback to the tool the player uses. Called on both sides. This damages the tool n stuff. - stack.onBlockDestroyed(world, state, pos, player); + stack.mineBlock(world, state, pos, player); // server sided handling - if (!world.isRemote) { + if (!world.isClientSide) { // send the blockbreak event - int xp = ForgeHooks.onBlockBreakEvent(world, ((ServerPlayerEntity) player).interactionManager.getGameType(), (ServerPlayerEntity) player, pos); + int xp = ForgeHooks.onBlockBreakEvent(world, ((ServerPlayerEntity) player).gameMode.getGameModeForPlayer(), (ServerPlayerEntity) player, pos); if (xp == -1) { return false; } - TileEntity tileEntity = world.getTileEntity(pos); + TileEntity tileEntity = world.getBlockEntity(pos); if (block.removedByPlayer(state, world, pos, player, true)) { // boolean is if block can be harvested, checked above - block.onPlayerDestroy(world, pos, state); - block.harvestBlock(world, player, pos, state, tileEntity, stack); - block.dropXpOnBlockBreak(world, pos, xp); + block.destroy(world, pos, state); + block.playerDestroy(world, player, pos, state, tileEntity, stack); + block.popExperience(world, pos, xp); } // always send block update to client - ((ServerPlayerEntity) player).connection.sendPacket(new SPacketBlockChange(world, pos)); + ((ServerPlayerEntity) player).connection.send(new SPacketBlockChange(world, pos)); return true; } // client sided handling @@ -355,12 +355,12 @@ public final class WorldUtil { // the code above, executed on the server, sends a block-updates that give us the correct state of the block we destroy. // following code can be found in PlayerControllerMP.onPlayerDestroyBlock - world.playEvent(2001, pos, Block.getStateId(state)); + world.levelEvent(2001, pos, Block.getId(state)); if (block.removedByPlayer(state, world, pos, player, true)) { - block.onPlayerDestroy(world, pos, state); + block.destroy(world, pos, state); } // callback to the tool - stack.onBlockDestroyed(world, state, pos, player); + stack.mineBlock(world, state, pos, player); // send an update to the server, so we get an update back