Portable Spillage Interface

- Fixed Chutes spilling items when inserting into disconnected storage interfaces
- Blaze Burners can now be picked up using the Wrench
- Additional safety checks from random crash reports
This commit is contained in:
simibubi 2021-11-22 11:38:52 +01:00
parent 67afe74250
commit 27c69250d1
5 changed files with 13 additions and 7 deletions

View file

@ -17,7 +17,7 @@ public class PortableItemInterfaceTileEntity extends PortableStorageInterfaceTil
public PortableItemInterfaceTileEntity(TileEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
capability = LazyOptional.empty();
capability = createEmptyHandler();
}
@Override
@ -31,11 +31,15 @@ public class PortableItemInterfaceTileEntity extends PortableStorageInterfaceTil
@Override
protected void stopTransferring() {
LazyOptional<IItemHandlerModifiable> oldCap = capability;
capability = LazyOptional.of(() -> new InterfaceItemHandler(new ItemStackHandler(0)));
capability = createEmptyHandler();
oldCap.invalidate();
super.stopTransferring();
}
private LazyOptional<IItemHandlerModifiable> createEmptyHandler() {
return LazyOptional.of(() -> new InterfaceItemHandler(new ItemStackHandler(0)));
}
@Override
protected void invalidateCapability() {
capability.invalidate();

View file

@ -78,7 +78,7 @@ public class SawMovementBehaviour extends BlockBreakingMovementBehaviour {
World world = context.world;
Vector3d dropPos = VecHelper.getCenterOf(pos);
float distance = (float) dropPos.distanceTo(context.position);
float distance = context.position == null ? 1 : (float) dropPos.distanceTo(context.position);
ItemEntity entity = new ItemEntity(world, dropPos.x, dropPos.y, dropPos.z, remainder);
entity.setDeltaMovement(context.relativeMotion.scale(distance / 20f));
world.addFreshEntity(entity);

View file

@ -228,9 +228,9 @@ public class MechanicalPressTileEntity extends BasinOperatingTileEntity {
pressedItems.clear();
applyBasinRecipe();
Optional<BasinTileEntity> basin = getBasin();
SmartInventory inputs = basin.get()
.getInputInventory();
if (basin.isPresent()) {
SmartInventory inputs = basin.get()
.getInputInventory();
for (int slot = 0; slot < inputs.getSlots(); slot++) {
ItemStack stackInSlot = inputs.getItem(slot);
if (stackInSlot.isEmpty())

View file

@ -10,6 +10,7 @@ import com.simibubi.create.AllItems;
import com.simibubi.create.AllShapes;
import com.simibubi.create.AllTileEntities;
import com.simibubi.create.content.contraptions.processing.BasinTileEntity;
import com.simibubi.create.content.contraptions.wrench.IWrenchable;
import com.simibubi.create.foundation.block.ITE;
import com.simibubi.create.foundation.utility.Lang;
@ -55,7 +56,7 @@ import net.minecraftforge.common.util.FakePlayer;
@MethodsReturnNonnullByDefault
@ParametersAreNonnullByDefault
public class BlazeBurnerBlock extends Block implements ITE<BlazeBurnerTileEntity> {
public class BlazeBurnerBlock extends Block implements ITE<BlazeBurnerTileEntity>, IWrenchable {
public static final EnumProperty<HeatLevel> HEAT_LEVEL = EnumProperty.create("blaze", HeatLevel.class);

View file

@ -4,6 +4,7 @@ import java.util.Random;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems;
import com.simibubi.create.content.contraptions.wrench.IWrenchable;
import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.block.Block;
@ -31,7 +32,7 @@ import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.ToolType;
public class LitBlazeBurnerBlock extends Block {
public class LitBlazeBurnerBlock extends Block implements IWrenchable {
public static final EnumProperty<FlameType> FLAME_TYPE = EnumProperty.create("flame_type", FlameType.class);