Jump to content

Custom modeled block direction problems


AppliedOnce

Recommended Posts

Hi, I am having trouble with how to make it so that a custom modeled block can be placed just as a vanilla furnace, with the front towards me no matter which direction I am heading.

 

As of now it can only be placed in one direction.

 

Here is all the classes I am using:

 

Main class

 

package com.xetosphere.soulcraft;

 

import java.io.File;

 

import net.minecraft.creativetab.CreativeTabs;

 

import com.xetosphere.soulcraft.block.ModBlocks;

import com.xetosphere.soulcraft.configuration.ConfigurationHandler;

import com.xetosphere.soulcraft.core.proxy.CommonProxy;

import com.xetosphere.soulcraft.creativetab.TabSC;

import com.xetosphere.soulcraft.item.ModItems;

import com.xetosphere.soulcraft.lib.Reference;

import com.xetosphere.soulcraft.network.PacketHandler;

import com.xetosphere.soulcraft.recipe.ModRecipes;

import com.xetosphere.soulcraft.world.gen.WorldGen;

 

import cpw.mods.fml.common.Mod;

import cpw.mods.fml.common.Mod.EventHandler;

import cpw.mods.fml.common.Mod.Instance;

import cpw.mods.fml.common.SidedProxy;

import cpw.mods.fml.common.event.FMLInitializationEvent;

import cpw.mods.fml.common.event.FMLPostInitializationEvent;

import cpw.mods.fml.common.event.FMLPreInitializationEvent;

import cpw.mods.fml.common.network.NetworkMod;

import cpw.mods.fml.common.network.NetworkRegistry;

 

@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION_NUMBER, dependencies = Reference.DEPENDENCIES)

@NetworkMod(channels = { Reference.CHANNEL_NAME }, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketHandler.class)

public class SoulCraft {

 

@Instance(Reference.MOD_ID)

public static SoulCraft instance;

 

@SidedProxy(clientSide = Reference.CLIENT_PROXY, serverSide = Reference.COMMON_PROXY)

public static CommonProxy proxy;

 

// Adds the moderations creative tab in the creative tabs.

public static final CreativeTabs tabSC = new TabSC(CreativeTabs.getNextID(), Reference.MOD_ID);

 

@EventHandler

public void preInit(FMLPreInitializationEvent e) {

 

// Adds the configuration, that can change block and item identities as well as making the mob spawn in an already existing world.

ConfigurationHandler.init(new File(e.getModConfigurationDirectory().getAbsolutePath() + File.separator + Reference.CHANNEL_NAME + File.separator + Reference.MOD_ID + ".cfg"));

 

// Adds the items that the moderation contains. As well as item recipes.

ModItems.init();

 

// Adds the blocks that the moderation contains. As well as block recipes and registering the blocks.

ModBlocks.init();

 

// Adds the crafting recipes within this moderation.

ModRecipes.addRecipes();

 

// Adds everything that has to do with generation.

WorldGen.init();

}

 

@EventHandler

public void init(FMLInitializationEvent e) {

 

// Register the GUI Handler.

NetworkRegistry.instance().registerGuiHandler(instance, proxy);

 

// Initialize moderation tile entities.

proxy.registerTileEntities();

 

// Initialize custom rendering and textures (Client only).

proxy.initRenderingAndTextures();

}

 

@EventHandler

public void postInit(FMLPostInitializationEvent e) {

 

}

 

}

 

 

 

Client Proxy

 

package com.xetosphere.soulcraft.core.proxy;

 

import net.minecraft.tileentity.TileEntity;

import net.minecraftforge.common.ForgeDirection;

 

import com.xetosphere.soulcraft.client.renderer.tileentity.TileTotemRenderer;

import com.xetosphere.soulcraft.lib.RenderIDs;

import com.xetosphere.soulcraft.tileentity.TileSC;

import com.xetosphere.soulcraft.tileentity.TileTotem;

 

import cpw.mods.fml.client.FMLClientHandler;

import cpw.mods.fml.client.registry.ClientRegistry;

import cpw.mods.fml.client.registry.RenderingRegistry;

 

public class ClientProxy extends CommonProxy {

 

@Override

public void initRenderingAndTextures() {

 

RenderIDs.totem = RenderingRegistry.getNextAvailableRenderId();

}

 

@Override

public void registerTileEntities() {

 

super.registerTileEntities();

 

ClientRegistry.bindTileEntitySpecialRenderer(TileTotem.class, new TileTotemRenderer());

}

 

@Override

public void handleTileEntityPacket(int x, int y, int z, ForgeDirection orientation, byte state, String customName) {

 

TileEntity tileEntity = FMLClientHandler.instance().getClient().theWorld.getBlockTileEntity(x, y, z);

 

if (tileEntity != null) {

if (tileEntity instanceof TileSC) {

((TileSC) tileEntity).setOrientation(orientation);

((TileSC) tileEntity).setState(state);

((TileSC) tileEntity).setCustomName(customName);

}

}

}

 

@Override

public void handleTileWithItemPacket(int x, int y, int z, ForgeDirection orientation, byte state, String customName, int itemID, int metaData, int stackSize, int color) {

 

this.handleTileEntityPacket(x, y, z, orientation, state, customName);

}

 

}

 

 

 

Common Proxy

 

package com.xetosphere.soulcraft.core.proxy;

 

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.world.World;

import net.minecraftforge.common.ForgeDirection;

 

import com.xetosphere.soulcraft.client.gui.inventory.GuiArcaneFuser;

import com.xetosphere.soulcraft.client.gui.inventory.GuiAuraCrusher;

import com.xetosphere.soulcraft.client.gui.inventory.GuiDuplicator;

import com.xetosphere.soulcraft.inventory.ContainerArcaneFuser;

import com.xetosphere.soulcraft.inventory.ContainerAuraCrusher;

import com.xetosphere.soulcraft.inventory.ContainerDuplicator;

import com.xetosphere.soulcraft.lib.GuiIDs;

import com.xetosphere.soulcraft.lib.Reference;

import com.xetosphere.soulcraft.lib.Strings;

import com.xetosphere.soulcraft.tileentity.TileArcaneFuser;

import com.xetosphere.soulcraft.tileentity.TileAuraCrusher;

import com.xetosphere.soulcraft.tileentity.TileDuplicator;

import com.xetosphere.soulcraft.tileentity.TileTotem;

 

import cpw.mods.fml.common.network.IGuiHandler;

import cpw.mods.fml.common.registry.GameRegistry;

 

public class CommonProxy implements IGuiHandler {

 

public void initRenderingAndTextures() {

 

}

 

public void registerTileEntities() {

 

GameRegistry.registerTileEntity(TileDuplicator.class, Reference.MOD_ID + Strings.DUPLICATOR_NAME);

GameRegistry.registerTileEntity(TileArcaneFuser.class, Reference.MOD_ID + Strings.ARCANE_FUSER_NAME);

GameRegistry.registerTileEntity(TileAuraCrusher.class, Reference.MOD_ID + Strings.AURA_CRUSHER_NAME);

GameRegistry.registerTileEntity(TileTotem.class, Reference.MOD_ID + Strings.AIR_TOTEM_NAME);

}

 

public void sendRequestEventPacket(byte eventType, int originX, int originY, int originZ, byte sideHit, byte rangeX, byte rangeY, byte rangeZ, String data) {

 

}

 

public void handleTileEntityPacket(int x, int y, int z, ForgeDirection orientation, byte state, String customName) {

 

}

 

public void handleTileWithItemPacket(int x, int y, int z, ForgeDirection orientation, byte state, String customName, int itemID, int metaData, int stackSize, int color) {

 

}

 

@Override

public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {

 

if (ID == GuiIDs.DUPLICATOR) {

 

TileDuplicator tileDuplicator = (TileDuplicator) world.getBlockTileEntity(x, y, z);

return new ContainerDuplicator(player.inventory, tileDuplicator);

}

 

else if (ID == GuiIDs.ARCANE_FUSER) {

 

TileArcaneFuser tileFuser = (TileArcaneFuser) world.getBlockTileEntity(x, y, z);

return new ContainerArcaneFuser(player.inventory, tileFuser);

}

 

else if (ID == GuiIDs.AURA_CRUSHER) {

 

TileAuraCrusher tileCrusher = (TileAuraCrusher) world.getBlockTileEntity(x, y, z);

return new ContainerAuraCrusher(player.inventory, tileCrusher);

}

 

return null;

}

 

@Override

public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {

 

if (ID == GuiIDs.DUPLICATOR) {

 

TileDuplicator tileDuplicator = (TileDuplicator) world.getBlockTileEntity(x, y, z);

return new GuiDuplicator(player.inventory, tileDuplicator);

}

 

else if (ID == GuiIDs.ARCANE_FUSER) {

 

TileArcaneFuser tileFuser = (TileArcaneFuser) world.getBlockTileEntity(x, y, z);

return new GuiArcaneFuser(player.inventory, tileFuser);

}

 

else if (ID == GuiIDs.AURA_CRUSHER) {

 

TileAuraCrusher tileCrusher = (TileAuraCrusher) world.getBlockTileEntity(x, y, z);

return new GuiAuraCrusher(player.inventory, tileCrusher);

}

 

return null;

}

 

}

 

 

 

TileSC

 

package com.xetosphere.soulcraft.tileentity;

 

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.nbt.NBTTagCompound;

import net.minecraft.network.packet.Packet;

import net.minecraft.tileentity.TileEntity;

import net.minecraftforge.common.ForgeDirection;

 

import com.xetosphere.soulcraft.lib.Strings;

import com.xetosphere.soulcraft.network.PacketTypeHandler;

import com.xetosphere.soulcraft.network.packet.PacketTileUpdate;

 

public class TileSC extends TileEntity {

 

protected ForgeDirection orientation;

protected byte state;

protected String customName;

 

public TileSC() {

 

orientation = ForgeDirection.SOUTH;

state = 0;

customName = "";

}

 

public ForgeDirection getOrientation() {

 

return orientation;

}

 

public void setOrientation(ForgeDirection orientation) {

 

this.orientation = orientation;

}

 

public void setOrientation(int orientation) {

 

this.orientation = ForgeDirection.getOrientation(orientation);

}

 

public short getState() {

 

return state;

}

 

public void setState(byte state) {

 

this.state = state;

}

 

public boolean hasCustomName() {

 

return customName != null && customName.length() > 0;

}

 

public String getCustomName() {

 

return customName;

}

 

public void setCustomName(String customName) {

 

this.customName = customName;

}

 

public boolean isUseableByPlayer(EntityPlayer player) {

 

return true;

}

 

@Override

public void readFromNBT(NBTTagCompound nbtTagCompound) {

 

super.readFromNBT(nbtTagCompound);

 

if (nbtTagCompound.hasKey(Strings.NBT_TE_DIRECTION_KEY)) {

orientation = ForgeDirection.getOrientation(nbtTagCompound.getByte(Strings.NBT_TE_DIRECTION_KEY));

}

 

if (nbtTagCompound.hasKey(Strings.NBT_TE_STATE_KEY)) {

state = nbtTagCompound.getByte(Strings.NBT_TE_STATE_KEY);

}

 

if (nbtTagCompound.hasKey(Strings.NBT_TE_CUSTOM_NAME)) {

customName = nbtTagCompound.getString(Strings.NBT_TE_CUSTOM_NAME);

}

}

 

@Override

public void writeToNBT(NBTTagCompound nbtTagCompound) {

 

super.writeToNBT(nbtTagCompound);

 

nbtTagCompound.setByte(Strings.NBT_TE_DIRECTION_KEY, (byte) orientation.ordinal());

nbtTagCompound.setByte(Strings.NBT_TE_STATE_KEY, state);

 

if (this.hasCustomName()) {

nbtTagCompound.setString(Strings.NBT_TE_CUSTOM_NAME, customName);

}

}

 

@Override

public Packet getDescriptionPacket() {

 

return PacketTypeHandler.populatePacket(new PacketTileUpdate(xCoord, yCoord, zCoord, orientation, state, customName));

}

 

@Override

public String toString() {

 

StringBuilder stringBuilder = new StringBuilder();

 

stringBuilder.append(String.format("TileARC Data - xCoord: %d, yCoord: %d, zCoord: %d, customName: '%s', orientation: %s, state: %d\n", xCoord, yCoord, zCoord, customName, orientation, state));

 

return stringBuilder.toString();

}

 

}

 

 

 

TileTotem

 

package com.xetosphere.soulcraft.tileentity;

 

public class TileTotem extends TileSC {

 

}

 

 

 

PacketTileUpdate

 

package com.xetosphere.soulcraft.network.packet;

 

import java.io.DataInputStream;

import java.io.DataOutputStream;

import java.io.IOException;

 

import net.minecraft.network.INetworkManager;

import net.minecraftforge.common.ForgeDirection;

 

import com.xetosphere.soulcraft.SoulCraft;

import com.xetosphere.soulcraft.network.PacketTypeHandler;

 

import cpw.mods.fml.common.network.Player;

 

public class PacketTileUpdate extends PacketSC {

 

public int x, y, z;

public byte orientation;

public byte state;

public String customName;

 

public PacketTileUpdate() {

 

super(PacketTypeHandler.TILE, true);

}

 

public PacketTileUpdate(int x, int y, int z, ForgeDirection orientation, byte state, String customName) {

 

super(PacketTypeHandler.TILE, true);

this.x = x;

this.y = y;

this.z = z;

this.orientation = (byte) orientation.ordinal();

this.state = state;

this.customName = customName;

}

 

@Override

public void writeData(DataOutputStream data) throws IOException {

 

data.writeInt(x);

data.writeInt(y);

data.writeInt(z);

data.writeByte(orientation);

data.writeByte(state);

data.writeUTF(customName);

}

 

@Override

public void readData(DataInputStream data) throws IOException {

 

x = data.readInt();

y = data.readInt();

z = data.readInt();

orientation = data.readByte();

state = data.readByte();

customName = data.readUTF();

}

 

@Override

public void execute(INetworkManager manager, Player player) {

 

SoulCraft.proxy.handleTileEntityPacket(x, y, z, ForgeDirection.getOrientation(orientation), state, customName);

}

 

}

 

 

 

PacketSC

 

package com.xetosphere.soulcraft.network.packet;

 

import java.io.ByteArrayOutputStream;

import java.io.DataInputStream;

import java.io.DataOutputStream;

import java.io.IOException;

 

import net.minecraft.network.INetworkManager;

 

import com.xetosphere.soulcraft.network.PacketTypeHandler;

 

import cpw.mods.fml.common.network.Player;

 

public class PacketSC {

 

public PacketTypeHandler packetType;

public boolean isChunkDataPacket;

 

public PacketSC(PacketTypeHandler packetType, boolean isChunkDataPacket) {

 

this.packetType = packetType;

this.isChunkDataPacket = isChunkDataPacket;

}

 

public byte[] populate() {

 

ByteArrayOutputStream bos = new ByteArrayOutputStream();

DataOutputStream dos = new DataOutputStream(bos);

 

try {

dos.writeByte(packetType.ordinal());

this.writeData(dos);

} catch (IOException e) {

e.printStackTrace(System.err);

}

 

return bos.toByteArray();

}

 

public void readPopulate(DataInputStream data) {

 

try {

this.readData(data);

} catch (IOException e) {

e.printStackTrace(System.err);

}

}

 

public void readData(DataInputStream data) throws IOException {

 

}

 

public void writeData(DataOutputStream dos) throws IOException {

 

}

 

public void execute(INetworkManager network, Player player) {

 

}

 

public void setKey(int key) {

 

}

 

}

 

 

 

PacketHandler

 

package com.xetosphere.soulcraft.network;

 

import net.minecraft.network.INetworkManager;

import net.minecraft.network.packet.Packet250CustomPayload;

 

import com.xetosphere.soulcraft.network.packet.PacketSC;

 

import cpw.mods.fml.common.network.IPacketHandler;

import cpw.mods.fml.common.network.Player;

 

public class PacketHandler implements IPacketHandler {

 

@Override

public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player) {

 

PacketSC packetSC = PacketTypeHandler.buildPacket(packet.data);

 

packetSC.execute(manager, player);

}

 

}

 

 

 

PacketTypeHandler

 

package com.xetosphere.soulcraft.network;

 

import java.io.ByteArrayInputStream;

import java.io.DataInputStream;

 

import net.minecraft.network.packet.Packet;

import net.minecraft.network.packet.Packet250CustomPayload;

 

import com.xetosphere.soulcraft.lib.Reference;

import com.xetosphere.soulcraft.network.packet.PacketSC;

import com.xetosphere.soulcraft.network.packet.PacketTileUpdate;

import com.xetosphere.soulcraft.network.packet.PacketTileWithItemUpdate;

 

public enum PacketTypeHandler {

TILE(PacketTileUpdate.class), TILE_WITH_ITEM(PacketTileWithItemUpdate.class);

 

private Class<? extends PacketSC> clazz;

 

PacketTypeHandler(Class<? extends PacketSC> clazz) {

 

this.clazz = clazz;

}

 

public static PacketSC buildPacket(byte[] data) {

 

ByteArrayInputStream bis = new ByteArrayInputStream(data);

int selector = bis.read();

DataInputStream dis = new DataInputStream(bis);

 

PacketSC packet = null;

 

try {

packet = values()[selector].clazz.newInstance();

} catch (Exception e) {

e.printStackTrace(System.err);

}

 

packet.readPopulate(dis);

 

return packet;

}

 

public static PacketSC buildPacket(PacketTypeHandler type) {

 

PacketSC packet = null;

 

try {

packet = values()[type.ordinal()].clazz.newInstance();

} catch (Exception e) {

e.printStackTrace(System.err);

}

 

return packet;

}

 

public static Packet populatePacket(PacketSC packetSC) {

 

byte[] data = packetSC.populate();

 

Packet250CustomPayload packet250 = new Packet250CustomPayload();

packet250.channel = Reference.CHANNEL_NAME;

packet250.data = data;

packet250.length = data.length;

packet250.isChunkDataPacket = packetSC.isChunkDataPacket;

 

return packet250;

}

 

}

 

 

 

ModelTotem

 

package com.xetosphere.soulcraft.client.model;

 

import net.minecraft.client.model.ModelBase;

import net.minecraft.client.model.ModelRenderer;

import net.minecraft.entity.Entity;

 

public class ModelTotem extends ModelBase {

 

ModelRenderer shapeMain;

ModelRenderer scaleFront;

ModelRenderer scaleBack;

ModelRenderer scaleRight;

ModelRenderer scaleLeft;

ModelRenderer nose;

ModelRenderer eyeRight;

ModelRenderer eyeLeft;

ModelRenderer earBottomRight;

ModelRenderer earTopRight;

ModelRenderer earTopRight1;

ModelRenderer earTopRight2;

ModelRenderer earBottomLeft;

ModelRenderer earTopLeft;

ModelRenderer earTopLeft1;

ModelRenderer earTopLeft2;

 

public ModelTotem() {

 

textureWidth = 128;

textureHeight = 64;

 

shapeMain = new ModelRenderer(this, 96, 40);

shapeMain.addBox(-4F, 0F, -4F, 8, 16, 8);

shapeMain.setRotationPoint(0F, 8F, -5.995204E-15F);

shapeMain.setTextureSize(128, 64);

shapeMain.mirror = true;

setRotation(shapeMain, 0F, 0F, 0F);

 

scaleFront = new ModelRenderer(this, 15, 47);

scaleFront.addBox(-3F, 0F, -1F, 6, 16, 1);

scaleFront.setRotationPoint(0F, 8F, -4F);

scaleFront.setTextureSize(128, 64);

scaleFront.mirror = true;

setRotation(scaleFront, 0F, 0F, 0F);

 

scaleBack = new ModelRenderer(this, 45, 47);

scaleBack.addBox(-3F, 0F, 0F, 6, 16, 1);

scaleBack.setRotationPoint(0F, 8F, 4F);

scaleBack.setTextureSize(128, 64);

scaleBack.mirror = true;

setRotation(scaleBack, 0F, 0F, 0F);

 

scaleRight = new ModelRenderer(this, 0, 42);

scaleRight.addBox(-1F, 0F, -3F, 1, 16, 6);

scaleRight.setRotationPoint(-4F, 8F, 0F);

scaleRight.setTextureSize(128, 64);

scaleRight.mirror = true;

setRotation(scaleRight, 0F, 0F, 0F);

 

scaleLeft = new ModelRenderer(this, 30, 42);

scaleLeft.addBox(0F, 0F, -3F, 1, 16, 6);

scaleLeft.setRotationPoint(4F, 8F, 0F);

scaleLeft.setTextureSize(128, 64);

scaleLeft.mirror = true;

setRotation(scaleLeft, 0F, 0F, 0F);

 

nose = new ModelRenderer(this, 20, 0);

nose.addBox(-1F, 0F, -1F, 2, 2, 1);

nose.setRotationPoint(0F, 14F, -5F);

nose.setTextureSize(128, 64);

nose.mirror = true;

setRotation(nose, 0F, 0F, 0F);

 

eyeRight = new ModelRenderer(this, 0, 0);

eyeRight.addBox(-1F, 0F, -1F, 2, 1, 1);

eyeRight.setRotationPoint(-2F, 11F, -5F);

eyeRight.setTextureSize(128, 64);

eyeRight.mirror = true;

setRotation(eyeRight, 0F, 0F, 0.1047198F);

 

eyeLeft = new ModelRenderer(this, 10, 0);

eyeLeft.addBox(-1F, 0F, -1F, 2, 1, 1);

eyeLeft.setRotationPoint(2F, 11F, -5F);

eyeLeft.setTextureSize(128, 64);

eyeLeft.mirror = true;

setRotation(eyeLeft, 0F, 0F, -0.1047198F);

 

earBottomRight = new ModelRenderer(this, 105, 0);

earBottomRight.addBox(-1F, -1F, 0F, 1, 3, 1);

earBottomRight.setRotationPoint(-5F, 11F, 0F);

earBottomRight.setTextureSize(128, 64);

earBottomRight.mirror = true;

setRotation(earBottomRight, 0F, 0F, 0F);

 

earTopRight = new ModelRenderer(this, 100, 0);

earTopRight.addBox(-1F, -3F, 0F, 1, 4, 1);

earTopRight.setRotationPoint(-6F, 11F, 0F);

earTopRight.setTextureSize(128, 64);

earTopRight.mirror = true;

setRotation(earTopRight, 0F, 0F, 0F);

 

earTopRight1 = new ModelRenderer(this, 95, 0);

earTopRight1.addBox(-1F, 0F, 0F, 1, 1, 1);

earTopRight1.setRotationPoint(-7F, 8F, 0F);

earTopRight1.setTextureSize(128, 64);

earTopRight1.mirror = true;

setRotation(earTopRight1, 0F, 0F, 0F);

 

earTopRight2 = new ModelRenderer(this, 90, 0);

earTopRight2.addBox(-1F, 0F, 0F, 1, 1, 1);

earTopRight2.setRotationPoint(-7F, 10F, 0F);

earTopRight2.setTextureSize(128, 64);

earTopRight2.mirror = true;

setRotation(earTopRight2, 0F, 0F, 0F);

 

earBottomLeft = new ModelRenderer(this, 125, 0);

earBottomLeft.addBox(0F, -1F, 0F, 1, 3, 1);

earBottomLeft.setRotationPoint(5F, 11F, 0F);

earBottomLeft.setTextureSize(128, 64);

earBottomLeft.mirror = true;

setRotation(earBottomLeft, 0F, 0F, 0F);

 

earTopLeft = new ModelRenderer(this, 120, 0);

earTopLeft.addBox(0F, -3F, 0F, 1, 4, 1);

earTopLeft.setRotationPoint(6F, 11F, 0F);

earTopLeft.setTextureSize(128, 64);

earTopLeft.mirror = true;

setRotation(earTopLeft, 0F, 0F, 0F);

 

earTopLeft1 = new ModelRenderer(this, 115, 0);

earTopLeft1.addBox(0F, 0F, 0F, 1, 1, 1);

earTopLeft1.setRotationPoint(7F, 8F, 0F);

earTopLeft1.setTextureSize(128, 64);

earTopLeft1.mirror = true;

setRotation(earTopLeft1, 0F, 0F, 0F);

 

earTopLeft2 = new ModelRenderer(this, 110, 0);

earTopLeft2.addBox(0F, 0F, 0F, 1, 1, 1);

earTopLeft2.setRotationPoint(7F, 10F, 0F);

earTopLeft2.setTextureSize(128, 64);

earTopLeft2.mirror = true;

setRotation(earTopLeft2, 0F, 0F, 0F);

}

 

public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {

 

super.render(entity, f, f1, f2, f3, f4, f5);

setRotationAngles(f, f1, f2, f3, f4, f5, entity);

shapeMain.render(f5);

scaleFront.render(f5);

scaleBack.render(f5);

scaleRight.render(f5);

scaleLeft.render(f5);

nose.render(f5);

eyeRight.render(f5);

eyeLeft.render(f5);

earBottomRight.render(f5);

earTopRight.render(f5);

earTopRight1.render(f5);

earTopRight2.render(f5);

earBottomLeft.render(f5);

earTopLeft.render(f5);

earTopLeft1.render(f5);

earTopLeft2.render(f5);

}

 

private void setRotation(ModelRenderer model, float x, float y, float z) {

 

model.rotateAngleX = x;

model.rotateAngleY = y;

model.rotateAngleZ = z;

}

 

public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) {

 

super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);

}

 

}

 

 

 

TileTotemRenderer

 

package com.xetosphere.soulcraft.client.renderer.tileentity;

 

import net.minecraft.block.Block;

import net.minecraft.client.Minecraft;

import net.minecraft.client.renderer.OpenGlHelper;

import net.minecraft.client.renderer.Tessellator;

import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;

import net.minecraft.entity.Entity;

import net.minecraft.tileentity.TileEntity;

import net.minecraft.world.World;

 

import org.lwjgl.opengl.GL11;

 

import com.xetosphere.soulcraft.block.ModBlocks;

import com.xetosphere.soulcraft.client.model.ModelTotem;

import com.xetosphere.soulcraft.lib.Textures;

 

public class TileTotemRenderer extends TileEntitySpecialRenderer {

 

private final ModelTotem model;

 

public TileTotemRenderer() {

 

model = new ModelTotem();

}

 

public void adjustRotatePivotViaMeta(World world, int x, int y, int z) {

 

int meta = world.getBlockMetadata(x, y, z);

GL11.glPushMatrix();

GL11.glRotatef(meta * (-90), 0.0F, 0.0F, 1.0F);

GL11.glPopMatrix();

}

 

public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {

 

GL11.glPushMatrix();

GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);

 

if (tileentity.getBlockType() == ModBlocks.airTotem) {

Minecraft.getMinecraft().renderEngine.bindTexture(Textures.MODEL_TOTEM);

}

 

else if (tileentity.getBlockType() == ModBlocks.waterTotem) {

Minecraft.getMinecraft().renderEngine.bindTexture(Textures.MODEL_TOTEM);

}

 

else if (tileentity.getBlockType() == ModBlocks.fireTotem) {

Minecraft.getMinecraft().renderEngine.bindTexture(Textures.MODEL_TOTEM);

}

 

else if (tileentity.getBlockType() == ModBlocks.earthTotem) {

Minecraft.getMinecraft().renderEngine.bindTexture(Textures.MODEL_TOTEM);

}

 

GL11.glPushMatrix();

GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);

model.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);

GL11.glPopMatrix();

GL11.glPopMatrix();

}

 

@SuppressWarnings("unused")

private void adjustLightFixture(World world, int i, int j, int k, Block block) {

 

Tessellator tess = Tessellator.instance;

float brightness = block.getBlockBrightness(world, i, j, k);

int skyLight = world.getLightBrightnessForSkyBlocks(i, j, k, 0);

int modulousModifier = skyLight % 65536;

int divModifier = skyLight / 65536;

tess.setColorOpaque_F(brightness, brightness, brightness);

OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) modulousModifier, divModifier);

}

 

}

 

 

 

BlockTotem

 

package com.xetosphere.soulcraft.block;

 

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

import net.minecraft.client.renderer.texture.IconRegister;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.potion.PotionEffect;

import net.minecraft.tileentity.TileEntity;

import net.minecraft.util.Icon;

import net.minecraft.world.World;

 

import com.xetosphere.soulcraft.SoulCraft;

import com.xetosphere.soulcraft.lib.Elements;

import com.xetosphere.soulcraft.lib.RenderIDs;

import com.xetosphere.soulcraft.lib.Strings;

import com.xetosphere.soulcraft.tileentity.TileTotem;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

 

public class BlockTotem extends BlockSC {

 

private int element;

 

private Icon[] icons;

 

String name;

 

public BlockTotem(int id, String name, int element) {

 

super(id, Material.wood);

setUnlocalizedName(Strings.RESOURCE_PREFIX + name);

setCreativeTab(SoulCraft.tabSC);

setHardness(3.0F);

setResistance(12.0F);

this.element = element;

this.name = name;

}

 

@Override

public String getUnlocalizedName() {

 

return String.format("tile.%s%s", Strings.RESOURCE_PREFIX, name);

}

 

@Override

public TileEntity createNewTileEntity(World world) {

 

return new TileTotem();

}

 

@Override

public boolean renderAsNormalBlock() {

 

return false;

}

 

@Override

public boolean isOpaqueCube() {

 

return false;

}

 

    @Override

    public int getRenderType()

    {

 

        return RenderIDs.totem;

    }

 

@Override

@SideOnly(Side.CLIENT)

public void registerIcons(IconRegister iconRegister) {

 

icons = new Icon[3];

 

String iconName = getUnlocalizedName().substring(getUnlocalizedName().indexOf('.') + 1);

 

icons[0] = iconRegister.registerIcon(iconName + "_top");

icons[1] = iconRegister.registerIcon(iconName + "_side");

icons[2] = iconRegister.registerIcon(iconName + "_bottom");

 

}

 

@SideOnly(Side.CLIENT)

public Icon getIcon(int side, int metadata) {

 

if (side == 1) {

return icons[0];

}

 

else if (side == 0) {

return icons[2];

}

 

else return icons[1];

}

 

@Override

public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {

 

ItemStack activeItem = player.inventory.getCurrentItem();

 

if (player.isSneaking()) {

 

return false;

 

} else {

 

if (activeItem == null) {

 

return false;

}

 

if (element == Elements.AIR) {

 

if (activeItem.itemID == Item.goldNugget.itemID) {

 

player.addPotionEffect(new PotionEffect(1, 1200, 0, false));

activeItem.stackSize -= 1;

 

if (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || (world.getBlockId(x, y - 2, z) == ModBlocks.fireTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID)) || (world.getBlockId(x, y - 3, z) == ModBlocks.fireTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID) && (world.getBlockId(x, y - 2, z) == ModBlocks.waterTotem.blockID || world.getBlockId(x, y - 2, z) == ModBlocks.earthTotem.blockID))) {

 

player.addPotionEffect(new PotionEffect(12, 600, 0, false));

}

 

if (world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID || (world.getBlockId(x, y - 2, z) == ModBlocks.waterTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID)) || (world.getBlockId(x, y - 3, z) == ModBlocks.waterTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID) && (world.getBlockId(x, y - 2, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 2, z) == ModBlocks.earthTotem.blockID))) {

 

player.addPotionEffect(new PotionEffect(13, 600, 0, false));

}

 

if (world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID || (world.getBlockId(x, y - 2, z) == ModBlocks.earthTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID)) || (world.getBlockId(x, y - 3, z) == ModBlocks.earthTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID) && (world.getBlockId(x, y - 2, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 2, z) == ModBlocks.waterTotem.blockID))) {

 

player.addPotionEffect(new PotionEffect(3, 600, 0, false));

}

return true;

}

 

if (activeItem.itemID == Item.ingotGold.itemID) {

 

player.addPotionEffect(new PotionEffect(1, 2400, 0, false));

activeItem.stackSize -= 1;

 

if (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || (world.getBlockId(x, y - 2, z) == ModBlocks.fireTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID)) || (world.getBlockId(x, y - 3, z) == ModBlocks.fireTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID) && (world.getBlockId(x, y - 2, z) == ModBlocks.waterTotem.blockID || world.getBlockId(x, y - 2, z) == ModBlocks.earthTotem.blockID))) {

 

player.addPotionEffect(new PotionEffect(12, 600, 0, false));

}

 

if (world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID || (world.getBlockId(x, y - 2, z) == ModBlocks.waterTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID)) || (world.getBlockId(x, y - 3, z) == ModBlocks.waterTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID) && (world.getBlockId(x, y - 2, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 2, z) == ModBlocks.earthTotem.blockID))) {

 

player.addPotionEffect(new PotionEffect(13, 600, 0, false));

}

 

if (world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID || (world.getBlockId(x, y - 2, z) == ModBlocks.earthTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID)) || (world.getBlockId(x, y - 3, z) == ModBlocks.earthTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID) && (world.getBlockId(x, y - 2, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 2, z) == ModBlocks.waterTotem.blockID))) {

 

player.addPotionEffect(new PotionEffect(3, 600, 0, false));

}

return true;

}

 

if (activeItem.itemID == Block.blockGold.blockID) {

 

player.addPotionEffect(new PotionEffect(1, 3000, 1, false));

activeItem.stackSize -= 1;

 

if (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || (world.getBlockId(x, y - 2, z) == ModBlocks.fireTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID)) || (world.getBlockId(x, y - 3, z) == ModBlocks.fireTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID) && (world.getBlockId(x, y - 2, z) == ModBlocks.waterTotem.blockID || world.getBlockId(x, y - 2, z) == ModBlocks.earthTotem.blockID))) {

 

player.addPotionEffect(new PotionEffect(12, 600, 0, false));

}

 

if (world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID || (world.getBlockId(x, y - 2, z) == ModBlocks.waterTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID)) || (world.getBlockId(x, y - 3, z) == ModBlocks.waterTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID) && (world.getBlockId(x, y - 2, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 2, z) == ModBlocks.earthTotem.blockID))) {

 

player.addPotionEffect(new PotionEffect(13, 600, 0, false));

}

 

if (world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID || (world.getBlockId(x, y - 2, z) == ModBlocks.earthTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID)) || (world.getBlockId(x, y - 3, z) == ModBlocks.earthTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID) && (world.getBlockId(x, y - 2, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 2, z) == ModBlocks.waterTotem.blockID))) {

 

player.addPotionEffect(new PotionEffect(3, 600, 0, false));

}

return true;

}

 

}

 

else if (element == Elements.FIRE) {

 

if (activeItem.itemID == Item.goldNugget.itemID) {

 

player.addPotionEffect(new PotionEffect(12, 1200, 0, false));

activeItem.stackSize -= 1;

 

if (world.getBlockId(x, y - 1, z) == ModBlocks.airTotem.blockID || (world.getBlockId(x, y - 2, z) == ModBlocks.airTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID)) || (world.getBlockId(x, y - 3, z) == ModBlocks.airTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID) && (world.getBlockId(x, y - 2, z) == ModBlocks.waterTotem.blockID || world.getBlockId(x, y - 2, z) == ModBlocks.earthTotem.blockID))) {

 

player.addPotionEffect(new PotionEffect(1, 600, 0, false));

}

 

if (world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID || (world.getBlockId(x, y - 2, z) == ModBlocks.waterTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.airTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID)) || (world.getBlockId(x, y - 3, z) == ModBlocks.waterTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.airTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID) && (world.getBlockId(x, y - 2, z) == ModBlocks.airTotem.blockID || world.getBlockId(x, y - 2, z) == ModBlocks.earthTotem.blockID))) {

 

player.addPotionEffect(new PotionEffect(13, 600, 0, false));

}

 

if (world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID || (world.getBlockId(x, y - 2, z) == ModBlocks.earthTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.airTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID)) || (world.getBlockId(x, y - 3, z) == ModBlocks.earthTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.airTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID) && (world.getBlockId(x, y - 2, z) == ModBlocks.airTotem.blockID || world.getBlockId(x, y - 2, z) == ModBlocks.waterTotem.blockID))) {

 

player.addPotionEffect(new PotionEffect(3, 600, 0, false));

}

return true;

}

 

if (activeItem.itemID == Item.ingotGold.itemID) {

 

player.addPotionEffect(new PotionEffect(12, 2400, 0, false));

activeItem.stackSize -= 1;

 

if (world.getBlockId(x, y - 1, z) == ModBlocks.airTotem.blockID || (world.getBlockId(x, y - 2, z) == ModBlocks.airTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID)) || (world.getBlockId(x, y - 3, z) == ModBlocks.airTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID) && (world.getBlockId(x, y - 2, z) == ModBlocks.waterTotem.blockID || world.getBlockId(x, y - 2, z) == ModBlocks.earthTotem.blockID))) {

 

player.addPotionEffect(new PotionEffect(1, 600, 0, false));

}

 

if (world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID || (world.getBlockId(x, y - 2, z) == ModBlocks.waterTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.airTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID)) || (world.getBlockId(x, y - 3, z) == ModBlocks.waterTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.airTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID) && (world.getBlockId(x, y - 2, z) == ModBlocks.airTotem.blockID || world.getBlockId(x, y - 2, z) == ModBlocks.earthTotem.blockID))) {

 

player.addPotionEffect(new PotionEffect(13, 600, 0, false));

}

 

if (world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID || (world.getBlockId(x, y - 2, z) == ModBlocks.earthTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.airTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID)) || (world.getBlockId(x, y - 3, z) == ModBlocks.earthTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.airTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID) && (world.getBlockId(x, y - 2, z) == ModBlocks.airTotem.blockID || world.getBlockId(x, y - 2, z) == ModBlocks.waterTotem.blockID))) {

 

player.addPotionEffect(new PotionEffect(3, 600, 0, false));

}

return true;

}

 

if (activeItem.itemID == Block.blockGold.blockID) {

 

player.addPotionEffect(new PotionEffect(12, 3000, 1, false));

activeItem.stackSize -= 1;

 

if (world.getBlockId(x, y - 1, z) == ModBlocks.airTotem.blockID || (world.getBlockId(x, y - 2, z) == ModBlocks.airTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID)) || (world.getBlockId(x, y - 3, z) == ModBlocks.airTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID) && (world.getBlockId(x, y - 2, z) == ModBlocks.waterTotem.blockID || world.getBlockId(x, y - 2, z) == ModBlocks.earthTotem.blockID))) {

 

player.addPotionEffect(new PotionEffect(1, 600, 0, false));

}

 

if (world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID || (world.getBlockId(x, y - 2, z) == ModBlocks.waterTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.airTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID)) || (world.getBlockId(x, y - 3, z) == ModBlocks.waterTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.airTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID) && (world.getBlockId(x, y - 2, z) == ModBlocks.airTotem.blockID || world.getBlockId(x, y - 2, z) == ModBlocks.earthTotem.blockID))) {

 

player.addPotionEffect(new PotionEffect(13, 600, 0, false));

}

 

if (world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID || (world.getBlockId(x, y - 2, z) == ModBlocks.earthTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.airTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID)) || (world.getBlockId(x, y - 3, z) == ModBlocks.earthTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.airTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID) && (world.getBlockId(x, y - 2, z) == ModBlocks.airTotem.blockID || world.getBlockId(x, y - 2, z) == ModBlocks.waterTotem.blockID))) {

 

player.addPotionEffect(new PotionEffect(3, 600, 0, false));

}

return true;

}

 

}

 

else if (element == Elements.WATER) {

 

if (activeItem.itemID == Item.goldNugget.itemID) {

 

player.addPotionEffect(new PotionEffect(13, 1200, 0, false));

activeItem.stackSize -= 1;

 

if (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || (world.getBlockId(x, y - 2, z) == ModBlocks.fireTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.airTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID)) || (world.getBlockId(x, y - 3, z) == ModBlocks.fireTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.airTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID) && (world.getBlockId(x, y - 2, z) == ModBlocks.airTotem.blockID || world.getBlockId(x, y - 2, z) == ModBlocks.earthTotem.blockID))) {

 

player.addPotionEffect(new PotionEffect(12, 600, 0, false));

}

 

if (world.getBlockId(x, y - 1, z) == ModBlocks.airTotem.blockID || (world.getBlockId(x, y - 2, z) == ModBlocks.airTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID)) || (world.getBlockId(x, y - 3, z) == ModBlocks.airTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID) && (world.getBlockId(x, y - 2, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 2, z) == ModBlocks.earthTotem.blockID))) {

 

player.addPotionEffect(new PotionEffect(1, 600, 0, false));

}

 

if (world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID || (world.getBlockId(x, y - 2, z) == ModBlocks.earthTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID)) || (world.getBlockId(x, y - 3, z) == ModBlocks.earthTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID) && (world.getBlockId(x, y - 2, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 2, z) == ModBlocks.earthTotem.blockID))) {

 

player.addPotionEffect(new PotionEffect(3, 600, 0, false));

}

return true;

}

 

if (activeItem.itemID == Item.ingotGold.itemID) {

 

player.addPotionEffect(new PotionEffect(13, 2400, 0, false));

activeItem.stackSize -= 1;

 

if (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || (world.getBlockId(x, y - 2, z) == ModBlocks.fireTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.airTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID)) || (world.getBlockId(x, y - 3, z) == ModBlocks.fireTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.airTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID) && (world.getBlockId(x, y - 2, z) == ModBlocks.airTotem.blockID || world.getBlockId(x, y - 2, z) == ModBlocks.earthTotem.blockID))) {

 

player.addPotionEffect(new PotionEffect(12, 600, 0, false));

}

 

if (world.getBlockId(x, y - 1, z) == ModBlocks.airTotem.blockID || (world.getBlockId(x, y - 2, z) == ModBlocks.airTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID)) || (world.getBlockId(x, y - 3, z) == ModBlocks.airTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID) && (world.getBlockId(x, y - 2, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 2, z) == ModBlocks.earthTotem.blockID))) {

 

player.addPotionEffect(new PotionEffect(1, 600, 0, false));

}

 

if (world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID || (world.getBlockId(x, y - 2, z) == ModBlocks.earthTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID)) || (world.getBlockId(x, y - 3, z) == ModBlocks.earthTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID) && (world.getBlockId(x, y - 2, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 2, z) == ModBlocks.earthTotem.blockID))) {

 

player.addPotionEffect(new PotionEffect(3, 600, 0, false));

}

return true;

}

 

if (activeItem.itemID == Block.blockGold.blockID) {

 

player.addPotionEffect(new PotionEffect(13, 3000, 1, false));

activeItem.stackSize -= 1;

 

if (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || (world.getBlockId(x, y - 2, z) == ModBlocks.fireTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.airTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID)) || (world.getBlockId(x, y - 3, z) == ModBlocks.fireTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.airTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID) && (world.getBlockId(x, y - 2, z) == ModBlocks.airTotem.blockID || world.getBlockId(x, y - 2, z) == ModBlocks.earthTotem.blockID))) {

 

player.addPotionEffect(new PotionEffect(12, 600, 0, false));

}

 

if (world.getBlockId(x, y - 1, z) == ModBlocks.airTotem.blockID || (world.getBlockId(x, y - 2, z) == ModBlocks.airTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID)) || (world.getBlockId(x, y - 3, z) == ModBlocks.airTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID) && (world.getBlockId(x, y - 2, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 2, z) == ModBlocks.earthTotem.blockID))) {

 

player.addPotionEffect(new PotionEffect(1, 600, 0, false));

}

 

if (world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID || (world.getBlockId(x, y - 2, z) == ModBlocks.earthTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID)) || (world.getBlockId(x, y - 3, z) == ModBlocks.earthTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.earthTotem.blockID) && (world.getBlockId(x, y - 2, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 2, z) == ModBlocks.earthTotem.blockID))) {

 

player.addPotionEffect(new PotionEffect(3, 600, 0, false));

}

return true;

}

 

} else if (element == Elements.EARTH) {

 

if (activeItem.itemID == Item.goldNugget.itemID) {

 

player.addPotionEffect(new PotionEffect(3, 1200, 0, false));

activeItem.stackSize -= 1;

 

if (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || (world.getBlockId(x, y - 2, z) == ModBlocks.fireTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.airTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID)) || (world.getBlockId(x, y - 3, z) == ModBlocks.fireTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.airTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID) && (world.getBlockId(x, y - 2, z) == ModBlocks.airTotem.blockID || world.getBlockId(x, y - 2, z) == ModBlocks.waterTotem.blockID))) {

 

player.addPotionEffect(new PotionEffect(12, 600, 0, false));

}

 

if (world.getBlockId(x, y - 1, z) == ModBlocks.airTotem.blockID || (world.getBlockId(x, y - 2, z) == ModBlocks.airTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID)) || (world.getBlockId(x, y - 3, z) == ModBlocks.airTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID) && (world.getBlockId(x, y - 2, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 2, z) == ModBlocks.waterTotem.blockID))) {

 

player.addPotionEffect(new PotionEffect(1, 600, 0, false));

}

 

if (world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID || (world.getBlockId(x, y - 2, z) == ModBlocks.waterTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.airTotem.blockID)) || (world.getBlockId(x, y - 3, z) == ModBlocks.waterTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.airTotem.blockID) && (world.getBlockId(x, y - 2, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 2, z) == ModBlocks.airTotem.blockID))) {

 

player.addPotionEffect(new PotionEffect(13, 600, 0, false));

}

return true;

}

 

if (activeItem.itemID == Item.ingotGold.itemID) {

 

player.addPotionEffect(new PotionEffect(3, 2400, 0, false));

activeItem.stackSize -= 1;

 

if (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || (world.getBlockId(x, y - 2, z) == ModBlocks.fireTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.airTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID)) || (world.getBlockId(x, y - 3, z) == ModBlocks.fireTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.airTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID) && (world.getBlockId(x, y - 2, z) == ModBlocks.airTotem.blockID || world.getBlockId(x, y - 2, z) == ModBlocks.waterTotem.blockID))) {

 

player.addPotionEffect(new PotionEffect(12, 600, 0, false));

}

 

if (world.getBlockId(x, y - 1, z) == ModBlocks.airTotem.blockID || (world.getBlockId(x, y - 2, z) == ModBlocks.airTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID)) || (world.getBlockId(x, y - 3, z) == ModBlocks.airTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID) && (world.getBlockId(x, y - 2, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 2, z) == ModBlocks.waterTotem.blockID))) {

 

player.addPotionEffect(new PotionEffect(1, 600, 0, false));

}

 

if (world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID || (world.getBlockId(x, y - 2, z) == ModBlocks.waterTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.airTotem.blockID)) || (world.getBlockId(x, y - 3, z) == ModBlocks.waterTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.airTotem.blockID) && (world.getBlockId(x, y - 2, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 2, z) == ModBlocks.airTotem.blockID))) {

 

player.addPotionEffect(new PotionEffect(13, 600, 0, false));

}

return true;

}

 

if (activeItem.itemID == Block.blockGold.blockID) {

 

player.addPotionEffect(new PotionEffect(3, 3000, 1, false));

activeItem.stackSize -= 1;

 

if (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || (world.getBlockId(x, y - 2, z) == ModBlocks.fireTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.airTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID)) || (world.getBlockId(x, y - 3, z) == ModBlocks.fireTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.airTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID) && (world.getBlockId(x, y - 2, z) == ModBlocks.airTotem.blockID || world.getBlockId(x, y - 2, z) == ModBlocks.waterTotem.blockID))) {

 

player.addPotionEffect(new PotionEffect(12, 600, 0, false));

}

 

if (world.getBlockId(x, y - 1, z) == ModBlocks.airTotem.blockID || (world.getBlockId(x, y - 2, z) == ModBlocks.airTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID)) || (world.getBlockId(x, y - 3, z) == ModBlocks.airTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID) && (world.getBlockId(x, y - 2, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 2, z) == ModBlocks.waterTotem.blockID))) {

 

player.addPotionEffect(new PotionEffect(1, 600, 0, false));

}

 

if (world.getBlockId(x, y - 1, z) == ModBlocks.waterTotem.blockID || (world.getBlockId(x, y - 2, z) == ModBlocks.waterTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.airTotem.blockID)) || (world.getBlockId(x, y - 3, z) == ModBlocks.waterTotem.blockID && (world.getBlockId(x, y - 1, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 1, z) == ModBlocks.airTotem.blockID) && (world.getBlockId(x, y - 2, z) == ModBlocks.fireTotem.blockID || world.getBlockId(x, y - 2, z) == ModBlocks.airTotem.blockID))) {

 

player.addPotionEffect(new PotionEffect(13, 600, 0, false));

}

return true;

}

}

 

}

 

return false;

}

 

}

 

 

Link to comment
Share on other sites

Because you're not rotating the model in the TileTotemRenderer class.

 

         double angle = Math.toRadians(entity.rotation); //entity here is my TileEntity.  You can also reference block metadata.
         GL11.glPushMatrix();
         GL11.glRotatef(-1*entity.rotation, 0, 1, 0); //negative because of an assumption made in my TE that was wrong and this was the easier fix

 

(The angle value was being used for another part of the rendering, not related to the model)

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Because you're not rotating the model in the TileTotemRenderer class.

 

         double angle = Math.toRadians(entity.rotation); //entity here is my TileEntity.  You can also reference block metadata.
         GL11.glPushMatrix();
         GL11.glRotatef(-1*entity.rotation, 0, 1, 0); //negative because of an assumption made in my TE that was wrong and this was the easier fix

 

(The angle value was being used for another part of the rendering, not related to the model)

^^^ The right way (how I did it)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.