forked from AE2-UEL/AE2FluidCraft-Rework
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show detailed fluid amount tooltip for Fluid Drop and Packet item (#127)
* Show detailed fluid amount tooltip for Fluid Drop and Packet item * Guard against division by zero
- Loading branch information
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
src/main/java/com/glodblock/github/nei/FCStackStringifyHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.glodblock.github.nei; | ||
|
||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.nbt.NBTTagCompound; | ||
import net.minecraftforge.fluids.FluidStack; | ||
|
||
import com.glodblock.github.common.item.ItemFluidDrop; | ||
import com.glodblock.github.common.item.ItemFluidPacket; | ||
|
||
import codechicken.nei.api.IStackStringifyHandler; | ||
|
||
public class FCStackStringifyHandler implements IStackStringifyHandler { | ||
|
||
@Override | ||
public NBTTagCompound convertItemStackToNBT(ItemStack stack, boolean saveStackSize) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public ItemStack convertNBTToItemStack(NBTTagCompound nbtTag) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public FluidStack getFluid(ItemStack item) { | ||
if (item.getItem() instanceof ItemFluidDrop) { | ||
FluidStack fluid = ItemFluidDrop.getFluidStack(item); | ||
fluid.amount /= Math.max(item.stackSize, 1); | ||
return fluid; | ||
} else if (item.getItem() instanceof ItemFluidPacket) { | ||
return ItemFluidPacket.getFluidStack(item); | ||
} | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters