From 37aaa58eec4a52969d7b69c8cf4acd53988e80ef Mon Sep 17 00:00:00 2001 From: 17146 <1714673995@qq.com> Date: Fri, 7 Feb 2025 00:29:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E5=85=85=E7=94=B5?= =?UTF-8?q?=E7=AB=99=E7=83=A7=E5=B2=A9=E6=B5=86=E4=B8=8D=E8=BF=94=E8=BF=98?= =?UTF-8?q?=E7=A9=BA=E6=A1=B6=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/ChargingStationBlockEntity.java | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/atsuishio/superbwarfare/block/entity/ChargingStationBlockEntity.java b/src/main/java/com/atsuishio/superbwarfare/block/entity/ChargingStationBlockEntity.java index ab43b85b3..809b7f507 100644 --- a/src/main/java/com/atsuishio/superbwarfare/block/entity/ChargingStationBlockEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/block/entity/ChargingStationBlockEntity.java @@ -16,6 +16,7 @@ import net.minecraft.world.ContainerHelper; import net.minecraft.world.MenuProvider; import net.minecraft.world.WorldlyContainer; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.AbstractContainerMenu; @@ -145,7 +146,27 @@ public class ChargingStationBlockEntity extends BlockEntity implements WorldlyCo if (burnTime > 0) { blockEntity.fuelTick = burnTime; blockEntity.maxFuelTick = burnTime; - fuel.shrink(1); + + if (fuel.hasCraftingRemainingItem()) { + if (fuel.getCount() <= 1) { + blockEntity.setItem(SLOT_FUEL, fuel.getCraftingRemainingItem()); + } else { + ItemStack copy = fuel.getCraftingRemainingItem().copy(); + copy.setCount(1); + + ItemEntity itemEntity = new ItemEntity(pLevel, + pPos.getX() + 0.5, + pPos.getY() + 0.2, + pPos.getZ() + 0.5, + copy); + pLevel.addFreshEntity(itemEntity); + + fuel.shrink(1); + } + } else { + fuel.shrink(1); + } + blockEntity.setChanged(); } else if (fuel.getItem().isEdible()) { var properties = fuel.getFoodProperties(null);