From 49ccc206223d1b44512482a3772860fc71ff49a2 Mon Sep 17 00:00:00 2001 From: Flanks255 <32142731+Flanks255@users.noreply.github.com> Date: Tue, 23 Jul 2024 17:51:57 -0500 Subject: [PATCH] more things. --- .../data/BlockStateGenerator.java | 56 ++++----- .../mod/ActuallyAdditions.java | 2 - .../mod/ActuallyAdditionsClient.java | 5 - .../mod/blocks/BlockColoredLamp.java | 2 +- .../mod/components/ActuallyComponents.java | 6 + .../mod/crafting/CrusherCrafting.java | 117 ------------------ .../mod/items/AllInOneTool.java | 9 +- .../mod/items/DrillItem.java | 15 +-- .../mod/items/ItemAxeAA.java | 56 --------- .../mod/items/ItemDrillUpgrade.java | 12 +- .../mod/items/ItemPickaxeAA.java | 90 -------------- .../mod/items/ItemShovelAA.java | 59 --------- .../mod/items/base/ItemHoeAA.java | 58 --------- .../mod/items/base/ItemSwordAA.java | 60 --------- .../mod/items/base/ItemToolAA.java | 73 ----------- .../mod/misc/apiimpl/MethodHandler.java | 2 +- .../mod/tile/TileEntityCoffeeMachine.java | 4 +- .../mod/tile/TileEntityDropper.java | 4 +- .../mod/tile/TileEntityFarmer.java | 2 +- .../mod/tile/TileEntityFluidCollector.java | 2 +- 20 files changed, 56 insertions(+), 578 deletions(-) delete mode 100644 src/main/java/de/ellpeck/actuallyadditions/mod/crafting/CrusherCrafting.java delete mode 100644 src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemAxeAA.java delete mode 100644 src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPickaxeAA.java delete mode 100644 src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemShovelAA.java delete mode 100644 src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemHoeAA.java delete mode 100644 src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSwordAA.java delete mode 100644 src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemToolAA.java diff --git a/src/main/java/de/ellpeck/actuallyadditions/data/BlockStateGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/data/BlockStateGenerator.java index fed1d9a0a..ddddeb654 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/data/BlockStateGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/data/BlockStateGenerator.java @@ -122,43 +122,43 @@ public class BlockStateGenerator extends BlockStateProvider { // TO BE SORTED getVariantBuilder(ActuallyBlocks.CANOLA.get()).partialState() .with(CropBlock.AGE, 0).modelForState().modelFile(models().crop("canola_1", modLoc("block/canola_stage_1"))).addModel() - .partialState().with(CropBlock.AGE, 1).modelForState().modelFile(models().crop("canola_2", modLoc("block/canola_stage_2"))).addModel() - .partialState().with(CropBlock.AGE, 2).modelForState().modelFile(models().crop("canola_2", modLoc("block/canola_stage_2"))).addModel() - .partialState().with(CropBlock.AGE, 3).modelForState().modelFile(models().crop("canola_2", modLoc("block/canola_stage_2"))).addModel() - .partialState().with(CropBlock.AGE, 4).modelForState().modelFile(models().crop("canola_3", modLoc("block/canola_stage_3"))).addModel() - .partialState().with(CropBlock.AGE, 5).modelForState().modelFile(models().crop("canola_3", modLoc("block/canola_stage_3"))).addModel() - .partialState().with(CropBlock.AGE, 6).modelForState().modelFile(models().crop("canola_3", modLoc("block/canola_stage_3"))).addModel() - .partialState().with(CropBlock.AGE, 7).modelForState().modelFile(models().crop("canola_4", modLoc("block/canola_stage_4"))).addModel(); + .partialState().with(CropBlock.AGE, 1).modelForState().modelFile(models().crop("canola_2", modLoc("block/canola_stage_2")).renderType("minecraft:cutout")).addModel() + .partialState().with(CropBlock.AGE, 2).modelForState().modelFile(models().crop("canola_2", modLoc("block/canola_stage_2")).renderType("minecraft:cutout")).addModel() + .partialState().with(CropBlock.AGE, 3).modelForState().modelFile(models().crop("canola_2", modLoc("block/canola_stage_2")).renderType("minecraft:cutout")).addModel() + .partialState().with(CropBlock.AGE, 4).modelForState().modelFile(models().crop("canola_3", modLoc("block/canola_stage_3")).renderType("minecraft:cutout")).addModel() + .partialState().with(CropBlock.AGE, 5).modelForState().modelFile(models().crop("canola_3", modLoc("block/canola_stage_3")).renderType("minecraft:cutout")).addModel() + .partialState().with(CropBlock.AGE, 6).modelForState().modelFile(models().crop("canola_3", modLoc("block/canola_stage_3")).renderType("minecraft:cutout")).addModel() + .partialState().with(CropBlock.AGE, 7).modelForState().modelFile(models().crop("canola_4", modLoc("block/canola_stage_4")).renderType("minecraft:cutout")).addModel(); getVariantBuilder(ActuallyBlocks.RICE.get()).partialState() .with(CropBlock.AGE, 0).modelForState().modelFile(models().crop("rice_1", modLoc("block/rice_stage_1"))).addModel() - .partialState().with(CropBlock.AGE, 1).modelForState().modelFile(models().crop("rice_2", modLoc("block/rice_stage_2"))).addModel() - .partialState().with(CropBlock.AGE, 2).modelForState().modelFile(models().crop("rice_2", modLoc("block/rice_stage_2"))).addModel() - .partialState().with(CropBlock.AGE, 3).modelForState().modelFile(models().crop("rice_2", modLoc("block/rice_stage_2"))).addModel() - .partialState().with(CropBlock.AGE, 4).modelForState().modelFile(models().crop("rice_3", modLoc("block/rice_stage_3"))).addModel() - .partialState().with(CropBlock.AGE, 5).modelForState().modelFile(models().crop("rice_3", modLoc("block/rice_stage_3"))).addModel() - .partialState().with(CropBlock.AGE, 6).modelForState().modelFile(models().crop("rice_3", modLoc("block/rice_stage_3"))).addModel() - .partialState().with(CropBlock.AGE, 7).modelForState().modelFile(models().crop("rice_4", modLoc("block/rice_stage_4"))).addModel(); + .partialState().with(CropBlock.AGE, 1).modelForState().modelFile(models().crop("rice_2", modLoc("block/rice_stage_2")).renderType("minecraft:cutout")).addModel() + .partialState().with(CropBlock.AGE, 2).modelForState().modelFile(models().crop("rice_2", modLoc("block/rice_stage_2")).renderType("minecraft:cutout")).addModel() + .partialState().with(CropBlock.AGE, 3).modelForState().modelFile(models().crop("rice_2", modLoc("block/rice_stage_2")).renderType("minecraft:cutout")).addModel() + .partialState().with(CropBlock.AGE, 4).modelForState().modelFile(models().crop("rice_3", modLoc("block/rice_stage_3")).renderType("minecraft:cutout")).addModel() + .partialState().with(CropBlock.AGE, 5).modelForState().modelFile(models().crop("rice_3", modLoc("block/rice_stage_3")).renderType("minecraft:cutout")).addModel() + .partialState().with(CropBlock.AGE, 6).modelForState().modelFile(models().crop("rice_3", modLoc("block/rice_stage_3")).renderType("minecraft:cutout")).addModel() + .partialState().with(CropBlock.AGE, 7).modelForState().modelFile(models().crop("rice_4", modLoc("block/rice_stage_4")).renderType("minecraft:cutout")).addModel(); getVariantBuilder(ActuallyBlocks.FLAX.get()).partialState() .with(CropBlock.AGE, 0).modelForState().modelFile(models().crop("flax_1", modLoc("block/flax_stage_1"))).addModel() - .partialState().with(CropBlock.AGE, 1).modelForState().modelFile(models().crop("flax_2", modLoc("block/flax_stage_2"))).addModel() - .partialState().with(CropBlock.AGE, 2).modelForState().modelFile(models().crop("flax_2", modLoc("block/flax_stage_2"))).addModel() - .partialState().with(CropBlock.AGE, 3).modelForState().modelFile(models().crop("flax_2", modLoc("block/flax_stage_2"))).addModel() - .partialState().with(CropBlock.AGE, 4).modelForState().modelFile(models().crop("flax_3", modLoc("block/flax_stage_3"))).addModel() - .partialState().with(CropBlock.AGE, 5).modelForState().modelFile(models().crop("flax_3", modLoc("block/flax_stage_3"))).addModel() - .partialState().with(CropBlock.AGE, 6).modelForState().modelFile(models().crop("flax_3", modLoc("block/flax_stage_3"))).addModel() - .partialState().with(CropBlock.AGE, 7).modelForState().modelFile(models().crop("flax_4", modLoc("block/flax_stage_4"))).addModel(); + .partialState().with(CropBlock.AGE, 1).modelForState().modelFile(models().crop("flax_2", modLoc("block/flax_stage_2")).renderType("minecraft:cutout")).addModel() + .partialState().with(CropBlock.AGE, 2).modelForState().modelFile(models().crop("flax_2", modLoc("block/flax_stage_2")).renderType("minecraft:cutout")).addModel() + .partialState().with(CropBlock.AGE, 3).modelForState().modelFile(models().crop("flax_2", modLoc("block/flax_stage_2")).renderType("minecraft:cutout")).addModel() + .partialState().with(CropBlock.AGE, 4).modelForState().modelFile(models().crop("flax_3", modLoc("block/flax_stage_3")).renderType("minecraft:cutout")).addModel() + .partialState().with(CropBlock.AGE, 5).modelForState().modelFile(models().crop("flax_3", modLoc("block/flax_stage_3")).renderType("minecraft:cutout")).addModel() + .partialState().with(CropBlock.AGE, 6).modelForState().modelFile(models().crop("flax_3", modLoc("block/flax_stage_3")).renderType("minecraft:cutout")).addModel() + .partialState().with(CropBlock.AGE, 7).modelForState().modelFile(models().crop("flax_4", modLoc("block/flax_stage_4")).renderType("minecraft:cutout")).addModel(); getVariantBuilder(ActuallyBlocks.COFFEE.get()).partialState() .with(CropBlock.AGE, 0).modelForState().modelFile(models().crop("coffee_1", modLoc("block/coffee_stage_1"))).addModel() - .partialState().with(CropBlock.AGE, 1).modelForState().modelFile(models().crop("coffee_2", modLoc("block/coffee_stage_2"))).addModel() - .partialState().with(CropBlock.AGE, 2).modelForState().modelFile(models().crop("coffee_2", modLoc("block/coffee_stage_2"))).addModel() - .partialState().with(CropBlock.AGE, 3).modelForState().modelFile(models().crop("coffee_2", modLoc("block/coffee_stage_2"))).addModel() - .partialState().with(CropBlock.AGE, 4).modelForState().modelFile(models().crop("coffee_3", modLoc("block/coffee_stage_3"))).addModel() - .partialState().with(CropBlock.AGE, 5).modelForState().modelFile(models().crop("coffee_3", modLoc("block/coffee_stage_3"))).addModel() - .partialState().with(CropBlock.AGE, 6).modelForState().modelFile(models().crop("coffee_3", modLoc("block/coffee_stage_3"))).addModel() - .partialState().with(CropBlock.AGE, 7).modelForState().modelFile(models().crop("coffee_4", modLoc("block/coffee_stage_4"))).addModel(); + .partialState().with(CropBlock.AGE, 1).modelForState().modelFile(models().crop("coffee_2", modLoc("block/coffee_stage_2")).renderType("minecraft:cutout")).addModel() + .partialState().with(CropBlock.AGE, 2).modelForState().modelFile(models().crop("coffee_2", modLoc("block/coffee_stage_2")).renderType("minecraft:cutout")).addModel() + .partialState().with(CropBlock.AGE, 3).modelForState().modelFile(models().crop("coffee_2", modLoc("block/coffee_stage_2")).renderType("minecraft:cutout")).addModel() + .partialState().with(CropBlock.AGE, 4).modelForState().modelFile(models().crop("coffee_3", modLoc("block/coffee_stage_3")).renderType("minecraft:cutout")).addModel() + .partialState().with(CropBlock.AGE, 5).modelForState().modelFile(models().crop("coffee_3", modLoc("block/coffee_stage_3")).renderType("minecraft:cutout")).addModel() + .partialState().with(CropBlock.AGE, 6).modelForState().modelFile(models().crop("coffee_3", modLoc("block/coffee_stage_3")).renderType("minecraft:cutout")).addModel() + .partialState().with(CropBlock.AGE, 7).modelForState().modelFile(models().crop("coffee_4", modLoc("block/coffee_stage_4")).renderType("minecraft:cutout")).addModel(); buildCubeAll(ActuallyBlocks.ENDER_CASING); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java b/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java index c7c09cf2a..c64ecd7aa 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java @@ -21,7 +21,6 @@ import de.ellpeck.actuallyadditions.mod.components.ActuallyComponents; import de.ellpeck.actuallyadditions.mod.config.CommonConfig; import de.ellpeck.actuallyadditions.mod.config.conditions.BoolConfigCondition; import de.ellpeck.actuallyadditions.mod.crafting.ActuallyRecipes; -import de.ellpeck.actuallyadditions.mod.crafting.CrusherCrafting; import de.ellpeck.actuallyadditions.mod.data.WorldData; import de.ellpeck.actuallyadditions.mod.entity.EntityWorm; import de.ellpeck.actuallyadditions.mod.entity.InitEntities; @@ -164,7 +163,6 @@ public class ActuallyAdditions { new UpdateChecker(); InitEntities.init(); // todo: [port] replace - CrusherCrafting.init(); } private void onConfigReload(ModConfigEvent event) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditionsClient.java b/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditionsClient.java index 05f7acbfa..a7824a78c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditionsClient.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditionsClient.java @@ -122,11 +122,6 @@ public class ActuallyAdditionsClient { ItemBlockRenderTypes.setRenderLayer(InitFluids.EMPOWERED_OIL.get(), RenderType.translucent()); ItemBlockRenderTypes.setRenderLayer(InitFluids.EMPOWERED_OIL.getFlowing(), RenderType.translucent()); - ItemBlockRenderTypes.setRenderLayer(ActuallyBlocks.CANOLA.get(), RenderType.cutout()); - ItemBlockRenderTypes.setRenderLayer(ActuallyBlocks.RICE.get(), RenderType.cutout()); - ItemBlockRenderTypes.setRenderLayer(ActuallyBlocks.FLAX.get(), RenderType.cutout()); - ItemBlockRenderTypes.setRenderLayer(ActuallyBlocks.COFFEE.get(), RenderType.cutout()); - ItemBlockRenderTypes.setRenderLayer(ActuallyBlocks.GREENHOUSE_GLASS.get(), RenderType.cutout()); } 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 ff39ee681..6ef806a23 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java @@ -74,7 +74,7 @@ public class BlockColoredLamp extends BlockBase { return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; } - if (StackUtil.isValid(stack) && stack.getItem() instanceof DyeItem) { + if (!stack.isEmpty() && stack.getItem() instanceof DyeItem) { DyeColor color = DyeColor.getColor(stack); if (color == null) { return ItemInteractionResult.FAIL; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/components/ActuallyComponents.java b/src/main/java/de/ellpeck/actuallyadditions/mod/components/ActuallyComponents.java index e0e2f6ee7..5ab1e749c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/components/ActuallyComponents.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/components/ActuallyComponents.java @@ -109,6 +109,12 @@ public class ActuallyComponents { .networkSynchronized(LastXY.STREAM_CODEC) .build()); + public static final Supplier> SLOT = DATA_COMPONENT_TYPES.register("slot", () -> + DataComponentType.builder() + .persistent(Codec.INT) + .networkSynchronized(ByteBufCodecs.INT) + .build()); + /* * This is a supplier for an attachment type that can be used to attach an energy storage to an item. diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/CrusherCrafting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/CrusherCrafting.java deleted file mode 100644 index 743e1e81f..000000000 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/CrusherCrafting.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * This file ("CrusherCrafting.java") is part of the Actually Additions mod for Minecraft. - * It is created and owned by Ellpeck and distributed - * under the Actually Additions License to be found at - * http://ellpeck.de/actaddlicense - * View the source code at https://github.com/Ellpeck/ActuallyAdditions - * - * © 2015-2017 Ellpeck - */ - -package de.ellpeck.actuallyadditions.mod.crafting; - -// TODO: [port] MOVE TO DATA_GENERATOR -@Deprecated -public final class CrusherCrafting { - // - // public static final ArrayList MISC_RECIPES = new ArrayList<>(); - // public static CrusherRecipe recipeIronHorseArmor; - // public static CrusherRecipe recipeGoldHorseArmor; - // public static CrusherRecipe recipeDiamondHorseArmor; - // - public static void init() { - // ActuallyAdditions.LOGGER.info("Initializing Crusher Recipes..."); - // - // ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.BONE), new ItemStack(Items.DYE, 6, 15), StackUtil.getEmpty(), 0); - // MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe()); - // ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.REEDS), new ItemStack(Items.SUGAR, 3), StackUtil.getEmpty(), 0); - // MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe()); - // ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.BLAZE_ROD), new ItemStack(Items.BLAZE_POWDER, 4), StackUtil.getEmpty(), 0); - // MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe()); - // - // ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.YELLOW_FLOWER), new ItemStack(Items.DYE, 3, 11), StackUtil.getEmpty(), 0); - // MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe()); - // ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 0), new ItemStack(Items.DYE, 3, 1), StackUtil.getEmpty(), 0); - // MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe()); - // ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 1), new ItemStack(Items.DYE, 3, 12), StackUtil.getEmpty(), 0); - // MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe()); - // ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 2), new ItemStack(Items.DYE, 3, 13), StackUtil.getEmpty(), 0); - // MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe()); - // ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 3), new ItemStack(Items.DYE, 3, 7), StackUtil.getEmpty(), 0); - // MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe()); - // ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 4), new ItemStack(Items.DYE, 3, 1), StackUtil.getEmpty(), 0); - // MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe()); - // ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 5), new ItemStack(Items.DYE, 3, 14), StackUtil.getEmpty(), 0); - // MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe()); - // ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 6), new ItemStack(Items.DYE, 3, 7), StackUtil.getEmpty(), 0); - // MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe()); - // ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 7), new ItemStack(Items.DYE, 3, 9), StackUtil.getEmpty(), 0); - // MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe()); - // ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 8), new ItemStack(Items.DYE, 3, 7), StackUtil.getEmpty(), 0); - // MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe()); - // ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.DOUBLE_PLANT, 1, 0), new ItemStack(Items.DYE, 4, 11), StackUtil.getEmpty(), 0); - // MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe()); - // ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.DOUBLE_PLANT, 1, 1), new ItemStack(Items.DYE, 4, 13), StackUtil.getEmpty(), 0); - // MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe()); - // ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.DOUBLE_PLANT, 1, 4), new ItemStack(Items.DYE, 4, 1), StackUtil.getEmpty(), 0); - // MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe()); - // ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.DOUBLE_PLANT, 1, 5), new ItemStack(Items.DYE, 4, 9), StackUtil.getEmpty(), 0); - // MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe()); - // - // if (!CrusherRecipeRegistry.hasException("oreRedstone")) ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("oreRedstone"), new ItemStack(Items.REDSTONE, 10), StackUtil.getEmpty(), 0); - // if (!CrusherRecipeRegistry.hasException("oreLapis")) ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("oreLapis"), new ItemStack(Items.DYE, 12, 4), StackUtil.getEmpty(), 0); - // if (!CrusherRecipeRegistry.hasException("coal")) ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("coal"), new ItemStack(InitItems.itemDust, 1, TheDusts.COAL.ordinal()), StackUtil.getEmpty(), 0); - // if (!CrusherRecipeRegistry.hasException("oreCoal")) ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("oreCoal"), new ItemStack(Items.COAL, 3), StackUtil.getEmpty(), 0); - // if (!CrusherRecipeRegistry.hasException("blockCoal")) ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("blockCoal"), new ItemStack(Items.COAL, 9), StackUtil.getEmpty(), 0); - // if (!CrusherRecipeRegistry.hasException("oreQuartz")) ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("oreQuartz"), new ItemStack(Items.QUARTZ, 3), StackUtil.getEmpty(), 0); - // if (!CrusherRecipeRegistry.hasException("cobblestone")) ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("cobblestone"), new ItemStack(Blocks.SAND), StackUtil.getEmpty(), 0); - // ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.GRAVEL), new ItemStack(Items.FLINT), new ItemStack(Items.FLINT), 50); - // if (!CrusherRecipeRegistry.hasException("stone")) ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("stone", false), OreDictionary.getOres("cobblestone", false), 1, NonNullList.withSize(1, StackUtil.getEmpty()), 0, 0); - // - // ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE.ordinal()), new ItemStack(Items.SUGAR, 2), StackUtil.getEmpty(), 0); - // MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe()); - // - // ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.GLOWSTONE), new ItemStack(Items.GLOWSTONE_DUST, 4), StackUtil.getEmpty(), 0); - // MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe()); - // - // if (!CrusherRecipeRegistry.hasException("oreNickel")) ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("oreNickel", false), OreDictionary.getOres("dustNickel", false), 2, OreDictionary.getOres("dustPlatinum", false), 1, 15); - // if (!CrusherRecipeRegistry.hasException("oreIron")) ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("oreIron", false), OreDictionary.getOres("dustIron", false), 2, OreDictionary.getOres("dustGold", false), 1, 20); - // - // ItemStack temp = getStack("dustIron"); - // if (!temp.isEmpty()) { - // temp.setCount(6); - // ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.IRON_HORSE_ARMOR), temp, StackUtil.getEmpty(), 0); - // recipeIronHorseArmor = RecipeUtil.lastCrusherRecipe(); - // } - // - // temp = getStack("dustGold"); - // if (!temp.isEmpty()) { - // temp.setCount(6); - // ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.GOLDEN_HORSE_ARMOR), temp, StackUtil.getEmpty(), 0); - // recipeGoldHorseArmor = RecipeUtil.lastCrusherRecipe(); - // } - // - // temp = getStack("dustDiamond"); - // if (!temp.isEmpty()) { - // temp.setCount(6); - // ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.DIAMOND_HORSE_ARMOR), temp, StackUtil.getEmpty(), 0); - // recipeDiamondHorseArmor = RecipeUtil.lastCrusherRecipe(); - // } - // - // CrusherRecipeRegistry.SEARCH_CASES.add(new CrusherRecipeRegistry.SearchCase("oreNether", 6)); - // CrusherRecipeRegistry.SEARCH_CASES.add(new CrusherRecipeRegistry.SearchCase("orePoor", 4, "nugget")); - // CrusherRecipeRegistry.SEARCH_CASES.add(new CrusherRecipeRegistry.SearchCase("denseore", 8)); - // CrusherRecipeRegistry.SEARCH_CASES.add(new CrusherRecipeRegistry.SearchCase("gem", 1)); - // CrusherRecipeRegistry.SEARCH_CASES.add(new CrusherRecipeRegistry.SearchCase("ingot", 1)); - // CrusherRecipeRegistry.SEARCH_CASES.add(new CrusherRecipeRegistry.SearchCase("ore", 2, "gem")); //Search for gems first so removeDuplicates doesn't clear gem recipes. - // CrusherRecipeRegistry.SEARCH_CASES.add(new CrusherRecipeRegistry.SearchCase("ore", 2)); - // - // CrusherRecipeRegistry.registerFinally(); - } - // - // private static ItemStack getStack(String ore) { - // List stacks = OreDictionary.getOres(ore); - // if (stacks.isEmpty()) return StackUtil.getEmpty(); - // return stacks.get(0).copy(); - // } -} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/AllInOneTool.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/AllInOneTool.java index 054c99f64..001856b29 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/AllInOneTool.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/AllInOneTool.java @@ -1,13 +1,13 @@ package de.ellpeck.actuallyadditions.mod.items; import de.ellpeck.actuallyadditions.api.ActuallyTags; +import net.minecraft.core.component.DataComponents; import net.minecraft.world.InteractionResult; import net.minecraft.world.item.DiggerItem; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.item.Tier; import net.minecraft.world.item.context.UseOnContext; -import net.minecraft.world.item.enchantment.Enchantment; import net.neoforged.neoforge.common.ItemAbilities; import net.neoforged.neoforge.common.ItemAbility; @@ -15,9 +15,8 @@ import javax.annotation.Nonnull; import java.util.List; public class AllInOneTool extends DiggerItem { - private final Tier tier; - private static List ACTIONS = List.of( + private static final List ACTIONS = List.of( ItemAbilities.AXE_DIG, ItemAbilities.HOE_DIG, ItemAbilities.PICKAXE_DIG, @@ -35,10 +34,8 @@ public class AllInOneTool extends DiggerItem { ActuallyTags.Blocks.MINEABLE_WITH_AIO, new Properties() .durability(tier.getUses() * 4) - + .component(DataComponents.TOOL, tier.createToolProperties(ActuallyTags.Blocks.MINEABLE_WITH_AIO)) ); - - this.tier = tier; } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/DrillItem.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/DrillItem.java index 298410be5..3ac76705d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/DrillItem.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/DrillItem.java @@ -25,6 +25,7 @@ import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Holder; +import net.minecraft.core.component.DataComponents; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; @@ -69,7 +70,7 @@ public class DrillItem extends ItemEnergy { private final Multimap, AttributeModifier> attributes_powered = ArrayListMultimap.create(); public DrillItem() { - super(ActuallyItems.defaultProps().durability(0).stacksTo(1), 250000, 1000); + super(ActuallyItems.defaultProps().durability(0).stacksTo(1).component(DataComponents.TOOL, Tiers.NETHERITE.createToolProperties(ActuallyTags.Blocks.MINEABLE_WITH_DRILL)), 250000, 1000); attributes_powered.put(Attributes.ATTACK_DAMAGE, new AttributeModifier(ActuallyAdditions.modLoc("drill_speed_powered"), 8.0F, AttributeModifier.Operation.ADD_VALUE)); attributes_powered.put(Attributes.ATTACK_SPEED, new AttributeModifier(ActuallyAdditions.modLoc("drill_speed_powered"), 1.5F, AttributeModifier.Operation.ADD_VALUE)); attributes_unpowered.put(Attributes.ATTACK_DAMAGE, new AttributeModifier(ActuallyAdditions.modLoc("drill_attack"), 0.1F, AttributeModifier.Operation.ADD_VALUE)); @@ -81,7 +82,7 @@ public class DrillItem extends ItemEnergy { return ACTIONS.contains(toolAction); } - public boolean isCorrectToolForDrops(@Nonnull BlockState pBlock) { +/* public boolean isCorrectToolForDrops(@Nonnull BlockState pBlock) { Tier tier = Tiers.NETHERITE; //Use Nettherite as the tier as it has the same harvest level as the drill if (TierSortingRegistry.isTierSorted(tier)) { return TierSortingRegistry.isCorrectTierForDrops(tier, pBlock) && pBlock.is(ActuallyTags.Blocks.MINEABLE_WITH_DRILL); @@ -93,7 +94,7 @@ public class DrillItem extends ItemEnergy { } else { return HARVEST_LEVEL < 1 && pBlock.is(BlockTags.NEEDS_STONE_TOOL) ? false : pBlock.is(ActuallyTags.Blocks.MINEABLE_WITH_DRILL); } - } + }*/ /** * Gets all of the Slots from NBT @@ -121,7 +122,7 @@ public class DrillItem extends ItemEnergy { @Nonnull @Override public InteractionResult useOn(UseOnContext context) { - Level level = context.getLevel(); + Level level = context.getLevel(); Player player = context.getPlayer(); InteractionHand hand = context.getHand(); @@ -134,9 +135,9 @@ public class DrillItem extends ItemEnergy { if (!equip.isEmpty() && equip != stack) { ItemStack toPlaceStack = equip; - //Places the Block into the World - BlockHitResult result = new BlockHitResult(context.getClickLocation(), context.getClickedFace(), context.getClickedPos(), context.isInside()); - return toPlaceStack.useOn(new UseOnContext(level, player, hand, toPlaceStack, result)); + //Places the Block into the World + BlockHitResult result = new BlockHitResult(context.getClickLocation(), context.getClickedFace(), context.getClickedPos(), context.isInside()); + return toPlaceStack.useOn(new UseOnContext(level, player, hand, toPlaceStack, result)); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemAxeAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemAxeAA.java deleted file mode 100644 index 038e75eec..000000000 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemAxeAA.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * This file ("ItemAxeAA.java") is part of the Actually Additions mod for Minecraft. - * It is created and owned by Ellpeck and distributed - * under the Actually Additions License to be found at - * http://ellpeck.de/actaddlicense - * View the source code at https://github.com/Ellpeck/ActuallyAdditions - * - * © 2015-2017 Ellpeck - */ - -package de.ellpeck.actuallyadditions.mod.items; - -import net.minecraft.world.item.DiggerItem; -import net.minecraft.world.item.Tier; - -public class ItemAxeAA extends DiggerItem { - private Tier tier; - public ItemAxeAA(Tier tier) { - super( - 4.0f, - -2f, - tier, - null, //Feed block tags here - new Properties() -// .addToolType(ToolType.AXE, tier.getLevel()) -// .addToolType(ToolType.HOE, tier.getLevel()) -// .addToolType(ToolType.SHOVEL, tier.getLevel()) -// .addToolType(ToolType.PICKAXE, tier.getLevel()) - .durability(tier.getUses() * 4) - - ); - - this.tier = tier; - } - -/* - private static final Set EFFECTIVE_ON = Sets.newHashSet(Blocks.PLANKS, Blocks.BOOKSHELF, Blocks.LOG, Blocks.LOG2, Blocks.CHEST, Blocks.PUMPKIN, Blocks.LIT_PUMPKIN, Blocks.MELON_BLOCK, Blocks.LADDER, Blocks.WOODEN_BUTTON, Blocks.WOODEN_PRESSURE_PLATE); - - public ItemAxeAA(IItemTier material) { - super(6.0F, -3.0F, material, this.repairItem, unlocalizedName, this.rarity, EFFECTIVE_ON); - this.setHarvestLevel("axe", material.getLevel()); - } - - @Override - public float getDestroySpeed(ItemStack stack, BlockState state) { - Material material = state.getMaterial(); - return material != Material.WOOD && material != Material.PLANT && material != Material.VINE - ? super.getDestroySpeed(stack, state) - : this.speed; - } - - @Override - public Set getToolClasses(ItemStack stack) { - return Collections.singleton("axe"); - }*/ -} 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 6d817b0b4..b4c15dcdd 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrillUpgrade.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrillUpgrade.java @@ -10,6 +10,7 @@ package de.ellpeck.actuallyadditions.mod.items; +import de.ellpeck.actuallyadditions.mod.components.ActuallyComponents; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; @@ -30,11 +31,7 @@ public class ItemDrillUpgrade extends ItemBase { } public static int getSlotToPlaceFrom(ItemStack stack) { - CompoundTag compound = stack.getTag(); - if (compound != null) { - return compound.getInt("SlotToPlaceFrom") - 1; - } - return -1; + return stack.getOrDefault(ActuallyComponents.SLOT, -1); } @Override @@ -49,10 +46,7 @@ public class ItemDrillUpgrade extends ItemBase { } public void setSlotToPlaceFrom(ItemStack stack, int slot) { - CompoundTag compound = stack.getOrCreateTag(); - compound.putInt("SlotToPlaceFrom", slot + 1); - - stack.setTag(compound); + stack.set(ActuallyComponents.SLOT, slot + 1); } public enum UpgradeType { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPickaxeAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPickaxeAA.java deleted file mode 100644 index dfcfc3785..000000000 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPickaxeAA.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * This file ("ItemPickaxeAA.java") is part of the Actually Additions mod for Minecraft. - * It is created and owned by Ellpeck and distributed - * under the Actually Additions License to be found at - * http://ellpeck.de/actaddlicense - * View the source code at https://github.com/Ellpeck/ActuallyAdditions - * - * © 2015-2017 Ellpeck - */ - -package de.ellpeck.actuallyadditions.mod.items; - -import net.minecraft.world.item.DiggerItem; -import net.minecraft.world.item.Tier; - -public class ItemPickaxeAA extends DiggerItem { - private final Tier tier; - public ItemPickaxeAA(Tier tier) { - super( - 4.0f, - -2f, - tier, - null, //Feed block tags here - new Properties() -// .addToolType(ToolType.AXE, tier.getLevel()) -// .addToolType(ToolType.HOE, tier.getLevel()) -// .addToolType(ToolType.SHOVEL, tier.getLevel()) -// .addToolType(ToolType.PICKAXE, tier.getLevel()) - .durability(tier.getUses() * 4) - - ); - - this.tier = tier; - } - -/* - private static final Set EFFECTIVE_ON = Sets.newHashSet(Blocks.ACTIVATOR_RAIL, Blocks.COAL_ORE, Blocks.COBBLESTONE, Blocks.DETECTOR_RAIL, Blocks.DIAMOND_BLOCK, Blocks.DIAMOND_ORE, Blocks.DOUBLE_STONE_SLAB, Blocks.GOLDEN_RAIL, Blocks.GOLD_BLOCK, Blocks.GOLD_ORE, Blocks.ICE, Blocks.IRON_BLOCK, Blocks.IRON_ORE, Blocks.LAPIS_BLOCK, Blocks.LAPIS_ORE, Blocks.LIT_REDSTONE_ORE, Blocks.MOSSY_COBBLESTONE, Blocks.NETHERRACK, Blocks.PACKED_ICE, Blocks.RAIL, Blocks.REDSTONE_ORE, Blocks.SANDSTONE, Blocks.RED_SANDSTONE, Blocks.STONE, Blocks.STONE_SLAB, Blocks.STONE_BUTTON, Blocks.STONE_PRESSURE_PLATE); - - public ItemPickaxeAA(IItemTier material) { - super(1.0F, -2.8F, material, this.repairItem, unlocalizedName, this.rarity, EFFECTIVE_ON); - this.setHarvestLevel("pickaxe", material.getLevel()); - } - - @Override - public boolean isCorrectToolForDrops(BlockState blockIn) { - Block block = blockIn.getBlock(); - - if (block == Blocks.OBSIDIAN) { - return this.toolMaterial.getHarvestLevel() == 3; - } else if (block != Blocks.DIAMOND_BLOCK && block != Blocks.DIAMOND_ORE) { - if (block != Blocks.EMERALD_ORE && block != Blocks.EMERALD_BLOCK) { - if (block != Blocks.GOLD_BLOCK && block != Blocks.GOLD_ORE) { - if (block != Blocks.IRON_BLOCK && block != Blocks.IRON_ORE) { - if (block != Blocks.LAPIS_BLOCK && block != Blocks.LAPIS_ORE) { - if (block != Blocks.REDSTONE_ORE) { - Material material = blockIn.getMaterial(); - return material == Material.STONE || material == Material.METAL || material == Material.HEAVY_METAL; - } else { - return this.toolMaterial.getHarvestLevel() >= 2; - } - } else { - return this.toolMaterial.getHarvestLevel() >= 1; - } - } else { - return this.toolMaterial.getHarvestLevel() >= 1; - } - } else { - return this.toolMaterial.getHarvestLevel() >= 2; - } - } else { - return this.toolMaterial.getHarvestLevel() >= 2; - } - } else { - return this.toolMaterial.getHarvestLevel() >= 2; - } - } - - @Override - public float getDestroySpeed(ItemStack stack, BlockState state) { - Material material = state.getMaterial(); - return material != Material.METAL && material != Material.HEAVY_METAL && material != Material.STONE - ? super.getDestroySpeed(stack, state) - : this.speed; - } - - @Override - public Set getToolClasses(ItemStack stack) { - return Collections.singleton("pickaxe"); - }*/ -} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemShovelAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemShovelAA.java deleted file mode 100644 index 5914074b6..000000000 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemShovelAA.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * This file ("ItemShovelAA.java") is part of the Actually Additions mod for Minecraft. - * It is created and owned by Ellpeck and distributed - * under the Actually Additions License to be found at - * http://ellpeck.de/actaddlicense - * View the source code at https://github.com/Ellpeck/ActuallyAdditions - * - * © 2015-2017 Ellpeck - */ - -package de.ellpeck.actuallyadditions.mod.items; - -import com.google.common.collect.Sets; -import de.ellpeck.actuallyadditions.mod.items.base.ItemToolAA; -import net.minecraft.tags.TagKey; -import net.minecraft.world.InteractionResult; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; -import net.minecraft.world.item.Tier; -import net.minecraft.world.item.context.UseOnContext; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.state.BlockState; - -import javax.annotation.Nonnull; -import java.util.Collections; -import java.util.Set; - -public class ItemShovelAA extends ItemToolAA { - - private static final Set EFFECTIVE_ON = Sets.newHashSet(Blocks.CLAY, Blocks.DIRT, Blocks.FARMLAND, Blocks.GRASS_BLOCK, Blocks.GRAVEL, Blocks.MYCELIUM, Blocks.SAND, Blocks.SNOW, Blocks.SNOW_BLOCK, Blocks.SOUL_SAND, Blocks.DIRT_PATH); - - public ItemShovelAA(float p_i48512_1_, float p_i48512_2_, Tier p_i48512_3_, TagKey p_i48512_4_, Properties p_i48512_5_, String name, ItemStack repairItem, TagKey repairTag) { - super(p_i48512_1_, p_i48512_2_, p_i48512_3_, p_i48512_4_, p_i48512_5_, name, repairItem, repairTag); - } - -// public ItemShovelAA(IItemTier material) { -//// super(1.5F, -3.0F, material, this.repairItem, unlocalizedName, this.rarity, EFFECTIVE_ON); -//// this.setHarvestLevel("shovel", material.getLevel()); -// } - - @Override - public boolean isCorrectToolForDrops(BlockState blockIn) { - Block block = blockIn.getBlock(); - return block == Blocks.SNOW_BLOCK || block == Blocks.SNOW; - } - - @Nonnull - @Override - public InteractionResult useOn(UseOnContext useContext) { - return Items.IRON_SHOVEL.useOn(useContext); - } - - //@Override - public Set getToolClasses(ItemStack stack) { - return Collections.singleton("shovel"); - } -} 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 deleted file mode 100644 index 705723a2f..000000000 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemHoeAA.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * This file ("ItemHoeAA.java") is part of the Actually Additions mod for Minecraft. - * It is created and owned by Ellpeck and distributed - * under the Actually Additions License to be found at - * http://ellpeck.de/actaddlicense - * View the source code at https://github.com/Ellpeck/ActuallyAdditions - * - * © 2015-2017 Ellpeck - */ - -package de.ellpeck.actuallyadditions.mod.items.base; - -import net.minecraft.world.item.HoeItem; -import net.minecraft.world.item.Tier; - -public class ItemHoeAA extends HoeItem { - private Tier tier; - public ItemHoeAA(Tier tier) { - super(tier, - 4, - -2f, - new Properties() -// .addToolType(ToolType.AXE, tier.getLevel()) -// .addToolType(ToolType.HOE, tier.getLevel()) -// .addToolType(ToolType.SHOVEL, tier.getLevel()) -// .addToolType(ToolType.PICKAXE, tier.getLevel()) - .durability(tier.getUses() * 4) - - ); - - this.tier = tier; - } - -/* private final ItemStack repairItem; - private final boolean disabled; - - public ItemHoeAA(IItemTier toolMat) { - super(toolMat); - - this.disabled = ConfigurationHandler.config.getBoolean("Disable: " + StringUtil.badTranslate(this.name), "Tool Control", false, "This will disable the " + StringUtil.badTranslate(this.name) + ". It will not be registered."); - if (!this.disabled) { - this.register(); - } - } - - private void register() { - } - - @Override - public boolean isValidRepairItem(ItemStack itemToRepair, ItemStack stack) { - return ItemUtil.areItemsEqual(this.repairItem, stack, false); - } - - @Override - public boolean isDisabled() { - return this.disabled; - }*/ -} 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 deleted file mode 100644 index 7cbafdbba..000000000 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSwordAA.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * This file ("ItemSwordAA.java") is part of the Actually Additions mod for Minecraft. - * It is created and owned by Ellpeck and distributed - * under the Actually Additions License to be found at - * http://ellpeck.de/actaddlicense - * View the source code at https://github.com/Ellpeck/ActuallyAdditions - * - * © 2015-2017 Ellpeck - */ - -package de.ellpeck.actuallyadditions.mod.items.base; - -import net.minecraft.world.item.SwordItem; -import net.minecraft.world.item.Tier; - -public class ItemSwordAA extends SwordItem { - private Tier tier; - public ItemSwordAA(Tier tier) { - super(tier, - (int) tier.getAttackDamageBonus(), - tier.getSpeed(), - new Properties() -// .addToolType(ToolType.AXE, tier.getLevel()) -// .addToolType(ToolType.HOE, tier.getLevel()) -// .addToolType(ToolType.SHOVEL, tier.getLevel()) -// .addToolType(ToolType.PICKAXE, tier.getLevel()) - .durability(tier.getUses() * 4) - - ); - } - -/* private final boolean disabled; - - public ItemSwordAA(IItemTier toolMat) { - super(toolMat); - - - this.disabled = ConfigurationHandler.config.getBoolean("Disable: " + StringUtil.badTranslate(this.name), "Tool Control", false, "This will disable the " + StringUtil.badTranslate(this.name) + ". It will not be registered."); - if (!this.disabled) { - this.register(); - } - } - - private void register() { - } - - protected Class getItemBlock() { - return ItemBlockBase.class; - } - - @Override - public boolean isValidRepairItem(ItemStack itemToRepair, ItemStack stack) { - return ItemUtil.areItemsEqual(this.repairItem, stack, false); - } - - @Override - public boolean isDisabled() { - return this.disabled; - }*/ -} 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 deleted file mode 100644 index 01fa5d032..000000000 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemToolAA.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * This file ("ItemToolAA.java") is part of the Actually Additions mod for Minecraft. - * It is created and owned by Ellpeck and distributed - * under the Actually Additions License to be found at - * http://ellpeck.de/actaddlicense - * View the source code at https://github.com/Ellpeck/ActuallyAdditions - * - * © 2015-2017 Ellpeck - */ - -package de.ellpeck.actuallyadditions.mod.items.base; - -import de.ellpeck.actuallyadditions.api.misc.IDisableableItem; -import de.ellpeck.actuallyadditions.mod.util.ItemUtil; -import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.tags.TagKey; -import net.minecraft.world.item.DiggerItem; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Tier; -import net.minecraft.world.level.block.Block; - -public class ItemToolAA extends DiggerItem implements IDisableableItem { - - private final String name; - private final ItemStack repairItem; - private final TagKey repairTag; - private final boolean disabled; - - public ItemToolAA(float p_i48512_1_, float p_i48512_2_, Tier p_i48512_3_, TagKey p_i48512_4_, Properties p_i48512_5_, String name, ItemStack repairItem, TagKey repairTag) { - super(p_i48512_1_, p_i48512_2_, p_i48512_3_, p_i48512_4_, p_i48512_5_); - - this.name = name; - this.repairItem = repairItem; - this.repairTag = repairTag; - this.disabled = false; - } - -// public ItemToolAA(float attack, float speed, IItemTier toolMat, String repairItem, String unlocalizedName, Rarity rarity, Set effectiveStuff) { -// this(attack, speed, toolMat, ItemStack.EMPTY, unlocalizedName, rarity, effectiveStuff); -// this.repairOredict = repairItem; -// } - -// public ItemToolAA(float attack, float speed, ToolMaterial toolMat, ItemStack repairItem, String unlocalizedName, Rarity rarity, Set effectiveStuff) { -// super(attack, speed, toolMat, effectiveStuff); -// -// this.repairItem = repairItem; -// this.name = unlocalizedName; -// this.rarity = rarity; -//// this.disabled = ConfigurationHandler.config.getBoolean("Disable: " + StringUtil.badTranslate(unlocalizedName), "Tool Control", false, "This will disable the " + StringUtil.badTranslate(unlocalizedName) + ". It will not be registered."); -//// if (!this.disabled) { -//// this.register(); -//// } -// } - - private void register() { - } - - @Override - public boolean isValidRepairItem(ItemStack itemToRepair, ItemStack stack) { - if (StackUtil.isValid(this.repairItem)) { - return ItemUtil.areItemsEqual(this.repairItem, stack, false); - } else if (this.repairTag != null) { - return stack.is(repairTag); - } - return false; - } - - @Override - public boolean isDisabled() { - return this.disabled; - } -} 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 fc163cc82..ffe043e18 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 @@ -72,7 +72,7 @@ public class MethodHandler implements IMethodHandler { public boolean addRecipeEffectToStack(ItemStack stack, CoffeeIngredientRecipe ingredient) { boolean worked = false; if (ingredient != null) { - List effects = ingredient.getEffects(); + List effects = ingredient.getEffects(); if (!effects.isEmpty()) { for (MobEffectInstance effect : effects) { MobEffectInstance effectHas = this.getSameEffectFromStack(stack, effect); 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 a7da4e3e3..f7e86320e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java @@ -167,7 +167,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements } public void storeCoffee() { - if (StackUtil.isValid(this.inv.getStackInSlot(SLOT_COFFEE_BEANS)) && this.inv.getStackInSlot(SLOT_COFFEE_BEANS).is(ActuallyTags.Items.COFFEE_BEANS)) { + if (!this.inv.getStackInSlot(SLOT_COFFEE_BEANS).isEmpty() && this.inv.getStackInSlot(SLOT_COFFEE_BEANS).is(ActuallyTags.Items.COFFEE_BEANS)) { int toAdd = 2; if (toAdd <= COFFEE_CACHE_MAX_AMOUNT - this.coffeeCacheAmount) { this.inv.setStackInSlot(SLOT_COFFEE_BEANS, StackUtil.shrink(this.inv.getStackInSlot(SLOT_COFFEE_BEANS), 1)); @@ -194,7 +194,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements this.brewTime = 0; ItemStack output = new ItemStack(ActuallyItems.COFFEE_CUP.get()); for (int i = 3; i < this.inv.getSlots(); i++) { - if (StackUtil.isValid(this.inv.getStackInSlot(i))) { + if (!this.inv.getStackInSlot(i).isEmpty()) { RecipeHolder recipeHolder = ItemCoffee.getIngredientRecipeFromStack(this.inv.getStackInSlot(i)); if (recipeHolder != null) { if (recipeHolder.value().effect(output)) { 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 3cbf46ec7..6fed1ec59 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDropper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDropper.java @@ -78,7 +78,7 @@ public class TileEntityDropper extends TileEntityInventoryBase implements MenuPr private void doWork() { ItemStack theoreticalRemove = this.removeFromInventory(false); - if (StackUtil.isValid(theoreticalRemove)) { + if (!theoreticalRemove.isEmpty()) { BlockState state = this.level.getBlockState(this.worldPosition); ItemStack drop = theoreticalRemove.copy(); drop.setCount(1); @@ -89,7 +89,7 @@ public class TileEntityDropper extends TileEntityInventoryBase implements MenuPr public ItemStack removeFromInventory(boolean actuallyDo) { for (int i = 0; i < this.inv.getSlots(); i++) { - if (StackUtil.isValid(this.inv.getStackInSlot(i))) { + if (!this.inv.getStackInSlot(i).isEmpty()) { ItemStack slot = this.inv.getStackInSlot(i).copy(); if (actuallyDo) { this.inv.setStackInSlot(i, StackUtil.shrink(this.inv.getStackInSlot(i), 1)); 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 59e4b2f70..6bbc8f05c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFarmer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFarmer.java @@ -151,7 +151,7 @@ public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer for (int i = 0; i < 6; i++) { //Process seed slots only ItemStack stack = this.inv.getStackInSlot(i); BlockState state = this.level.getBlockState(query); - if (StackUtil.isValid(stack) && state.canBeReplaced()) { + if (!stack.isEmpty() && state.canBeReplaced()) { FarmerResult plantResult = behavior.tryPlantSeed(stack, this.level, query, this); if (plantResult == FarmerResult.SUCCESS) { this.inv.getStackInSlot(i).shrink(1); 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 7bbbc5667..e91ebb11e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFluidCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFluidCollector.java @@ -120,7 +120,7 @@ public class TileEntityFluidCollector extends TileEntityBase implements ISharing if (placeable) { this.tank.drainInternal(FluidType.BUCKET_VOLUME, IFluidHandler.FluidAction.EXECUTE); // TODO: [port] validate this check is still valid. - if (this.level.dimensionType().ultraWarm() && stack.getFluid().is(FluidTags.WATER)) { + if (this.level.dimensionType().ultraWarm() && stack.is(FluidTags.WATER)) { this.level.playSound(null, offsetPos, SoundEvents.FIRE_EXTINGUISH, SoundSource.BLOCKS, 0.5F, 2.6F + (this.level.random.nextFloat() - this.level.random.nextFloat()) * 0.8F); if (this.level instanceof ServerLevel) {