mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-17 19:05:16 +00:00
Looking at a Crafty Crate with a Wand of the Forest now shows you the items inside.
This commit is contained in:
1 parent
7109393727
commit
31c93a8867
1 file changed
+44
-1
@@ -13,8 +13,15 @@ package vazkii.botania.common.block;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
@@ -28,6 +35,7 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.wand.IWandHUD;
|
||||
import vazkii.botania.api.wand.IWandable;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.common.block.tile.TileCraftCrate;
|
||||
@@ -38,7 +46,7 @@ import vazkii.botania.common.lexicon.LexiconData;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class BlockOpenCrate extends BlockModContainer implements ILexiconable, IWandable {
|
||||
public class BlockOpenCrate extends BlockModContainer implements ILexiconable, IWandable, IWandHUD {
|
||||
|
||||
IIcon iconSide;
|
||||
IIcon iconBottom;
|
||||
@@ -174,4 +182,39 @@ public class BlockOpenCrate extends BlockModContainer implements ILexiconable, I
|
||||
return crate.onWanded(player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res, World world, int x, int y, int z) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if(tile instanceof TileCraftCrate) {
|
||||
TileCraftCrate craft = (TileCraftCrate) tile;
|
||||
|
||||
int width = 52;
|
||||
int height = 52;
|
||||
int xc = res.getScaledWidth() / 2 + 20;
|
||||
int yc = res.getScaledHeight() / 2 - height / 2;
|
||||
|
||||
Gui.drawRect(xc - 6, yc - 6, xc + width + 6, yc + height + 6, 0x22000000);
|
||||
Gui.drawRect(xc - 4, yc - 4, xc + width + 4, yc + height + 4, 0x22000000);
|
||||
|
||||
for(int i = 0; i < 3; i++)
|
||||
for(int j = 0; j < 3; j++) {
|
||||
int index = i * 3 + j;
|
||||
int xp = xc + j * 18;
|
||||
int yp = yc + i * 18;
|
||||
|
||||
boolean enabled = true;
|
||||
if(craft.pattern > -1)
|
||||
enabled = TileCraftCrate.PATTERNS[craft.pattern][index];
|
||||
|
||||
Gui.drawRect(xp, yp, xp + 16, yp + 16, enabled ? 0x22FFFFFF : 0x22FF0000);
|
||||
|
||||
ItemStack item = craft.getStackInSlot(index);
|
||||
net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, item, xp, yp);
|
||||
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user