Schematic item requirement fix

- ISpecialXItemRequirement no longer provides a default implementation
This commit is contained in:
simibubi 2022-07-10 18:39:37 +02:00
parent c20129ecc2
commit a6b35f2a8d
4 changed files with 6 additions and 11 deletions

View File

@ -4,8 +4,6 @@ import net.minecraft.world.level.block.state.BlockState;
public interface ISpecialBlockEntityItemRequirement {
default ItemRequirement getRequiredItems(BlockState state) {
return ItemRequirement.INVALID;
}
public ItemRequirement getRequiredItems(BlockState state);
}

View File

@ -5,8 +5,6 @@ import net.minecraft.world.level.block.state.BlockState;
public interface ISpecialBlockItemRequirement {
default ItemRequirement getRequiredItems(BlockState state, BlockEntity te) {
return ItemRequirement.INVALID;
}
public ItemRequirement getRequiredItems(BlockState state, BlockEntity te);
}

View File

@ -2,8 +2,6 @@ package com.simibubi.create.content.schematics;
public interface ISpecialEntityItemRequirement {
default ItemRequirement getRequiredItems() {
return ItemRequirement.INVALID;
}
public ItemRequirement getRequiredItems();
}

View File

@ -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<BehaviourType<?>, TileEntityBehaviour> behaviours = new HashMap<>();
private boolean initialized = false;
@ -176,7 +177,7 @@ public abstract class SmartTileEntity extends CachedRenderBBTileEntity implement
behaviour.initialize();
}
public ItemRequirement getRequiredItems() {
public ItemRequirement getRequiredItems(BlockState state) {
return behaviours.values()
.stream()
.reduce(ItemRequirement.NONE, (r, b) -> r.union(b.getRequiredItems()), (r, r1) -> r.union(r1));