mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Add look overlay to named crates
I think this is better than signs for a crate-based stockpile. Only shows the name for now, but a contents summary might be included too.
This commit is contained in:
parent
6fb0b647fd
commit
8970878e6b
@ -6,6 +6,7 @@ import java.util.List;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import com.hbm.blocks.IBlockMulti;
|
import com.hbm.blocks.IBlockMulti;
|
||||||
|
import com.hbm.blocks.ILookOverlay;
|
||||||
import com.hbm.blocks.ITooltipProvider;
|
import com.hbm.blocks.ITooltipProvider;
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.config.ServerConfig;
|
import com.hbm.config.ServerConfig;
|
||||||
@ -39,8 +40,9 @@ import net.minecraft.util.EnumChatFormatting;
|
|||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||||
|
|
||||||
public class BlockStorageCrate extends BlockContainer implements IBlockMulti, ITooltipProvider {
|
public class BlockStorageCrate extends BlockContainer implements IBlockMulti, ILookOverlay, ITooltipProvider {
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
private IIcon iconTop;
|
private IIcon iconTop;
|
||||||
@ -374,4 +376,20 @@ public class BlockStorageCrate extends BlockContainer implements IBlockMulti, IT
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void printHook(RenderGameOverlayEvent.Pre event, World world, int x, int y, int z) {
|
||||||
|
|
||||||
|
TileEntity te = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
|
if (!(te instanceof IInventory))
|
||||||
|
return;
|
||||||
|
|
||||||
|
IInventory inv = (IInventory) te;
|
||||||
|
|
||||||
|
if (!inv.hasCustomInventoryName())
|
||||||
|
return;
|
||||||
|
|
||||||
|
ILookOverlay.printGeneric(event, inv.getInventoryName(), 0xffff00, 0x404000, new ArrayList<String>(0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user