修复了充电站烧岩浆不返还空桶的问题
This commit is contained in:
parent
5d6f63c9de
commit
37aaa58eec
1 changed files with 22 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue