summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorOnyxDarkKnight <sor1n.iliutza16@gmail.com>2013-12-16 23:23:32 +0200
committerOnyxDarkKnight <sor1n.iliutza16@gmail.com>2013-12-16 23:23:32 +0200
commit44a23f0b989818f26473c3f6cd03986d52420b80 (patch)
tree8492dcba4c907ff46caf39dfa2027cca9d861281 /common
parent84718834dd385f1c548816d2be75970abdc82822 (diff)
Added jewelrycraft/block/BlockJewelrsCraftingTable.java
Diffstat (limited to 'common')
-rw-r--r--common/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java82
-rw-r--r--common/darkknight/jewelrycraft/block/BlockList.java4
-rw-r--r--common/darkknight/jewelrycraft/client/ClientProxy.java3
-rw-r--r--common/darkknight/jewelrycraft/model/ModelJewlersCraftingBench.java140
-rw-r--r--common/darkknight/jewelrycraft/renders/TileEntityJewelrsCraftingTableRender.java43
-rw-r--r--common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java65
6 files changed, 336 insertions, 1 deletions
diff --git a/common/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java b/common/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java
new file mode 100644
index 0000000..1c22062
--- /dev/null
+++ b/common/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java
@@ -0,0 +1,82 @@
+package darkknight.jewelrycraft.block;
+
+import java.util.Random;
+
+import net.minecraft.block.BlockContainer;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.renderer.texture.IconRegister;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.Explosion;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+import darkknight.jewelrycraft.tileentity.TileEntityMolder;
+
+public class BlockJewelrsCraftingTable extends BlockContainer
+{
+ Random rand = new Random();
+
+ protected BlockJewelrsCraftingTable(int par1, Material par2Material)
+ {
+ super(par1, par2Material);
+ this.setBlockBounds(0.1F, 0F, 0.1F, 0.9F, 0.2F, 0.9F);
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World world)
+ {
+ return new TileEntityMolder();
+ }
+
+ @Override
+ public boolean renderAsNormalBlock()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9)
+ {
+ return true;
+ }
+
+ @Override
+ public void onBlockDestroyedByPlayer(World world, int i, int j, int k, int par5)
+ {
+ }
+
+ @Override
+ public void onBlockDestroyedByExplosion(World world, int i, int j, int k, Explosion par5Explosion)
+ {
+ onBlockDestroyedByPlayer(world, i, j, k, 0);
+ }
+
+ @Override
+ public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player)
+ {
+ }
+
+ @Override
+ public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
+ {
+ return false;
+ }
+
+ @Override
+ public boolean isOpaqueCube()
+ {
+ return false;
+ }
+
+ @Override
+ public int getRenderType()
+ {
+ return -1;
+ }
+
+ @Override
+ public void registerIcons(IconRegister icon)
+ {
+ this.blockIcon = icon.registerIcon("jewelrycraft:jewelrdCraftingTable");
+ }
+}
diff --git a/common/darkknight/jewelrycraft/block/BlockList.java b/common/darkknight/jewelrycraft/block/BlockList.java
index 368b97f..f094811 100644
--- a/common/darkknight/jewelrycraft/block/BlockList.java
+++ b/common/darkknight/jewelrycraft/block/BlockList.java
@@ -6,6 +6,7 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;
import darkknight.jewelrycraft.JewelrycraftMod;
import darkknight.jewelrycraft.config.ConfigHandler;
+import darkknight.jewelrycraft.tileentity.TileEntityJewelrsCraftingTable;
import darkknight.jewelrycraft.tileentity.TileEntityMolder;
import darkknight.jewelrycraft.tileentity.TileEntitySmelter;
@@ -25,7 +26,7 @@ public class BlockList
shadowOre = new BlockBase(ConfigHandler.idShadowOre, Material.rock).setHardness(3.0F).setResistance(5.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("jewelrycraft.oreShadow").setCreativeTab(JewelrycraftMod.jewelrycraft);
smelter = new BlockSmelter(ConfigHandler.idSmelter, Material.iron).setHardness(5.0F).setResistance(6.0F).setStepSound(Block.soundMetalFootstep).setUnlocalizedName("jewelrycraft.smelter").setCreativeTab(JewelrycraftMod.jewelrycraft);
molder = new BlockMolder(ConfigHandler.idMolder, Material.iron).setHardness(5.0F).setResistance(6.0F).setStepSound(Block.soundMetalFootstep).setUnlocalizedName("jewelrycraft.molder").setCreativeTab(JewelrycraftMod.jewelrycraft);
- jewelCraftingTable = new BlockBase(ConfigHandler.idJewelCraftingTable, Material.rock).setHardness(3.0F).setResistance(5.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("jewelrycraft.jewelCraftingTable").setCreativeTab(JewelrycraftMod.jewelrycraft);
+ jewelCraftingTable = new BlockJewelrsCraftingTable(ConfigHandler.idJewelCraftingTable, Material.rock).setHardness(3.0F).setResistance(5.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("jewelrycraft.jewelCraftingTable").setCreativeTab(JewelrycraftMod.jewelrycraft);
GameRegistry.registerBlock(shadowOre, "shadowOre");
GameRegistry.registerBlock(smelter, "Smelter");
@@ -34,6 +35,7 @@ public class BlockList
GameRegistry.registerTileEntity(TileEntitySmelter.class, "30");
GameRegistry.registerTileEntity(TileEntityMolder.class, "31");
+ GameRegistry.registerTileEntity(TileEntityJewelrsCraftingTable.class, "32");
isInitialized = true;
}
diff --git a/common/darkknight/jewelrycraft/client/ClientProxy.java b/common/darkknight/jewelrycraft/client/ClientProxy.java
index fc19fff..35fec97 100644
--- a/common/darkknight/jewelrycraft/client/ClientProxy.java
+++ b/common/darkknight/jewelrycraft/client/ClientProxy.java
@@ -2,8 +2,10 @@ package darkknight.jewelrycraft.client;
import cpw.mods.fml.client.registry.ClientRegistry;
import darkknight.jewelrycraft.CommonProxy;
+import darkknight.jewelrycraft.renders.TileEntityJewelrsCraftingTableRender;
import darkknight.jewelrycraft.renders.TileEntityMolderRender;
import darkknight.jewelrycraft.renders.TileEntitySmelterRender;
+import darkknight.jewelrycraft.tileentity.TileEntityJewelrsCraftingTable;
import darkknight.jewelrycraft.tileentity.TileEntityMolder;
import darkknight.jewelrycraft.tileentity.TileEntitySmelter;
@@ -14,5 +16,6 @@ public class ClientProxy extends CommonProxy
{
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySmelter.class, new TileEntitySmelterRender());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMolder.class, new TileEntityMolderRender());
+ ClientRegistry.bindTileEntitySpecialRenderer(TileEntityJewelrsCraftingTable.class, new TileEntityJewelrsCraftingTableRender());
}
}
diff --git a/common/darkknight/jewelrycraft/model/ModelJewlersCraftingBench.java b/common/darkknight/jewelrycraft/model/ModelJewlersCraftingBench.java
new file mode 100644
index 0000000..1cc3f72
--- /dev/null
+++ b/common/darkknight/jewelrycraft/model/ModelJewlersCraftingBench.java
@@ -0,0 +1,140 @@
+package darkknight.jewelrycraft.model;
+
+import net.minecraft.client.model.ModelBase;
+import net.minecraft.client.model.ModelRenderer;
+import net.minecraft.entity.Entity;
+
+public class ModelJewlersCraftingBench extends ModelBase
+{
+ //fields
+ ModelRenderer Leg1;
+ ModelRenderer Leg2;
+ ModelRenderer Leg3;
+ ModelRenderer Leg4;
+ ModelRenderer Top;
+ ModelRenderer Support1;
+ ModelRenderer Support2;
+ ModelRenderer Support3;
+ ModelRenderer Support4;
+ ModelRenderer Support5;
+ ModelRenderer Support6;
+ ModelRenderer Support7;
+ ModelRenderer Support8;
+
+ public ModelJewlersCraftingBench()
+ {
+ textureWidth = 64;
+ textureHeight = 32;
+
+ Leg1 = new ModelRenderer(this, 0, 0);
+ Leg1.addBox(0F, 0F, 0F, 2, 10, 2);
+ Leg1.setRotationPoint(-6F, 14F, 4F);
+ Leg1.setTextureSize(64, 32);
+ Leg1.mirror = true;
+ setRotation(Leg1, 0F, 0F, 0F);
+ Leg2 = new ModelRenderer(this, 0, 0);
+ Leg2.addBox(0F, 0F, 0F, 2, 10, 2);
+ Leg2.setRotationPoint(-6F, 14F, -6F);
+ Leg2.setTextureSize(64, 32);
+ Leg2.mirror = true;
+ setRotation(Leg2, 0F, 0F, 0F);
+ Leg3 = new ModelRenderer(this, 0, 0);
+ Leg3.addBox(0F, 0F, 0F, 2, 10, 2);
+ Leg3.setRotationPoint(4F, 14F, -6F);
+ Leg3.setTextureSize(64, 32);
+ Leg3.mirror = true;
+ setRotation(Leg3, 0F, 0F, 0F);
+ Leg4 = new ModelRenderer(this, 0, 0);
+ Leg4.addBox(0F, 0F, 0F, 2, 10, 2);
+ Leg4.setRotationPoint(4F, 14F, 4F);
+ Leg4.setTextureSize(64, 32);
+ Leg4.mirror = true;
+ setRotation(Leg4, 0F, 0F, 0F);
+ Top = new ModelRenderer(this, 0, 13);
+ Top.addBox(0F, 0F, 0F, 16, 1, 16);
+ Top.setRotationPoint(-8F, 13F, -8F);
+ Top.setTextureSize(64, 32);
+ Top.mirror = true;
+ setRotation(Top, 0F, 0F, 0F);
+ Support1 = new ModelRenderer(this, 0, 0);
+ Support1.addBox(0F, 0F, 0F, 3, 1, 1);
+ Support1.setRotationPoint(3F, 12F, 5F);
+ Support1.setTextureSize(64, 32);
+ Support1.mirror = true;
+ setRotation(Support1, 0F, 0F, 0F);
+ Support2 = new ModelRenderer(this, 0, 0);
+ Support2.addBox(0F, 0F, 0F, 1, 1, 3);
+ Support2.setRotationPoint(2F, 12F, 2F);
+ Support2.setTextureSize(64, 32);
+ Support2.mirror = true;
+ setRotation(Support2, 0F, 0F, 0F);
+ Support3 = new ModelRenderer(this, 0, 0);
+ Support3.addBox(0F, 0F, 0F, 1, 1, 3);
+ Support3.setRotationPoint(6F, 12F, 2F);
+ Support3.setTextureSize(64, 32);
+ Support3.mirror = true;
+ setRotation(Support3, 0F, 0F, 0F);
+ Support4 = new ModelRenderer(this, 0, 0);
+ Support4.addBox(0F, 0F, 0F, 3, 1, 1);
+ Support4.setRotationPoint(3F, 12F, 1F);
+ Support4.setTextureSize(64, 32);
+ Support4.mirror = true;
+ setRotation(Support4, 0F, 0F, 0F);
+ Support5 = new ModelRenderer(this, 0, 0);
+ Support5.addBox(0F, 0F, 0F, 1, 1, 3);
+ Support5.setRotationPoint(-3F, 12F, 2F);
+ Support5.setTextureSize(64, 32);
+ Support5.mirror = true;
+ setRotation(Support5, 0F, 0F, 0F);
+ Support6 = new ModelRenderer(this, 0, 0);
+ Support6.addBox(0F, 0F, 0F, 3, 1, 1);
+ Support6.setRotationPoint(-6F, 12F, 5F);
+ Support6.setTextureSize(64, 32);
+ Support6.mirror = true;
+ setRotation(Support6, 0F, 0F, 0F);
+ Support7 = new ModelRenderer(this, 0, 0);
+ Support7.addBox(0F, 0F, 0F, 1, 1, 3);
+ Support7.setRotationPoint(-7F, 12F, 2F);
+ Support7.setTextureSize(64, 32);
+ Support7.mirror = true;
+ setRotation(Support7, 0F, 0F, 0F);
+ Support8 = new ModelRenderer(this, 0, 0);
+ Support8.addBox(0F, 0F, 0F, 3, 1, 1);
+ Support8.setRotationPoint(-6F, 12F, 1F);
+ Support8.setTextureSize(64, 32);
+ Support8.mirror = true;
+ setRotation(Support8, 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);
+ Leg1.render(f5);
+ Leg2.render(f5);
+ Leg3.render(f5);
+ Leg4.render(f5);
+ Top.render(f5);
+ Support1.render(f5);
+ Support2.render(f5);
+ Support3.render(f5);
+ Support4.render(f5);
+ Support5.render(f5);
+ Support6.render(f5);
+ Support7.render(f5);
+ Support8.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)
+ {
+ super.setRotationAngles(f, f1, f2, f3, f4, f5, null);
+ }
+
+}
diff --git a/common/darkknight/jewelrycraft/renders/TileEntityJewelrsCraftingTableRender.java b/common/darkknight/jewelrycraft/renders/TileEntityJewelrsCraftingTableRender.java
new file mode 100644
index 0000000..870190e
--- /dev/null
+++ b/common/darkknight/jewelrycraft/renders/TileEntityJewelrsCraftingTableRender.java
@@ -0,0 +1,43 @@
+package darkknight.jewelrycraft.renders;
+
+import org.lwjgl.opengl.GL11;
+
+import darkknight.jewelrycraft.model.ModelMolder;
+import net.minecraft.block.Block;
+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;
+
+public class TileEntityJewelrsCraftingTableRender extends TileEntitySpecialRenderer
+{
+ ModelMolder modelTable = new ModelMolder();
+ String texture = "textures/tileentities/JewelrsCraftingTable.png";
+
+ @Override
+ public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale)
+ {
+ GL11.glPushMatrix();
+ GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
+
+ GL11.glPushMatrix();
+ GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
+ modelTable.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
+ GL11.glPopMatrix();
+ GL11.glPopMatrix();
+ }
+
+ public 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);
+ }
+
+}
diff --git a/common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java b/common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java
new file mode 100644
index 0000000..5cce837
--- /dev/null
+++ b/common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java
@@ -0,0 +1,65 @@
+package darkknight.jewelrycraft.tileentity;
+
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.network.INetworkManager;
+import net.minecraft.network.packet.Packet;
+import net.minecraft.network.packet.Packet132TileEntityData;
+import net.minecraft.tileentity.TileEntity;
+
+public class TileEntityJewelrsCraftingTable extends TileEntity
+{
+ public boolean hasJewel, hasModifier;
+ public ItemStack jewel, modifier;
+
+ public TileEntityJewelrsCraftingTable()
+ {
+ this.jewel = new ItemStack(0, 0, 0);
+ this.modifier = new ItemStack(0, 0, 0);
+ this.hasJewel = false;
+ this.hasModifier = false;
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound nbt)
+ {
+ super.writeToNBT(nbt);
+ nbt.setBoolean("hasJewel", hasJewel);
+ nbt.setBoolean("hasModifier", hasModifier);
+ NBTTagCompound tag = new NBTTagCompound();
+ NBTTagCompound tag1 = new NBTTagCompound();
+ this.jewel.writeToNBT(tag);
+ nbt.setCompoundTag("jewel", tag);
+ this.modifier.writeToNBT(tag1);
+ nbt.setCompoundTag("modifier", tag1);
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound nbt)
+ {
+ super.readFromNBT(nbt);
+ this.hasJewel = nbt.getBoolean("hasJewel");
+ this.hasModifier = nbt.getBoolean("hasModifier");
+ this.jewel = new ItemStack(0, 0, 0);
+ this.jewel.readFromNBT(nbt.getCompoundTag("jewel"));
+ this.modifier = new ItemStack(0, 0, 0);
+ this.modifier.readFromNBT(nbt.getCompoundTag("modifier"));
+ }
+
+ public void updateEntity()
+ {
+ super.updateEntity();
+ }
+
+ public void onDataPacket(INetworkManager net, Packet132TileEntityData pkt)
+ {
+ readFromNBT(pkt.data);
+ }
+
+ public Packet getDescriptionPacket()
+ {
+ NBTTagCompound nbtTag = new NBTTagCompound();
+ this.writeToNBT(nbtTag);
+ return new Packet132TileEntityData(this.xCoord, this.yCoord, this.zCoord, 1, nbtTag);
+ }
+}