Fiery containers

- Fix #2812
This commit is contained in:
PepperCode1 2022-03-23 18:15:59 -07:00
parent a31d713958
commit bf1b6382ee
3 changed files with 17 additions and 15 deletions

View file

@ -162,13 +162,11 @@ public class BlazeBurnerBlock extends Block implements ITE<BlazeBurnerTileEntity
return InteractionResultHolder.fail(ItemStack.EMPTY);
if (!doNotConsume) {
ItemStack container = stack.getContainerItem();
if (!world.isClientSide && !simulate) {
ItemStack container = stack.hasContainerItem() ? stack.getContainerItem() : ItemStack.EMPTY;
if (!world.isClientSide) {
stack.shrink(1);
}
if (!container.isEmpty()) {
return InteractionResultHolder.success(container);
}
return InteractionResultHolder.success(container);
}
return InteractionResultHolder.success(ItemStack.EMPTY);
}

View file

@ -42,7 +42,7 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtUtils;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.Containers;
import net.minecraft.world.InteractionResultHolder;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
@ -332,15 +332,15 @@ public abstract class ArmInteractionPoint {
@Override
protected ItemStack insert(Level world, ItemStack stack, boolean simulate) {
ItemStack input = stack.copy();
if (!BlazeBurnerBlock.tryInsert(state, world, pos, input, false, false, true)
.getObject()
.isEmpty()) {
return stack;
}
InteractionResultHolder<ItemStack> res = BlazeBurnerBlock.tryInsert(state, world, pos, input, false, false, simulate);
return res.getResult() == InteractionResult.SUCCESS
? ItemHandlerHelper.copyStackWithSize(stack, stack.getCount() - 1)
: stack;
ItemStack remainder = res.getObject();
if (input.isEmpty()) {
return remainder;
} else {
if (!simulate)
Containers.dropItemStack(world, pos.getX(), pos.getY(), pos.getZ(), remainder);
return input;
}
}
@Override

View file

@ -313,7 +313,11 @@ public class ArmTileEntity extends KineticTileEntity implements ITransformableTE
protected int getDistributableAmount(ArmInteractionPoint armInteractionPoint, int i) {
ItemStack stack = armInteractionPoint.extract(level, i, true);
ItemStack remainder = simulateInsertion(stack);
return stack.getCount() - remainder.getCount();
if (stack.sameItem(remainder)) {
return stack.getCount() - remainder.getCount();
} else {
return stack.getCount();
}
}
protected void depositItem() {