parent
3fc8587200
commit
50a45560ab
1 changed files with 10 additions and 5 deletions
|
@ -10,6 +10,7 @@ import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
import reborncore.api.IListInfoProvider;
|
import reborncore.api.IListInfoProvider;
|
||||||
import reborncore.common.util.Color;
|
import reborncore.common.util.Color;
|
||||||
|
import techreborn.Core;
|
||||||
import techreborn.api.power.IEnergyInterfaceItem;
|
import techreborn.api.power.IEnergyInterfaceItem;
|
||||||
|
|
||||||
public class StackToolTipEvent {
|
public class StackToolTipEvent {
|
||||||
|
@ -35,12 +36,16 @@ public class StackToolTipEvent {
|
||||||
event.toolTip.add(Color.GREEN + "" + (int) ((IEnergyInterfaceItem) event.itemStack.getItem()).getMaxTransfer(event.itemStack) + ChatFormatting.LIGHT_PURPLE + " eu/tick in/out");
|
event.toolTip.add(Color.GREEN + "" + (int) ((IEnergyInterfaceItem) event.itemStack.getItem()).getMaxTransfer(event.itemStack) + ChatFormatting.LIGHT_PURPLE + " eu/tick in/out");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Block block = Block.getBlockFromItem(event.itemStack.getItem());
|
try{
|
||||||
if (block != null && block instanceof BlockContainer && block.getClass().getCanonicalName().startsWith("techreborn.")) {
|
Block block = Block.getBlockFromItem(event.itemStack.getItem());
|
||||||
TileEntity tile = block.createTileEntity(Minecraft.getMinecraft().theWorld, event.itemStack.getItemDamage());
|
if (block != null && block instanceof BlockContainer && block.getClass().getCanonicalName().startsWith("techreborn.")) {
|
||||||
if (tile instanceof IListInfoProvider) {
|
TileEntity tile = block.createTileEntity(Minecraft.getMinecraft().theWorld, event.itemStack.getItemDamage());
|
||||||
((IListInfoProvider) tile).addInfo(event.toolTip, false);
|
if (tile instanceof IListInfoProvider) {
|
||||||
|
((IListInfoProvider) tile).addInfo(event.toolTip, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (NullPointerException e){
|
||||||
|
Core.logHelper.debug("Failed to load info for " + event.itemStack.getDisplayName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue