From 44effd2e7a9f40f2293e9460abc8803f0b26b017 Mon Sep 17 00:00:00 2001 From: Flanks255 <32142731+Flanks255@users.noreply.github.com> Date: Sun, 15 Jan 2023 10:56:02 -0600 Subject: [PATCH] Coffee fixes. Batbox stuff. --- port.MD | 8 +++---- src/generated/resources/.cache/cache | 3 +-- .../models/item/coffee_seeds.json | 6 ----- .../loot_tables/blocks/coffee.json | 4 ++-- .../data/LootTableGenerator.java | 2 +- .../mod/blocks/ActuallyBlocks.java | 2 +- .../mod/blocks/BlockBatteryBox.java | 22 ++++++++++++++----- .../actuallyadditions/mod/blocks/Shapes.java | 1 + .../mod/blocks/render/RenderBatteryBox.java | 5 ++--- .../mod/items/ActuallyItems.java | 13 +++++++---- .../mod/tile/TileEntityBatteryBox.java | 8 +++---- 11 files changed, 42 insertions(+), 32 deletions(-) delete mode 100644 src/generated/resources/assets/actuallyadditions/models/item/coffee_seeds.json diff --git a/port.MD b/port.MD index f1dc9b119..fa61c2984 100644 --- a/port.MD +++ b/port.MD @@ -45,9 +45,9 @@ - [ ] Improve the coffee maker's ui by putting the water meter actually into the ui - [ ] Rename phantom boosters to range boosters (since they work for other stuff too) - [ ] Make worms use that new forge event/hook to keep the ground watered instead of trying to re-water it every few ticks -- [ ] Give ender star an enchantment glint +- [x] Give ender star an enchantment glint - [ ] Make miner lens far more expensive to use, mmm power creep -- [ ] Make coffee beans and seeds be the same item or I might get killed by someone finally +- [x] Make coffee beans and seeds be the same item or I might get killed by someone finally # Keep As Is - [ ] Battery box @@ -70,7 +70,7 @@ - [ ] Crusher and double crusher - [ ] Heat collectors - [x] Precision dropper -- [ ] Engineer's goggles +- [x] Engineer's goggles - [ ] Laser relay modifiers and wrench - [ ] Handheld filler - [ ] Sacks @@ -89,7 +89,7 @@ - [ ] Drills and drill upgrades - [ ] Batteries - [x] Crafting table on a stick -- [ ] Leaf blowers +- [x] Leaf blowers - [ ] The book - [x] The Crystal Flux name and rainbow effect - [ ] Engineer's village house and engineer villager \ No newline at end of file diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index c2f717e2e..a8fe15224 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -260,7 +260,6 @@ bbf723238f6536295339f0b0b5b052cf89b92d5b assets/actuallyadditions/models/item/co 1d676d4abc4c67c3da2d15499ecb585f436f3893 assets/actuallyadditions/models/item/coffee_beans.json 28fc61074cb1a60ef5904e4bba7f6ad3c42b55fd assets/actuallyadditions/models/item/coffee_cup.json 082ecd5232059fadaa447a99a623437e3adab3ef assets/actuallyadditions/models/item/coffee_machine.json -6765c06218d8940c06daeff92aeb44516ac6ff4a assets/actuallyadditions/models/item/coffee_seeds.json 7698ec0e672b1209e6a664dfee5c3bbaa1a612c7 assets/actuallyadditions/models/item/crafter_on_a_stick.json 1e7e61701473dbf3dfc18bb5b9fa7be91b443dd8 assets/actuallyadditions/models/item/crusher.json aeacd7ca465c19d6cbcef25e61023397c4472ab3 assets/actuallyadditions/models/item/crusher_double.json @@ -478,7 +477,7 @@ f3df22f203e8c00ee7ee004bb9b4edfd522f069a data/actuallyadditions/loot_tables/bloc 6df5538ba7cf057d19728f8e615862a84b9d4bb1 data/actuallyadditions/loot_tables/blocks/chiseled_black_quartz_stair.json 092e8773d46f16d80d0c489c4a2d2f8bd5a78799 data/actuallyadditions/loot_tables/blocks/chiseled_black_quartz_wall.json bf7743c27757cf5b0dbab9b3e15d1d5ca1ece818 data/actuallyadditions/loot_tables/blocks/coal_generator.json -66ee33930c8392b29710ce2bc117f99907e336df data/actuallyadditions/loot_tables/blocks/coffee.json +01ed45d18335029de7725ae4490077c9280eedd1 data/actuallyadditions/loot_tables/blocks/coffee.json 3285202e3f840d091b8d85dc2c721199fcc96240 data/actuallyadditions/loot_tables/blocks/coffee_machine.json 317d0377327250f2fe15ff549a1ffa1b7bdade14 data/actuallyadditions/loot_tables/blocks/crusher.json b087c6f44cf0236f52471ec54c026ee30ba0d273 data/actuallyadditions/loot_tables/blocks/crusher_double.json diff --git a/src/generated/resources/assets/actuallyadditions/models/item/coffee_seeds.json b/src/generated/resources/assets/actuallyadditions/models/item/coffee_seeds.json deleted file mode 100644 index 3c4ae6c87..000000000 --- a/src/generated/resources/assets/actuallyadditions/models/item/coffee_seeds.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "minecraft:item/handheld", - "textures": { - "layer0": "actuallyadditions:item/coffee_seeds" - } -} \ No newline at end of file diff --git a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/coffee.json b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/coffee.json index 712ba0088..a12e5c4c9 100644 --- a/src/generated/resources/data/actuallyadditions/loot_tables/blocks/coffee.json +++ b/src/generated/resources/data/actuallyadditions/loot_tables/blocks/coffee.json @@ -22,7 +22,7 @@ }, { "type": "minecraft:item", - "name": "actuallyadditions:coffee_seeds" + "name": "actuallyadditions:coffee_beans" } ] } @@ -44,7 +44,7 @@ } } ], - "name": "actuallyadditions:coffee_seeds" + "name": "actuallyadditions:coffee_beans" } ], "conditions": [ diff --git a/src/main/java/de/ellpeck/actuallyadditions/data/LootTableGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/data/LootTableGenerator.java index ab4469e69..25754afb6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/data/LootTableGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/data/LootTableGenerator.java @@ -190,7 +190,7 @@ public class LootTableGenerator extends LootTableProvider { addCrop(ActuallyBlocks.CANOLA, ActuallyItems.CANOLA, ActuallyItems.CANOLA_SEEDS); addCrop(ActuallyBlocks.RICE, ActuallyItems.RICE, ActuallyItems.RICE_SEEDS); addCrop(ActuallyBlocks.FLAX, () -> Items.STRING, ActuallyItems.FLAX_SEEDS); - addCrop(ActuallyBlocks.COFFEE, ActuallyItems.COFFEE_BEANS, ActuallyItems.COFFEE_SEEDS); + addCrop(ActuallyBlocks.COFFEE, ActuallyItems.COFFEE_BEANS, ActuallyItems.COFFEE_BEANS); } private void addCrop(Supplier block, Supplier item, Supplier seed) { 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 e0e44440e..7dabd3532 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/ActuallyBlocks.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/ActuallyBlocks.java @@ -262,7 +262,7 @@ public final class ActuallyBlocks { public static Supplier CANOLA = BLOCKS.register("canola", () -> new AACrops(defaultCropProps(), ActuallyItems.CANOLA_SEEDS)); public static Supplier RICE = BLOCKS.register("rice", () -> new AACrops(defaultCropProps(), ActuallyItems.RICE_SEEDS)); public static Supplier FLAX = BLOCKS.register("flax", () -> new AACrops(defaultCropProps(), ActuallyItems.FLAX_SEEDS)); - public static Supplier COFFEE = BLOCKS.register("coffee", () -> new AACrops(defaultCropProps(), ActuallyItems.COFFEE_SEEDS)); + public static Supplier COFFEE = BLOCKS.register("coffee", () -> new AACrops(defaultCropProps(), ActuallyItems.COFFEE_BEANS)); public static final AABlockReg GREENHOUSE_GLASS = new AABlockReg<>("greenhouse_glass", BlockGreenhouseGlass::new, (b) -> new AABlockItem(b, defaultBlockItemProperties)); 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 cf91d4798..71c0f9799 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBatteryBox.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBatteryBox.java @@ -13,6 +13,7 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.items.ItemBattery; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBatteryBox; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoalGenerator; import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; @@ -22,6 +23,8 @@ import net.minecraft.util.ActionResultType; import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; +import net.minecraft.util.math.shapes.ISelectionContext; +import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.world.IBlockReader; import net.minecraft.world.World; @@ -37,10 +40,19 @@ public class BlockBatteryBox extends BlockContainerBase { // public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) { // return BlockSlabs.AABB_BOTTOM_HALF; // } + @Override + public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { + return Shapes.BATBOX_SHAPE; + } + + @Override + public boolean hasTileEntity(BlockState state) { + return true; + } @Nullable - //@Override - public TileEntity newBlockEntity(IBlockReader worldIn) { + @Override + public TileEntity createTileEntity(BlockState state, IBlockReader world) { return new TileEntityBatteryBox(); } @@ -51,15 +63,15 @@ public class BlockBatteryBox extends BlockContainerBase { TileEntityBatteryBox box = (TileEntityBatteryBox) tile; ItemStack stack = player.getItemInHand(hand); - if (StackUtil.isValid(stack)) { - if (stack.getItem() instanceof ItemBattery && !StackUtil.isValid(box.inv.getStackInSlot(0))) { + if (!stack.isEmpty()) { + if (stack.getItem() instanceof ItemBattery && box.inv.getStackInSlot(0).isEmpty()) { box.inv.setStackInSlot(0, stack.copy()); player.setItemInHand(hand, ItemStack.EMPTY); return ActionResultType.SUCCESS; } } else { ItemStack inSlot = box.inv.getStackInSlot(0); - if (StackUtil.isValid(inSlot)) { + if (!inSlot.isEmpty()) { player.setItemInHand(hand, inSlot.copy()); box.inv.setStackInSlot(0, ItemStack.EMPTY); return ActionResultType.SUCCESS; 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 a1f5fb9d2..e5544e09f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/Shapes.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/Shapes.java @@ -12,6 +12,7 @@ public class Shapes { 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 BATBOX_SHAPE = Block.box(0,0,0, 16, 8, 16); 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(); 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 b68a3a95a..5a6245747 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 @@ -14,6 +14,7 @@ import com.mojang.blaze3d.matrix.MatrixStack; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.items.ItemBattery; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBatteryBox; +import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.Lang; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -97,9 +98,7 @@ public class RenderBatteryBox extends TileEntityRenderer { matrices.scale(scale, scale, scale); try { - Minecraft.getInstance().getItemRenderer().renderStatic( - stack, ItemCameraTransforms.TransformType.FIXED, combinedLight, combinedOverlay, matrices, buffer - ); + AssetUtil.renderItemInWorld(stack, 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); } 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 6e0eb5229..b15bc0f5b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ActuallyItems.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ActuallyItems.java @@ -25,6 +25,7 @@ import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; +import javax.annotation.Nonnull; import java.util.Set; import java.util.function.Supplier; @@ -58,7 +59,12 @@ public final class ActuallyItems { public static final RegistryObject BATS_WING = ITEMS.register("bats_wing", ItemBase::new); public static final RegistryObject DRILL_CORE = ITEMS.register("drill_core", ItemBase::new); public static final RegistryObject LENS = ITEMS.register("lens", ItemBase::new); - public static final RegistryObject ENDER_STAR = ITEMS.register("ender_star", ItemBase::new); + public static final RegistryObject ENDER_STAR = ITEMS.register("ender_star", () -> new ItemBase() { + @Override + public boolean isFoil(@Nonnull ItemStack pStack) { + return true; + } + }); public static final RegistryObject CRYSTALLIZED_CANOLA_SEED = ITEMS.register("crystallized_canola_seed", () -> new CanolaSeed(false)); public static final RegistryObject EMPOWERED_CANOLA_SEED = ITEMS.register("empowered_canola_seed", () -> new CanolaSeed(true)); @@ -156,12 +162,11 @@ public final class ActuallyItems { public static final RegistryObject LEAF_BLOWER = ITEMS.register("leaf_blower", () -> new ItemLeafBlower(false)); public static final RegistryObject ADVANCED_LEAF_BLOWER = ITEMS.register("advanced_leaf_blower", () -> new ItemLeafBlower(true)); - public static final RegistryObject COFFEE_BEANS = ITEMS.register("coffee_beans", ItemCoffeeBean::new); + public static final RegistryObject COFFEE_BEANS = ITEMS.register("coffee_beans", () -> new AABlockItem.AASeedItem(ActuallyBlocks.COFFEE.get(), ActuallyItems.defaultProps())); public static final RegistryObject RICE_SEEDS = ITEMS.register("rice_seeds", () -> new AABlockItem.AASeedItem(ActuallyBlocks.RICE.get(), ActuallyItems.defaultProps())); //() -> new ItemSeed("seedRice", ActuallyBlocks.RICE.get(), FOOD.get(), TheFoods.RICE.ordinal())); public static final RegistryObject CANOLA_SEEDS = ITEMS.register("canola_seeds", () -> new AABlockItem.AASeedItem(ActuallyBlocks.CANOLA.get(), ActuallyItems.defaultProps())); //() -> new ItemFoodSeed("seedCanola", ActuallyBlocks.CANOLA, itemMisc, 0, 1, 0.01F, 10).setPotionEffect(new PotionEffect(MobEffects.NAUSEA, 1000, 0), 0.2F)); public static final RegistryObject FLAX_SEEDS = ITEMS.register("flax_seeds", () -> new AABlockItem.AASeedItem(ActuallyBlocks.FLAX.get(), ActuallyItems.defaultProps())); //() -> new ItemSeed("seedFlax", ActuallyBlocks.FLAX, Items.STRING, 0)); - public static final RegistryObject COFFEE_SEEDS = ITEMS.register("coffee_seeds", () -> new AABlockItem.AASeedItem(ActuallyBlocks.COFFEE.get(), ActuallyItems.defaultProps())); //() -> new ItemSeed("seedCoffeeBeans", ActuallyBlocks.COFFEE, COFFEE_BEANS, 0)); // TOOLS & ARMOR public static final RegistryObject WOODEN_AIOT = ITEMS.register("wooden_aiot", () -> new AllInOneTool(ItemTier.WOOD)); @@ -197,7 +202,7 @@ public final class ActuallyItems { CRUSHED_QUARTZ, CRUSHED_COAL, CRUSHED_BLACK_QUARTZ, */ SOLIDIFIED_EXPERIENCE, LEAF_BLOWER, ADVANCED_LEAF_BLOWER, RING_OF_GROWTH, RING_OF_MAGNETIZING, - COFFEE_BEANS, RICE_SEEDS, CANOLA_SEEDS, FLAX_SEEDS, COFFEE_SEEDS + COFFEE_BEANS, RICE_SEEDS, CANOLA_SEEDS, FLAX_SEEDS ); private static Supplier basicItem() { 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 1f9d505af..603570473 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBatteryBox.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBatteryBox.java @@ -37,7 +37,7 @@ public class TileEntityBatteryBox extends TileEntityInventoryBase implements ISh @Override public LazyOptional getEnergyStorage(Direction facing) { ItemStack stack = this.inv.getStackInSlot(0); - if (StackUtil.isValid(stack) && stack.getItem() instanceof ItemBattery) { + if (stack.getItem() instanceof ItemBattery) { return stack.getCapability(CapabilityEnergy.ENERGY, null); } return LazyOptional.empty(); @@ -51,7 +51,7 @@ public class TileEntityBatteryBox extends TileEntityInventoryBase implements ISh LazyOptional cap = this.getEnergyStorage(null); int currStorage = cap.map(storage -> { ItemStack stack = this.inv.getStackInSlot(0); - if (StackUtil.isValid(stack) && ItemUtil.isEnabled(stack)) { + if (!stack.isEmpty() && ItemUtil.isEnabled(stack)) { if (storage.getEnergyStored() > 0) { List tiles = new ArrayList<>(); this.energyPushOffLoop(this, tiles); @@ -67,7 +67,7 @@ public class TileEntityBatteryBox extends TileEntityInventoryBase implements ISh for (TileEntityBatteryBox tile : tiles) { ItemStack battery = tile.inv.getStackInSlot(0); - if (StackUtil.isValid(battery) && !ItemUtil.isEnabled(battery)) { + if (!battery.isEmpty() && !ItemUtil.isEnabled(battery)) { int received = tile.getCapability(CapabilityEnergy.ENERGY, null).map(e -> e.receiveEnergy(maxPer, false)).orElse(0); storage.extractEnergy(received, false); @@ -108,7 +108,7 @@ public class TileEntityBatteryBox extends TileEntityInventoryBase implements ISh @Override public void activateOnPulse() { ItemStack stack = this.inv.getStackInSlot(0); - if (StackUtil.isValid(stack)) { + if (!stack.isEmpty()) { ItemUtil.changeEnabled(stack); this.setChanged(); }