diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index b058bc380..e392b0dfb 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -5628,12 +5628,12 @@ ac265a674626e0e832330086fd18fe0be37fc327 data/create/recipes/weathered_copper_ti 5942a571f79c40524bbf408775cf91de4715f2b6 data/create/recipes/weathered_copper_tile_stairs_from_weathered_copper_tiles_stonecutting.json 2d549ea56fb226c0e31e66c0391996093f8bece9 data/create/tags/blocks/brittle.json d99d5c67bdffff60789a19bd51a5c5267c75e0a4 data/create/tags/blocks/casing.json -330bfb3850ba3964b10b1bccbc3cbb9b012cae54 data/create/tags/blocks/fan_heaters.json -57b942386a15c874d1ca9cd6a8032c11a5599fc2 data/create/tags/blocks/fan_transparent.json +418c6da531d6206e3cbe4049dce3db23c4270bed data/create/tags/blocks/fan_heaters.json +443f75adbf3d2f6fb0aad4b344372669470065b8 data/create/tags/blocks/fan_transparent.json 6e5d3b2123fbb00e7f439c091623619502551bca data/create/tags/blocks/non_movable.json 10781e8cfcbb3486327aace3aa00e437fb44b331 data/create/tags/blocks/ore_override_stone.json 197ed7ee3b284045c005011d28c38ac5b2e44d8c data/create/tags/blocks/passive_boiler_heaters.json -90eae7075c4588540560185eea40a1f37b2663d8 data/create/tags/blocks/safe_nbt.json +74f4ba5f6f61c30e27947c6fb4557e888d018285 data/create/tags/blocks/safe_nbt.json 6cdeeac1689f7b5bfd9bc40b462143d8eaf3ad0b data/create/tags/blocks/seats.json d063e12c9ef75f39518c6d129ea35d833464d547 data/create/tags/blocks/toolboxes.json 50936b211d94167a35ec78c89954082a336b6269 data/create/tags/blocks/valve_handles.json diff --git a/src/generated/resources/data/create/tags/blocks/fan_heaters.json b/src/generated/resources/data/create/tags/blocks/fan_heaters.json index b23883a0d..dc4ef4afb 100644 --- a/src/generated/resources/data/create/tags/blocks/fan_heaters.json +++ b/src/generated/resources/data/create/tags/blocks/fan_heaters.json @@ -3,11 +3,9 @@ "values": [ "create:blaze_burner", "create:lit_blaze_burner", + "#minecraft:fire", + "#minecraft:campfires", "minecraft:magma_block", - "minecraft:campfire", - "minecraft:lava", - "minecraft:fire", - "minecraft:soul_fire", - "minecraft:soul_campfire" + "minecraft:lava" ] } \ No newline at end of file diff --git a/src/generated/resources/data/create/tags/blocks/fan_transparent.json b/src/generated/resources/data/create/tags/blocks/fan_transparent.json index 6c8dfd4aa..4847b23a8 100644 --- a/src/generated/resources/data/create/tags/blocks/fan_transparent.json +++ b/src/generated/resources/data/create/tags/blocks/fan_transparent.json @@ -5,8 +5,7 @@ "create:lit_blaze_burner", "create:sail_frame", "#minecraft:fences", - "minecraft:iron_bars", - "minecraft:campfire", - "minecraft:soul_campfire" + "#minecraft:campfires", + "minecraft:iron_bars" ] } \ No newline at end of file diff --git a/src/generated/resources/data/create/tags/blocks/safe_nbt.json b/src/generated/resources/data/create/tags/blocks/safe_nbt.json index 4858e0624..3d607530a 100644 --- a/src/generated/resources/data/create/tags/blocks/safe_nbt.json +++ b/src/generated/resources/data/create/tags/blocks/safe_nbt.json @@ -25,6 +25,7 @@ "create:placard", "create:pulse_repeater", "create:pulse_extender", - "#minecraft:signs" + "#minecraft:signs", + "#minecraft:banners" ] } \ No newline at end of file diff --git a/src/main/java/com/simibubi/create/AllTags.java b/src/main/java/com/simibubi/create/AllTags.java index 162086829..d58f1eea8 100644 --- a/src/main/java/com/simibubi/create/AllTags.java +++ b/src/main/java/com/simibubi/create/AllTags.java @@ -397,12 +397,16 @@ public class AllTags { AllBlockTags.BRITTLE.add(Blocks.FLOWER_POT, Blocks.BELL, Blocks.COCOA); AllBlockTags.FAN_TRANSPARENT.includeAll(BlockTags.FENCES); - AllBlockTags.FAN_TRANSPARENT.add(Blocks.IRON_BARS, Blocks.CAMPFIRE, Blocks.SOUL_CAMPFIRE); + AllBlockTags.FAN_TRANSPARENT.includeAll(BlockTags.CAMPFIRES); + AllBlockTags.FAN_TRANSPARENT.add(Blocks.IRON_BARS); - AllBlockTags.FAN_HEATERS.add(Blocks.MAGMA_BLOCK, Blocks.CAMPFIRE, Blocks.LAVA, Blocks.FIRE, Blocks.SOUL_FIRE, - Blocks.SOUL_CAMPFIRE); + AllBlockTags.FAN_HEATERS.includeAll(BlockTags.FIRE); + AllBlockTags.FAN_HEATERS.includeAll(BlockTags.CAMPFIRES); + AllBlockTags.FAN_HEATERS.add(Blocks.MAGMA_BLOCK, Blocks.LAVA); AllBlockTags.FAN_HEATERS.includeIn(AllBlockTags.PASSIVE_BOILER_HEATERS); + AllBlockTags.SAFE_NBT.includeAll(BlockTags.SIGNS); + AllBlockTags.SAFE_NBT.includeAll(BlockTags.BANNERS); AllBlockTags.WRENCH_PICKUP.includeAll(BlockTags.RAILS); AllBlockTags.WRENCH_PICKUP.includeAll(BlockTags.BUTTONS); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerMovementBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerMovementBehaviour.java index 0fb1332dc..116918e76 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerMovementBehaviour.java @@ -138,21 +138,20 @@ public class DeployerMovementBehaviour implements MovementBehaviour { return; List requiredItems = requirement.getRequiredItems(); - ItemStack firstRequired = requiredItems.isEmpty() ? ItemStack.EMPTY : requiredItems.get(0).item; + ItemStack contextStack = requiredItems.isEmpty() ? ItemStack.EMPTY : requiredItems.get(0).stack; if (!context.contraption.hasUniversalCreativeCrate) { IItemHandler iItemHandler = context.contraption.getSharedInventory(); for (ItemRequirement.StackRequirement required : requiredItems) { - int amountFound = ItemHelper - .extract(iItemHandler, s -> ItemRequirement.validate(required.item, s), ExtractionCountMode.UPTO, - required.item.getCount(), true) - .getCount(); - if (amountFound < required.item.getCount()) + ItemStack stack= ItemHelper + .extract(iItemHandler, required::matches, ExtractionCountMode.EXACTLY, + required.stack.getCount(), true); + if (stack.isEmpty()) return; } for (ItemRequirement.StackRequirement required : requiredItems) - ItemHelper.extract(iItemHandler, s -> ItemRequirement.validate(required.item, s), - ExtractionCountMode.UPTO, required.item.getCount(), false); + contextStack = ItemHelper.extract(iItemHandler, required::matches, + ExtractionCountMode.EXACTLY, required.stack.getCount(), false); } CompoundTag data = null; @@ -165,7 +164,7 @@ public class DeployerMovementBehaviour implements MovementBehaviour { } BlockSnapshot blocksnapshot = BlockSnapshot.create(world.dimension(), world, pos); - BlockHelper.placeSchematicBlock(world, blockState, pos, firstRequired, data); + BlockHelper.placeSchematicBlock(world, blockState, pos, contextStack, data); if (ForgeEventFactory.onBlockPlace(player, blocksnapshot, Direction.UP)) blocksnapshot.restore(true, false); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/SailBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/SailBlock.java index 3f63ce22f..ee71a2dd5 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/SailBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/SailBlock.java @@ -107,7 +107,7 @@ public class SailBlock extends WrenchableDirectionalBlock { return InteractionResult.PASS; } - protected void applyDye(BlockState state, Level world, BlockPos pos, Vec3 hit, @Nullable DyeColor color) { + public void applyDye(BlockState state, Level world, BlockPos pos, Vec3 hit, @Nullable DyeColor color) { BlockState newState = (color == null ? AllBlocks.SAIL_FRAME : AllBlocks.DYED_SAILS.get(color)).getDefaultState(); newState = BlockHelper.copyProperties(state, newState); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/CartAssemblerBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/CartAssemblerBlock.java index eac0d072b..4efb61f65 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/CartAssemblerBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/CartAssemblerBlock.java @@ -255,10 +255,10 @@ public class CartAssemblerBlock extends BaseRailBlock @Override public ItemRequirement getRequiredItems(BlockState state, BlockEntity te) { - ArrayList reuiredItems = new ArrayList<>(); - reuiredItems.add(new ItemStack(getRailItem(state))); - reuiredItems.add(new ItemStack(asItem())); - return new ItemRequirement(ItemUseType.CONSUME, reuiredItems); + ArrayList requiredItems = new ArrayList<>(); + requiredItems.add(new ItemStack(getRailItem(state))); + requiredItems.add(new ItemStack(asItem())); + return new ItemRequirement(ItemUseType.CONSUME, requiredItems); } @Override diff --git a/src/main/java/com/simibubi/create/content/schematics/ISpecialBlockEntityItemRequirement.java b/src/main/java/com/simibubi/create/content/schematics/ISpecialBlockEntityItemRequirement.java new file mode 100644 index 000000000..f5e6ec689 --- /dev/null +++ b/src/main/java/com/simibubi/create/content/schematics/ISpecialBlockEntityItemRequirement.java @@ -0,0 +1,11 @@ +package com.simibubi.create.content.schematics; + +import net.minecraft.world.level.block.state.BlockState; + +public interface ISpecialBlockEntityItemRequirement { + + default ItemRequirement getRequiredItems(BlockState state) { + return ItemRequirement.INVALID; + } + +} diff --git a/src/main/java/com/simibubi/create/content/schematics/ItemRequirement.java b/src/main/java/com/simibubi/create/content/schematics/ItemRequirement.java index 507e659ca..32f4c1563 100644 --- a/src/main/java/com/simibubi/create/content/schematics/ItemRequirement.java +++ b/src/main/java/com/simibubi/create/content/schematics/ItemRequirement.java @@ -2,18 +2,18 @@ package com.simibubi.create.content.schematics; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; -import com.simibubi.create.foundation.tileEntity.SmartTileEntity; - import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.decoration.ArmorStand; import net.minecraft.world.entity.decoration.ItemFrame; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; +import net.minecraft.world.level.block.AbstractBannerBlock; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.DirtPathBlock; @@ -21,41 +21,28 @@ import net.minecraft.world.level.block.FarmBlock; import net.minecraft.world.level.block.SeaPickleBlock; import net.minecraft.world.level.block.SnowLayerBlock; import net.minecraft.world.level.block.TurtleEggBlock; +import net.minecraft.world.level.block.entity.BannerBlockEntity; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.SlabType; public class ItemRequirement { + public static final ItemRequirement NONE = new ItemRequirement(Collections.emptyList()); + public static final ItemRequirement INVALID = new ItemRequirement(Collections.emptyList()); - public enum ItemUseType { - CONSUME, DAMAGE - } - - public static class StackRequirement { - public final ItemStack item; - public final ItemUseType usage; - - public StackRequirement(ItemUseType usage, ItemStack item) { - this.item = item; - this.usage = usage; - } - } - - List requiredItems; - - public static final ItemRequirement INVALID = new ItemRequirement(); - public static final ItemRequirement NONE = new ItemRequirement(); - - private ItemRequirement() { - } + protected List requiredItems; public ItemRequirement(List requiredItems) { this.requiredItems = requiredItems; } - public ItemRequirement(ItemUseType usage, ItemStack items) { - this(Arrays.asList(new StackRequirement(usage, items))); + public ItemRequirement(StackRequirement stackRequirement) { + this(List.of(stackRequirement)); + } + + public ItemRequirement(ItemUseType usage, ItemStack stack) { + this(new StackRequirement(stack, usage)); } public ItemRequirement(ItemUseType usage, Item item) { @@ -63,28 +50,26 @@ public class ItemRequirement { } public ItemRequirement(ItemUseType usage, List requiredItems) { - this(requiredItems.stream().map(req -> new StackRequirement(usage, req)).collect(Collectors.toList())); + this(requiredItems.stream().map(req -> new StackRequirement(req, usage)).collect(Collectors.toList())); } - public static ItemRequirement of(BlockState state, BlockEntity te) { Block block = state.getBlock(); - ItemRequirement baseRequirement; - if (block instanceof ISpecialBlockItemRequirement) { - baseRequirement = ((ISpecialBlockItemRequirement) block).getRequiredItems(state, te); + ItemRequirement requirement; + if (block instanceof ISpecialBlockItemRequirement specialBlock) { + requirement = specialBlock.getRequiredItems(state, te); } else { - baseRequirement = ofBlockState(state); + requirement = defaultOf(state, te); } - // Behaviours can add additional required items - if (te instanceof SmartTileEntity) - baseRequirement = baseRequirement.with(((SmartTileEntity) te).getRequiredItems()); + if (te instanceof ISpecialBlockEntityItemRequirement specialBE) + requirement = requirement.union(specialBE.getRequiredItems(state)); - return baseRequirement; + return requirement; } - private static ItemRequirement ofBlockState(BlockState state) { + private static ItemRequirement defaultOf(BlockState state, BlockEntity te) { Block block = state.getBlock(); if (block == Blocks.AIR) return NONE; @@ -95,22 +80,24 @@ public class ItemRequirement { // double slab needs two items if (state.hasProperty(BlockStateProperties.SLAB_TYPE) && state.getValue(BlockStateProperties.SLAB_TYPE) == SlabType.DOUBLE) - return new ItemRequirement(ItemUseType.CONSUME, Arrays.asList(new ItemStack(item, 2))); + return new ItemRequirement(ItemUseType.CONSUME, new ItemStack(item, 2)); if (block instanceof TurtleEggBlock) - return new ItemRequirement(ItemUseType.CONSUME, Arrays.asList(new ItemStack(item, state.getValue(TurtleEggBlock.EGGS).intValue()))); + return new ItemRequirement(ItemUseType.CONSUME, new ItemStack(item, state.getValue(TurtleEggBlock.EGGS).intValue())); if (block instanceof SeaPickleBlock) - return new ItemRequirement(ItemUseType.CONSUME, Arrays.asList(new ItemStack(item, state.getValue(SeaPickleBlock.PICKLES).intValue()))); + return new ItemRequirement(ItemUseType.CONSUME, new ItemStack(item, state.getValue(SeaPickleBlock.PICKLES).intValue())); if (block instanceof SnowLayerBlock) - return new ItemRequirement(ItemUseType.CONSUME, Arrays.asList(new ItemStack(item, state.getValue(SnowLayerBlock.LAYERS).intValue()))); + return new ItemRequirement(ItemUseType.CONSUME, new ItemStack(item, state.getValue(SnowLayerBlock.LAYERS).intValue())); if (block instanceof FarmBlock || block instanceof DirtPathBlock) - return new ItemRequirement(ItemUseType.CONSUME, Arrays.asList(new ItemStack(Items.DIRT))); + return new ItemRequirement(ItemUseType.CONSUME, Items.DIRT); + if (block instanceof AbstractBannerBlock && te instanceof BannerBlockEntity bannerBE) + return new ItemRequirement(new StrictNbtStackRequirement(bannerBE.getItem(), ItemUseType.CONSUME)); return new ItemRequirement(ItemUseType.CONSUME, item); } public static ItemRequirement of(Entity entity) { - if (entity instanceof ISpecialEntityItemRequirement) - return ((ISpecialEntityItemRequirement) entity).getRequiredItems(); + if (entity instanceof ISpecialEntityItemRequirement specialEntity) + return specialEntity.getRequiredItems(); if (entity instanceof ItemFrame itemFrame) { ItemStack frame = new ItemStack(Items.ITEM_FRAME); @@ -147,11 +134,7 @@ public class ItemRequirement { return requiredItems; } - public static boolean validate(ItemStack required, ItemStack present) { - return required.isEmpty() || required.getItem() == present.getItem(); - } - - public ItemRequirement with(ItemRequirement other) { + public ItemRequirement union(ItemRequirement other) { if (this.isInvalid() || other.isInvalid()) return INVALID; if (this.isEmpty()) @@ -164,4 +147,32 @@ public class ItemRequirement { ); } + public enum ItemUseType { + CONSUME, DAMAGE + } + + public static class StackRequirement { + public final ItemStack stack; + public final ItemUseType usage; + + public StackRequirement(ItemStack stack, ItemUseType usage) { + this.stack = stack; + this.usage = usage; + } + + public boolean matches(ItemStack other) { + return stack.sameItem(other); + } + } + + public static class StrictNbtStackRequirement extends StackRequirement { + public StrictNbtStackRequirement(ItemStack stack, ItemUseType usage) { + super(stack, usage); + } + + @Override + public boolean matches(ItemStack other) { + return ItemStack.isSameItemSameTags(stack, other); + } + } } diff --git a/src/main/java/com/simibubi/create/content/schematics/MaterialChecklist.java b/src/main/java/com/simibubi/create/content/schematics/MaterialChecklist.java index 3662a3515..00d4e5835 100644 --- a/src/main/java/com/simibubi/create/content/schematics/MaterialChecklist.java +++ b/src/main/java/com/simibubi/create/content/schematics/MaterialChecklist.java @@ -45,9 +45,9 @@ public class MaterialChecklist { for (ItemRequirement.StackRequirement stack : requirement.requiredItems) { if (stack.usage == ItemUseType.DAMAGE) - putOrIncrement(damageRequired, stack.item); + putOrIncrement(damageRequired, stack.stack); if (stack.usage == ItemUseType.CONSUME) - putOrIncrement(required, stack.item); + putOrIncrement(required, stack.stack); } } diff --git a/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonTileEntity.java b/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonTileEntity.java index 933a4a0b0..d5065cd53 100644 --- a/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonTileEntity.java +++ b/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonTileEntity.java @@ -383,7 +383,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements MenuPro List requiredItems = requirement.getRequiredItems(); if (!requirement.isEmpty()) { for (ItemRequirement.StackRequirement required : requiredItems) { - if (!grabItemsFromAttachedInventories(required.item, required.usage, true)) { + if (!grabItemsFromAttachedInventories(required, true)) { if (skipMissing) { statusMsg = "skipping"; blockSkipped = true; @@ -394,7 +394,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements MenuPro return; } - missingItem = required.item; + missingItem = required.stack; state = State.PAUSED; statusMsg = "missingBlock"; return; @@ -402,12 +402,12 @@ public class SchematicannonTileEntity extends SmartTileEntity implements MenuPro } for (ItemRequirement.StackRequirement required : requiredItems) - grabItemsFromAttachedInventories(required.item, required.usage, false); + grabItemsFromAttachedInventories(required, false); } // Success state = State.RUNNING; - ItemStack icon = requirement.isEmpty() || requiredItems.isEmpty() ? ItemStack.EMPTY : requiredItems.get(0).item; + ItemStack icon = requirement.isEmpty() || requiredItems.isEmpty() ? ItemStack.EMPTY : requiredItems.get(0).stack; printer.handleCurrentTarget((target, blockState, tile) -> { // Launch block statusMsg = blockState.getBlock() != Blocks.AIR ? "placing" : "clearing"; @@ -476,19 +476,21 @@ public class SchematicannonTileEntity extends SmartTileEntity implements MenuPro return item == Items.AIR ? ItemStack.EMPTY : new ItemStack(item); } - protected boolean grabItemsFromAttachedInventories(ItemStack required, ItemUseType usage, boolean simulate) { + protected boolean grabItemsFromAttachedInventories(ItemRequirement.StackRequirement required, boolean simulate) { if (hasCreativeCrate) return true; attachedInventories.removeIf(cap -> !cap.isPresent()); + ItemUseType usage = required.usage; + // Find and apply damage if (usage == ItemUseType.DAMAGE) { for (LazyOptional cap : attachedInventories) { IItemHandler iItemHandler = cap.orElse(EmptyHandler.INSTANCE); for (int slot = 0; slot < iItemHandler.getSlots(); slot++) { ItemStack extractItem = iItemHandler.extractItem(slot, 1, true); - if (!ItemRequirement.validate(required, extractItem)) + if (!required.matches(extractItem)) continue; if (!extractItem.isDamageableItem()) continue; @@ -508,36 +510,36 @@ public class SchematicannonTileEntity extends SmartTileEntity implements MenuPro return true; } } + + return false; } // Find and remove boolean success = false; - if (usage == ItemUseType.CONSUME) { - int amountFound = 0; - for (LazyOptional cap : attachedInventories) { - IItemHandler iItemHandler = cap.orElse(EmptyHandler.INSTANCE); - amountFound += ItemHelper - .extract(iItemHandler, s -> ItemRequirement.validate(required, s), ExtractionCountMode.UPTO, - required.getCount(), true) - .getCount(); + int amountFound = 0; + for (LazyOptional cap : attachedInventories) { + IItemHandler iItemHandler = cap.orElse(EmptyHandler.INSTANCE); + amountFound += ItemHelper + .extract(iItemHandler, required::matches, ExtractionCountMode.UPTO, + required.stack.getCount(), true) + .getCount(); - if (amountFound < required.getCount()) - continue; + if (amountFound < required.stack.getCount()) + continue; - success = true; - break; - } + success = true; + break; } if (!simulate && success) { - int amountFound = 0; + amountFound = 0; for (LazyOptional cap : attachedInventories) { IItemHandler iItemHandler = cap.orElse(EmptyHandler.INSTANCE); amountFound += ItemHelper - .extract(iItemHandler, s -> ItemRequirement.validate(required, s), ExtractionCountMode.UPTO, - required.getCount(), false) + .extract(iItemHandler, required::matches, ExtractionCountMode.UPTO, + required.stack.getCount(), false) .getCount(); - if (amountFound < required.getCount()) + if (amountFound < required.stack.getCount()) continue; break; } diff --git a/src/main/java/com/simibubi/create/foundation/tileEntity/SmartTileEntity.java b/src/main/java/com/simibubi/create/foundation/tileEntity/SmartTileEntity.java index da2f6e220..bce28fd71 100644 --- a/src/main/java/com/simibubi/create/foundation/tileEntity/SmartTileEntity.java +++ b/src/main/java/com/simibubi/create/foundation/tileEntity/SmartTileEntity.java @@ -7,6 +7,7 @@ import java.util.Map; import java.util.function.Consumer; import com.simibubi.create.api.event.TileEntityBehaviourEvent; +import com.simibubi.create.content.schematics.ISpecialBlockEntityItemRequirement; import com.simibubi.create.content.schematics.ItemRequirement; import com.simibubi.create.foundation.advancement.AdvancementBehaviour; import com.simibubi.create.foundation.advancement.CreateAdvancement; @@ -25,7 +26,7 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.items.CapabilityItemHandler; -public abstract class SmartTileEntity extends CachedRenderBBTileEntity implements IPartialSafeNBT, IInteractionChecker { +public abstract class SmartTileEntity extends CachedRenderBBTileEntity implements IPartialSafeNBT, IInteractionChecker, ISpecialBlockEntityItemRequirement { private final Map, TileEntityBehaviour> behaviours = new HashMap<>(); private boolean initialized = false; @@ -179,7 +180,7 @@ public abstract class SmartTileEntity extends CachedRenderBBTileEntity implement public ItemRequirement getRequiredItems() { return behaviours.values() .stream() - .reduce(ItemRequirement.NONE, (r, b) -> r.with(b.getRequiredItems()), (r, r1) -> r.with(r1)); + .reduce(ItemRequirement.NONE, (r, b) -> r.union(b.getRequiredItems()), (r, r1) -> r.union(r1)); } protected void removeBehaviour(BehaviourType type) { diff --git a/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/filtering/SidedFilteringBehaviour.java b/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/filtering/SidedFilteringBehaviour.java index 2f12902c9..87753bc80 100644 --- a/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/filtering/SidedFilteringBehaviour.java +++ b/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/filtering/SidedFilteringBehaviour.java @@ -124,8 +124,8 @@ public class SidedFilteringBehaviour extends FilteringBehaviour { public ItemRequirement getRequiredItems() { return sidedFilters.values().stream().reduce( ItemRequirement.NONE, - (a, b) -> a.with(b.getRequiredItems()), - (a, b) -> a.with(b) + (a, b) -> a.union(b.getRequiredItems()), + (a, b) -> a.union(b) ); } diff --git a/src/main/java/com/simibubi/create/foundation/utility/BlockHelper.java b/src/main/java/com/simibubi/create/foundation/utility/BlockHelper.java index 6cacb3fc9..4817470f3 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/BlockHelper.java +++ b/src/main/java/com/simibubi/create/foundation/utility/BlockHelper.java @@ -6,7 +6,6 @@ import javax.annotation.Nullable; import com.simibubi.create.AllBlocks; import com.simibubi.create.content.contraptions.base.KineticTileEntity; -import com.simibubi.create.foundation.fluid.FluidHelper; import com.simibubi.create.foundation.tileEntity.IMergeableTE; import net.minecraft.core.BlockPos; @@ -234,7 +233,7 @@ public class BlockHelper { state = ((IPlantable) state.getBlock()).getPlant(world, target); if (world.dimensionType() - .ultraWarm() && FluidHelper.isTag(state.getFluidState(), FluidTags.WATER)) { + .ultraWarm() && state.getFluidState().is(FluidTags.WATER)) { int i = target.getX(); int j = target.getY(); int k = target.getZ(); diff --git a/src/main/resources/assets/create/models/item/wrench/item.json b/src/main/resources/assets/create/models/item/wrench/item.json index 55cbe7e35..9c89b0ff6 100644 --- a/src/main/resources/assets/create/models/item/wrench/item.json +++ b/src/main/resources/assets/create/models/item/wrench/item.json @@ -81,65 +81,13 @@ "to": [10.4, 9, 9], "rotation": {"angle": 0, "axis": "y", "origin": [9, 11, 8]}, "faces": { - "north": { - "uv": [ - 4, - 10, - 12, - 12 - ], - "texture": "#5" - }, - "east": { - "uv": [ - 4, - 10, - 6, - 14 - ], - "rotation": 90, - "texture": "#5" - }, - "south": { - "uv": [ - 12, - 10, - 4, - 12 - ], - "texture": "#5" - }, - "west": { - "uv": [ - 4, - 10, - 6, - 14 - ], - "rotation": 90, - "texture": "#5" - }, - "up": { - "uv": [ - 4, - 10, - 12, - 14 - ], - "rotation": 180, - "texture": "#5" - }, - "down": { - "uv": [ - 4, - 10, - 12, - 13 - ], - "rotation": 180, - "texture": "#5" - } - } + "north": {"uv": [4, 10, 12, 12], "texture": "#5"}, + "east": {"uv": [4, 10, 6, 14], "rotation": 90, "texture": "#5"}, + "south": {"uv": [12, 10, 4, 12], "texture": "#5"}, + "west": {"uv": [4, 10, 6, 14], "rotation": 90, "texture": "#5"}, + "up": {"uv": [4, 10, 12, 14], "rotation": 180, "texture": "#5"}, + "down": {"uv": [4, 10, 12, 13], "rotation": 180, "texture": "#5"} + } }, { "name": "gear case", @@ -162,6 +110,7 @@ "translation": [0, 3.25, 0] }, "thirdperson_lefthand": { + "rotation": [0, -90, 0], "translation": [0, 3.75, 0] }, "firstperson_righthand": { @@ -191,7 +140,8 @@ { "name": "item", "origin": [8, 8, 8], + "color": 0, "children": [0, 1, 2, 3, 4, 5, 6] } ] -} +} \ No newline at end of file