diff options
Diffstat (limited to 'src/main/java/darkknight/jewelrycraft/block')
14 files changed, 1087 insertions, 1176 deletions
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockCrystal.java b/src/main/java/darkknight/jewelrycraft/block/BlockCrystal.java index 28f154c..e987c27 100644 --- a/src/main/java/darkknight/jewelrycraft/block/BlockCrystal.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockCrystal.java @@ -3,7 +3,6 @@ */
package darkknight.jewelrycraft.block;
-import java.io.IOException;
import java.util.List;
import java.util.Random;
import cpw.mods.fml.relauncher.Side;
@@ -11,9 +10,7 @@ import cpw.mods.fml.relauncher.SideOnly; import darkknight.jewelrycraft.config.ConfigHandler;
import darkknight.jewelrycraft.proxy.ClientProxy.BlockRenderIDs;
import darkknight.jewelrycraft.tileentity.TileEntityCrystal;
-import darkknight.jewelrycraft.tileentity.TileEntityShadowEye;
import net.minecraft.block.Block;
-import net.minecraft.block.BlockContainer;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockDisplayer.java b/src/main/java/darkknight/jewelrycraft/block/BlockDisplayer.java index 8d11806..ba8884b 100644 --- a/src/main/java/darkknight/jewelrycraft/block/BlockDisplayer.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockDisplayer.java @@ -1,245 +1,244 @@ -package darkknight.jewelrycraft.block; - -import java.util.Random; -import net.minecraft.block.Block; -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.MathHelper; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import darkknight.jewelrycraft.tileentity.TileEntityDisplayer; -import darkknight.jewelrycraft.util.Variables; - -public class BlockDisplayer extends BlockContainer -{ - Random rand = new Random(); - - /** - * @param par2Material - */ - protected BlockDisplayer(Material par2Material) - { - super(par2Material); - } - - /** - * @param world - * @param var2 - * @return - */ - @Override - public TileEntity createNewTileEntity(World world, int var2) - { - return new TileEntityDisplayer(); - } - - /** - * @return - */ - @Override - public boolean renderAsNormalBlock() - { - return false; - } - - /** - * @param iblockaccess - * @param i - * @param j - * @param k - * @param l - * @return - */ - @Override - public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) - { - return false; - } - - /** - * @return - */ - @Override - public boolean isOpaqueCube() - { - return false; - } - - /** - * @return - */ - @Override - public int getRenderType() - { - return -1; - } - - /** - * @param world - * @param i - * @param j - * @param k - * @param entityPlayer - * @param par6 - * @param par7 - * @param par8 - * @param par9 - * @return - */ - @Override - public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) - { - TileEntityDisplayer te = (TileEntityDisplayer)world.getTileEntity(i, j, k); - ItemStack item = entityPlayer.inventory.getCurrentItem(); - if (te != null){ - if (item != null && item != new ItemStack(Item.getItemById(0), 0, 0) && !world.isRemote){ - if (!te.hasObject){ - te.object = item.copy(); - te.quantity += item.stackSize; - te.object.stackSize = 1; - te.hasObject = true; - if (!entityPlayer.capabilities.isCreativeMode) entityPlayer.inventory.decrStackSize(entityPlayer.inventory.currentItem, item.stackSize); - te.isDirty = true; - }else if (te.object.getItem() == item.getItem() && te.object != null && te.object != new ItemStack(Item.getItemById(0), 0, 0) && te.object.getItemDamage() == item.getItemDamage()) if (te.object.hasTagCompound() && item.hasTagCompound() && te.object.getTagCompound().equals(item.getTagCompound())){ - te.quantity += item.stackSize; - if (!entityPlayer.capabilities.isCreativeMode) entityPlayer.inventory.decrStackSize(entityPlayer.inventory.currentItem, item.stackSize); - te.isDirty = true; - }else if (!te.object.hasTagCompound() && !item.hasTagCompound()){ - te.quantity += item.stackSize; - if (!entityPlayer.capabilities.isCreativeMode) entityPlayer.inventory.decrStackSize(entityPlayer.inventory.currentItem, item.stackSize); - te.isDirty = true; - } - }else if (item == null || item == new ItemStack(Item.getItemById(0), 0, 0)) if (!entityPlayer.capabilities.isCreativeMode) for(int inv = 0; inv < entityPlayer.inventory.getSizeInventory(); inv++){ - item = entityPlayer.inventory.getStackInSlot(inv); - if (item != null && te.object.getItem() == item.getItem() && te.object != null && te.object != new ItemStack(Item.getItemById(0), 0, 0) && te.object.getItemDamage() == item.getItemDamage()) if (te.object.hasTagCompound() && item.hasTagCompound() && te.object.getTagCompound().equals(item.getTagCompound())){ - te.quantity += item.stackSize; - if (!entityPlayer.capabilities.isCreativeMode) entityPlayer.inventory.decrStackSize(inv, item.stackSize); - te.isDirty = true; - te.markDirty(); - }else if (!te.object.hasTagCompound() && !item.hasTagCompound()){ - te.quantity += item.stackSize; - if (!entityPlayer.capabilities.isCreativeMode) entityPlayer.inventory.decrStackSize(inv, item.stackSize); - te.isDirty = true; - } - } - else if (entityPlayer.capabilities.isCreativeMode && te.hasObject && te.object.getItem() != null){ - te.quantity += 64; - te.isDirty = true; - } - te.isDirty = true; - } - return true; - } - - /** - * @param world - * @param i - * @param j - * @param k - * @param player - */ - @Override - public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player) - { - TileEntityDisplayer te = (TileEntityDisplayer)world.getTileEntity(i, j, k); - if (te != null && !world.isRemote) if (te.hasObject && te.object != null && te.object != new ItemStack(Item.getItemById(0), 0, 0) && player.inventory.addItemStackToInventory(te.object)) if (!player.isSneaking()){ - if (te.quantity > te.object.getMaxStackSize()){ - te.object.stackSize = te.object.getMaxStackSize() - 1; - player.inventory.addItemStackToInventory(te.object); - te.object.stackSize = 1; - te.quantity -= te.object.getMaxStackSize(); - te.isDirty = true; - }else{ - te.object.stackSize = te.quantity - 1; - player.inventory.addItemStackToInventory(te.object); - te.hasObject = false; - te.object = new ItemStack(Item.getItemById(0), 0, 0); - te.quantity = 0; - te.isDirty = true; - } - te.isDirty = true; - }else{ - if (te.quantity >= 2){ - player.inventory.addItemStackToInventory(te.object); - te.object.stackSize = 1; - te.quantity--; - te.isDirty = true; - }else{ - player.inventory.addItemStackToInventory(te.object); - te.object.stackSize = 1; - te.hasObject = false; - te.object = new ItemStack(Item.getItemById(0), 0, 0); - te.quantity = 0; - te.isDirty = true; - } - te.isDirty = true; - } - } - - /** - * @param world - * @param x - * @param y - * @param z - * @param stack - */ - public void dropItem(World world, double x, double y, double z, ItemStack stack) - { - EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 1.5D, z + 0.5D, stack); - entityitem.motionX = 0; - entityitem.motionZ = 0; - entityitem.motionY = 0.11000000298023224D; - world.spawnEntityInWorld(entityitem); - } - - /** - * @param world - * @param i - * @param j - * @param k - * @param block - * @param par6 - */ - @Override - public void breakBlock(World world, int i, int j, int k, Block block, int par6) - { - TileEntityDisplayer te = (TileEntityDisplayer)world.getTileEntity(i, j, k); - if (te != null && te.hasObject){ - te.object.stackSize = te.quantity; - dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, te.object); - world.removeTileEntity(i, j, k); - } - super.breakBlock(world, i, j, k, block, par6); - } - - /** - * @param world - * @param i - * @param j - * @param k - * @param entityLiving - * @param par6ItemStack - */ - @Override - public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack) - { - int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; - world.setBlockMetadataWithNotify(i, j, k, rotation, 2); - } - - /** - * @param icon - */ - @Override - public void registerBlockIcons(IIconRegister icon) - { - blockIcon = icon.registerIcon(Variables.MODID + ":displayer"); - } -} +package darkknight.jewelrycraft.block;
+
+import java.util.Random;
+import darkknight.jewelrycraft.tileentity.TileEntityDisplayer;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockContainer;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+
+public class BlockDisplayer extends BlockContainer
+{
+ Random rand = new Random();
+
+ /**
+ * @param par2Material
+ */
+ protected BlockDisplayer(Material par2Material)
+ {
+ super(par2Material);
+ }
+
+ /**
+ * @param world
+ * @param var2
+ * @return
+ */
+ @Override
+ public TileEntity createNewTileEntity(World world, int var2)
+ {
+ return new TileEntityDisplayer();
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public boolean renderAsNormalBlock()
+ {
+ return false;
+ }
+
+ /**
+ * @param iblockaccess
+ * @param i
+ * @param j
+ * @param k
+ * @param l
+ * @return
+ */
+ @Override
+ public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
+ {
+ return false;
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public boolean isOpaqueCube()
+ {
+ return false;
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public int getRenderType()
+ {
+ return -1;
+ }
+
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param entityPlayer
+ * @param par6
+ * @param par7
+ * @param par8
+ * @param par9
+ * @return
+ */
+ @Override
+ public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9)
+ {
+ TileEntityDisplayer te = (TileEntityDisplayer)world.getTileEntity(i, j, k);
+ ItemStack item = entityPlayer.inventory.getCurrentItem();
+ if (te != null){
+ if (item != null && item != new ItemStack(Item.getItemById(0), 0, 0) && !world.isRemote){
+ if (!te.hasObject){
+ te.object = item.copy();
+ te.quantity += item.stackSize;
+ te.object.stackSize = 1;
+ te.hasObject = true;
+ if (!entityPlayer.capabilities.isCreativeMode) entityPlayer.inventory.decrStackSize(entityPlayer.inventory.currentItem, item.stackSize);
+ te.isDirty = true;
+ }else if (te.object.getItem() == item.getItem() && te.object != null && te.object != new ItemStack(Item.getItemById(0), 0, 0) && te.object.getItemDamage() == item.getItemDamage()) if (te.object.hasTagCompound() && item.hasTagCompound() && te.object.getTagCompound().equals(item.getTagCompound())){
+ te.quantity += item.stackSize;
+ if (!entityPlayer.capabilities.isCreativeMode) entityPlayer.inventory.decrStackSize(entityPlayer.inventory.currentItem, item.stackSize);
+ te.isDirty = true;
+ }else if (!te.object.hasTagCompound() && !item.hasTagCompound()){
+ te.quantity += item.stackSize;
+ if (!entityPlayer.capabilities.isCreativeMode) entityPlayer.inventory.decrStackSize(entityPlayer.inventory.currentItem, item.stackSize);
+ te.isDirty = true;
+ }
+ }else if (item == null || item == new ItemStack(Item.getItemById(0), 0, 0)) if (!entityPlayer.capabilities.isCreativeMode) for(int inv = 0; inv < entityPlayer.inventory.getSizeInventory(); inv++){
+ item = entityPlayer.inventory.getStackInSlot(inv);
+ if (item != null && te.object.getItem() == item.getItem() && te.object != null && te.object != new ItemStack(Item.getItemById(0), 0, 0) && te.object.getItemDamage() == item.getItemDamage()) if (te.object.hasTagCompound() && item.hasTagCompound() && te.object.getTagCompound().equals(item.getTagCompound())){
+ te.quantity += item.stackSize;
+ if (!entityPlayer.capabilities.isCreativeMode) entityPlayer.inventory.decrStackSize(inv, item.stackSize);
+ te.isDirty = true;
+ te.markDirty();
+ }else if (!te.object.hasTagCompound() && !item.hasTagCompound()){
+ te.quantity += item.stackSize;
+ if (!entityPlayer.capabilities.isCreativeMode) entityPlayer.inventory.decrStackSize(inv, item.stackSize);
+ te.isDirty = true;
+ }
+ }
+ else if (entityPlayer.capabilities.isCreativeMode && te.hasObject && te.object.getItem() != null){
+ te.quantity += 64;
+ te.isDirty = true;
+ }
+ te.isDirty = true;
+ }
+ return true;
+ }
+
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param player
+ */
+ @Override
+ public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player)
+ {
+ TileEntityDisplayer te = (TileEntityDisplayer)world.getTileEntity(i, j, k);
+ if (te != null && !world.isRemote) if (te.hasObject && te.object != null && te.object != new ItemStack(Item.getItemById(0), 0, 0) && player.inventory.addItemStackToInventory(te.object)) if (!player.isSneaking()){
+ if (te.quantity > te.object.getMaxStackSize()){
+ te.object.stackSize = te.object.getMaxStackSize() - 1;
+ player.inventory.addItemStackToInventory(te.object);
+ te.object.stackSize = 1;
+ te.quantity -= te.object.getMaxStackSize();
+ te.isDirty = true;
+ }else{
+ te.object.stackSize = te.quantity - 1;
+ player.inventory.addItemStackToInventory(te.object);
+ te.hasObject = false;
+ te.object = new ItemStack(Item.getItemById(0), 0, 0);
+ te.quantity = 0;
+ te.isDirty = true;
+ }
+ te.isDirty = true;
+ }else{
+ if (te.quantity >= 2){
+ player.inventory.addItemStackToInventory(te.object);
+ te.object.stackSize = 1;
+ te.quantity--;
+ te.isDirty = true;
+ }else{
+ player.inventory.addItemStackToInventory(te.object);
+ te.object.stackSize = 1;
+ te.hasObject = false;
+ te.object = new ItemStack(Item.getItemById(0), 0, 0);
+ te.quantity = 0;
+ te.isDirty = true;
+ }
+ te.isDirty = true;
+ }
+ }
+
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param stack
+ */
+ public void dropItem(World world, double x, double y, double z, ItemStack stack)
+ {
+ EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 1.5D, z + 0.5D, stack);
+ entityitem.motionX = 0;
+ entityitem.motionZ = 0;
+ entityitem.motionY = 0.11000000298023224D;
+ world.spawnEntityInWorld(entityitem);
+ }
+
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param block
+ * @param par6
+ */
+ @Override
+ public void breakBlock(World world, int i, int j, int k, Block block, int par6)
+ {
+ TileEntityDisplayer te = (TileEntityDisplayer)world.getTileEntity(i, j, k);
+ if (te != null && te.hasObject){
+ te.object.stackSize = te.quantity;
+ dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, te.object);
+ world.removeTileEntity(i, j, k);
+ }
+ super.breakBlock(world, i, j, k, block, par6);
+ }
+
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param entityLiving
+ * @param par6ItemStack
+ */
+ @Override
+ public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack)
+ {
+ int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
+ world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
+ }
+
+ /**
+ * @param icon
+ */
+ @Override
+ public void registerBlockIcons(IIconRegister icon)
+ {
+ blockIcon = icon.registerIcon("minecraft:emerald_block");
+ }
+}
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockHandPedestal.java b/src/main/java/darkknight/jewelrycraft/block/BlockHandPedestal.java index f88048e..4059101 100644 --- a/src/main/java/darkknight/jewelrycraft/block/BlockHandPedestal.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockHandPedestal.java @@ -1,169 +1,169 @@ -package darkknight.jewelrycraft.block; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.MathHelper; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import darkknight.jewelrycraft.tileentity.TileEntityHandPedestal; - -public class BlockHandPedestal extends BlockContainer -{ - - /** - * @param material - */ - protected BlockHandPedestal(Material material) - { - super(material); - setBlockBounds(0.2F, 0F, 0.2F, 0.8F, 1.0F, 0.8F); - } - - /** - * @param world - * @param var2 - * @return - */ - @Override - public TileEntity createNewTileEntity(World world, int var2) - { - return new TileEntityHandPedestal(); - } - - /** - * @return - */ - @Override - public boolean renderAsNormalBlock() - { - return false; - } - - /** - * @param iblockaccess - * @param i - * @param j - * @param k - * @param l - * @return - */ - @Override - public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) - { - return false; - } - - /** - * @return - */ - @Override - public boolean isOpaqueCube() - { - return false; - } - - /** - * @return - */ - @Override - public int getRenderType() - { - return -1; - } - - /** - * @param world - * @param i - * @param j - * @param k - * @param entityPlayer - * @param par6 - * @param par7 - * @param par8 - * @param par9 - * @return - */ - @Override - public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) - { - TileEntityHandPedestal te = (TileEntityHandPedestal)world.getTileEntity(i, j, k); - ItemStack item = entityPlayer.inventory.getCurrentItem(); - if (te != null){ - if (!world.isRemote && te.getHeldItemStack() == null && item != null){ - te.setHeldItemStack(item.copy()); - if (!entityPlayer.capabilities.isCreativeMode) item.stackSize--; - te.markDirty(); - }else if (entityPlayer.isSneaking()) if (entityPlayer.inventory.addItemStackToInventory(te.getHeldItemStack())){ - te.removeHeldItemStack(); - } - te.markDirty(); - } - return true; - } - - /** - * @param world - * @param x - * @param y - * @param z - * @param stack - */ - public void dropItem(World world, double x, double y, double z, ItemStack stack) - { - EntityItem entityitem = new EntityItem(world, x + 0.5, y + 1.5, z + 0.5, stack); - entityitem.motionX = 0; - entityitem.motionZ = 0; - entityitem.motionY = 0.11000000298023224D; - world.spawnEntityInWorld(entityitem); - } - - /** - * @param world - * @param i - * @param j - * @param k - * @param block - * @param par6 - */ - @Override - public void breakBlock(World world, int i, int j, int k, Block block, int par6) - { - TileEntityHandPedestal te = (TileEntityHandPedestal)world.getTileEntity(i, j, k); - if (te != null && te.getHeldItemStack() != null){ - dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, te.getHeldItemStack()); - world.removeTileEntity(i, j, k); - } - super.breakBlock(world, i, j, k, block, par6); - } - - /** - * @param world - * @param i - * @param j - * @param k - * @param entityLiving - * @param par6ItemStack - */ - @Override - public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack) - { - int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 8 / 360 + 0.5) & 7; - world.setBlockMetadataWithNotify(i, j, k, rotation, 2); - } - - /** - * @param icon - */ - @Override - public void registerBlockIcons(IIconRegister icon) - { - blockIcon = icon.registerIcon("minecraft:stonebrick"); - } +package darkknight.jewelrycraft.block;
+
+import darkknight.jewelrycraft.tileentity.TileEntityHandPedestal;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockContainer;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+
+public class BlockHandPedestal extends BlockContainer
+{
+
+ /**
+ * @param material
+ */
+ protected BlockHandPedestal(Material material)
+ {
+ super(material);
+ setBlockBounds(0.2F, 0F, 0.2F, 0.8F, 1.0F, 0.8F);
+ }
+
+ /**
+ * @param world
+ * @param var2
+ * @return
+ */
+ @Override
+ public TileEntity createNewTileEntity(World world, int var2)
+ {
+ return new TileEntityHandPedestal();
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public boolean renderAsNormalBlock()
+ {
+ return false;
+ }
+
+ /**
+ * @param iblockaccess
+ * @param i
+ * @param j
+ * @param k
+ * @param l
+ * @return
+ */
+ @Override
+ public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
+ {
+ return false;
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public boolean isOpaqueCube()
+ {
+ return false;
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public int getRenderType()
+ {
+ return -1;
+ }
+
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param entityPlayer
+ * @param par6
+ * @param par7
+ * @param par8
+ * @param par9
+ * @return
+ */
+ @Override
+ public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9)
+ {
+ TileEntityHandPedestal te = (TileEntityHandPedestal)world.getTileEntity(i, j, k);
+ ItemStack item = entityPlayer.inventory.getCurrentItem();
+ if (te != null){
+ if (!world.isRemote && te.getHeldItemStack() == null && item != null){
+ te.setHeldItemStack(item.copy());
+ if (!entityPlayer.capabilities.isCreativeMode) item.stackSize--;
+ te.markDirty();
+ }else if (entityPlayer.isSneaking()) if (entityPlayer.inventory.addItemStackToInventory(te.getHeldItemStack())){
+ te.removeHeldItemStack();
+ }
+ te.markDirty();
+ }
+ return true;
+ }
+
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param stack
+ */
+ public void dropItem(World world, double x, double y, double z, ItemStack stack)
+ {
+ EntityItem entityitem = new EntityItem(world, x + 0.5, y + 1.5, z + 0.5, stack);
+ entityitem.motionX = 0;
+ entityitem.motionZ = 0;
+ entityitem.motionY = 0.11000000298023224D;
+ world.spawnEntityInWorld(entityitem);
+ }
+
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param block
+ * @param par6
+ */
+ @Override
+ public void breakBlock(World world, int i, int j, int k, Block block, int par6)
+ {
+ TileEntityHandPedestal te = (TileEntityHandPedestal)world.getTileEntity(i, j, k);
+ if (te != null && te.getHeldItemStack() != null){
+ dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, te.getHeldItemStack());
+ world.removeTileEntity(i, j, k);
+ }
+ super.breakBlock(world, i, j, k, block, par6);
+ }
+
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param entityLiving
+ * @param par6ItemStack
+ */
+ @Override
+ public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack)
+ {
+ int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 8 / 360 + 0.5) & 7;
+ world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
+ }
+
+ /**
+ * @param icon
+ */
+ @Override
+ public void registerBlockIcons(IIconRegister icon)
+ {
+ blockIcon = icon.registerIcon("minecraft:stonebrick");
+ }
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockItemCrystal.java b/src/main/java/darkknight/jewelrycraft/block/BlockItemCrystal.java index a8fb0b1..ca3490a 100644 --- a/src/main/java/darkknight/jewelrycraft/block/BlockItemCrystal.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockItemCrystal.java @@ -1,36 +1,35 @@ -package darkknight.jewelrycraft.block; - -import java.io.IOException; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.block.Block; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; - -public class BlockItemCrystal extends ItemBlock -{ - public BlockItemCrystal(Block block) { - super(block); - setHasSubtypes(true); - } - - @Override - public int getMetadata (int damageValue) - { - return damageValue; - } - - @Override - public String getUnlocalizedName(ItemStack itemstack) - { - return getUnlocalizedName() + "." + itemstack.getItemDamage(); - } - - @Override - @SideOnly (Side.CLIENT) - public int getColorFromItemStack(ItemStack stack, int pass) - { - return stack.getItemDamage() < 16 ? BlockCrystal.colors[stack.getItemDamage()] : 0; - } - +package darkknight.jewelrycraft.block;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import net.minecraft.block.Block;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+
+public class BlockItemCrystal extends ItemBlock
+{
+ public BlockItemCrystal(Block block) {
+ super(block);
+ setHasSubtypes(true);
+ }
+
+ @Override
+ public int getMetadata (int damageValue)
+ {
+ return damageValue;
+ }
+
+ @Override
+ public String getUnlocalizedName(ItemStack itemstack)
+ {
+ return getUnlocalizedName() + "." + itemstack.getItemDamage();
+ }
+
+ @Override
+ @SideOnly (Side.CLIENT)
+ public int getColorFromItemStack(ItemStack stack, int pass)
+ {
+ return stack.getItemDamage() < 16 ? BlockCrystal.colors[stack.getItemDamage()] : 0;
+ }
+
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockJCOre.java b/src/main/java/darkknight/jewelrycraft/block/BlockJCOre.java index 4e5ca6d..5265a6a 100644 --- a/src/main/java/darkknight/jewelrycraft/block/BlockJCOre.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockJCOre.java @@ -1,14 +1,12 @@ -package darkknight.jewelrycraft.block; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockOre; -import net.minecraft.block.material.Material; - -public class BlockJCOre extends BlockOre -{ - protected BlockJCOre() - { - super(); - setHarvestLevel("pickaxe", 3); - } -} +package darkknight.jewelrycraft.block;
+
+import net.minecraft.block.BlockOre;
+
+public class BlockJCOre extends BlockOre
+{
+ protected BlockJCOre()
+ {
+ super();
+ setHarvestLevel("pickaxe", 3);
+ }
+}
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java b/src/main/java/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java index 7a6bf38..71b1a23 100644 --- a/src/main/java/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java @@ -1,6 +1,10 @@ package darkknight.jewelrycraft.block;
import java.util.Random;
+import darkknight.jewelrycraft.config.ConfigHandler;
+import darkknight.jewelrycraft.tileentity.TileEntityJewelrsCraftingTable;
+import darkknight.jewelrycraft.util.JewelrycraftUtil;
+import darkknight.jewelrycraft.util.Variables;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
@@ -8,7 +12,6 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
@@ -16,10 +19,6 @@ import net.minecraft.util.MathHelper; import net.minecraft.util.StatCollector;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
-import darkknight.jewelrycraft.config.ConfigHandler;
-import darkknight.jewelrycraft.tileentity.TileEntityJewelrsCraftingTable;
-import darkknight.jewelrycraft.util.JewelrycraftUtil;
-import darkknight.jewelrycraft.util.Variables;
public class BlockJewelrsCraftingTable extends BlockContainer {
Random rand = new Random();
@@ -111,9 +110,10 @@ public class BlockJewelrsCraftingTable extends BlockContainer { public int getRenderType() {
return -1;
}
-
- @Override
- public void registerBlockIcons(IIconRegister icon) {
- blockIcon = icon.registerIcon(Variables.MODID + ":jewelrsCraftingTable");
- }
+
+ @Override
+ public void registerBlockIcons(IIconRegister icon)
+ {
+ blockIcon = icon.registerIcon("minecraft:planks_spruce");
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockList.java b/src/main/java/darkknight/jewelrycraft/block/BlockList.java index 9d3a54b..7f59e7f 100644 --- a/src/main/java/darkknight/jewelrycraft/block/BlockList.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockList.java @@ -27,7 +27,6 @@ public class BlockList public static Block shadowOre, smelter, molder, displayer, jewelCraftingTable, shadowBlock, shadowEye, handPedestal, shadowHand, midasTouchBlock, crystal;
public static BlockMoltenMetal moltenMetal;
public static Fluid moltenMetalFluid;
- private static boolean isInitialized = false;
public static void preInit(FMLPreInitializationEvent e)
{
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockMidasTouch.java b/src/main/java/darkknight/jewelrycraft/block/BlockMidasTouch.java index 4e09e4a..337428d 100644 --- a/src/main/java/darkknight/jewelrycraft/block/BlockMidasTouch.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockMidasTouch.java @@ -1,83 +1,78 @@ -package darkknight.jewelrycraft.block; - -import java.util.ArrayList; -import java.util.Random; -import net.minecraft.block.Block; -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import darkknight.jewelrycraft.tileentity.TileEntityMidasTouch; -import darkknight.jewelrycraft.tileentity.TileEntityMolder; - -public class BlockMidasTouch extends BlockContainer -{ - protected BlockMidasTouch(Material mat) - { - super(mat); - setHarvestLevel("pickaxe", 2); - } - - @Override - public TileEntity createNewTileEntity(World world, int var2) - { - return new TileEntityMidasTouch(); - } - - @Override - public boolean renderAsNormalBlock() - { - return false; - } - - @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; - } - - public int quantityDropped(Random rand) - { - return 0; - } - - public Item getItemDropped(int id, Random rand, int size) - { - return Items.gold_nugget; - } - - public void onBlockHarvested(World world, int i, int j, int k, int meta, EntityPlayer player) - { - } - - public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) - { - TileEntity tile = world.getTileEntity(x, y, z); - if (((TileEntityMidasTouch)tile).target != null) this.setBlockBounds(0.5f - ((TileEntityMidasTouch)tile).target.width / 2, 0F, 0.5f - ((TileEntityMidasTouch)tile).target.width / 2, 0.5f + ((TileEntityMidasTouch)tile).target.width / 2, ((TileEntityMidasTouch)tile).target.height, 0.5f + ((TileEntityMidasTouch)tile).target.width / 2); - } - - @Override - public void registerBlockIcons(IIconRegister icon) - { - blockIcon = icon.registerIcon("minecraft:gold_block"); - } -} +package darkknight.jewelrycraft.block;
+
+import java.util.Random;
+import darkknight.jewelrycraft.tileentity.TileEntityMidasTouch;
+import net.minecraft.block.BlockContainer;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+
+public class BlockMidasTouch extends BlockContainer
+{
+ protected BlockMidasTouch(Material mat)
+ {
+ super(mat);
+ setHarvestLevel("pickaxe", 2);
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World world, int var2)
+ {
+ return new TileEntityMidasTouch();
+ }
+
+ @Override
+ public boolean renderAsNormalBlock()
+ {
+ return false;
+ }
+
+ @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;
+ }
+
+ public int quantityDropped(Random rand)
+ {
+ return 0;
+ }
+
+ public Item getItemDropped(int id, Random rand, int size)
+ {
+ return Items.gold_nugget;
+ }
+
+ public void onBlockHarvested(World world, int i, int j, int k, int meta, EntityPlayer player)
+ {
+ }
+
+ public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z)
+ {
+ TileEntity tile = world.getTileEntity(x, y, z);
+ if (((TileEntityMidasTouch)tile).target != null) this.setBlockBounds(0.5f - ((TileEntityMidasTouch)tile).target.width / 2, 0F, 0.5f - ((TileEntityMidasTouch)tile).target.width / 2, 0.5f + ((TileEntityMidasTouch)tile).target.width / 2, ((TileEntityMidasTouch)tile).target.height, 0.5f + ((TileEntityMidasTouch)tile).target.width / 2);
+ }
+
+ @Override
+ public void registerBlockIcons(IIconRegister icon)
+ {
+ blockIcon = icon.registerIcon("minecraft:gold_block");
+ }
+}
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockMolder.java b/src/main/java/darkknight/jewelrycraft/block/BlockMolder.java index 8c152e3..0c58784 100644 --- a/src/main/java/darkknight/jewelrycraft/block/BlockMolder.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockMolder.java @@ -1,206 +1,136 @@ -package darkknight.jewelrycraft.block; - -import java.util.Random; -import net.minecraft.block.Block; -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.MathHelper; -import net.minecraft.util.StatCollector; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import darkknight.jewelrycraft.config.ConfigHandler; -import darkknight.jewelrycraft.item.ItemList; -import darkknight.jewelrycraft.tileentity.TileEntityMolder; -import darkknight.jewelrycraft.util.Variables; - -public class BlockMolder extends BlockContainer -{ - Random rand = new Random(); - - /** - * @param par2Material - */ - protected BlockMolder(Material par2Material) - { - super(par2Material); - setBlockBounds(0.1F, 0F, 0.1F, 0.9F, 0.2F, 0.9F); - } - - /** - * @param world - * @param var2 - * @return - */ - @Override - public TileEntity createNewTileEntity(World world, int var2) - { - return new TileEntityMolder(); - } - - /** - * @return - */ - @Override - public boolean renderAsNormalBlock() - { - return false; - } - - /** - * @param world - * @param i - * @param j - * @param k - * @param entityPlayer - * @param par6 - * @param par7 - * @param par8 - * @param par9 - * @return - */ - @Override - public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) - { - TileEntityMolder te = (TileEntityMolder)world.getTileEntity(i, j, k); - ItemStack item = entityPlayer.inventory.getCurrentItem(); - if (te != null && !world.isRemote){ - if (item != null && !te.hasMold && item.getItem() == ItemList.molds){ - te.mold = item.copy(); - te.hasMold = true; - if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize; - entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("chatmessage." + Variables.MODID + ".molder.addedmold", te.mold.getDisplayName()))); - te.isDirty = true; - } - if (te.hasMold && entityPlayer.isSneaking() && !te.hasMoltenMetal){ - dropItem(world, te.xCoord, te.yCoord, te.zCoord, te.mold.copy()); - te.mold = new ItemStack(Item.getItemById(0), 0, 0); - te.hasMold = false; - te.isDirty = true; - }else if (te.hasMoltenMetal) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".molder.hasmoltenmetal"))); - } - return true; - } - - /** - * @param world - * @param x - * @param y - * @param z - * @param stack - */ - public void dropItem(World world, double x, double y, double z, ItemStack stack) - { - EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 0.5D, z + 0.5D, stack); - entityitem.motionX = 0; - entityitem.motionZ = 0; - entityitem.motionY = 0.11000000298023224D; - world.spawnEntityInWorld(entityitem); - } - - /** - * @param world - * @param i - * @param j - * @param k - * @param par5 - * @param par6 - */ - @Override - public void breakBlock(World world, int i, int j, int k, Block par5, int par6) - { - TileEntityMolder te = (TileEntityMolder)world.getTileEntity(i, j, k); - if (te != null){ - if (te.hasJewelBase) dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, te.jewelBase.copy()); - if (te.hasMold) dropItem(world, te.xCoord, te.yCoord, te.zCoord, te.mold.copy()); - world.removeTileEntity(i, j, k); - } - super.breakBlock(world, i, j, k, par5, par6); - } - - /** - * @param world - * @param i - * @param j - * @param k - * @param entityLiving - * @param par6ItemStack - */ - @Override - public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack) - { - int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; - world.setBlockMetadataWithNotify(i, j, k, rotation, 2); - } - - /** - * @param world - * @param i - * @param j - * @param k - * @param player - */ - @Override - public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player) - { - TileEntityMolder me = (TileEntityMolder)world.getTileEntity(i, j, k); - if (me != null && !world.isRemote){ - if (me.hasJewelBase){ - dropItem(me.getWorldObj(), me.xCoord, me.yCoord, me.zCoord, me.jewelBase.copy()); - me.jewelBase = new ItemStack(Item.getItemById(0), 0, 0); - me.hasJewelBase = false; - }else if (me.hasMoltenMetal && me.cooling >= 0) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".molder.metaliscooling") + " (" + (ConfigHandler.INGOT_COOLING_TIME - me.cooling) * 100 / ConfigHandler.INGOT_COOLING_TIME + "%)")); - else if (me.mold.getItem() == ItemList.molds && !me.hasMoltenMetal) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".molder.moldisempty"))); - else if (me.mold.getItem() != ItemList.molds) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".molder.moldismissing"))); - me.isDirty = true; - } - } - - /** - * @param iblockaccess - * @param i - * @param j - * @param k - * @param l - * @return - */ - @Override - public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) - { - return false; - } - - /** - * @return - */ - @Override - public boolean isOpaqueCube() - { - return false; - } - - /** - * @return - */ - @Override - public int getRenderType() - { - return -1; - } - - /** - * @param icon - */ - @Override - public void registerBlockIcons(IIconRegister icon) - { - blockIcon = icon.registerIcon(Variables.MODID + ":molder"); - } -} +package darkknight.jewelrycraft.block;
+
+import java.util.Random;
+import darkknight.jewelrycraft.config.ConfigHandler;
+import darkknight.jewelrycraft.item.ItemList;
+import darkknight.jewelrycraft.tileentity.TileEntityMolder;
+import darkknight.jewelrycraft.util.Variables;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockContainer;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+
+public class BlockMolder extends BlockContainer
+{
+ Random rand = new Random();
+
+ protected BlockMolder(Material par2Material)
+ {
+ super(par2Material);
+ setBlockBounds(0.1F, 0F, 0.1F, 0.9F, 0.2F, 0.9F);
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World world, int var2)
+ {
+ 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)
+ {
+ TileEntityMolder te = (TileEntityMolder)world.getTileEntity(i, j, k);
+ ItemStack item = entityPlayer.inventory.getCurrentItem();
+ if (te != null && !world.isRemote){
+ if (item != null && !te.hasMold && item.getItem() == ItemList.molds){
+ te.mold = item.copy();
+ te.hasMold = true;
+ if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize;
+ entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("chatmessage." + Variables.MODID + ".molder.addedmold", te.mold.getDisplayName())));
+ te.isDirty = true;
+ }
+ if (te.hasMold && entityPlayer.isSneaking() && !te.hasMoltenMetal){
+ dropItem(world, te.xCoord, te.yCoord, te.zCoord, te.mold.copy());
+ te.mold = new ItemStack(Item.getItemById(0), 0, 0);
+ te.hasMold = false;
+ te.isDirty = true;
+ }else if (te.hasMoltenMetal) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".molder.hasmoltenmetal")));
+ }
+ return true;
+ }
+
+ public void dropItem(World world, double x, double y, double z, ItemStack stack)
+ {
+ EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 0.5D, z + 0.5D, stack);
+ entityitem.motionX = 0;
+ entityitem.motionZ = 0;
+ entityitem.motionY = 0.11000000298023224D;
+ world.spawnEntityInWorld(entityitem);
+ }
+
+ @Override
+ public void breakBlock(World world, int i, int j, int k, Block par5, int par6)
+ {
+ TileEntityMolder te = (TileEntityMolder)world.getTileEntity(i, j, k);
+ if (te != null){
+ if (te.hasJewelBase) dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, te.jewelBase.copy());
+ if (te.hasMold) dropItem(world, te.xCoord, te.yCoord, te.zCoord, te.mold.copy());
+ world.removeTileEntity(i, j, k);
+ }
+ super.breakBlock(world, i, j, k, par5, par6);
+ }
+
+ @Override
+ public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack)
+ {
+ int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
+ world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
+ }
+
+ @Override
+ public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player)
+ {
+ TileEntityMolder me = (TileEntityMolder)world.getTileEntity(i, j, k);
+ if (me != null && !world.isRemote){
+ if (me.hasJewelBase){
+ dropItem(me.getWorldObj(), me.xCoord, me.yCoord, me.zCoord, me.jewelBase.copy());
+ me.jewelBase = new ItemStack(Item.getItemById(0), 0, 0);
+ me.hasJewelBase = false;
+ }else if (me.hasMoltenMetal && me.cooling >= 0) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".molder.metaliscooling") + " (" + (ConfigHandler.INGOT_COOLING_TIME - me.cooling) * 100 / ConfigHandler.INGOT_COOLING_TIME + "%)"));
+ else if (me.mold.getItem() == ItemList.molds && !me.hasMoltenMetal) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".molder.moldisempty")));
+ else if (me.mold.getItem() != ItemList.molds) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".molder.moldismissing")));
+ me.isDirty = true;
+ }
+ }
+
+ @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 registerBlockIcons(IIconRegister icon)
+ {
+ blockIcon = icon.registerIcon("minecraft:cobblestone");
+ }
+}
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockShadow.java b/src/main/java/darkknight/jewelrycraft/block/BlockShadow.java index 7f8041d..ae9ceaa 100644 --- a/src/main/java/darkknight/jewelrycraft/block/BlockShadow.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockShadow.java @@ -1,5 +1,8 @@ package darkknight.jewelrycraft.block;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import darkknight.jewelrycraft.tileentity.TileEntityBlockShadow;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
@@ -10,9 +13,6 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
-import darkknight.jewelrycraft.tileentity.TileEntityBlockShadow;
public class BlockShadow extends BlockContainer
{
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockShadowEye.java b/src/main/java/darkknight/jewelrycraft/block/BlockShadowEye.java index 53688ce..7a2277e 100644 --- a/src/main/java/darkknight/jewelrycraft/block/BlockShadowEye.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockShadowEye.java @@ -1,135 +1,135 @@ -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.IIconRegister; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.MathHelper; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import darkknight.jewelrycraft.tileentity.TileEntityShadowEye; - -public class BlockShadowEye extends BlockContainer -{ - Random rand = new Random(); - - protected BlockShadowEye() - { - super(Material.rock); - } - - /** - * @param world - * @param var2 - * @return - */ - @Override - public TileEntity createNewTileEntity(World world, int var2) - { - return new TileEntityShadowEye(); - } - - /** - * @return - */ - @Override - public boolean renderAsNormalBlock() - { - return false; - } - - /** - * @param iblockaccess - * @param i - * @param j - * @param k - * @param l - * @return - */ - @Override - public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) - { - return false; - } - - /** - * @return - */ - @Override - public boolean isOpaqueCube() - { - return false; - } - - /** - * @return - */ - @Override - public int getRenderType() - { - return -1; - } - - /** - * @param world - * @param i - * @param j - * @param k - * @param entityPlayer - * @param par6 - * @param par7 - * @param par8 - * @param par9 - * @return - */ - @Override - public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) - { - TileEntityShadowEye tile = (TileEntityShadowEye)world.getTileEntity(i, j, k); - if (!tile.active && tile.opening == 1){ - tile.active = true; - tile.target = entityPlayer; - tile.shouldAddData = true; - } - return true; - } - - /** - * @param world - * @param i - * @param j - * @param k - * @param player - */ - @Override - public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player) - {} - - /** - * @param world - * @param i - * @param j - * @param k - * @param entityLiving - * @param par6ItemStack - */ - @Override - public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack) - { - int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; - world.setBlockMetadataWithNotify(i, j, k, rotation, 2); - } - - /** - * @param icon - */ - @Override - public void registerBlockIcons(IIconRegister icon) - { - blockIcon = icon.registerIcon("minecraft:stonebrick"); - } -} +package darkknight.jewelrycraft.block;
+
+import java.util.Random;
+import darkknight.jewelrycraft.tileentity.TileEntityShadowEye;
+import net.minecraft.block.BlockContainer;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+
+public class BlockShadowEye extends BlockContainer
+{
+ Random rand = new Random();
+
+ protected BlockShadowEye()
+ {
+ super(Material.rock);
+ }
+
+ /**
+ * @param world
+ * @param var2
+ * @return
+ */
+ @Override
+ public TileEntity createNewTileEntity(World world, int var2)
+ {
+ return new TileEntityShadowEye();
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public boolean renderAsNormalBlock()
+ {
+ return false;
+ }
+
+ /**
+ * @param iblockaccess
+ * @param i
+ * @param j
+ * @param k
+ * @param l
+ * @return
+ */
+ @Override
+ public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
+ {
+ return false;
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public boolean isOpaqueCube()
+ {
+ return false;
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public int getRenderType()
+ {
+ return -1;
+ }
+
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param entityPlayer
+ * @param par6
+ * @param par7
+ * @param par8
+ * @param par9
+ * @return
+ */
+ @Override
+ public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9)
+ {
+ TileEntityShadowEye tile = (TileEntityShadowEye)world.getTileEntity(i, j, k);
+ if (!tile.active && tile.opening == 1){
+ tile.active = true;
+ tile.target = entityPlayer;
+ tile.shouldAddData = true;
+ }
+ return true;
+ }
+
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param player
+ */
+ @Override
+ public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player)
+ {}
+
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param entityLiving
+ * @param par6ItemStack
+ */
+ @Override
+ public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack)
+ {
+ int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
+ world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
+ }
+
+ /**
+ * @param icon
+ */
+ @Override
+ public void registerBlockIcons(IIconRegister icon)
+ {
+ blockIcon = icon.registerIcon("minecraft:stonebrick");
+ }
+}
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockShadowHand.java b/src/main/java/darkknight/jewelrycraft/block/BlockShadowHand.java index 2d488ca..bd33536 100644 --- a/src/main/java/darkknight/jewelrycraft/block/BlockShadowHand.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockShadowHand.java @@ -1,139 +1,139 @@ -package darkknight.jewelrycraft.block; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.MathHelper; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import darkknight.jewelrycraft.tileentity.TileEntityShadowHand; - -public class BlockShadowHand extends BlockContainer -{ - /** - * @param material - */ - protected BlockShadowHand(Material material) - { - super(material); - setBlockBounds(0.2F, 0F, 0.2F, 0.8F, 1.0F, 0.8F); - } - - /** - * @param world - * @param var2 - * @return - */ - @Override - public TileEntity createNewTileEntity(World world, int var2) - { - return new TileEntityShadowHand(); - } - - /** - * @return - */ - @Override - public boolean renderAsNormalBlock() - { - return false; - } - - /** - * @param iblockaccess - * @param i - * @param j - * @param k - * @param l - * @return - */ - @Override - public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) - { - return false; - } - - /** - * @return - */ - @Override - public boolean isOpaqueCube() - { - return false; - } - - /** - * @return - */ - @Override - public int getRenderType() - { - return -1; - } - - /** - * @param world - * @param x - * @param y - * @param z - * @param stack - */ - public void dropItem(World world, double x, double y, double z, ItemStack stack) - { - EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 1.5D, z + 0.5D, stack); - entityitem.motionX = 0; - entityitem.motionZ = 0; - entityitem.motionY = 0.11000000298023224D; - world.spawnEntityInWorld(entityitem); - } - - /** - * @param world - * @param i - * @param j - * @param k - * @param block - * @param par6 - */ - @Override - public void breakBlock(World world, int i, int j, int k, Block block, int par6) - { - if (world.getTileEntity(i, j, k) instanceof TileEntityShadowHand){ - TileEntityShadowHand te = (TileEntityShadowHand)world.getTileEntity(i, j, k); - if (te != null && te.getHeldItemStack() != null){ - dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, te.getHeldItemStack()); - world.removeTileEntity(i, j, k); - } - } - super.breakBlock(world, i, j, k, block, par6); - } - - /** - * @param world - * @param i - * @param j - * @param k - * @param entityLiving - * @param par6ItemStack - */ - @Override - public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack) - { - int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 8.0F / 360.0F + 0.5D) & 7; - world.setBlockMetadataWithNotify(i, j, k, rotation, 2); - } - - /** - * @param icon - */ - @Override - public void registerBlockIcons(IIconRegister icon) - { - blockIcon = icon.registerIcon("minecraft:coal_block"); - } +package darkknight.jewelrycraft.block;
+
+import darkknight.jewelrycraft.tileentity.TileEntityShadowHand;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockContainer;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+
+public class BlockShadowHand extends BlockContainer
+{
+ /**
+ * @param material
+ */
+ protected BlockShadowHand(Material material)
+ {
+ super(material);
+ setBlockBounds(0.2F, 0F, 0.2F, 0.8F, 1.0F, 0.8F);
+ }
+
+ /**
+ * @param world
+ * @param var2
+ * @return
+ */
+ @Override
+ public TileEntity createNewTileEntity(World world, int var2)
+ {
+ return new TileEntityShadowHand();
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public boolean renderAsNormalBlock()
+ {
+ return false;
+ }
+
+ /**
+ * @param iblockaccess
+ * @param i
+ * @param j
+ * @param k
+ * @param l
+ * @return
+ */
+ @Override
+ public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
+ {
+ return false;
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public boolean isOpaqueCube()
+ {
+ return false;
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public int getRenderType()
+ {
+ return -1;
+ }
+
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param stack
+ */
+ public void dropItem(World world, double x, double y, double z, ItemStack stack)
+ {
+ EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 1.5D, z + 0.5D, stack);
+ entityitem.motionX = 0;
+ entityitem.motionZ = 0;
+ entityitem.motionY = 0.11000000298023224D;
+ world.spawnEntityInWorld(entityitem);
+ }
+
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param block
+ * @param par6
+ */
+ @Override
+ public void breakBlock(World world, int i, int j, int k, Block block, int par6)
+ {
+ if (world.getTileEntity(i, j, k) instanceof TileEntityShadowHand){
+ TileEntityShadowHand te = (TileEntityShadowHand)world.getTileEntity(i, j, k);
+ if (te != null && te.getHeldItemStack() != null){
+ dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, te.getHeldItemStack());
+ world.removeTileEntity(i, j, k);
+ }
+ }
+ super.breakBlock(world, i, j, k, block, par6);
+ }
+
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param entityLiving
+ * @param par6ItemStack
+ */
+ @Override
+ public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack)
+ {
+ int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 8.0F / 360.0F + 0.5D) & 7;
+ world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
+ }
+
+ /**
+ * @param icon
+ */
+ @Override
+ public void registerBlockIcons(IIconRegister icon)
+ {
+ blockIcon = icon.registerIcon("minecraft:coal_block");
+ }
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockSmelter.java b/src/main/java/darkknight/jewelrycraft/block/BlockSmelter.java index 3c9b680..db8e254 100644 --- a/src/main/java/darkknight/jewelrycraft/block/BlockSmelter.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockSmelter.java @@ -5,7 +5,6 @@ import darkknight.jewelrycraft.config.ConfigHandler; import darkknight.jewelrycraft.item.ItemList;
import darkknight.jewelrycraft.item.ItemMoltenMetalBucket;
import darkknight.jewelrycraft.tileentity.TileEntityMolder;
-import darkknight.jewelrycraft.tileentity.TileEntityMoltenMetal;
import darkknight.jewelrycraft.tileentity.TileEntitySmelter;
import darkknight.jewelrycraft.util.JewelryNBT;
import darkknight.jewelrycraft.util.JewelrycraftUtil;
@@ -21,7 +20,6 @@ import net.minecraft.init.Blocks; import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.MathHelper;
@@ -208,9 +206,10 @@ public class BlockSmelter extends BlockContainer { public int getRenderType() {
return -1;
}
-
- @Override
- public void registerBlockIcons(IIconRegister icon) {
- blockIcon = icon.registerIcon(Variables.MODID + ":smelter");
- }
+
+ @Override
+ public void registerBlockIcons(IIconRegister icon)
+ {
+ blockIcon = icon.registerIcon("minecraft:iron_block");
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/block/render/BlockCrystalRenderer.java b/src/main/java/darkknight/jewelrycraft/block/render/BlockCrystalRenderer.java index 061a8ea..a571927 100644 --- a/src/main/java/darkknight/jewelrycraft/block/render/BlockCrystalRenderer.java +++ b/src/main/java/darkknight/jewelrycraft/block/render/BlockCrystalRenderer.java @@ -4,11 +4,6 @@ package darkknight.jewelrycraft.block.render;
import java.util.Random;
-import net.minecraft.block.Block;
-import net.minecraft.client.renderer.RenderBlocks;
-import net.minecraft.client.renderer.Tessellator;
-import net.minecraft.util.IIcon;
-import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.relauncher.Side;
@@ -17,131 +12,131 @@ import darkknight.jewelrycraft.block.BlockCrystal; import darkknight.jewelrycraft.config.ConfigHandler;
import darkknight.jewelrycraft.proxy.ClientProxy.BlockRenderIDs;
import darkknight.jewelrycraft.tileentity.TileEntityCrystal;
+import net.minecraft.block.Block;
+import net.minecraft.client.renderer.RenderBlocks;
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.IBlockAccess;
/**
* @author Sorin
*/
-@SideOnly (Side.CLIENT)
-public class BlockCrystalRenderer implements ISimpleBlockRenderingHandler
-{
- @Override
- public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
- {
- Tessellator tessellator = Tessellator.instance;
- GL11.glPushMatrix();
- GL11.glDisable(GL11.GL_LIGHTING);
- tessellator.startDrawingQuads();
- if (metadata < 16) tessellator.setColorRGBA_I(((BlockCrystal)block).colors[metadata], 100);
- GL11.glTranslatef(-0.5f, -0.5f, -0.5f);
- this.renderWorldBlock(null, 0, 0, 0, block, modelID, renderer);
- tessellator.draw();
- GL11.glTranslatef(0.5f, 0.5f, 0.5f);
- GL11.glEnable(GL11.GL_LIGHTING);
- GL11.glPopMatrix();
- }
-
- @Override
- public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
- {
- int crystals = 5;
- Random rnd = new Random();
- Tessellator tessellator = Tessellator.instance;
- IIcon icon = ((BlockCrystal)block).getIcon(0, 0);
- double umin = icon.getMinU();
- double vmin = icon.getMinV();
- double umax = icon.getMaxU();
- double vmax = icon.getMaxV();
- tessellator.addTranslation(x, y, z);
- if (world != null && world.getTileEntity(x, y, z) != null && ConfigHandler.CRYSTAL_GLOW) tessellator.setBrightness(((TileEntityCrystal)world.getTileEntity(x, y, z)).shine);
- else tessellator.setBrightness(230);
- // 37435, 76464
- if (world != null) rnd.setSeed(2 * x * 3 * y * z * 5);
- else rnd.setSeed(76464);
- if (world != null && world.getBlockMetadata(x, y, z) < 16) tessellator.setColorRGBA_I(((BlockCrystal)block).colors[world.getBlockMetadata(x, y, z)], 100);
- crystal(tessellator, umin, vmin, umax, vmax, 0.8D, 0.2D, 0D, 0D, 0D, 0.0D, 0.0D);
- for(int i = 0; i < crystals; i++){
- double rotation = Math.PI * 2.0f / (float)crystals * (float)i;
- double xp1 = Math.sin(rotation) * ((0.15F + rnd.nextFloat())/2f);
- double zp1 = Math.cos(rotation) * ((0.15F + rnd.nextFloat())/2f);
- double height = 0.2f + rnd.nextFloat();
- double topHeight = 0.1f + rnd.nextFloat() / 2f;
- crystal(tessellator, umin, vmin, umax, vmax, height, topHeight, -xp1, 0D, zp1, xp1, zp1);
- }
- if (world != null){
- crystals = 4;
- for(int i = 0; i < crystals; i++){
- double rotation = Math.PI * 2F / (float)crystals * (float)i;
- double xp1 = Math.sin(rotation) * ((0.15F + rnd.nextFloat())/2f);
- double zp1 = Math.cos(rotation) * ((0.15F + rnd.nextFloat())/2f);
- double height = 0.1f + rnd.nextFloat();
- double topHeight = 0.1f + rnd.nextFloat() / 2f;
- float xOff = (rnd.nextFloat() * 1.5f - 0.5f) * (rnd.nextFloat()/2f);
- float zOff = (rnd.nextFloat() * 1.5f - 0.5f) * (rnd.nextFloat()/2f);
- crystal(tessellator, umin, vmin, umax, vmax, height, topHeight, xOff, 0D, zOff, xp1, zp1);
- }
- }
- tessellator.addTranslation(-x, -y, -z);
- return true;
- }
-
- private void crystal(Tessellator tessellator, double umin, double vmin, double umax, double vmax, double height, double topHeight, double posX, double posY, double posZ, double rotX, double rotZ)
- {
- // Negative X
- tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY, 0.6 - rotZ + posZ, umin, vmin);
- tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umin, vmax);
- tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umax, vmax);
- tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY, 0.4 - rotZ + posZ, umax, vmin);
- // Positive X
- tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY, 0.4 - rotZ + posZ, umin, vmin);
- tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umin, vmax);
- tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umax, vmax);
- tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY, 0.6 - rotZ + posZ, umax, vmin);
- // Negative Z
- tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY, 0.4 - rotZ + posZ, umin, vmin);
- tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umin, vmax);
- tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umax, vmax);
- tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY, 0.4 - rotZ + posZ, umax, vmin);
- // Positive Z
- tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY, 0.6 - rotZ + posZ, umin, vmin);
- tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umin, vmax);
- tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umax, vmax);
- tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY, 0.6 - rotZ + posZ, umax, vmin);
- // Top -X
- tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umin, vmin);
- tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umin, vmax);
- tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umax, vmax);
- tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umax, vmin);
- // Top +X
- tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umin, vmin);
- tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umin, vmax);
- tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umax, vmax);
- tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umax, vmin);
- // Top +Z
- tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umin, vmin);
- tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umin, vmax);
- tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umax, vmax);
- tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umax, vmin);
- // Top -Z
- tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umin, vmin);
- tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umin, vmax);
- tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umax, vmax);
- tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umax, vmin);
- // Bottom
- tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY, 0.6 - rotZ + posZ, umin, vmin);
- tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY, 0.4 - rotZ + posZ, umin, vmax);
- tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY, 0.4 - rotZ + posZ, umax, vmax);
- tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY, 0.6 - rotZ + posZ, umax, vmin);
- }
-
- @Override
- public boolean shouldRender3DInInventory(int modelId)
- {
- return true;
- }
-
- @Override
- public int getRenderId()
- {
- return BlockRenderIDs.CRYSTAL.id();
- }
+@SideOnly(Side.CLIENT)
+public class BlockCrystalRenderer implements ISimpleBlockRenderingHandler {
+ @Override
+ public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
+ Tessellator tessellator = Tessellator.instance;
+ GL11.glPushMatrix();
+ GL11.glDisable(GL11.GL_LIGHTING);
+ tessellator.startDrawingQuads();
+ if (metadata < 16) tessellator.setColorRGBA_I(((BlockCrystal) block).colors[metadata], 100);
+ GL11.glTranslatef(-0.5f, -0.5f, -0.5f);
+ this.renderWorldBlock(null, 0, 0, 0, block, modelID, renderer);
+ tessellator.draw();
+ GL11.glTranslatef(0.5f, 0.5f, 0.5f);
+ GL11.glEnable(GL11.GL_LIGHTING);
+ GL11.glPopMatrix();
+ }
+
+ @Override
+ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
+ int crystals = 5;
+ Random rnd = new Random();
+ Tessellator tessellator = Tessellator.instance;
+ IIcon icon = ((BlockCrystal) block).getIcon(0, 0);
+ double umin = icon.getMinU();
+ double vmin = icon.getMinV();
+ double umax = icon.getMaxU();
+ double vmax = icon.getMaxV();
+ tessellator.addTranslation(x, y, z);
+ if (world != null && world.getTileEntity(x, y, z) != null && ConfigHandler.CRYSTAL_GLOW) tessellator.setBrightness(((TileEntityCrystal) world.getTileEntity(x, y, z)).shine);
+ else tessellator.setBrightness(230);
+ // 37435, 76464
+ if (world != null) rnd.setSeed(2 * x * 3 * y * z * 5);
+ else rnd.setSeed(76464);
+ if (world != null && world.getBlockMetadata(x, y, z) < 16) tessellator.setColorRGBA_I(((BlockCrystal) block).colors[world.getBlockMetadata(x, y, z)], 100);
+ crystal(tessellator, umin, vmin, umax, vmax, 0.8D, 0.2D, 0D, 0D, 0D, 0.0D, 0.0D);
+ for (int i = 0; i < crystals; i++) {
+ double rotation = Math.PI * 2.0f / (float) crystals * (float) i;
+ double xp1 = Math.sin(rotation) * ((0.15F + rnd.nextFloat()) / 2f);
+ double zp1 = Math.cos(rotation) * ((0.15F + rnd.nextFloat()) / 2f);
+ double height = 0.2f + rnd.nextFloat();
+ double topHeight = 0.1f + rnd.nextFloat() / 2f;
+ crystal(tessellator, umin, vmin, umax, vmax, height, topHeight, -xp1, 0D, zp1, xp1, zp1);
+ }
+ if (world != null) {
+ crystals = 4;
+ for (int i = 0; i < crystals; i++) {
+ double rotation = Math.PI * 2F / (float) crystals * (float) i;
+ double xp1 = Math.sin(rotation) * ((0.15F + rnd.nextFloat()) / 2f);
+ double zp1 = Math.cos(rotation) * ((0.15F + rnd.nextFloat()) / 2f);
+ double height = 0.1f + rnd.nextFloat();
+ double topHeight = 0.1f + rnd.nextFloat() / 2f;
+ float xOff = (rnd.nextFloat() * 1.5f - 0.5f) * (rnd.nextFloat() / 2f);
+ float zOff = (rnd.nextFloat() * 1.5f - 0.5f) * (rnd.nextFloat() / 2f);
+ crystal(tessellator, umin, vmin, umax, vmax, height, topHeight, xOff, 0D, zOff, xp1, zp1);
+ }
+ }
+ tessellator.addTranslation(-x, -y, -z);
+ return true;
+ }
+
+ private void crystal(Tessellator tessellator, double umin, double vmin, double umax, double vmax, double height, double topHeight, double posX, double posY, double posZ, double rotX, double rotZ) {
+ // Negative X
+ tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY, 0.6 - rotZ + posZ, umin, vmin);
+ tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umin, vmax);
+ tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umax, vmax);
+ tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY, 0.4 - rotZ + posZ, umax, vmin);
+ // Positive X
+ tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY, 0.4 - rotZ + posZ, umin, vmin);
+ tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umin, vmax);
+ tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umax, vmax);
+ tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY, 0.6 - rotZ + posZ, umax, vmin);
+ // Negative Z
+ tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY, 0.4 - rotZ + posZ, umin, vmin);
+ tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umin, vmax);
+ tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umax, vmax);
+ tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY, 0.4 - rotZ + posZ, umax, vmin);
+ // Positive Z
+ tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY, 0.6 - rotZ + posZ, umin, vmin);
+ tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umin, vmax);
+ tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umax, vmax);
+ tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY, 0.6 - rotZ + posZ, umax, vmin);
+ // Top -X
+ tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umin, vmin);
+ tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umin, vmax);
+ tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umax, vmax);
+ tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umax, vmin);
+ // Top +X
+ tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umin, vmin);
+ tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umin, vmax);
+ tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umax, vmax);
+ tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umax, vmin);
+ // Top +Z
+ tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umin, vmin);
+ tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umin, vmax);
+ tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umax, vmax);
+ tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umax, vmin);
+ // Top -Z
+ tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umin, vmin);
+ tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umin, vmax);
+ tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umax, vmax);
+ tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umax, vmin);
+ // Bottom
+ tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY, 0.6 - rotZ + posZ, umin, vmin);
+ tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY, 0.4 - rotZ + posZ, umin, vmax);
+ tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY, 0.4 - rotZ + posZ, umax, vmax);
+ tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY, 0.6 - rotZ + posZ, umax, vmin);
+ }
+
+ @Override
+ public boolean shouldRender3DInInventory(int modelId) {
+ return true;
+ }
+
+ @Override
+ public int getRenderId() {
+ return BlockRenderIDs.CRYSTAL.id();
+ }
+
}
|
