Railcraft

Railcraft

34M Downloads

Furnace cart doesn't use last fuel of a stack

Trinsdar opened this issue ยท 2 comments

commented

Description of the Bug
if you right click a furnace cart with a fuel item such as coal that only has a stacksize of 1, it will fuel the furnace cart without consuming the coal.

To Reproduce

  1. Place furnace cart
  2. Click on furnace cart with exactly one coal
  3. watch it start up without consuming the coal

Expected behavior
it should consume the coal

Screenshots & Video
https://gfycat.com/decentfatherlyhornet

Logs & Environment
N/A

Additional context
Noticed in our testing pack for my mod, can try to reproduce it with just rc if you want, but I doubt any other mod is messing with the furnace cart.

commented

Relevant Code:

public boolean processInitialInteract(EntityPlayer player, EnumHand hand) {
if (MinecraftForge.EVENT_BUS.post(new MinecartInteractEvent(this, player, hand)))
return true;
ItemStack stack = player.getHeldItem(hand);
int burnTime = FuelPlugin.getBurnTime(stack);
if (burnTime > 0 && fuel + burnTime <= 32000) {
if (!player.capabilities.isCreativeMode)
InvTools.depleteItem(stack);
fuel += burnTime;
pushX = posX - player.posX;
pushZ = posZ - player.posZ;
}
return true;
}

public static ItemStack depleteItem(ItemStack stack) {
if (sizeOf(stack) == 1)
return stack.getItem().getContainerItem(stack);
else {
stack.splitStack(1);
return stack;
}
}

The only way I can see what you describe happening is if you are in creative mode or if Coal has a container item. Coal does not normally have a container item. That said, I've not tested it in game yet, so maybe something is happening I'm not accounting for.

commented

Of course as soon as I say that, I realize that I never actually set the held item. Returning an Empty item from depleteItem() is not sufficient.