mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-11 15:57:55 +00:00
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
This commit is contained in:
1 parent
56cda9f9e2
commit
f01cde7659
2 files changed
+37
No files matched your search
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -8,12 +8,14 @@ import com.glodblock.github.util.ModAndClassUtil;
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.api.IConfigureNEI;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class NEI_FC_Config implements IConfigureNEI {
|
||||
|
||||
@Override
|
||||
public void loadConfig() {
|
||||
API.registerNEIGuiHandler(new NEIGuiHandler());
|
||||
API.addSearchProvider(new NEIItemFilter());
|
||||
API.registerStackStringifyHandler(new FCStackStringifyHandler());
|
||||
|
||||
if (ModAndClassUtil.AVARITIA) {
|
||||
API.registerGuiOverlay(GuiFluidPatternWireless.class, "extreme", null);
|
||||
|
||||
Reference in new issue
Block a user