Skip to content

Commit

Permalink
fix drum TOP display
Browse files Browse the repository at this point in the history
  • Loading branch information
TechLord22 committed Aug 9, 2021
1 parent b1ac5e5 commit a4634bd
Showing 1 changed file with 28 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,38 @@ public void writeItemStackData(NBTTagCompound itemStack) {
public ICapabilityProvider initItemStackCapabilities(ItemStack itemStack) {
return new FluidHandlerItemStack(itemStack, tankSize) {
@Override
protected void setContainerToEmpty() {
this.container.setTagCompound(null);
public FluidStack drain(FluidStack resource, boolean doDrain) {
FluidStack drained = super.drain(resource, doDrain);
this.removeTagWhenEmptied(doDrain);
return drained;
}

@Override
public FluidStack drain(int maxDrain, boolean doDrain) {
FluidStack drained = super.drain(maxDrain, doDrain);
this.removeTagWhenEmptied(doDrain);
return drained;
}

private void removeTagWhenEmptied(boolean doDrain) {
if (doDrain && this.getFluid() == null) {
this.container.setTagCompound(null);
}
}

@Override
public boolean canFillFluidType(FluidStack fluid) {
return MetaTileEntityDrum.this.canFillFluidType(fluid);
}
};
}

protected boolean canFillFluidType(FluidStack fluid) {
return !ModHandler.isMaterialWood(material) &&
!material.hasFlag(FLAMMABLE) ||
fluid.getFluid().getTemperature(fluid) <= 325;
}

@Override
public void writeInitialSyncData(PacketBuffer buf) {
super.writeInitialSyncData(buf);
Expand Down

0 comments on commit a4634bd

Please sign in to comment.