use of mdc.voodoocraft.util.EnumGlyphType in project VoodooCraft by Mod-DevCafeTeam.
the class ItemChalk method onItemRightClick.
/**
* Changes glyphtype NBT, cycles through all in the {@link EnumGlyphType}
*/
@Override
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) {
if (playerIn.isSneaking()) {
NBTTagCompound nbt = NBTHelper.getTagCompound(itemStackIn);
EnumGlyphType newtype = EnumGlyphType.byIndex(nbt.getInteger(KEY_GLYPH)).next();
nbt.setInteger(KEY_GLYPH, newtype.ordinal());
itemStackIn.setTagCompound(nbt);
return new ActionResult<>(EnumActionResult.SUCCESS, itemStackIn);
}
return super.onItemRightClick(itemStackIn, worldIn, playerIn, hand);
}
use of mdc.voodoocraft.util.EnumGlyphType in project VoodooCraft by Mod-DevCafeTeam.
the class TileTotemRender method renderTileEntityAt.
public void renderTileEntityAt(TileTotem te, double x, double y, double z, float partialTicks, int destroyStage) {
for (EnumFacing side : EnumFacing.HORIZONTALS) {
//Get the glyph on the given side
EnumGlyphType glyph = te.getSide(side);
if (glyph == null)
continue;
GlStateManager.pushMatrix();
GlStateManager.translate(x, y, z);
GlStateManager.enableAlpha();
GlStateManager.enableBlend();
GlStateManager.color(0.25f, 0.1f, 0.1f, 0.4f);
//Fix the lighting
int i = te.getWorld().getCombinedLight(te.getPos().offset(side), 0);
int j = i % 65536;
int k = i / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, j / 1.0F, k / 1.0F);
//Bind the glyph texture to use to render
bindTexture(glyph.getTextureLocation());
Tessellator tes = Tessellator.getInstance();
VertexBuffer buf = tes.getBuffer();
buf.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
float offset = (1f / 16f) * 0.9f;
switch(side) {
case //-Z
NORTH:
buf.pos(1, 0, offset).tex(0, 1).endVertex();
buf.pos(0, 0, offset).tex(1, 1).endVertex();
buf.pos(0, 1, offset).tex(1, 0).endVertex();
buf.pos(1, 1, offset).tex(0, 0).endVertex();
break;
case //+Z
SOUTH:
buf.pos(0, 0, 1 - offset).tex(0, 1).endVertex();
buf.pos(1, 0, 1 - offset).tex(1, 1).endVertex();
buf.pos(1, 1, 1 - offset).tex(1, 0).endVertex();
buf.pos(0, 1, 1 - offset).tex(0, 0).endVertex();
break;
case //-X
WEST:
buf.pos(offset, 0, 0).tex(0, 1).endVertex();
buf.pos(offset, 0, 1).tex(1, 1).endVertex();
buf.pos(offset, 1, 1).tex(1, 0).endVertex();
buf.pos(offset, 1, 0).tex(0, 0).endVertex();
break;
case //+X
EAST:
buf.pos(1 - offset, 0, 0).tex(1, 1).endVertex();
buf.pos(1 - offset, 1, 0).tex(1, 0).endVertex();
buf.pos(1 - offset, 1, 1).tex(0, 0).endVertex();
buf.pos(1 - offset, 0, 1).tex(0, 1).endVertex();
}
tes.draw();
GlStateManager.popMatrix();
}
}
Aggregations