summaryrefslogtreecommitdiff
path: root/src/main/java/gmail/Lance5057/blocks
diff options
context:
space:
mode:
authorLance5057 <Lance5057@gmail.com>2015-03-13 08:15:33 -0500
committerLance5057 <Lance5057@gmail.com>2015-03-13 08:15:33 -0500
commitafb474545246da88084a43cae31259c33e63a8d1 (patch)
treedf0e220a3568546b7c64bf56e00c8d6af24fed64 /src/main/java/gmail/Lance5057/blocks
parent495fc1d710df9f5b98fec0d0f61f105811742d89 (diff)
Updated to TiCo 1.8.3 and fixed the rendering issues that followed.
Also refactored some codes.
Diffstat (limited to 'src/main/java/gmail/Lance5057/blocks')
-rw-r--r--src/main/java/gmail/Lance5057/blocks/ArmorAnvil.java47
-rw-r--r--src/main/java/gmail/Lance5057/blocks/CrestMount.java4
-rw-r--r--src/main/java/gmail/Lance5057/blocks/JewelersBench.java47
-rw-r--r--src/main/java/gmail/Lance5057/blocks/ModelCrestMount.java87
-rw-r--r--src/main/java/gmail/Lance5057/blocks/Renderer_CrestMount.java185
5 files changed, 96 insertions, 274 deletions
diff --git a/src/main/java/gmail/Lance5057/blocks/ArmorAnvil.java b/src/main/java/gmail/Lance5057/blocks/ArmorAnvil.java
new file mode 100644
index 0000000..1c9b153
--- /dev/null
+++ b/src/main/java/gmail/Lance5057/blocks/ArmorAnvil.java
@@ -0,0 +1,47 @@
+package gmail.Lance5057.blocks;
+
+import gmail.Lance5057.tileentities.TileEntity_ArmorAnvil;
+import gmail.Lance5057.tileentities.TileEntity_CrestMount;
+import net.minecraft.block.Block;
+import net.minecraft.block.ITileEntityProvider;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
+
+public class ArmorAnvil extends Block implements ITileEntityProvider
+{
+
+ public ArmorAnvil() {
+ super(Material.iron);
+ }
+
+ //You don't want the normal render type, or it wont render properly.
+ @Override
+ public int getRenderType() {
+ return -1;
+ }
+
+ //It's not an opaque cube, so you need this.
+ @Override
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ //It's not a normal block, so you need this too.
+ public boolean renderAsNormalBlock() {
+ return false;
+ }
+
+ //This is the icon to use for showing the block in your hand.
+ public void registerIcons(IIconRegister icon) {
+ //TODO fix the icon
+ this.blockIcon = icon.registerIcon("tinkersdefense:textures/items/QueensGoldIngot.png");
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World w, int md) {
+ TileEntity_ArmorAnvil te = new TileEntity_ArmorAnvil();
+ return te;
+ }
+}
diff --git a/src/main/java/gmail/Lance5057/blocks/CrestMount.java b/src/main/java/gmail/Lance5057/blocks/CrestMount.java
index 84749de..d78a216 100644
--- a/src/main/java/gmail/Lance5057/blocks/CrestMount.java
+++ b/src/main/java/gmail/Lance5057/blocks/CrestMount.java
@@ -4,7 +4,7 @@ import static net.minecraftforge.common.util.ForgeDirection.EAST;
import static net.minecraftforge.common.util.ForgeDirection.NORTH;
import static net.minecraftforge.common.util.ForgeDirection.SOUTH;
import static net.minecraftforge.common.util.ForgeDirection.WEST;
-import gmail.Lance5057.com.mod_TinkersDefense;
+import gmail.Lance5057.TinkersDefense;
import gmail.Lance5057.tileentities.TileEntity_CrestMount;
import java.util.Random;
@@ -43,7 +43,7 @@ public class CrestMount extends BlockContainer {
return false;
}
//code to open gui explained later
- player.openGui(mod_TinkersDefense.instance, mod_TinkersDefense.GUI_ITEM_INV, player.worldObj, x, y, z);
+ player.openGui(TinkersDefense.instance, TinkersDefense.GUI_ITEM_INV, player.worldObj, x, y, z);
return true;
}
diff --git a/src/main/java/gmail/Lance5057/blocks/JewelersBench.java b/src/main/java/gmail/Lance5057/blocks/JewelersBench.java
new file mode 100644
index 0000000..af9ca1c
--- /dev/null
+++ b/src/main/java/gmail/Lance5057/blocks/JewelersBench.java
@@ -0,0 +1,47 @@
+package gmail.Lance5057.blocks;
+
+import gmail.Lance5057.tileentities.TileEntity_JewelersBench;
+import net.minecraft.block.Block;
+import net.minecraft.block.ITileEntityProvider;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
+
+public class JewelersBench extends Block implements ITileEntityProvider
+{
+
+ public JewelersBench() {
+ super(Material.iron);
+ }
+
+ //You don't want the normal render type, or it wont render properly.
+ @Override
+ public int getRenderType() {
+ return -1;
+ }
+
+ //It's not an opaque cube, so you need this.
+ @Override
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ //It's not a normal block, so you need this too.
+ public boolean renderAsNormalBlock() {
+ return false;
+ }
+
+ //This is the icon to use for showing the block in your hand.
+ public void registerIcons(IIconRegister icon) {
+ //TODO fix the icon
+ this.blockIcon = icon.registerIcon("tinkersdefense:textures/items/QueensGoldIngot.png");
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World w, int md) {
+ TileEntity_JewelersBench te = new TileEntity_JewelersBench();
+ return te;
+ }
+
+}
diff --git a/src/main/java/gmail/Lance5057/blocks/ModelCrestMount.java b/src/main/java/gmail/Lance5057/blocks/ModelCrestMount.java
deleted file mode 100644
index d22158c..0000000
--- a/src/main/java/gmail/Lance5057/blocks/ModelCrestMount.java
+++ /dev/null
@@ -1,87 +0,0 @@
-// Date: 1/18/2015 9:46:49 PM
-// Template version 1.1
-// Java generated by Techne
-// Keep in mind that you still need to fill in some blanks
-// - ZeuX
-
-package gmail.Lance5057.blocks;
-
-import net.minecraft.client.model.ModelBase;
-import net.minecraft.client.model.ModelRenderer;
-import net.minecraft.entity.Entity;
-
-public class ModelCrestMount extends ModelBase
-{
- //fields
- ModelRenderer ShieldMount;
- ModelRenderer Base;
- ModelRenderer SwordMount1;
- ModelRenderer SwordMount2;
- //ModelRenderer SwordMount3;
-
- public ModelCrestMount()
- {
- textureWidth = 32;
- textureHeight = 32;
-
- ShieldMount = new ModelRenderer(this, 20, 6);
- ShieldMount.addBox(0F, 0F, 0F, 2, 7, 2);
- ShieldMount.setRotationPoint(-1F, 17F, -1F);
- ShieldMount.setTextureSize(32, 32);
- ShieldMount.mirror = true;
- setRotation(ShieldMount, 0F, 0F, 0F);
-
- Base = new ModelRenderer(this, 0, 6);
- Base.addBox(0F, 0F, 0F, 4, 4, 4);
- Base.setRotationPoint(-2F, 20F, -2F);
- Base.setTextureSize(32, 32);
- Base.mirror = true;
- setRotation(Base, 0F, 0F, 0F);
-
- SwordMount1 = new ModelRenderer(this, 0, 0);
- SwordMount1.addBox(-5F, 0F, -2F, 10, 2, 4);
- SwordMount1.setRotationPoint(0F, 22F, 0F);
- SwordMount1.setTextureSize(32, 32);
- SwordMount1.mirror = true;
- setRotation(SwordMount1, 0F, 0.7853982F, 0F);
-
- SwordMount2 = new ModelRenderer(this, 0, 0);
- SwordMount2.addBox(-5F, 0F, -2F, 10, 2, 4);
- SwordMount2.setRotationPoint(0F, 22F, 0F);
- SwordMount2.setTextureSize(32, 32);
- SwordMount2.mirror = true;
- setRotation(SwordMount2, 0F, -0.7853982F, 0F);
-
-// SwordMount3 = new ModelRenderer(this, 0, 0);
-// SwordMount3.addBox(-5F, 0F, -2F, 10, 2, 4);
-// SwordMount3.setRotationPoint(0F, 21.9F, 0F);
-// SwordMount3.setTextureSize(32, 32);
-// SwordMount3.mirror = true;
-// setRotation(SwordMount3, 0F, 1.570796F, 0F);
- }
-
- public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5, boolean left, boolean right, boolean shield)
- {
- super.render(entity, f, f1, f2, f3, f4, f5);
- setRotationAngles(f, f1, f2, f3, f4, f5, entity);
- if(shield) ShieldMount.render(f5);
- if(left) SwordMount1.render(f5);
- if(right) SwordMount2.render(f5);
-
- Base.render(f5);
- //SwordMount3.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);
- }
-
-}
diff --git a/src/main/java/gmail/Lance5057/blocks/Renderer_CrestMount.java b/src/main/java/gmail/Lance5057/blocks/Renderer_CrestMount.java
deleted file mode 100644
index 4959e7c..0000000
--- a/src/main/java/gmail/Lance5057/blocks/Renderer_CrestMount.java
+++ /dev/null
@@ -1,185 +0,0 @@
-package gmail.Lance5057.blocks;
-
-import gmail.Lance5057.tileentities.TileEntity_CrestMount;
-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.entity.RenderItem;
-import net.minecraft.client.renderer.entity.RenderManager;
-import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.item.EntityItem;
-import net.minecraft.item.ItemStack;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.ResourceLocation;
-import net.minecraft.world.World;
-import net.minecraftforge.client.IItemRenderer;
-
-import org.lwjgl.opengl.GL11;
-
-public class Renderer_CrestMount extends TileEntitySpecialRenderer
-{
- //private RenderItem itemRenderer;
- private final ModelCrestMount model;
- EntityItem entItem = null;
- EntityItem entItem2 = null;
- EntityItem entItem3 = null;
- EntityItem entItem4 = null;
-
- public Renderer_CrestMount() {
- this.model = new ModelCrestMount();
- }
-
- @Override
- public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale)
- {
- TileEntity_CrestMount tileEntity = (TileEntity_CrestMount)te;
-
- boolean left=false,
- right=false,
- shield=false;
-
- if(tileEntity.getStackInSlot(0)!=null)
- right=true;
- if(tileEntity.getStackInSlot(1)!=null)
- left=true;
- if(tileEntity.getStackInSlot(3)!=null)
- shield=true;
-
-
- GL11.glPushMatrix();
-
- //Render Crest Mount
- GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
-
- ResourceLocation textures = (new ResourceLocation("tinkersdefense:textures/blocks/CrestMount.png"));
-
- Minecraft.getMinecraft().renderEngine.bindTexture(textures);
-
- GL11.glPushMatrix();
-
- int meta = te.getBlockMetadata();
- float rotation = 0;
- switch(meta)
- {
- case 1: rotation = 0; break;
- case 2: rotation = 180; break;
- case 3: rotation = 90; break;
- case 4: rotation = -90; break;
- }
- GL11.glRotatef(rotation, 0.0F, 1.0F, 0.0F);
-
- GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
- GL11.glRotatef(90F, 0.5F, 0.0F, 0.0F);
- GL11.glTranslatef(0, -1, -1);
-
- this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F,left,right,shield);
- GL11.glPopMatrix();
-
- //Render Inventory
-
- //right slot
- int slot = 0;
- if(tileEntity.getStackInSlot(slot)!=null)
- {
- if((entItem == null) || entItem.getEntityItem().getItem() != tileEntity.getStackInSlot(slot).getItem())
- entItem = new EntityItem(tileEntity.getWorldObj(), 0, 0, 0, tileEntity.getStackInSlot(slot));
- GL11.glPushMatrix();
- this.entItem.hoverStart = 0.0F;
- RenderItem.renderInFrame = true;
- GL11.glScalef(2f,2f,2f);
- GL11.glRotatef(90, 0, 0, -1);
- GL11.glRotatef(rotation, -1.0F, 0.0F, 0.0F);
- //GL11.glTranslatef(0.4f/*up - down*/, -0.3f/*left - right*/, 0.22f);
- if(tileEntity.flip[0]==true)
- {
- GL11.glRotatef(180, 0, 0, 1);
- GL11.glTranslatef(-0.8f, 0.2f, 0);
- }
- RenderManager.instance.renderEntityWithPosYaw(entItem, 0.4f/*up - down*/, -0.3f/*left - right*/, 0.23f, 0, 0);
- RenderItem.renderInFrame = false;
- GL11.glPopMatrix();
- }
-
- //left slot
- slot = 1;
- if(tileEntity.getStackInSlot(slot)!=null)
- {
- if((entItem2 == null) || entItem2.getEntityItem().getItem() != tileEntity.getStackInSlot(slot).getItem())
- entItem2 = new EntityItem(tileEntity.getWorldObj(), x, y, z, tileEntity.getStackInSlot(slot));
- GL11.glPushMatrix();
- this.entItem2.hoverStart = 0.0F;
- RenderItem.renderInFrame = true;
- //GL11.glTranslatef((float)te.xCoord + 0.5F, (float)te.yCoord + 1.02F, (float)te.zCoord + 0.3F);
- GL11.glScalef(2f,2f,2f);
- GL11.glRotatef(180, 0, 0, 1);
- GL11.glRotatef(rotation, 0.0F, -1.0F, 0.0F);
- if(tileEntity.flip[1]==true)
- {
- GL11.glRotatef(180, 0, 0, 1);
- GL11.glTranslatef(0.2f, -0.8f, 0);
- }
- RenderManager.instance.renderEntityWithPosYaw(entItem2, -0.1, 0.2, 0.23, 0, 0);
- RenderItem.renderInFrame = false;
- GL11.glPopMatrix();
- }
-
- //middle slot
- slot = 2;
- if(tileEntity.getStackInSlot(slot)!=null)
- {
- if((entItem3 == null) || entItem3.getEntityItem().getItem() != tileEntity.getStackInSlot(slot).getItem())
- entItem3 = new EntityItem(tileEntity.getWorldObj(), x, y, z, tileEntity.getStackInSlot(slot));
- GL11.glPushMatrix();
- this.entItem3.hoverStart = 0.0F;
- RenderItem.renderInFrame = true;
- GL11.glScalef(2f,2f,2f);
- if(rotation == 90)
- GL11.glTranslatef(0.3f, 0, 0.0f);
- if(rotation == -90)
- GL11.glTranslatef(-0.3f, 0, 0.0f);
- GL11.glRotatef(225, 0, 0, 1);
- GL11.glRotatef(rotation, 1F, 1F, 0F);
- if(tileEntity.flip[2]==true)
- {
- GL11.glRotatef(180, 0, 0, 1);
- GL11.glTranslatef(-0.5f, -0.5f, 0);
- }
- RenderManager.instance.renderEntityWithPosYaw(entItem3, 0.3, 0.1, 0.16, 0, 0);
- RenderItem.renderInFrame = false;
- GL11.glPopMatrix();
- }
-
- //shield slot
- slot = 3;
- if(tileEntity.getStackInSlot(slot)!=null)
- {
- if((entItem4 == null) || entItem4.getEntityItem().getItem() != tileEntity.getStackInSlot(slot).getItem())
- entItem4 = new EntityItem(tileEntity.getWorldObj(), x, y, z, tileEntity.getStackInSlot(slot));
- GL11.glPushMatrix();
- this.entItem4.hoverStart = 0.0F;
- RenderItem.renderInFrame = true;
- GL11.glScalef(2f,2f,2f);
- GL11.glRotatef(180, 0.0F, 1.0F, 0.0F);
- GL11.glRotatef(rotation, 0.0F, 1.0F, 0.0F);
- if(tileEntity.flip[3]==true)
- {
- GL11.glRotatef(180, 0, 0, 1);
- GL11.glTranslatef(0.0f, 1.0f, 0);
- }
- RenderManager.instance.renderEntityWithPosYaw(entItem4, 0, -0.7, -0.01, 0, 0);
- RenderItem.renderInFrame = false;
- GL11.glPopMatrix();
- }
-
-
- GL11.glPopMatrix();
-
- entItem = null;
- entItem2= null;
- entItem3= null;
- entItem4= null;
- }
-
-}