diff --git a/mods/tinker/common/InventoryBlock.java b/mods/tinker/common/InventoryBlock.java index 94de53d2..a3cc1802 100644 --- a/mods/tinker/common/InventoryBlock.java +++ b/mods/tinker/common/InventoryBlock.java @@ -150,7 +150,6 @@ public abstract class InventoryBlock extends BlockContainer public void registerIcons(IconRegister iconRegister) { String[] textureNames = getTextureNames(); - //System.out.println("TextureNames: :"+this.getClass().getSimpleName()); this.icons = new Icon[textureNames.length]; for (int i = 0; i < this.icons.length; ++i) diff --git a/mods/tinker/golems/blocks/GolemCoreBlock.java b/mods/tinker/golems/blocks/GolemCoreBlock.java new file mode 100644 index 00000000..57e4b922 --- /dev/null +++ b/mods/tinker/golems/blocks/GolemCoreBlock.java @@ -0,0 +1,115 @@ +package mods.tinker.golems.blocks; + +import mods.tinker.common.InventoryBlock; +import mods.tinker.golems.client.GolemCoreRender; +import mods.tinker.golems.logic.GolemCoreLogic; +import mods.tinker.tconstruct.TConstruct; +import mods.tinker.tconstruct.library.TConstructRegistry; +import net.minecraft.block.material.Material; +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.Icon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class GolemCoreBlock extends InventoryBlock +{ + public GolemCoreBlock(int id) + { + super(id, Material.rock); + this.setCreativeTab(TConstructRegistry.blockTab); + } + + public boolean isOpaqueCube() + { + return false; + } + + public boolean renderAsNormalBlock() + { + return false; + } + + public int getRenderType() + { + return GolemCoreRender.model; + } + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) + { + if (!world.isRemote) + { + GolemCoreLogic logic = (GolemCoreLogic)world.getBlockTileEntity(x, y, z); + + if (!logic.isStackInSlot(0)) + { + ItemStack stack = player.getCurrentEquippedItem(); + stack = player.inventory.decrStackSize(player.inventory.currentItem, 1); + logic.setInventorySlotContents(0, stack); + } + else + { + ItemStack stack = logic.decrStackSize(0, 1); + if (stack != null) + addItemToInventory(player, world, x, y, z, stack); + } + + world.markBlockForUpdate(x, y, z); + } + return true; + } + + protected void addItemToInventory (EntityPlayer player, World world, int x, int y, int z, ItemStack stack) + { + if (!world.isRemote) + { + EntityItem entityitem = new EntityItem(world, (double) x + 0.5D, (double) y + 0.9325D, (double) z + 0.5D, stack); + world.spawnEntityInWorld(entityitem); + entityitem.onCollideWithPlayer(player); + } + } + + public int damageDropped(int meta) + { + return meta; + } + + @Override + public Icon getBlockTextureFromSideAndMetadata(int side, int meta) + { + return icons[0]; + } + + @Override + public boolean shouldSideBeRendered (IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + return true; + } + + @Override + public TileEntity createTileEntity (World world, int metadata) + { + return new GolemCoreLogic(); + } + + @Override + public Integer getGui (World world, int x, int y, int z, EntityPlayer entityplayer) + { + return null; //Not sure if gui block or not, probably not + } + + @Override + public Object getModInstance () + { + return TConstruct.instance; + } + + @Override + public String[] getTextureNames () + { + return new String[] { "golemcore" }; + } +} diff --git a/mods/tinker/golems/blocks/GolemHeadBlock.java b/mods/tinker/golems/blocks/GolemHeadBlock.java new file mode 100644 index 00000000..98a1e654 --- /dev/null +++ b/mods/tinker/golems/blocks/GolemHeadBlock.java @@ -0,0 +1,1014 @@ +package mods.tinker.golems.blocks; + +import mods.tinker.golems.logic.GolemCoreLogic; +import mods.tinker.tconstruct.TContent; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.item.ItemStack; +import net.minecraft.util.Icon; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class GolemHeadBlock extends Block +{ + /*public static int headSideTex = ModLoader.addOverride("/terrain.png", "/GGE/golemheadside.png"); + public static int headTopTex = ModLoader.addOverride("/terrain.png", "/GGE/golemheadtop&bottom.png"); + public static int face;*/ + + public GolemHeadBlock(int id) + { + super(id, Material.ground); + //setTickRandomly(true); + } + + public Icon[] icons; + public String[] textureNames = new String[] { "golemhead_face", "golemhead_side", "golemhead_top"}; + + @Override + public void registerIcons(IconRegister iconRegister) + { + this.icons = new Icon[textureNames.length]; + + for (int i = 0; i < this.icons.length; ++i) + { + this.icons[i] = iconRegister.registerIcon("tinker:"+textureNames[i]); + } + } + + @Override + public void onNeighborBlockChange (World world, int x, int y, int z, int blockID) + { + if (buildGolem(world, x, y, z, world.getBlockMetadata(x, y, z))) + { + //mod_Golems.trigger("headachievement"); + } + } + + /*public int getBlockTextureFromSideAndMetadata(int i, int j) + { + if (i == 1) + { + return headTopTex; + } + if (i == 0) + { + return headTopTex; + } + int k = face; + if (j == 2 && i == 2) + { + return k; + } + if (j == 3 && i == 5) + { + return k; + } + if (j == 0 && i == 3) + { + return k; + } + if (j == 1 && i == 4) + { + return k; + } + else + { + return headSideTex; + } + }*/ + + /*public int getBlockTextureFromSide(int i) + { + int j = face; + if (i == 1) + { + return blockIndexInTexture; + } + if (i == 0) + { + return blockIndexInTexture; + } + if (i == 3) + { + return j; + } + else + { + return blockIndexInTexture + 16; + } + }*/ + + @Override + public void onBlockPlacedBy (World world, int i, int j, int k, EntityLiving entityliving, ItemStack par6ItemStack) + { + int l = MathHelper.floor_double((double) ((entityliving.rotationYaw * 4F) / 360F) + 2.5D) & 3; + world.setBlockMetadataWithNotify(i, j, k, l, 3); + if (!buildGolem(world, i, j, k, l)) + { + for (int i1 = 0; (double) i1 < Math.random() * 5D + 3D; i1++) + { + world.spawnParticle("largesmoke", (double) i + Math.random(), (double) j + 1.2D + Math.random() / 2D, (double) k + Math.random(), 0.0D, 0.0D, 0.0D); + } + } + /*else + { + mod_Golems.trigger("headachievement"); + }*/ + } + + private boolean idIsInvalid (int i) + { + return Block.blocksList[i] != null && (!Block.blocksList[i].renderAsNormalBlock() && i != TContent.golemCore.blockID || i == 43 || i == 44 || i == Block.chest.blockID); + } + + private boolean buildGolem (World world, int x, int y, int z, int metadata) + { + /*int pedestalHeight = 0; + for (int yPos = 1; yPos <= 3; yPos++) + { + if (world.getBlockId(x, y - yPos, z) == TContent.golemPedestal.blockID) + { + pedestalHeight = yPos; + } + } + + if (pedestalHeight == 0) + { + return false; + } + for (int height = pedestalHeight; height >= 0; height--) + { + if (world.getBlockId(x, y - height, z) == 0) + { + return false; + } + } + + int l1 = 0; + int i2 = 0; + ItemStack itemstack = null; + GolemCoreLogic coreLogic = null; + int golemBlockIDs[][] = new int[3][3]; + int golemBlockMetas[][] = new int[3][3]; + for (int arrX = 0; arrX < 3; arrX++) + { + for (int arrY = 0; arrY < 3; arrY++) + { + golemBlockIDs[arrX][arrY] = 0; + } + } + + for (int iterX = -1; iterX <= 1; iterX++) + { + for (int iterY = 0; iterY < 3; iterY++) + { + if (iterY + (3 - pedestalHeight) >= 3 || iterY + (3 - pedestalHeight) == 0 && iterX != 0) + { + continue; + } + if (metadata == 0) + { + int bID = world.getBlockId(x - iterX, y - iterY, z); + if (idIsInvalid(bID)) + { + bID = 0; + return false; + } + if (bID == blockID) + { + i2++; + } + golemBlockIDs[iterX + 1][iterY + (3 - pedestalHeight)] = bID; + golemBlockMetas[iterX + 1][iterY + (3 - pedestalHeight)] = bID == blockID ? 0 : world.getBlockMetadata(x - iterX, y - iterY, z); + } + if (metadata == 1) + { + int l3 = world.getBlockId(x, y - iterY, z - iterX); + if (idIsInvalid(l3)) + { + l3 = 0; + return false; + } + if (l3 == blockID) + { + i2++; + } + golemBlockIDs[iterX + 1][iterY + (3 - pedestalHeight)] = l3; + golemBlockMetas[iterX + 1][iterY + (3 - pedestalHeight)] = l3 == blockID ? 0 : world.getBlockMetadata(x, y - iterY, z - iterX); + } + if (metadata == 2) + { + int i4 = world.getBlockId(x + iterX, y - iterY, z); + if (idIsInvalid(i4)) + { + i4 = 0; + return false; + } + if (i4 == blockID) + { + i2++; + } + golemBlockIDs[iterX + 1][iterY + (3 - pedestalHeight)] = i4; + golemBlockMetas[iterX + 1][iterY + (3 - pedestalHeight)] = i4 == blockID ? 0 : world.getBlockMetadata(x + iterX, y - iterY, z); + } + if (metadata == 3) + { + int bID = world.getBlockId(x, y - iterY, z + iterX); + if (idIsInvalid(bID)) + { + bID = 0; + return false; + } + if (bID == blockID) + { + i2++; + } + golemBlockIDs[iterX + 1][iterY + (3 - pedestalHeight)] = bID; + golemBlockMetas[iterX + 1][iterY + (3 - pedestalHeight)] = bID == blockID ? 0 : world.getBlockMetadata(x, y - iterY, z + iterX); + } + if (i2 > 1) + { + return false; + } + if (golemBlockIDs[iterX + 1][iterY + (3 - pedestalHeight)] != 0 && Block.blocksList[golemBlockIDs[iterX + 1][iterY]] != null + && !Block.blocksList[golemBlockIDs[iterX + 1][iterY]].renderAsNormalBlock() && (iterX + 1 == 0 || iterX + 1 == 2) && iterY == 2 + && golemBlockIDs[iterX + 1][iterY] != TContent.golemCore.blockID) + { + return false; + } + if (golemBlockIDs[iterX + 1][iterY + (3 - pedestalHeight)] == TContent.golemCore.blockID) + { + l1++; + if (metadata == 0) + { + coreLogic = (GolemCoreLogic) world.getBlockTileEntity(x - iterX, y - iterY, z); + } + if (metadata == 1) + { + coreLogic = (GolemCoreLogic) world.getBlockTileEntity(x, y - iterY, z - iterX); + } + if (metadata == 2) + { + coreLogic = (GolemCoreLogic) world.getBlockTileEntity(x + iterX, y - iterY, z); + } + if (metadata == 3) + { + coreLogic = (GolemCoreLogic) world.getBlockTileEntity(x, y - iterY, z + iterX); + } + itemstack = coreLogic.getKey(); + } + if (l1 > 1) + { + return false; + } + } + } + + boolean flag = false; + for (int j3 = 0; j3 < 3; j3++) + { + for (int k4 = 0; k4 < 3; k4++) + { + if (golemBlockIDs[k4][j3] == this.blockID) + { + flag = true; + } + } + } + + if (!flag) + { + return false; + } + if (golemBlockIDs[0][2] != 0 && Block.blocksList[golemBlockIDs[0][2]].renderAsNormalBlock() || golemBlockIDs[2][2] != 0 && Block.blocksList[golemBlockIDs[2][2]].renderAsNormalBlock()) + { + return false; + } + if (l1 > 0 + && (golemBlockIDs[0][0] == TContent.golemCore.blockID || golemBlockIDs[0][1] == TContent.golemCore.blockID || golemBlockIDs[2][0] == TContent.golemCore.blockID || golemBlockIDs[2][1] == TContent.golemCore.blockID)) + { + return false; + } + TileEntity tileentity = world.getBlockTileEntity(x, y - pedestalHeight, z); + if (!(tileentity instanceof TileEntityGolemPedestal)) + { + return false; + } + TileEntityGolemPedestal tileentitygolempedestal = (TileEntityGolemPedestal) tileentity; + if (tileentitygolempedestal.subtractSoul(l1 == 1 ? 8 : 1) && world.getBlockId(x, y - pedestalHeight, z) == TContent.golemPedestal.blockID) + { + EntityGenericGolem entitygenericgolem = new EntityGenericGolem(world); + EntityPlayerSP entityplayersp = ModLoader.getMinecraftInstance().thePlayer; + double d = ((EntityPlayer) (entityplayersp)).posX - (double) (float) ((double) x + 0.5D); + double d1 = ((EntityPlayer) (entityplayersp)).posZ - (double) (float) ((double) z + 0.5D); + entitygenericgolem.setBody(golemBlockIDs, golemBlockMetas, y, pedestalHeight); + entitygenericgolem.setPositionAndRotation((double) x + 0.5D, (y - pedestalHeight) + 1, (double) z + 0.5D, (float) ((Math.atan2(d1, d) * 180D) / 3.1415927410125732D) - 90F, 0.0F); + if (l1 > 0) + { + entitygenericgolem.setCore(itemstack); + } + if (coreLogic != null) + { + //((GolemCoreBlock) mod_Golems.golemCore).killDisplayItem(world, coreLogic.xCoord, coreLogic.yCoord, coreLogic.zCoord); + //coreLogic.key = null; + } + if (!buildInterrupt(world, x, y, z, metadata, golemBlockIDs, golemBlockMetas, pedestalHeight, coreLogic != null, itemstack, coreLogic) && world.spawnEntityInWorld(entitygenericgolem)) + { + delBlocks(world, x, y, z, metadata, golemBlockIDs, pedestalHeight); + world.spawnParticle("hugeexplosion", (double) x + Math.random(), (double) y + 1.2D, (double) z + Math.random(), 0.0D, 0.0D, 0.0D); + return true; + } + else + { + return false; + } + } + else + { + return false; + }*/ + return false; + } + + public boolean buildInterrupt (World world, int i, int j, int k, int l, int ai[][], int ai1[][], int i1, boolean flag, ItemStack itemstack, GolemCoreLogic tileentitygolemcore) + { + /*EntityPlayerSP entityplayersp = ModLoader.getMinecraftInstance().thePlayer; + double d = ((EntityPlayer) (entityplayersp)).posX - (double) (float) ((double) i + 0.5D); + double d1 = ((EntityPlayer) (entityplayersp)).posZ - (double) (float) ((double) k + 0.5D); + int j1 = world.difficultySetting; + int k1 = 0; + for (int l1 = 0; l1 < 3; l1++) + { + for (int i2 = 0; i2 < 3; i2++) + { + if (ai[l1][i2] != 0) + { + k1++; + } + } + } + + boolean flag1 = ai[0][1] != 0 || ai[2][1] != 0; + if (isAll(ai, ai1, Block.tnt.blockID, -1) || i1 == 3 && ai[1][1] == Block.tnt.blockID && ai[1][2] == Block.cloth.blockID && ai1[1][2] == 5 && !flag1 && j1 >= 1) + { + EntityCreeper entitycreeper = new EntityCreeper(world); + entitycreeper.setPositionAndRotation((double) i + 0.5D, (j - i1) + 1, (double) k + 0.5D, (float) ((Math.atan2(d1, d) * 180D) / 3.1415927410125732D) - 90F, 0.0F); + world.spawnEntityInWorld(entitycreeper); + delBlocks(world, i, j, k, l, ai, i1); + world.spawnParticle("hugeexplosion", (double) i + Math.random(), (double) j + 1.2D, (double) k + Math.random(), 0.0D, 0.0D, 0.0D); + mod_Golems.trigger("creeper"); + return true; + } + if (isAll(ai, ai1, Block.netherrack.blockID, -1) && i1 == 3 && j1 >= 1) + { + EntityBlaze entityblaze = new EntityBlaze(world); + entityblaze.setPositionAndRotation((double) i + 0.5D, (j - i1) + 1, (double) k + 0.5D, (float) ((Math.atan2(d1, d) * 180D) / 3.1415927410125732D) - 90F, 0.0F); + world.spawnEntityInWorld(entityblaze); + delBlocks(world, i, j, k, l, ai, i1); + world.spawnParticle("hugeexplosion", (double) i + Math.random(), (double) j + 1.2D, (double) k + Math.random(), 0.0D, 0.0D, 0.0D); + mod_Golems.trigger("blaze"); + return true; + } + if (isAll(ai, ai1, Block.obsidian.blockID, -1) && i1 == 3 && countBlock(ai, ai1, Block.obsidian.blockID, -1) == 2 && j1 >= 1) + { + EntityEnderman entityenderman = new EntityEnderman(world); + entityenderman.setPositionAndRotation((double) i + 0.5D, (j - i1) + 1, (double) k + 0.5D, (float) ((Math.atan2(d1, d) * 180D) / 3.1415927410125732D) - 90F, 0.0F); + world.spawnEntityInWorld(entityenderman); + delBlocks(world, i, j, k, l, ai, i1); + world.spawnParticle("hugeexplosion", (double) i + Math.random(), (double) j + 1.2D, (double) k + Math.random(), 0.0D, 0.0D, 0.0D); + mod_Golems.trigger("enderman"); + return true; + } + if (hasBlock(ai, ai1, Block.tnt.blockID, -1) && hasBlock(ai, ai1, Block.netherrack.blockID, -1)) + { + boolean flag2 = false; + Entity aentity[][] = new Entity[3][3]; + for (int j2 = 0; j2 < 3; j2++) + { + for (int l2 = 0; l2 < 3; l2++) + { + aentity[j2][l2] = null; + if (ai[j2][l2] == Block.tnt.blockID) + { + EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world); + entitytntprimed.fuse = 80; + aentity[j2][l2] = entitytntprimed; + } + } + } + + replEntity(world, i, j, k, l, ai, aentity, i1); + i1 = updateBody(ai, ai1); + EntityGenericGolem entitygenericgolem = new EntityGenericGolem(world); + entitygenericgolem.setBody(ai, ai1, l, i1); + entitygenericgolem.setPositionAndRotation((double) i + 0.5D, (j - i1) + 1, (double) k + 0.5D, (float) ((Math.atan2(d1, d) * 180D) / 3.1415927410125732D) - 90F, 0.0F); + if (flag) + { + entitygenericgolem.setCore(itemstack); + } + world.spawnEntityInWorld(entitygenericgolem); + world.spawnParticle("hugeexplosion", (double) i + Math.random(), (double) j + 1.2D, (double) k + Math.random(), 0.0D, 0.0D, 0.0D); + mod_Golems.trigger("boom"); + return true; + } + if (i1 == 3 && !flag1 && ai[1][2] == Block.blockSteel.blockID && ai[1][1] == Block.blockSteel.blockID) + { + List list = world.getEntitiesWithinAABB(EntityLiving.class, AxisAlignedBB.getAABBPool().getAABB(i, j, k, (double) i + 1.0D, (double) j + 1.0D, (double) k + 1.0D).expand(4D, 16D, 4D)); + Entity entity; + for (Iterator iterator = list.iterator(); iterator.hasNext(); world.addWeatherEffect(new EntityLightningBolt(world, entity.posX, entity.posY, entity.posZ))) + { + Object obj = iterator.next(); + entity = (Entity) obj; + } + + mod_Golems.trigger("zap"); + } + else + { + if (isAll(ai, ai1, Block.cloth.blockID, 0) && countBlock(ai, ai1, Block.cloth.blockID, 0) == 4) + { + EntitySheep entitysheep = new EntitySheep(world); + entitysheep.setPositionAndRotation((double) i + 0.5D, (j - i1) + 1, (double) k + 0.5D, (float) ((Math.atan2(d1, d) * 180D) / 3.1415927410125732D) - 90F, 0.0F); + world.spawnEntityInWorld(entitysheep); + delBlocks(world, i, j, k, l, ai, i1); + world.spawnParticle("hugeexplosion", (double) i + Math.random(), (double) j + 1.2D, (double) k + Math.random(), 0.0D, 0.0D, 0.0D); + mod_Golems.trigger("sheep"); + return true; + } + if (countBlock(ai, ai1, Block.furnaceIdle.blockID, -1) >= (int) (Math.random() * 2D + 2D)) + { + ItemStack aitemstack[][] = new ItemStack[3][3]; + aitemstack[0][1] = new ItemStack(Block.lavaMoving, 1); + aitemstack[2][1] = new ItemStack(Block.lavaMoving, 1); + aitemstack[1][0] = new ItemStack(Block.lavaMoving, 1); + aitemstack[1][1] = new ItemStack(Block.lavaMoving, 1); + aitemstack[1][2] = new ItemStack(Block.lavaMoving, 1); + replBlocks(world, i, j, k, l, ai, aitemstack, i1); + mod_Golems.trigger("meltdown"); + return true; + } + if (hasBlock(ai, ai1, Block.stoneBrick.blockID, -1) && Math.random() <= 0.40000000000000002D) + { + boolean flag3 = false; + Entity aentity1[][] = new Entity[3][3]; + for (int k2 = 0; k2 < 3; k2++) + { + for (int i3 = 0; i3 < 3; i3++) + { + aentity1[k2][i3] = null; + if (ai[k2][i3] == Block.stoneBrick.blockID) + { + aentity1[k2][i3] = Math.random() <= 0.59999999999999998D ? ((Entity) (new EntitySilverfish(world))) : null; + } + } + } + + replEntity(world, i, j, k, l, ai, aentity1, i1); + i1 = updateBody(ai, ai1); + EntityGenericGolem entitygenericgolem1 = new EntityGenericGolem(world); + entitygenericgolem1.setBody(ai, ai1, l, i1); + entitygenericgolem1.setPositionAndRotation((double) i + 0.5D, (j - i1) + 1, (double) k + 0.5D, (float) ((Math.atan2(d1, d) * 180D) / 3.1415927410125732D) - 90F, 0.0F); + if (flag) + { + entitygenericgolem1.setCore(itemstack); + } + world.spawnEntityInWorld(entitygenericgolem1); + world.spawnParticle("hugeexplosion", (double) i + Math.random(), (double) j + 1.2D, (double) k + Math.random(), 0.0D, 0.0D, 0.0D); + mod_Golems.trigger("silverfish"); + return true; + } + if (countBlock(ai, ai1, Block.melon.blockID, -1) == 4) + { + delBlocks(world, i, j, k, l, ai, i1); + EntityGSpawn entitygspawn = new EntityGSpawn(world); + entitygspawn.setPosition(i, j, k); + entitygspawn.skin = "http://s3.amazonaws.com/MinecraftSkins/loligator704.png"; + world.spawnEntityInWorld(entitygspawn); + mod_Golems.trigger("loligator"); + world.spawnParticle("hugeexplosion", (double) i + Math.random(), (double) j + 1.2D, (double) k + Math.random(), 0.0D, 0.0D, 0.0D); + return true; + } + if (countBlock(ai, ai1, Block.cloth.blockID, 13) == 3 && ai[1][1] == Block.cloth.blockID && ai1[1][1] == 0) + { + delBlocks(world, i, j, k, l, ai, i1); + EntityGSpawn entitygspawn1 = new EntityGSpawn(world); + entitygspawn1.setPosition(i, j, k); + entitygspawn1.skin = "http://s3.amazonaws.com/MinecraftSkins/coalheartly.png"; + world.spawnEntityInWorld(entitygspawn1); + mod_Golems.trigger("bitterman"); + world.spawnParticle("hugeexplosion", (double) i + Math.random(), (double) j + 1.2D, (double) k + Math.random(), 0.0D, 0.0D, 0.0D); + return true; + } + if (countBlock(ai, ai1, Block.cloth.blockID, 11) == 3 && ai[1][1] == Block.blockLapis.blockID) + { + delBlocks(world, i, j, k, l, ai, i1); + EntityGSpawn entitygspawn2 = new EntityGSpawn(world); + entitygspawn2.setPosition(i, j, k); + entitygspawn2.skin = "http://s3.amazonaws.com/MinecraftSkins/BILLYTG101.png"; + world.spawnEntityInWorld(entitygspawn2); + mod_Golems.trigger("yourstruly"); + return true; + } + if (countBlock(ai, ai1, Block.cloth.blockID, 12) == 2 && ai[1][1] == Block.blockGold.blockID && ai[1][2] == Block.cloth.blockID && ai1[1][2] == 0) + { + delBlocks(world, i, j, k, l, ai, i1); + EntityGSpawn entitygspawn3 = new EntityGSpawn(world); + entitygspawn3.setPosition(i, j, k); + entitygspawn3.skin = "http://s3.amazonaws.com/MinecraftSkins/Notch.png"; + world.spawnEntityInWorld(entitygspawn3); + mod_Golems.trigger("king"); + world.spawnParticle("hugeexplosion", (double) i + Math.random(), (double) j + 1.2D, (double) k + Math.random(), 0.0D, 0.0D, 0.0D); + return true; + } + + if (isAll(ai, ai1, Block.blockClay.blockID, -1) && i1 == 3 && countBlock(ai, ai1, Block.blockClay.blockID, -1) == 2 && j1 >= 1) + { + EntityZombie entityzombie = new EntityZombie(world); + entityzombie.setPositionAndRotation((double) i + 0.5D, (j - i1) + 1, (double) k + 0.5D, (float) ((Math.atan2(d1, d) * 180D) / 3.1415927410125732D) - 90F, 0.0F); + world.spawnEntityInWorld(entityzombie); + delBlocks(world, i, j, k, l, ai, i1); + world.spawnParticle("hugeexplosion", (double) i + Math.random(), (double) j + 1.2D, (double) k + Math.random(), 0.0D, 0.0D, 0.0D); + mod_Golems.trigger("zombie"); + return true; + } + }*/ + return false; + } + + private void delBlocks (World world, int i, int j, int k, int l, int ai[][], int i1) + { + for (int j1 = -1; j1 <= 1; j1++) + { + for (int k1 = 0; k1 < i1; k1++) + { + if (k1 == 0 && j1 != 0 || ai[j1 + 1][(k1 - i1) + 3] == 0) + { + continue; + } + if (l == 0) + { + world.setBlock(i - j1, j - k1, k, 0); + } + if (l == 1) + { + world.setBlock(i, j - k1, k - j1, 0); + } + if (l == 2) + { + world.setBlock(i + j1, j - k1, k, 0); + } + if (l == 3) + { + world.setBlock(i, j - k1, k + j1, 0); + } + } + } + + if (i1 == 2 && (ai[0][1] != 0 || ai[2][1] != 0)) + { + if (l == 0) + { + if (ai[0][1] != 0) + { + world.setBlock(i + 1, j, k, 0); + } + if (ai[2][1] != 0) + { + world.setBlock(i - 1, j, k, 0); + } + } + if (l == 1) + { + if (ai[0][1] != 0) + { + world.setBlock(i, j, k + 1, 0); + } + if (ai[2][1] != 0) + { + world.setBlock(i, j, k - 1, 0); + } + } + if (l == 2) + { + if (ai[0][1] != 0) + { + world.setBlock(i - 1, j, k, 0); + } + if (ai[2][1] != 0) + { + world.setBlock(i + 1, j, k, 0); + } + } + if (l == 3) + { + if (ai[0][1] != 0) + { + world.setBlock(i, j, k - 1, 0); + } + if (ai[2][1] != 0) + { + world.setBlock(i, j, k + 1, 0); + } + } + } + } + + private boolean hasBlock (int ai[][], int ai1[][], int i, int j) + { + for (int k = 0; k < 3; k++) + { + for (int l = 0; l < 3; l++) + { + if (ai[k][l] == i && (ai1[k][l] == j || j == -1)) + { + return true; + } + } + } + + return false; + } + + private void replBlocks (World world, int i, int j, int k, int l, int ai[][], ItemStack aitemstack[][], int i1) + { + for (int j1 = -1; j1 <= 1; j1++) + { + for (int k1 = 0; k1 < i1; k1++) + { + if (aitemstack[j1 + 1][(k1 - i1) + 3] == null) + { + aitemstack[j1 + 1][(k1 - i1) + 3] = new ItemStack(0, 0, 0); + } + if (k1 == 0 && j1 != 0 || ai[j1 + 1][(k1 - i1) + 3] == 0) + { + continue; + } + if (l == 0) + { + world.setBlock(i - j1, j - k1, k, aitemstack[j1 + 1][(k1 - i1) + 3].itemID, aitemstack[j1 + 1][(k1 - i1) + 3].getItemDamage(), 3); + } + if (l == 1) + { + world.setBlock(i, j - k1, k - j1, aitemstack[j1 + 1][(k1 - i1) + 3].itemID, aitemstack[j1 + 1][(k1 - i1) + 3].getItemDamage(), 3); + } + if (l == 2) + { + world.setBlock(i + j1, j - k1, k, aitemstack[j1 + 1][(k1 - i1) + 3].itemID, aitemstack[j1 + 1][(k1 - i1) + 3].getItemDamage(), 3); + } + if (l == 3) + { + world.setBlock(i, j - k1, k + j1, aitemstack[j1 + 1][(k1 - i1) + 3].itemID, aitemstack[j1 + 1][(k1 - i1) + 3].getItemDamage(), 3); + } + } + } + + if (i1 == 2 && (ai[0][1] != 0 || ai[2][1] != 0)) + { + if (l == 0) + { + if (ai[0][1] != 0) + { + world.setBlock(i + 1, j, k, aitemstack[0][1].itemID, aitemstack[0][1].getItemDamage(), 3); + } + if (ai[2][1] != 0) + { + world.setBlock(i - 1, j, k, aitemstack[2][1].itemID, aitemstack[2][1].getItemDamage(), 3); + } + } + if (l == 1) + { + if (ai[0][1] != 0) + { + world.setBlock(i, j, k + 1, aitemstack[0][1].itemID, aitemstack[0][1].getItemDamage(), 3); + } + if (ai[2][1] != 0) + { + world.setBlock(i, j, k - 1, aitemstack[2][1].itemID, aitemstack[2][1].getItemDamage(), 3); + } + } + if (l == 2) + { + if (ai[0][1] != 0) + { + world.setBlock(i - 1, j, k, aitemstack[0][1].itemID, aitemstack[0][1].getItemDamage(), 3); + } + if (ai[2][1] != 0) + { + world.setBlock(i + 1, j, k, aitemstack[2][1].itemID, aitemstack[2][1].getItemDamage(), 3); + } + } + if (l == 3) + { + if (ai[0][1] != 0) + { + world.setBlock(i, j, k - 1, aitemstack[0][1].itemID, aitemstack[0][1].getItemDamage(), 3); + } + if (ai[2][1] != 0) + { + world.setBlock(i, j, k + 1, aitemstack[2][1].itemID, aitemstack[2][1].getItemDamage(), 3); + } + } + } + } + + private void replEntity (World world, int i, int j, int k, int l, int ai[][], Entity aentity[][], int i1) + { + for (int j1 = -1; j1 <= 1; j1++) + { + for (int k1 = 0; k1 < i1; k1++) + { + if (k1 == 0 && j1 != 0) + { + continue; + } + Entity entity8 = aentity[j1 + 1][(k1 - i1) + 3]; + if (ai[j1 + 1][(k1 - i1) + 3] == 0) + { + if (entity8 != null) + { + entity8.setDead(); + } + continue; + } + if (l == 0) + { + world.setBlock(i - j1, j - k1, k, 0); + if (entity8 != null) + { + entity8.setPosition(((float) i - (float) j1) + 0.5F, ((float) j - (float) k1) + 0.5F, (float) k + 0.5F); + world.spawnEntityInWorld(entity8); + ai[j1 + 1][(k1 - i1) + 3] = 0; + } + } + if (l == 1) + { + world.setBlock(i, j - k1, k - j1, 0); + if (entity8 != null) + { + entity8.setPosition(((float) i - (float) j1) + 0.5F, ((float) j - (float) k1) + 0.5F, (float) k + 0.5F); + world.spawnEntityInWorld(entity8); + ai[j1 + 1][(k1 - i1) + 3] = 0; + } + } + if (l == 2) + { + world.setBlock(i + j1, j - k1, k, 0); + if (entity8 != null) + { + entity8.setPosition(((float) i - (float) j1) + 0.5F, ((float) j - (float) k1) + 0.5F, (float) k + 0.5F); + world.spawnEntityInWorld(entity8); + ai[j1 + 1][(k1 - i1) + 3] = 0; + } + } + if (l != 3) + { + continue; + } + world.setBlock(i, j - k1, k + j1, 0); + if (entity8 != null) + { + entity8.setPosition(((float) i - (float) j1) + 0.5F, ((float) j - (float) k1) + 0.5F, (float) k + 0.5F); + world.spawnEntityInWorld(entity8); + ai[j1 + 1][(k1 - i1) + 3] = 0; + } + } + } + + if (i1 == 2 && (ai[0][1] != 0 || ai[2][1] != 0)) + { + Object obj = null; + if (l == 0) + { + if (ai[0][1] != 0) + { + world.setBlock(i + 1, j, k, 0); + Entity entity; + if ((entity = aentity[0][1]) != null) + { + entity.setPosition((float) i + 1.0F + 0.5F, (float) j + 0.5F, (float) k + 0.5F); + world.spawnEntityInWorld(aentity[0][1]); + ai[2][1] = 0; + } + } + else if (aentity[0][1] != null) + { + aentity[0][1].setDead(); + } + if (ai[2][1] != 0) + { + world.setBlock(i - 1, j, k, 0); + Entity entity1; + if ((entity1 = aentity[2][1]) != null) + { + entity1.setPosition(((float) i - 1.0F) + 0.5F, (float) j + 0.5F, (float) k + 0.5F); + world.spawnEntityInWorld(aentity[2][1]); + ai[2][1] = 0; + } + } + else if (aentity[2][1] != null) + { + aentity[2][1].setDead(); + } + } + if (l == 1) + { + if (ai[0][1] != 0) + { + world.setBlock(i, j, k + 1, 0); + Entity entity2; + if ((entity2 = aentity[0][1]) != null) + { + entity2.setPosition((float) i + 0.5F, (float) j + 0.5F, (float) k + 1.0F + 0.5F); + world.spawnEntityInWorld(aentity[0][1]); + ai[2][1] = 0; + } + } + else if (aentity[0][1] != null) + { + aentity[0][1].setDead(); + } + if (ai[2][1] != 0) + { + world.setBlock(i, j, k - 1, 0); + Entity entity3; + if ((entity3 = aentity[2][1]) != null) + { + entity3.setPosition((float) i + 0.5F, (float) j + 0.5F, ((float) k - 1.0F) + 0.5F); + world.spawnEntityInWorld(aentity[2][1]); + ai[2][1] = 0; + } + } + else if (aentity[2][1] != null) + { + aentity[2][1].setDead(); + } + } + if (l == 2) + { + if (ai[0][1] != 0) + { + world.setBlock(i - 1, j, k, 0); + Entity entity4; + if ((entity4 = aentity[0][1]) != null) + { + entity4.setPosition(((float) i - 1.0F) + 0.5F, (float) j + 0.5F, (float) k + 0.5F); + world.spawnEntityInWorld(aentity[0][1]); + ai[2][1] = 0; + } + } + else if (aentity[0][1] != null) + { + aentity[0][1].setDead(); + } + if (ai[2][1] != 0) + { + world.setBlock(i + 1, j, k, 0); + Entity entity5; + if ((entity5 = aentity[2][1]) != null) + { + entity5.setPosition((float) i + 1.0F + 0.5F, (float) j + 0.5F, (float) k + 0.5F); + world.spawnEntityInWorld(aentity[2][1]); + ai[2][1] = 0; + } + } + else if (aentity[2][1] != null) + { + aentity[2][1].setDead(); + } + } + if (l == 3) + { + if (ai[0][1] != 0) + { + world.setBlock(i, j, k - 1, 0); + Entity entity6; + if ((entity6 = aentity[0][1]) != null) + { + entity6.setPosition((float) i + 0.5F, (float) j + 0.5F, (float) k + 1.0F + 0.5F); + world.spawnEntityInWorld(aentity[0][1]); + } + } + else if (aentity[0][1] != null) + { + aentity[0][1].setDead(); + } + if (ai[2][1] != 0) + { + world.setBlock(i, j, k + 1, 0); + Entity entity7; + if ((entity7 = aentity[2][1]) != null) + { + entity7.setPosition((float) i + 0.5F, (float) j + 0.5F, (float) k + 1.0F + 0.5F); + world.spawnEntityInWorld(aentity[2][1]); + } + } + else if (aentity[2][1] != null) + { + aentity[2][1].setDead(); + } + } + } + } + + private int updateBody (int ai[][], int ai1[][]) + { + for (int i = 0; ai[1][2] == 0 && i < 3;) + { + i++; + for (int i1 = 0; i1 < 3; i1++) + { + int j2 = ai[i1][0]; + int l2 = ai[i1][1]; + ai[i1][0] = ai[i1][2]; + ai[i1][1] = j2; + ai[i1][2] = l2; + } + + int j1 = 0; + while (j1 < 3) + { + int k2 = ai1[j1][0]; + int i3 = ai1[j1][1]; + ai1[j1][0] = ai1[j1][2]; + ai1[j1][1] = k2; + ai1[j1][2] = i3; + j1++; + } + } + + if (ai[1][1] == 0) + { + for (int j = 0; j < 3; j++) + { + int k1 = ai[j][0]; + ai[j][0] = ai[j][1]; + ai[j][1] = k1; + } + + for (int k = 0; k < 3; k++) + { + int l1 = ai1[k][0]; + ai1[k][0] = ai1[k][1]; + ai1[k][1] = l1; + } + } + int l = 0; + for (int i2 = 0; i2 < 3; i2++) + { + if (ai[1][i2] != 0) + { + l = 3 - i2; + } + } + + if (l == 1) + { + ai[0][1] = 0; + ai[2][1] = 0; + ai1[0][1] = 0; + ai1[2][1] = 0; + } + return 0; + } + + private boolean isAll (int ai[][], int ai1[][], int i, int j) + { + boolean flag = false; + for (int k = 0; k < 3; k++) + { + for (int l = 0; l < 3; l++) + { + if (ai[k][l] != i && ai[k][l] != 0 && ai[k][l] != this.blockID && (ai1[k][l] != j || j == -1)) + { + return false; + } + if (ai[k][l] == i && (ai1[k][l] == j || j == -1)) + { + flag = true; + } + } + } + + return flag; + } + + private int countBlock (int ai[][], int ai1[][], int i, int j) + { + int k = 0; + for (int l = 0; l < 3; l++) + { + for (int i1 = 0; i1 < 3; i1++) + { + if (ai[l][i1] == i && (ai1[l][i1] == j || j == -1)) + { + k++; + } + } + } + + return k; + } +} diff --git a/mods/tinker/golems/blocks/GolemPedestalBlock.java b/mods/tinker/golems/blocks/GolemPedestalBlock.java new file mode 100644 index 00000000..1bdc5fe7 --- /dev/null +++ b/mods/tinker/golems/blocks/GolemPedestalBlock.java @@ -0,0 +1,147 @@ +package mods.tinker.golems.blocks; + +import java.util.Random; + +import mods.tinker.common.InventoryBlock; +import mods.tinker.golems.logic.GolemPedestalLogic; +import net.minecraft.block.material.Material; +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.world.World; + +public class GolemPedestalBlock extends InventoryBlock +{ + /*public static int texTop; + public static int texTopp; + public static int texSide; + public static int texBottom;*/ + + public GolemPedestalBlock(int i) + { + super(i, Material.wood); + /*texTop = ModLoader.addOverride("/terrain.png", "/GGE/pedestaltop.png"); + texTopp = ModLoader.addOverride("/terrain.png", "/GGE/pedestaltopp.png"); + texSide = ModLoader.addOverride("/terrain.png", "/GGE/pedestalside.png"); + texBottom = ModLoader.addOverride("/terrain.png", "/GGE/pedestalbottom.png");*/ + } + + /*public int getBlockTextureFromSideAndMetadata(int i, int j) + { + if (i == 1) + { + return j == 0 ? texTop : texTopp; + } + if (i == 0) + { + return texBottom; + } + if (i == 2 || i == 4) + { + return texSide; + } + else + { + return texSide; + } + }*/ + + /*public int idDropped(int i, Random random, int j) + { + return super.idDropped(i, random, j); + }*/ + + /*public void onBlockPlacedBy(World world, int i, int j, int k, EntityLiving entityliving) + { + super.onBlockPlacedBy(world, i, j, k, entityliving); + ItemStack itemstack = ((EntityPlayer)entityliving).getCurrentEquippedItem(); + world.setBlockMetadata(i, j, k, itemstack.getItemDamage()); + }*/ + + public void onBlockRemoval(World world, int i, int j, int k) + { + Random random = new Random(); + GolemPedestalLogic tileentitygolempedestal = (GolemPedestalLogic)world.getBlockTileEntity(i, j, k); + if (tileentitygolempedestal != null) + { + label0: + for (int l = 0; l < tileentitygolempedestal.getSizeInventory(); l++) + { + ItemStack itemstack = tileentitygolempedestal.getStackInSlot(l); + if (itemstack == null) + { + continue; + } + float f = random.nextFloat() * 0.8F + 0.1F; + float f1 = random.nextFloat() * 0.8F + 0.1F; + float f2 = random.nextFloat() * 0.8F + 0.1F; + do + { + if (itemstack.stackSize <= 0) + { + continue label0; + } + int i1 = random.nextInt(21) + 10; + if (i1 > itemstack.stackSize) + { + i1 = itemstack.stackSize; + } + itemstack.stackSize -= i1; + EntityItem entityitem = new EntityItem(world, (float)i + f, (float)j + f1, (float)k + f2, new ItemStack(itemstack.itemID, i1, itemstack.getItemDamage())); + float f3 = 0.05F; + entityitem.motionX = (float)random.nextGaussian() * f3; + entityitem.motionY = (float)random.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float)random.nextGaussian() * f3; + world.spawnEntityInWorld(entityitem); + } + while (true); + } + } + //super.onBlockRemoval(world, i, j, k); + } + + public boolean blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer) + { + /*ItemStack itemstack = entityplayer.getCurrentEquippedItem(); + if (world.isRemote) + { + return true; + } + if (itemstack == null || itemstack != null && (itemstack.itemID >= 256 || itemstack.itemID == 0 || itemstack.itemID == Block.slowSand.blockID)) + { + ModLoader.openGUI(entityplayer, new GuiGolemPedestal(entityplayer.inventory, world, i, j, k)); + return true; + } + else + { + return false; + }*/ + return false; + } + + @Override + public TileEntity createTileEntity (World world, int metadata) + { + return new GolemPedestalLogic(); + } + + @Override + public Integer getGui (World world, int x, int y, int z, EntityPlayer entityplayer) + { + // TODO Auto-generated method stub + return null; + } + + @Override + public Object getModInstance () + { + return null; + } + + @Override + public String[] getTextureNames () + { + return null; + } +} diff --git a/mods/tinker/golems/client/GolemCoreRender.java b/mods/tinker/golems/client/GolemCoreRender.java new file mode 100644 index 00000000..f1b76bbb --- /dev/null +++ b/mods/tinker/golems/client/GolemCoreRender.java @@ -0,0 +1,117 @@ +package mods.tinker.golems.client; + +import org.lwjgl.opengl.GL11; + +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.src.ModLoader; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; +import cpw.mods.fml.client.registry.RenderingRegistry; + +public class GolemCoreRender implements ISimpleBlockRenderingHandler +{ + public static int model = RenderingRegistry.getNextAvailableRenderId(); + + @Override + public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer) + { + /*Tessellator tessellator = Tessellator.instance; + double d = 0.1875D; + World world = ModLoader.getMinecraftInstance().theWorld; + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, -1F, 0.0F); + renderblocks.renderBottomFace(block, -0.5D, -0.5D, -0.5D, block.getBlockTextureFromSide(0)); + renderblocks.renderBottomFace(block, -0.5D, 0.5D - d, -0.5D, block.getBlockTextureFromSide(0)); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, 1.0F, 0.0F); + renderblocks.renderTopFace(block, -0.5D, -0.5D, -0.5D, block.getBlockTextureFromSide(1)); + renderblocks.renderTopFace(block, -0.5D, -1.5D + d, -0.5D, block.getBlockTextureFromSide(1)); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(1.0F, 0.0F, 0.0F); + renderblocks.renderEastFace(block, -0.5D, -0.5D, -0.5D, block.getBlockTextureFromSide(2)); + renderblocks.renderEastFace(block, -0.5D, -0.5D, 0.5D - d, block.getBlockTextureFromSide(2)); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(-1F, 1.0F, 0.0F); + renderblocks.renderWestFace(block, -0.5D, -0.5D, -0.5D, block.getBlockTextureFromSide(3)); + renderblocks.renderWestFace(block, -0.5D, -0.5D, -1.5D + d, block.getBlockTextureFromSide(3)); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, 1.0F, 1.0F); + renderblocks.renderNorthFace(block, -0.5D, -0.5D, -0.5D, block.getBlockTextureFromSide(4)); + renderblocks.renderNorthFace(block, 0.5D - d, -0.5D, -0.5D, block.getBlockTextureFromSide(4)); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, 1.0F, -1F); + renderblocks.renderSouthFace(block, -0.5D, -0.5D, -0.5D, block.getBlockTextureFromSide(5)); + renderblocks.renderSouthFace(block, -1.5D + d, -0.5D, -0.5D, block.getBlockTextureFromSide(5)); + tessellator.draw();*/ + renderInvBlock(renderer, block, metadata); + } + + @Override + public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) + { + renderer.setRenderBounds(0.0F, 0F, 0.0F, 1.0F, 0.1875F, 1.0F); + renderer.renderStandardBlock(block, x, y, z); + renderer.setRenderBounds(0.0F, 0.8125F, 0.0F, 1.0F, 1.0F, 1.0F); + renderer.renderStandardBlock(block, x, y, z); + renderer.setRenderBounds(0.0F, 0.1875F, 0.0F, 0.1875F, 0.8125F, 0.1875F); + renderer.renderStandardBlock(block, x, y, z); + renderer.setRenderBounds(0.8175, 0.1875F, 0.0F, 1f, 0.8125F, 0.1875F); + renderer.renderStandardBlock(block, x, y, z); + renderer.setRenderBounds(0.0F, 0.1875F, 0.8175, 0.1875F, 0.8125F, 1f); + renderer.renderStandardBlock(block, x, y, z); + renderer.setRenderBounds(0.8175F, 0.1875F, 0.8175, 1f, 0.8125F, 1f); + renderer.renderStandardBlock(block, x, y, z); + return true; + } + + @Override + public boolean shouldRender3DInInventory () + { + return true; + } + + @Override + public int getRenderId () + { + return model; + } + + public static void renderInvBlock (RenderBlocks renderblocks, Block block, int meta) + { + Tessellator tessellator = Tessellator.instance; + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, -1F, 0.0F); + renderblocks.renderBottomFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(0, meta)); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, 1.0F, 0.0F); + renderblocks.renderTopFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(1, meta)); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, 0.0F, -1F); + renderblocks.renderEastFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(2, meta)); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, 0.0F, 1.0F); + renderblocks.renderWestFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(3, meta)); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(-1F, 0.0F, 0.0F); + renderblocks.renderNorthFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(4, meta)); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(1.0F, 0.0F, 0.0F); + renderblocks.renderSouthFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(5, meta)); + tessellator.draw(); + GL11.glTranslatef(0.5F, 0.5F, 0.5F); + } +} diff --git a/mods/tinker/golems/client/GolemCoreSpecialRender.java b/mods/tinker/golems/client/GolemCoreSpecialRender.java new file mode 100644 index 00000000..b5dab01e --- /dev/null +++ b/mods/tinker/golems/client/GolemCoreSpecialRender.java @@ -0,0 +1,64 @@ +package mods.tinker.golems.client; + +import mods.tinker.common.fancyitem.FancyEntityItem; +import mods.tinker.golems.logic.GolemCoreLogic; +import net.minecraft.client.renderer.entity.RenderItem; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +/* Special renderer, only used for drawing tools */ + +@SideOnly(Side.CLIENT) +public class GolemCoreSpecialRender extends TileEntitySpecialRenderer +{ + @Override + public void renderTileEntityAt (TileEntity logic, double var2, double var4, double var6, float var8) + { + this.render((GolemCoreLogic) logic, var2, var4, var6, var8); + } + + public void render (GolemCoreLogic logic, double posX, double posY, double posZ, float var8) + { + GL11.glPushMatrix(); + float var10 = (float) (posX - 0.5F); + float var11 = (float) (posY - 0.5F); + float var12 = (float) (posZ - 0.5F); + GL11.glTranslatef(var10, var11, var12); + + ItemStack stack = logic.getStackInSlot(0); + if (stack != null) + renderItem(logic, stack); + + GL11.glPopMatrix(); + } + + void renderItem(GolemCoreLogic logic, ItemStack stack) + { + FancyEntityItem entityitem = new FancyEntityItem(logic.worldObj, 0.0D, 0.0D, 0.0D, stack); + entityitem.getEntityItem().stackSize = 1; + entityitem.hoverStart = 0.0F; + GL11.glPushMatrix(); + GL11.glTranslatef(1F, 0.675F, 1.0F); + //GL11.glRotatef(90F, 1, 0F, 0F); + GL11.glScalef(1.4F, 1.4F, 1.4F); + if (stack.getItem() instanceof ItemBlock) + { + GL11.glScalef(1.6F, 1.6F, 1.6F); + GL11.glTranslatef(0F, 0.045F, 0.0f); + } + + RenderItem.renderInFrame = true; + RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); + RenderItem.renderInFrame = false; + + GL11.glPopMatrix(); + } +} diff --git a/mods/tinker/golems/logic/GolemCoreLogic.java b/mods/tinker/golems/logic/GolemCoreLogic.java new file mode 100644 index 00000000..e2cecfb6 --- /dev/null +++ b/mods/tinker/golems/logic/GolemCoreLogic.java @@ -0,0 +1,113 @@ +package mods.tinker.golems.logic; + +import mods.tinker.common.InventoryLogic; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.IInventory; +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.world.World; + +public class GolemCoreLogic extends InventoryLogic + implements IInventory +{ + + public GolemCoreLogic() + { + super(1); + } + + public ItemStack getKey() + { + return inventory[0]; + } + + public void setKey(ItemStack itemstack) + { + inventory[0] = itemstack; + onInventoryChanged(); + } + + public void clear() + { + inventory[0] = null; + } + + public int getSizeInventory() + { + return 1; + } + + public ItemStack getStackInSlot(int slot) + { + return inventory[0]; + } + + public int getInventoryStackLimit() + { + return 1; + } + + public boolean canInteractWith(EntityPlayer entityplayer) + { + return true; + } + + public void openChest() {} + public void closeChest() {} + + public boolean isUseableByPlayer(EntityPlayer entityplayer) + { + return true; + } + + @Override + public ItemStack getStackInSlotOnClosing (int i) + { + return null; + } + + @Override + public boolean isInvNameLocalized () + { + return false; + } + + @Override + public boolean isStackValidForSlot (int i, ItemStack itemstack) + { + return true; + } + + @Override + public Container getGuiContainer (InventoryPlayer inventoryplayer, World world, int x, int y, int z) + { + return null; + } + + @Override + protected String getDefaultName () + { + return "golems.core"; + } + + /* Packets */ + @Override + public Packet getDescriptionPacket () + { + NBTTagCompound tag = new NBTTagCompound(); + writeToNBT(tag); + return new Packet132TileEntityData(xCoord, yCoord, zCoord, 1, tag); + } + + @Override + public void onDataPacket (INetworkManager net, Packet132TileEntityData packet) + { + readFromNBT(packet.customParam1); + worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord); + } +} diff --git a/mods/tinker/golems/logic/GolemPedestalLogic.java b/mods/tinker/golems/logic/GolemPedestalLogic.java new file mode 100644 index 00000000..e1b20cbe --- /dev/null +++ b/mods/tinker/golems/logic/GolemPedestalLogic.java @@ -0,0 +1,358 @@ +package mods.tinker.golems.logic; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.src.ModLoader; +import net.minecraft.tileentity.TileEntity; + +public class GolemPedestalLogic extends TileEntity + implements IInventory +{ + public ItemStack supply; + public static int cost[] = null; + public static int souls[] = null; + + public GolemPedestalLogic() + { + supply = null; + if (cost == null) + { + cost = new int[512]; + souls = new int[512]; + cost[Block.planks.blockID] = 0; + cost[Block.wood.blockID] = 32; + cost[Block.cloth.blockID] = 8; + cost[Block.cobblestoneMossy.blockID] = 16; + cost[Block.obsidian.blockID] = 8; + cost[Block.pumpkin.blockID] = 8; + cost[Block.netherrack.blockID] = 64; + cost[Block.slowSand.blockID] = 1; + cost[Block.glowStone.blockID] = 1; + cost[Block.pumpkinLantern.blockID] = 8; + cost[Block.blockDiamond.blockID] = 1; + cost[Block.blockGold.blockID] = 1; + cost[Block.blockSteel.blockID] = 1; + cost[Block.blockLapis.blockID] = 1; + cost[Block.jukebox.blockID] = 1; + cost[Block.music.blockID] = 1; + cost[Block.melon.blockID] = 8; + cost[Block.torchRedstoneIdle.blockID] = 6; + cost[Block.torchRedstoneActive.blockID] = cost[Block.torchRedstoneIdle.blockID]; + cost[Item.redstone.itemID] = 6; + cost[Item.beefRaw.itemID] = 8; + cost[Item.beefCooked.itemID] = cost[Item.beefRaw.itemID]; + cost[Item.porkRaw.itemID] = cost[Item.beefRaw.itemID]; + cost[Item.porkCooked.itemID] = cost[Item.beefRaw.itemID]; + cost[Item.enderPearl.itemID] = 1; + cost[Item.eyeOfEnder.itemID] = 1; + cost[Item.blazeRod.itemID] = 2; + cost[Block.mushroomBrown.blockID] = 16; + cost[Block.mushroomRed.blockID] = cost[Block.mushroomBrown.blockID]; + cost[Block.netherStalk.blockID] = 6; + cost[Item.lightStoneDust.itemID] = 4; + cost[Item.diamond.itemID] = 1; + cost[Item.ingotIron.itemID] = 8; + cost[Item.ingotGold.itemID] = 2; + cost[Item.reed.itemID] = 8; + cost[Item.sugar.itemID] = cost[Item.reed.itemID]; + cost[Item.bucketLava.itemID] = 1; + cost[Item.cake.itemID] = 1; + cost[Item.bucketMilk.itemID] = 1; + cost[Item.wheat.itemID] = 32; + cost[Item.bread.itemID] = 8; + cost[Block.plantYellow.blockID] = 32; + cost[Block.plantRed.blockID] = cost[Block.plantYellow.blockID]; + cost[Block.dragonEgg.blockID] = 1; + cost[Block.tallGrass.blockID] = 64; + cost[Block.sapling.blockID] = 64; + cost[Item.ghastTear.itemID] = 8; + cost[Item.goldNugget.itemID] = 18; + cost[Item.spiderEye.itemID] = 16; + cost[Item.fermentedSpiderEye.itemID] = 6; + cost[Item.bowlSoup.itemID] = 0; + cost[Item.fishRaw.itemID] = 1; + cost[Item.fishCooked.itemID] = cost[Item.fishRaw.itemID]; + cost[Item.magmaCream.itemID] = 2; + cost[Item.blazePowder.itemID] = 4; + cost[Item.speckledMelon.itemID] = 1; + cost[Item.paper.itemID] = 8; + cost[Item.book.itemID] = 2; + cost[Item.egg.itemID] = 4; + cost[Item.slimeBall.itemID] = 2; + cost[Item.saddle.itemID] = 1; + cost[Item.feather.itemID] = 48; + cost[Item.gunpowder.itemID] = 16; + cost[Item.appleRed.itemID] = 8; + cost[Item.appleGold.itemID] = 1; + cost[Item.dyePowder.itemID] = 64; + cost[Item.bone.itemID] = 2; + cost[Item.rottenFlesh.itemID] = 48; + cost[Item.cookie.itemID] = 16; + cost[Item.melon.itemID] = 32; + cost[Item.chickenCooked.itemID] = 8; + cost[Item.chickenRaw.itemID] = cost[Item.chickenCooked.itemID]; + cost[Item.silk.itemID] = 64; + cost[Block.cactus.blockID] = 32; + souls[Block.planks.blockID] = 0; + souls[Block.wood.blockID] = 1; + souls[Block.cloth.blockID] = 1; + souls[Block.cobblestoneMossy.blockID] = 1; + souls[Block.obsidian.blockID] = 1; + souls[Block.pumpkin.blockID] = 1; + souls[Block.netherrack.blockID] = 1; + souls[Block.slowSand.blockID] = 1; + souls[Block.glowStone.blockID] = 2; + souls[Block.pumpkinLantern.blockID] = 1; + souls[Block.blockDiamond.blockID] = 27; + souls[Block.blockGold.blockID] = 2; + souls[Block.blockSteel.blockID] = 2; + souls[Block.blockLapis.blockID] = 3; + souls[Block.jukebox.blockID] = 3; + souls[Block.music.blockID] = 1; + souls[Block.melon.blockID] = 1; + souls[Block.torchRedstoneIdle.blockID] = 1; + souls[Block.torchRedstoneActive.blockID] = souls[Block.torchRedstoneIdle.blockID]; + souls[Item.redstone.itemID] = 1; + souls[Item.beefRaw.itemID] = 1; + souls[Item.beefCooked.itemID] = souls[Item.beefRaw.itemID]; + souls[Item.porkRaw.itemID] = souls[Item.beefRaw.itemID]; + souls[Item.porkCooked.itemID] = souls[Item.beefRaw.itemID]; + souls[Item.enderPearl.itemID] = 1; + souls[Item.eyeOfEnder.itemID] = 2; + souls[Item.blazeRod.itemID] = 2; + souls[Block.mushroomBrown.blockID] = 1; + souls[Block.mushroomRed.blockID] = souls[Block.mushroomBrown.blockID]; + souls[Block.netherStalk.blockID] = 1; + souls[Item.lightStoneDust.itemID] = 1; + souls[Item.diamond.itemID] = 3; + souls[Item.ingotIron.itemID] = 1; + souls[Item.ingotGold.itemID] = 1; + souls[Item.reed.itemID] = 1; + souls[Item.sugar.itemID] = souls[Item.reed.itemID]; + souls[Item.bucketLava.itemID] = 1; + souls[Item.cake.itemID] = 1; + souls[Item.bucketMilk.itemID] = 1; + souls[Item.wheat.itemID] = 1; + souls[Item.bread.itemID] = 1; + souls[Block.plantYellow.blockID] = 1; + souls[Block.plantRed.blockID] = souls[Block.plantYellow.blockID]; + souls[Block.dragonEgg.blockID] = 1; + souls[Block.tallGrass.blockID] = 1; + souls[Block.sapling.blockID] = 1; + souls[Item.ghastTear.itemID] = 1; + souls[Item.goldNugget.itemID] = 1; + souls[Item.spiderEye.itemID] = 1; + souls[Item.fermentedSpiderEye.itemID] = 1; + souls[Item.bowlSoup.itemID] = 1; + souls[Item.fishRaw.itemID] = 1; + souls[Item.fishCooked.itemID] = souls[Item.fishRaw.itemID]; + souls[Item.magmaCream.itemID] = 1; + souls[Item.blazePowder.itemID] = 1; + souls[Item.speckledMelon.itemID] = 1; + souls[Item.paper.itemID] = 1; + souls[Item.book.itemID] = 1; + souls[Item.egg.itemID] = 1; + souls[Item.slimeBall.itemID] = 1; + souls[Item.saddle.itemID] = 1; + souls[Item.feather.itemID] = 1; + souls[Item.gunpowder.itemID] = 1; + souls[Item.appleRed.itemID] = 1; + souls[Item.appleGold.itemID] = 3; + souls[Item.dyePowder.itemID] = 1; + souls[Item.bone.itemID] = 1; + souls[Item.rottenFlesh.itemID] = 1; + souls[Item.cookie.itemID] = 1; + souls[Item.melon.itemID] = 1; + souls[Item.chickenCooked.itemID] = 1; + souls[Item.chickenRaw.itemID] = souls[Item.chickenCooked.itemID]; + souls[Item.silk.itemID] = 1; + souls[Block.cactus.blockID] = 1; + } + } + + public int getSizeInventory() + { + return 9; + } + + public ItemStack getStackInSlot(int i) + { + if (supply != null && supply.getItem() == null) + { + supply = null; + } + return supply; + } + + public boolean subtractSoul(int i) + { + System.out.println("SUBTRACT WHY"); + if (supply == null || supply.itemID >= 512 || cost[supply.itemID] == 0) + { + worldObj.playSoundAtEntity(ModLoader.getMinecraftInstance().thePlayer, "mob.blaze.death", 1.0F, 0.5F); + ModLoader.getMinecraftInstance().thePlayer.addChatMessage("I require more souls..."); + return false; + } + int j = cost[supply.itemID]; + int k = souls[supply.itemID]; + int l = (supply.stackSize / j) * k; + System.out.println((new StringBuilder()).append("Subtracting amt").append(i).append(" s").append(k).append(" c").append(j).append(" ss").append(supply.stackSize).append(" id").append(supply.itemID).append(" sa").append(l).append(" calc").append(Math.ceil((double)i / (double)k)).toString()); + if (l < i) + { + worldObj.playSoundAtEntity(ModLoader.getMinecraftInstance().thePlayer, "mob.blaze.death", 1.0F, 0.5F); + ModLoader.getMinecraftInstance().thePlayer.addChatMessage("I need more souls..."); + return false; + } + supply.stackSize -= Math.ceil((double)i / (double)k) * (double)j; + if (supply.stackSize == 0) + { + supply = null; + } + else if (supply.stackSize < 0) + { + throw new UnsupportedOperationException((new StringBuilder()).append("If you are getting this error then your golems mod has derped, \nplease contact billythegoat101 on the minecraftforums with the error code: LERN YO MATHS [i").append(supply.itemID).append(",ss").append(supply.stackSize).append(",a").append(i).append("]").toString()); + } + return true; + } + + public ItemStack decrStackSize(int i, int j) + { + if (supply != null && supply.getItem() == null) + { + supply = null; + } + if (supply != null) + { + if (supply.stackSize <= j) + { + ItemStack itemstack = supply; + supply = null; + onInventoryChanged(); + return itemstack; + } + ItemStack itemstack1 = supply.splitStack(j); + if (supply.stackSize == 0) + { + supply = null; + } + onInventoryChanged(); + return itemstack1; + } + else + { + return null; + } + } + + public void setInventorySlotContents(int i, ItemStack itemstack) + { + supply = itemstack; + if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) + { + itemstack.stackSize = getInventoryStackLimit(); + } + if (supply != null && supply.getItem() == null) + { + supply = null; + } + onInventoryChanged(); + } + + public void writeToNBT(NBTTagCompound nbttagcompound) + { + super.writeToNBT(nbttagcompound); + if (supply == null) + { + supply = new ItemStack(0, 0, 0); + } + NBTTagList nbttaglist = new NBTTagList(); + if (supply != null) + { + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound1.setByte("Slot", (byte)0); + supply.writeToNBT(nbttagcompound1); + nbttaglist.appendTag(nbttagcompound1); + } + nbttagcompound.setTag("Items", nbttaglist); + } + + public void readFromNBT(NBTTagCompound nbttagcompound) + { + super.readFromNBT(nbttagcompound); + supply = new ItemStack(0, 0, 0); + NBTTagList nbttaglist = nbttagcompound.getTagList("Items"); + for (int i = 0; i < nbttaglist.tagCount(); i++) + { + NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbttaglist.tagAt(i); + int j = nbttagcompound1.getByte("Slot") & 0xff; + if (j >= 0 && j < 1) + { + supply = ItemStack.loadItemStackFromNBT(nbttagcompound1); + } + } + + if (supply != null && supply.getItem() == null) + { + supply = null; + } + } + + public String getInvName() + { + return "golempedestalinv"; + } + + public int getInventoryStackLimit() + { + return 64; + } + + public boolean canInteractWith(EntityPlayer entityplayer) + { + return true; + } + + public void openChest() + { + } + + public void closeChest() + { + } + + public void clear() + { + supply = null; + } + + public boolean isUseableByPlayer(EntityPlayer entityplayer) + { + return true; + } + + @Override + public ItemStack getStackInSlotOnClosing (int i) + { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean isInvNameLocalized () + { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean isStackValidForSlot (int i, ItemStack itemstack) + { + // TODO Auto-generated method stub + return false; + } +} diff --git a/mods/tinker/tconstruct/PHConstruct.java b/mods/tinker/tconstruct/PHConstruct.java index eae80e57..4383c698 100644 --- a/mods/tinker/tconstruct/PHConstruct.java +++ b/mods/tinker/tconstruct/PHConstruct.java @@ -54,8 +54,10 @@ public class PHConstruct { enableTCactus = config.get("Difficulty Changes", "Enable mod cactus tools", true).getBoolean(true); enableTBone = config.get("Difficulty Changes", "Enable mod bone tools", true).getBoolean(true); - unstableCreeper = config.get("Mob Spawning", "Activate Nitro Creeper Spawns", true).getBoolean(true); + redCreeper = config.get("Mob Spawning", "Activate Nitro Creeper Spawns", true).getBoolean(true); blueSlime = config.get("Mob Spawning", "Activate Blue Slime Spawns", true).getBoolean(true); + redCreeperWeight = config.get("Mob Spawning", "Spawn Weight for Nitro Creeper", 7).getInt(7); + blueSlimeWeight = config.get("Mob Spawning", "Spawn Weight for Blue Slime", 10).getInt(10); woodCrafter = config.getBlock("Wood Tool Station", 1471).getInt(1471); heldItemBlock = config.getBlock("Held Item Block", 1472).getInt(1472); @@ -69,6 +71,10 @@ public class PHConstruct { metalStill = config.getBlock("Liquid Metal Still", 1480).getInt(1480); //landmine = config.getBlock("Landmine", 1481).getInt(1481); + golemCore = config.getBlock("Golem Core", 1481).getInt(1481); + golemHead = config.getBlock("Golem Head", 1482).getInt(1482); + golemPedestal = config.getBlock("Golem Pedestal", 1483).getInt(1483); + manual = config.getItem("Patterns and Misc", "Tinker's Manual", 14018).getInt(14018); blankPattern = config.getItem("Patterns and Misc", "Blank Patterns", 14019).getInt(14019); materials = config.getItem("Patterns and Misc", "Materials", 14020).getInt(14020); @@ -107,6 +113,8 @@ public class PHConstruct { mattock = config.getItem("Tools", "Mattock", 14060).getInt(14060); lumberaxe = config.getItem("Tools", "Lumber Axe", 14061).getInt(14061); longbow = config.getItem("Tools", "Longbow", 14062).getInt(14062); + shortbow = config.getItem("Tools", "Shortbow", 14063).getInt(14063); + potionLauncher = config.getItem("Tools", "Potion Launcher", 14064).getInt(14064); buckets = config.getItem("Patterns and Misc", "Buckets", 14101).getInt(14101); uselessItem = config.getItem("Patterns and Misc", "Title Icon", 14102).getInt(14102); @@ -159,6 +167,10 @@ public class PHConstruct { public static int oreSlag; public static int metalBlock; //public static int axle; + + public static int golemCore; + public static int golemHead; + public static int golemPedestal; //Traps //public static int landmine; @@ -195,6 +207,8 @@ public class PHConstruct { public static int frypan; public static int battlesign; public static int longbow; + public static int shortbow; + public static int potionLauncher; public static int mattock; public static int lumberaxe; @@ -236,8 +250,10 @@ public class PHConstruct { public static int netherDensity; //Mobs - public static boolean unstableCreeper; + public static boolean redCreeper; + public static int redCreeperWeight; public static boolean blueSlime; + public static int blueSlimeWeight; //Difficulty modifiers public static boolean keepHunger; diff --git a/mods/tinker/tconstruct/TConstruct.java b/mods/tinker/tconstruct/TConstruct.java index 8d4b9e79..e904d161 100644 --- a/mods/tinker/tconstruct/TConstruct.java +++ b/mods/tinker/tconstruct/TConstruct.java @@ -25,7 +25,7 @@ import cpw.mods.fml.common.registry.GameRegistry; * @author: mDiyo */ -@Mod(modid = "TConstruct", name = "TConstruct", version = "1.5.1_1.2.12") +@Mod(modid = "TConstruct", name = "TConstruct", version = "1.5.1_1.2.15") @NetworkMod(serverSideRequired = false, clientSideRequired = true, channels = { "TConstruct" }, packetHandler = mods.tinker.tconstruct.TPacketHandler.class) public class TConstruct { diff --git a/mods/tinker/tconstruct/TContent.java b/mods/tinker/tconstruct/TContent.java index 4a424b57..3b387aaa 100644 --- a/mods/tinker/tconstruct/TContent.java +++ b/mods/tinker/tconstruct/TContent.java @@ -7,14 +7,72 @@ import java.util.List; import mods.tinker.common.IPattern; import mods.tinker.common.RecipeRemover; import mods.tinker.common.fancyitem.FancyEntityItem; -import mods.tinker.tconstruct.blocks.*; -import mods.tinker.tconstruct.crafting.*; -import mods.tinker.tconstruct.entity.*; -import mods.tinker.tconstruct.items.*; -import mods.tinker.tconstruct.library.*; -import mods.tinker.tconstruct.logic.*; -import mods.tinker.tconstruct.modifiers.*; -import mods.tinker.tconstruct.tools.*; +import mods.tinker.tconstruct.blocks.EquipBlock; +import mods.tinker.tconstruct.blocks.LavaTankBlock; +import mods.tinker.tconstruct.blocks.LiquidMetalFlowing; +import mods.tinker.tconstruct.blocks.LiquidMetalStill; +import mods.tinker.tconstruct.blocks.MetalOre; +import mods.tinker.tconstruct.blocks.SearedBlock; +import mods.tinker.tconstruct.blocks.SmelteryBlock; +import mods.tinker.tconstruct.blocks.TConstructBlock; +import mods.tinker.tconstruct.blocks.ToolStationBlock; +import mods.tinker.tconstruct.crafting.LiquidCasting; +import mods.tinker.tconstruct.crafting.PatternBuilder; +import mods.tinker.tconstruct.crafting.Smeltery; +import mods.tinker.tconstruct.crafting.ToolBuilder; +import mods.tinker.tconstruct.entity.BlueSlime; +import mods.tinker.tconstruct.entity.Crystal; +import mods.tinker.tconstruct.entity.LaunchedPotion; +import mods.tinker.tconstruct.entity.UnstableCreeper; +import mods.tinker.tconstruct.items.CraftedSoilItemBlock; +import mods.tinker.tconstruct.items.CraftingItem; +import mods.tinker.tconstruct.items.FilledBucket; +import mods.tinker.tconstruct.items.LavaTankItemBlock; +import mods.tinker.tconstruct.items.LiquidItemBlock; +import mods.tinker.tconstruct.items.MetalItemBlock; +import mods.tinker.tconstruct.items.MetalOreItemBlock; +import mods.tinker.tconstruct.items.MetalPattern; +import mods.tinker.tconstruct.items.Pattern; +import mods.tinker.tconstruct.items.PatternManual; +import mods.tinker.tconstruct.items.SearedTableItemBlock; +import mods.tinker.tconstruct.items.SmelteryItemBlock; +import mods.tinker.tconstruct.items.StrangeFood; +import mods.tinker.tconstruct.items.TitleIcon; +import mods.tinker.tconstruct.items.ToolPart; +import mods.tinker.tconstruct.items.ToolShard; +import mods.tinker.tconstruct.items.ToolStationItemBlock; +import mods.tinker.tconstruct.library.TConstructRegistry; +import mods.tinker.tconstruct.library.ToolCore; +import mods.tinker.tconstruct.logic.CastingTableLogic; +import mods.tinker.tconstruct.logic.FaucetLogic; +import mods.tinker.tconstruct.logic.FrypanLogic; +import mods.tinker.tconstruct.logic.LavaTankLogic; +import mods.tinker.tconstruct.logic.LiquidTextureLogic; +import mods.tinker.tconstruct.logic.MultiServantLogic; +import mods.tinker.tconstruct.logic.PartCrafterLogic; +import mods.tinker.tconstruct.logic.PatternChestLogic; +import mods.tinker.tconstruct.logic.PatternShaperLogic; +import mods.tinker.tconstruct.logic.SmelteryDrainLogic; +import mods.tinker.tconstruct.logic.SmelteryLogic; +import mods.tinker.tconstruct.logic.ToolStationLogic; +import mods.tinker.tconstruct.modifiers.ModBlaze; +import mods.tinker.tconstruct.modifiers.ModBoolean; +import mods.tinker.tconstruct.modifiers.ModDurability; +import mods.tinker.tconstruct.modifiers.ModElectric; +import mods.tinker.tconstruct.modifiers.ModInteger; +import mods.tinker.tconstruct.modifiers.ModLapisBase; +import mods.tinker.tconstruct.modifiers.ModLapisIncrease; +import mods.tinker.tconstruct.modifiers.ModRedstone; +import mods.tinker.tconstruct.modifiers.ModRepair; +import mods.tinker.tconstruct.tools.Axe; +import mods.tinker.tconstruct.tools.BattleSign; +import mods.tinker.tconstruct.tools.Broadsword; +import mods.tinker.tconstruct.tools.FryingPan; +import mods.tinker.tconstruct.tools.Longsword; +import mods.tinker.tconstruct.tools.Mattock; +import mods.tinker.tconstruct.tools.Pickaxe; +import mods.tinker.tconstruct.tools.PotionLauncher; +import mods.tinker.tconstruct.tools.Rapier; import mods.tinker.tconstruct.tools.Shovel; import net.minecraft.block.Block; import net.minecraft.block.material.MapColor; @@ -69,6 +127,8 @@ public class TContent implements IFuelHandler public static ToolCore mattock; public static ToolCore lumberaxe; + + public static Item potionLauncher; //Tool parts public static Item pickaxeHead; @@ -108,6 +168,21 @@ public class TContent implements IFuelHandler //Tool modifiers public static ModElectric modE; + + //Golems + public static Block glowSapling; + public static Block glowLeaves; + public static Block glowLog; + + public static Block golemCore; + public static Block golemPedestal; + public static Block golemHead; + + public static Item golemWand; + public static Item golemRecharger; + public static Item corestone; + public static Item notebook; + public static Item note; public TContent() { @@ -124,21 +199,23 @@ public class TContent implements IFuelHandler void createEntities () { EntityRegistry.registerModEntity(FancyEntityItem.class, "Fancy Item", 0, TConstruct.instance, 32, 5, true); - EntityRegistry.registerModEntity(CartEntity.class, "Small Wagon", 1, TConstruct.instance, 32, 5, true); + EntityRegistry.registerModEntity(LaunchedPotion.class, "Launched Potion", 1, TConstruct.instance, 32, 3, true); + //EntityRegistry.registerModEntity(CartEntity.class, "Small Wagon", 1, TConstruct.instance, 32, 5, true); + //EntityRegistry.registerModEntity(Crystal.class, "Crystal", 2, TConstruct.instance, 32, 5, true); EntityRegistry.registerModEntity(Crystal.class, "Crystal", 2, TConstruct.instance, 32, 5, true); - EntityRegistry.registerModEntity(Skyla.class, "Skyla", 10, TConstruct.instance, 32, 5, true); + //EntityRegistry.registerModEntity(Skyla.class, "Skyla", 10, TConstruct.instance, 32, 5, true); EntityRegistry.registerModEntity(UnstableCreeper.class, "UnstableCreeper", 11, TConstruct.instance, 64, 5, true); EntityRegistry.registerModEntity(BlueSlime.class, "EdibleSlime", 12, TConstruct.instance, 64, 5, true); - EntityRegistry.registerModEntity(MetalSlime.class, "MetalSlime", 13, TConstruct.instance, 64, 5, true); + //EntityRegistry.registerModEntity(MetalSlime.class, "MetalSlime", 13, TConstruct.instance, 64, 5, true); BiomeGenBase[] overworldBiomes = new BiomeGenBase[] { BiomeGenBase.ocean, BiomeGenBase.plains, BiomeGenBase.desert, BiomeGenBase.extremeHills, BiomeGenBase.forest, BiomeGenBase.taiga, BiomeGenBase.swampland, BiomeGenBase.river, BiomeGenBase.frozenOcean, BiomeGenBase.frozenRiver, BiomeGenBase.icePlains, BiomeGenBase.iceMountains, BiomeGenBase.beach, BiomeGenBase.desertHills, BiomeGenBase.forestHills, BiomeGenBase.taigaHills, BiomeGenBase.extremeHillsEdge, BiomeGenBase.jungle, BiomeGenBase.jungleHills }; - if (PHConstruct.unstableCreeper) - EntityRegistry.addSpawn(UnstableCreeper.class, 7, 4, 6, EnumCreatureType.monster, overworldBiomes); + if (PHConstruct.redCreeper) + EntityRegistry.addSpawn(UnstableCreeper.class, PHConstruct.redCreeperWeight, 4, 6, EnumCreatureType.monster, overworldBiomes); if (PHConstruct.blueSlime) - EntityRegistry.addSpawn(BlueSlime.class, 10, 4, 4, EnumCreatureType.monster, overworldBiomes); + EntityRegistry.addSpawn(BlueSlime.class, PHConstruct.blueSlimeWeight, 4, 4, EnumCreatureType.monster, overworldBiomes); //EntityRegistry.addSpawn(MetalSlime.class, 1, 4, 4, EnumCreatureType.monster, overworldBiomes); } @@ -205,6 +282,18 @@ public class TContent implements IFuelHandler GameRegistry.registerBlock(liquidMetalFlowing, LiquidItemBlock.class, "metalFlow"); GameRegistry.registerBlock(liquidMetalStill, LiquidItemBlock.class, "metalStill"); GameRegistry.registerTileEntity(LiquidTextureLogic.class, "LiquidTexture"); + + //Golems + /*golemCore = new GolemCoreBlock(PHConstruct.golemCore).setUnlocalizedName("golemcore"); + GameRegistry.registerBlock(golemCore, "Golem Core"); + GameRegistry.registerTileEntity(GolemCoreLogic.class, "TConstruct.GolemCore"); + + golemHead = new GolemHeadBlock(PHConstruct.golemHead).setUnlocalizedName("golemhead"); + GameRegistry.registerBlock(golemHead, "Golem Head"); + + golemPedestal = new GolemPedestalBlock(PHConstruct.golemPedestal).setUnlocalizedName("golempedestal"); + GameRegistry.registerBlock(golemPedestal, "Golem Pedestal"); + GameRegistry.registerTileEntity(GolemPedestalLogic.class, "TConstruct.GolemPedestal");*/ } void registerItems () @@ -243,6 +332,7 @@ public class TContent implements IFuelHandler //longbow = new RangedWeapon(PHConstruct.longbow); mattock = new Mattock(PHConstruct.mattock); //lumberaxe = new LumberAxe(PHConstruct.lumberaxe, lumberaxeTexture); + potionLauncher = new PotionLauncher(PHConstruct.potionLauncher); pickaxeHead = new ToolPart(PHConstruct.pickaxeHead, "PickaxeHead", "_pickaxe_head").setUnlocalizedName("tconstruct.PickaxeHead"); shovelHead = new ToolPart(PHConstruct.shovelHead, "ShovelHead", "_shovel_head").setUnlocalizedName("tconstruct.ShovelHead"); diff --git a/mods/tinker/tconstruct/blocks/LiquidMetalBase.java b/mods/tinker/tconstruct/blocks/LiquidMetalBase.java index 67d62fca..ee87b788 100644 --- a/mods/tinker/tconstruct/blocks/LiquidMetalBase.java +++ b/mods/tinker/tconstruct/blocks/LiquidMetalBase.java @@ -365,7 +365,7 @@ public abstract class LiquidMetalBase extends Block } /** - * Can add to the passed in vector for a movement vector to be applied to the entity. Args: x, y, z, entity, vec3d + * Can add to the passed in vector for a movement vector to be applied to the entity. Args: x, y, z, entity, Vec3 */ public void velocityToAddToEntity (World par1World, int par2, int par3, int par4, Entity par5Entity, Vec3 par6Vec3) { diff --git a/mods/tinker/tconstruct/client/CastingTableSpecialRenderer.java b/mods/tinker/tconstruct/client/CastingTableSpecialRenderer.java index 7d45bf29..abb3fd26 100644 --- a/mods/tinker/tconstruct/client/CastingTableSpecialRenderer.java +++ b/mods/tinker/tconstruct/client/CastingTableSpecialRenderer.java @@ -62,7 +62,7 @@ public class CastingTableSpecialRenderer extends TileEntitySpecialRenderer if (stack.getItem() instanceof ItemBlock) { GL11.glRotatef(90F, -1, 0F, 0F); - GL11.glTranslatef(0F, -10.1F, 0.2275F); + GL11.glTranslatef(0F, -0.1F, 0.2275F); } RenderItem.renderInFrame = true; diff --git a/mods/tinker/tconstruct/client/TProxyClient.java b/mods/tinker/tconstruct/client/TProxyClient.java index 06a7aeac..786adbbd 100644 --- a/mods/tinker/tconstruct/client/TProxyClient.java +++ b/mods/tinker/tconstruct/client/TProxyClient.java @@ -9,16 +9,21 @@ import javax.xml.parsers.DocumentBuilderFactory; import mods.tinker.common.fancyitem.FancyEntityItem; import mods.tinker.common.fancyitem.FancyItemRender; +import mods.tinker.golems.client.GolemCoreRender; +import mods.tinker.golems.client.GolemCoreSpecialRender; +import mods.tinker.golems.logic.GolemCoreLogic; import mods.tinker.tconstruct.TConstruct; import mods.tinker.tconstruct.TContent; import mods.tinker.tconstruct.TProxyCommon; import mods.tinker.tconstruct.client.entityrender.CartRender; import mods.tinker.tconstruct.client.entityrender.CrystalRender; +import mods.tinker.tconstruct.client.entityrender.ThrownItemRender; import mods.tinker.tconstruct.client.entityrender.SkylaRender; import mods.tinker.tconstruct.client.entityrender.SlimeRender; import mods.tinker.tconstruct.entity.BlueSlime; import mods.tinker.tconstruct.entity.CartEntity; import mods.tinker.tconstruct.entity.Crystal; +import mods.tinker.tconstruct.entity.LaunchedPotion; import mods.tinker.tconstruct.entity.Skyla; import mods.tinker.tconstruct.entity.UnstableCreeper; import mods.tinker.tconstruct.library.client.TConstructClientRegistry; @@ -87,6 +92,7 @@ public class TProxyClient extends TProxyCommon RenderingRegistry.registerBlockHandler(new TankRender()); RenderingRegistry.registerBlockHandler(new SearedRender()); RenderingRegistry.registerBlockHandler(new FluidRender()); + RenderingRegistry.registerBlockHandler(new GolemCoreRender()); //Tools //MinecraftForgeClient.preloadTexture(TContent.blockTexture); @@ -98,6 +104,7 @@ public class TProxyClient extends TProxyCommon //Special Renderers ClientRegistry.bindTileEntitySpecialRenderer(CastingTableLogic.class, new CastingTableSpecialRenderer()); + ClientRegistry.bindTileEntitySpecialRenderer(GolemCoreLogic.class, new GolemCoreSpecialRender()); //Entities RenderingRegistry.registerEntityRenderingHandler(CartEntity.class, new CartRender()); @@ -106,6 +113,7 @@ public class TProxyClient extends TProxyCommon RenderingRegistry.registerEntityRenderingHandler(Crystal.class, new CrystalRender()); RenderingRegistry.registerEntityRenderingHandler(UnstableCreeper.class, new RenderCreeper()); RenderingRegistry.registerEntityRenderingHandler(BlueSlime.class, new SlimeRender(new ModelSlime(16), new ModelSlime(0), 0.25F)); + RenderingRegistry.registerEntityRenderingHandler(LaunchedPotion.class, new ThrownItemRender(Item.potion, 16384)); //RenderingRegistry.registerEntityRenderingHandler(net.minecraft.entity.player.EntityPlayer.class, new PlayerArmorRender()); // <-- Works, woo! addRenderMappings(); @@ -168,6 +176,8 @@ public class TProxyClient extends TProxyCommon LanguageRegistry.instance().addStringLocalization("entity.TConstruct.UnstableCreeper.name", "en_US", "Nitro Creeper"); LanguageRegistry.instance().addStringLocalization("entity.TConstruct.EdibleSlime.name", "en_US", "Blue Slime"); + LanguageRegistry.instance().addStringLocalization("entity.tconstruct.UnstableCreeper.name", "en_US", "Nitro Creeper"); + LanguageRegistry.instance().addStringLocalization("entity.tconstruct.EdibleSlime.name", "en_US", "Blue Slime"); LanguageRegistry.instance().addStringLocalization("entity.TConstruct.MetalSlime.name", "en_US", "Metal Slime"); //LanguageRegistry.instance().addStringLocalization("item.tconstruct.diary.diary.name", "en_US", "Tinker's Log"); LanguageRegistry.instance().addStringLocalization("item.tconstruct.Pattern.blank_pattern.name", "en_US", "Blank Pattern"); diff --git a/mods/tinker/tconstruct/client/entityrender/ThrownItemRender.java b/mods/tinker/tconstruct/client/entityrender/ThrownItemRender.java new file mode 100644 index 00000000..4ac148a7 --- /dev/null +++ b/mods/tinker/tconstruct/client/entityrender/ThrownItemRender.java @@ -0,0 +1,92 @@ +package mods.tinker.tconstruct.client.entityrender; + +import mods.tinker.tconstruct.entity.LaunchedPotion; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.entity.Entity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemPotion; +import net.minecraft.potion.PotionHelper; +import net.minecraft.util.Icon; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class ThrownItemRender extends Render +{ + private Item field_94151_a; + private int field_94150_f; + + public ThrownItemRender(Item par1, int par2) + { + this.field_94151_a = par1; + this.field_94150_f = par2; + } + + public ThrownItemRender(Item par1) + { + this(par1, 0); + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render> 16 & 255) / 255.0F; + float f3 = (float)(i >> 8 & 255) / 255.0F; + float f4 = (float)(i & 255) / 255.0F; + GL11.glColor3f(f2, f3, f4); + GL11.glPushMatrix(); + this.func_77026_a(tessellator, ItemPotion.func_94589_d("potion_contents")); + GL11.glPopMatrix(); + GL11.glColor3f(1.0F, 1.0F, 1.0F); + } + + this.func_77026_a(tessellator, icon); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glPopMatrix(); + } + } + + private void func_77026_a(Tessellator par1Tessellator, Icon par2Icon) + { + float f = par2Icon.getMinU(); + float f1 = par2Icon.getMaxU(); + float f2 = par2Icon.getMinV(); + float f3 = par2Icon.getMaxV(); + float f4 = 1.0F; + float f5 = 0.5F; + float f6 = 0.25F; + GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); + par1Tessellator.startDrawingQuads(); + par1Tessellator.setNormal(0.0F, 1.0F, 0.0F); + par1Tessellator.addVertexWithUV((double)(0.0F - f5), (double)(0.0F - f6), 0.0D, (double)f, (double)f3); + par1Tessellator.addVertexWithUV((double)(f4 - f5), (double)(0.0F - f6), 0.0D, (double)f1, (double)f3); + par1Tessellator.addVertexWithUV((double)(f4 - f5), (double)(f4 - f6), 0.0D, (double)f1, (double)f2); + par1Tessellator.addVertexWithUV((double)(0.0F - f5), (double)(f4 - f6), 0.0D, (double)f, (double)f2); + par1Tessellator.draw(); + } +} diff --git a/mods/tinker/tconstruct/entity/BlueSlime.java b/mods/tinker/tconstruct/entity/BlueSlime.java index 2b0a3d1e..568ff66a 100644 --- a/mods/tinker/tconstruct/entity/BlueSlime.java +++ b/mods/tinker/tconstruct/entity/BlueSlime.java @@ -28,11 +28,14 @@ public class BlueSlime extends EntityLiving implements IMob { super(world); this.texture = "/mods/tinker/textures/mob/slimeedible.png"; - int i = 1 << Math.max(1, this.rand.nextInt(4)); + int offset = Math.max(1, this.rand.nextInt(4)); + if (offset >= 3) + offset--; + int size = 1 << offset; this.yOffset = 0.0F; this.slimeJumpDelay = this.rand.nextInt(120) + 40; - this.setSlimeSize(i); - this.jumpMovementFactor = 0.004F * i + 0.01F; + this.setSlimeSize(size); + this.jumpMovementFactor = 0.004F * size + 0.01F; } protected void damageEntity (DamageSource damageSource, int damage) @@ -128,7 +131,7 @@ public class BlueSlime extends EntityLiving implements IMob this.worldObj.skylightSubtracted = i1; } - return light <= this.rand.nextInt(10); + return light <= this.rand.nextInt(8); } } diff --git a/mods/tinker/tconstruct/entity/LaunchedPotion.java b/mods/tinker/tconstruct/entity/LaunchedPotion.java new file mode 100644 index 00000000..cd8d4d81 --- /dev/null +++ b/mods/tinker/tconstruct/entity/LaunchedPotion.java @@ -0,0 +1,192 @@ +package mods.tinker.tconstruct.entity; + +import java.util.Iterator; +import java.util.List; + +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.projectile.EntityThrowable; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class LaunchedPotion extends EntityThrowable +{ + /** + * The damage value of the thrown potion that this EntityPotion represents. + */ + private ItemStack potionDamage; + + public LaunchedPotion(World par1World) + { + super(par1World); + } + + public LaunchedPotion(World par1World, EntityLiving par2EntityLiving, int par3) + { + this(par1World, par2EntityLiving, new ItemStack(Item.potion, 1, par3)); + } + + public LaunchedPotion(World par1World, EntityLiving par2EntityLiving, ItemStack par3ItemStack) + { + super(par1World, par2EntityLiving); + this.potionDamage = par3ItemStack; + } + + @SideOnly(Side.CLIENT) + public LaunchedPotion(World par1World, double par2, double par4, double par6, int par8) + { + this(par1World, par2, par4, par6, new ItemStack(Item.potion, 1, par8)); + } + + public LaunchedPotion(World par1World, double par2, double par4, double par6, ItemStack par8ItemStack) + { + super(par1World, par2, par4, par6); + this.potionDamage = par8ItemStack; + } + + /** + * Gets the amount of gravity to apply to the thrown entity with each tick. + */ + protected float getGravityVelocity() + { + return 0.05F; + } + + protected float func_70182_d() + { + return 1.0F; + } + + protected float func_70183_g() + { + return -10.0F; + } + + public void setPotionDamage(int par1) + { + if (this.potionDamage == null) + { + this.potionDamage = new ItemStack(Item.potion, 1, 0); + } + + this.potionDamage.setItemDamage(par1); + } + + /** + * Returns the damage value of the thrown potion that this EntityPotion represents. + */ + public int getPotionDamage() + { + if (this.potionDamage == null) + { + this.potionDamage = new ItemStack(Item.potion, 1, 0); + } + + return this.potionDamage.getItemDamage(); + } + + /** + * Called when this EntityThrowable hits a block or entity. + */ + protected void onImpact(MovingObjectPosition par1MovingObjectPosition) + { + if (!this.worldObj.isRemote) + { + List list = Item.potion.getEffects(this.potionDamage); + + if (list != null && !list.isEmpty()) + { + AxisAlignedBB axisalignedbb = this.boundingBox.expand(4.0D, 2.0D, 4.0D); + List list1 = this.worldObj.getEntitiesWithinAABB(EntityLiving.class, axisalignedbb); + + if (list1 != null && !list1.isEmpty()) + { + Iterator iterator = list1.iterator(); + + while (iterator.hasNext()) + { + EntityLiving entityliving = (EntityLiving)iterator.next(); + double d0 = this.getDistanceSqToEntity(entityliving); + + if (d0 < 16.0D) + { + double d1 = 1.0D - Math.sqrt(d0) / 4.0D; + + if (entityliving == par1MovingObjectPosition.entityHit) + { + d1 = 1.0D; + } + + Iterator iterator1 = list.iterator(); + + while (iterator1.hasNext()) + { + PotionEffect potioneffect = (PotionEffect)iterator1.next(); + int i = potioneffect.getPotionID(); + + if (Potion.potionTypes[i].isInstant()) + { + Potion.potionTypes[i].affectEntity(this.getThrower(), entityliving, potioneffect.getAmplifier(), d1); + } + else + { + int j = (int)(d1 * (double)potioneffect.getDuration() + 0.5D); + + if (j > 20) + { + entityliving.addPotionEffect(new PotionEffect(i, j, potioneffect.getAmplifier())); + } + } + } + } + } + } + } + + this.worldObj.playAuxSFX(2002, (int)Math.round(this.posX), (int)Math.round(this.posY), (int)Math.round(this.posZ), this.getPotionDamage()); + this.setDead(); + } + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + super.readEntityFromNBT(par1NBTTagCompound); + + if (par1NBTTagCompound.hasKey("Potion")) + { + this.potionDamage = ItemStack.loadItemStackFromNBT(par1NBTTagCompound.getCompoundTag("Potion")); + } + else + { + this.setPotionDamage(par1NBTTagCompound.getInteger("potionValue")); + } + + if (this.potionDamage == null) + { + this.setDead(); + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + super.writeEntityToNBT(par1NBTTagCompound); + + if (this.potionDamage != null) + { + par1NBTTagCompound.setCompoundTag("Potion", this.potionDamage.writeToNBT(new NBTTagCompound())); + } + } +} diff --git a/mods/tinker/tconstruct/entity/UnstableCreeper.java b/mods/tinker/tconstruct/entity/UnstableCreeper.java index 19f843dd..55d9d36e 100644 --- a/mods/tinker/tconstruct/entity/UnstableCreeper.java +++ b/mods/tinker/tconstruct/entity/UnstableCreeper.java @@ -10,7 +10,7 @@ public class UnstableCreeper extends EntityCreeper protected int timeSinceIgnited; protected int lastActiveTime; - protected int explosionRadius = 3; + protected float explosionRadius = 1.5f; public UnstableCreeper(World world) { @@ -31,11 +31,11 @@ public class UnstableCreeper extends EntityCreeper if (this.getPowered()) { - this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float) (this.explosionRadius * 2), flag); + this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float) (this.explosionRadius + 0.75f * (worldObj.difficultySetting-1))* 2, false); } else { - this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float) this.explosionRadius, flag); + this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float) (this.explosionRadius + 0.75f * (worldObj.difficultySetting-1)), false); } this.setDead(); @@ -87,11 +87,11 @@ public class UnstableCreeper extends EntityCreeper if (this.getPowered()) { - this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float) (this.explosionRadius * 2), flag); + this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float) (this.explosionRadius + 0.75f * (worldObj.difficultySetting-1))* 2, flag); } else { - this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float) this.explosionRadius, flag); + this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float) (this.explosionRadius + 0.75f * (worldObj.difficultySetting-1)), flag); } this.setDead(); diff --git a/mods/tinker/tconstruct/library/AbilityHelper.java b/mods/tinker/tconstruct/library/AbilityHelper.java index 03431531..354f0a01 100644 --- a/mods/tinker/tconstruct/library/AbilityHelper.java +++ b/mods/tinker/tconstruct/library/AbilityHelper.java @@ -297,7 +297,7 @@ public class AbilityHelper charge -= mineSpeed; ToolCore tool = (ToolCore) stack.getItem(); - stack.setItemDamage(1 + (tool.getMaxCharge() - charge) * (stack.getMaxDamage() - 1) / tool.getMaxCharge()); + stack.setItemDamage(1 + (tool.getMaxCharge(stack) - charge) * (stack.getMaxDamage() - 1) / tool.getMaxCharge(stack)); tags.setInteger("charge", charge); if (entity instanceof EntityPlayer) chargeFromArmor(stack, (EntityPlayer) entity); @@ -317,7 +317,7 @@ public class AbilityHelper IElectricItem electricArmor = (IElectricItem) armor.getItem(); ToolCore tool = (ToolCore) stack.getItem(); - if (electricArmor.canProvideEnergy() && electricArmor.getTier() >= ((IElectricItem) stack.getItem()).getTier()) + if (electricArmor.canProvideEnergy(stack) && electricArmor.getTier(stack) >= ((IElectricItem) stack.getItem()).getTier(stack)) { int chargeAmount = tool.charge(stack, Integer.MAX_VALUE, Integer.MAX_VALUE, true, true); chargeAmount = discharge(armor, chargeAmount, Integer.MAX_VALUE, true, false); @@ -337,22 +337,22 @@ public class AbilityHelper } } - public static int discharge (ItemStack itemStack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate) + public static int discharge (ItemStack stack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate) { - IElectricItem ielectricitem = (IElectricItem) itemStack.getItem(); + IElectricItem ielectricitem = (IElectricItem) stack.getItem(); if (ielectricitem instanceof ICustomElectricItem) { - return ((ICustomElectricItem) ielectricitem).discharge(itemStack, amount, tier, ignoreTransferLimit, simulate); + return ((ICustomElectricItem) ielectricitem).discharge(stack, amount, tier, ignoreTransferLimit, simulate); } - else if (amount >= 0 && itemStack.stackSize <= 1 && ielectricitem.getTier() <= tier) + else if (amount >= 0 && stack.stackSize <= 1 && ielectricitem.getTier(stack) <= tier) { - if (amount > ielectricitem.getTransferLimit() && !ignoreTransferLimit) + if (amount > ielectricitem.getTransferLimit(stack) && !ignoreTransferLimit) { - amount = ielectricitem.getTransferLimit(); + amount = ielectricitem.getTransferLimit(stack); } - NBTTagCompound tags = itemStack.getTagCompound();//StackUtil.getOrCreateNbtData(itemStack); + NBTTagCompound tags = stack.getTagCompound(); int charge = tags.getInteger("charge"); if (amount > charge) @@ -365,24 +365,24 @@ public class AbilityHelper if (!simulate) { tags.setInteger("charge", charge); - itemStack.itemID = charge > 0 ? ielectricitem.getChargedItemId() : ielectricitem.getEmptyItemId(); + stack.itemID = charge > 0 ? ielectricitem.getChargedItemId(stack) : ielectricitem.getEmptyItemId(stack); - if (itemStack.getItem() instanceof IElectricItem) + if (stack.getItem() instanceof IElectricItem) { - ielectricitem = (IElectricItem) itemStack.getItem(); + ielectricitem = (IElectricItem) stack.getItem(); - if (itemStack.getMaxDamage() > 2) + if (stack.getMaxDamage() > 2) { - itemStack.setItemDamage(1 + (ielectricitem.getMaxCharge() - charge) * (itemStack.getMaxDamage() - 2) / ielectricitem.getMaxCharge()); + stack.setItemDamage(1 + (ielectricitem.getMaxCharge(stack) - charge) * (stack.getMaxDamage() - 2) / ielectricitem.getMaxCharge(stack)); } else { - itemStack.setItemDamage(0); + stack.setItemDamage(0); } } else { - itemStack.setItemDamage(0); + stack.setItemDamage(0); } } diff --git a/mods/tinker/tconstruct/library/ToolCore.java b/mods/tinker/tconstruct/library/ToolCore.java index ebc12216..154402d6 100644 --- a/mods/tinker/tconstruct/library/ToolCore.java +++ b/mods/tinker/tconstruct/library/ToolCore.java @@ -253,15 +253,15 @@ public abstract class ToolCore extends Item implements ICustomElectricItem, IBox if (power != 0) { - if (power <= this.getMaxCharge() / 3) + if (power <= this.getMaxCharge(stack) / 3) color = "\u00a74"; - else if (power > this.getMaxCharge() * 2 / 3) + else if (power > this.getMaxCharge(stack) * 2 / 3) color = "\u00a72"; else color = "\u00a76"; } - String charge = new StringBuilder().append(color).append(tags.getInteger("charge")).append("/").append(getMaxCharge()).append(" En").toString(); + String charge = new StringBuilder().append(color).append(tags.getInteger("charge")).append("/").append(getMaxCharge(stack)).append(" En").toString(); list.add(charge); } if (tags.hasKey("InfiTool")) @@ -557,37 +557,37 @@ public abstract class ToolCore extends Item implements ICustomElectricItem, IBox } @Override - public boolean canProvideEnergy () + public boolean canProvideEnergy (ItemStack itemStack) { return true; } @Override - public int getChargedItemId () + public int getChargedItemId (ItemStack itemStack) { return this.itemID; } @Override - public int getEmptyItemId () + public int getEmptyItemId (ItemStack itemStack) { return this.itemID; } @Override - public int getMaxCharge () + public int getMaxCharge (ItemStack itemStack) { return 10000; } @Override - public int getTier () + public int getTier (ItemStack itemStack) { return 0; } @Override - public int getTransferLimit () + public int getTransferLimit (ItemStack itemStack) { return 32; } @@ -601,16 +601,16 @@ public abstract class ToolCore extends Item implements ICustomElectricItem, IBox if (amount > 0) { - if (amount > getTransferLimit() && !ignoreTransferLimit) + if (amount > getTransferLimit(stack) && !ignoreTransferLimit) { - amount = getTransferLimit(); + amount = getTransferLimit(stack); } int charge = tags.getInteger("charge"); - if (amount > getMaxCharge() - charge) + if (amount > getMaxCharge(stack) - charge) { - amount = getMaxCharge() - charge; + amount = getMaxCharge(stack) - charge; } charge += amount; @@ -618,7 +618,7 @@ public abstract class ToolCore extends Item implements ICustomElectricItem, IBox if (!simulate) { tags.setInteger("charge", charge); - stack.setItemDamage(1 + (getMaxCharge() - charge) * (stack.getMaxDamage() - 2) / getMaxCharge()); + stack.setItemDamage(1 + (getMaxCharge(stack) - charge) * (stack.getMaxDamage() - 2) / getMaxCharge(stack)); } return amount; @@ -637,9 +637,9 @@ public abstract class ToolCore extends Item implements ICustomElectricItem, IBox if (amount > 0) { - if (amount > getTransferLimit() && !ignoreTransferLimit) + if (amount > getTransferLimit(stack) && !ignoreTransferLimit) { - amount = getTransferLimit(); + amount = getTransferLimit(stack); } int charge = tags.getInteger("charge"); @@ -654,7 +654,7 @@ public abstract class ToolCore extends Item implements ICustomElectricItem, IBox if (!simulate) { tags.setInteger("charge", charge); - stack.setItemDamage(1 + (getMaxCharge() - charge) * (stack.getMaxDamage() - 1) / getMaxCharge()); + stack.setItemDamage(1 + (getMaxCharge(stack) - charge) * (stack.getMaxDamage() - 1) / getMaxCharge(stack)); } return amount; @@ -663,16 +663,16 @@ public abstract class ToolCore extends Item implements ICustomElectricItem, IBox else return 0; } - - @Override - public boolean canUse (ItemStack itemStack, int amount) - { - return false; - } - + @Override public boolean canShowChargeToolTip (ItemStack itemStack) { return false; } + + @Override + public boolean canUse (ItemStack itemStack, int amount) + { + return false; + } } diff --git a/mods/tinker/tconstruct/tools/PotionLauncher.java b/mods/tinker/tconstruct/tools/PotionLauncher.java new file mode 100644 index 00000000..9dc978e4 --- /dev/null +++ b/mods/tinker/tconstruct/tools/PotionLauncher.java @@ -0,0 +1,122 @@ +package mods.tinker.tconstruct.tools; + +import mods.tinker.tconstruct.entity.LaunchedPotion; +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.item.EnumAction; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.Icon; +import net.minecraft.world.World; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class PotionLauncher extends Item +{ + @SideOnly(Side.CLIENT) + private Icon[] icons; + public static final String[] textureNames = new String[] { "potionlauncher" }; + + public PotionLauncher(int par1) + { + super(par1); + this.maxStackSize = 1; + this.setCreativeTab(CreativeTabs.tabCombat); + this.setMaxDamage(3); + } + + public ItemStack onEaten (ItemStack stack, World world, EntityPlayer player) + { + if (stack.getItemDamage() == 0) + stack.setItemDamage(1); + return stack; + } + + public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int time) + { + if (stack.getItemDamage() == 1) + stack.setItemDamage(2); + } + + /** + * How long it takes to use or consume an item + */ + public int getMaxItemUseDuration (ItemStack stack) + { + int meta = stack.getItemDamage(); + if (meta == 1) + return 72000; + else if (meta == 2) + return 0; + + return 30; + } + + /** + * returns the action that specifies what animation to play when the items is being used + */ + public EnumAction getItemUseAction (ItemStack stack) + { + if (stack.getItemDamage() == 0) + return EnumAction.bow; + else + return EnumAction.none; + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player) + { + if (stack.getItemDamage() == 2) + { + world.playSoundAtEntity(player, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); + + if (!world.isRemote) + { + world.spawnEntityInWorld(new LaunchedPotion(world, player, stack)); + } + + stack.damageItem(1, player); + System.out.println("Rawr! "+stack.getItemDamage()); + } + + else + { + if (player.capabilities.isCreativeMode) + { + player.setItemInUse(stack, this.getMaxItemUseDuration(stack)); + } + } + return stack; + } + + /** + * Return the enchantability factor of the item, most of the time is based on material. + */ + public int getItemEnchantability () + { + return 1; + } + + @SideOnly(Side.CLIENT) + public void updateIcons (IconRegister par1IconRegister) + { + this.icons = new Icon[textureNames.length]; + + for (int i = 0; i < this.icons.length; ++i) + { + this.icons[i] = par1IconRegister.registerIcon("tinker:" + textureNames[i]); + } + } + + @SideOnly(Side.CLIENT) + public Icon getIconFromDamage (int meta) + { + return icons[0]; + } +} diff --git a/mods/tinker/textures/GGE/GUIPedestal.png b/mods/tinker/textures/GGE/GUIPedestal.png new file mode 100644 index 00000000..2de45bac Binary files /dev/null and b/mods/tinker/textures/GGE/GUIPedestal.png differ diff --git a/mods/tinker/textures/GGE/ItemLBInnerSide.png b/mods/tinker/textures/GGE/ItemLBInnerSide.png new file mode 100644 index 00000000..4f86b2ee Binary files /dev/null and b/mods/tinker/textures/GGE/ItemLBInnerSide.png differ diff --git a/mods/tinker/textures/GGE/ItemLBOuterSide.png b/mods/tinker/textures/GGE/ItemLBOuterSide.png new file mode 100644 index 00000000..3af81220 Binary files /dev/null and b/mods/tinker/textures/GGE/ItemLBOuterSide.png differ diff --git a/mods/tinker/textures/GGE/ItemLBPoleSide.png b/mods/tinker/textures/GGE/ItemLBPoleSide.png new file mode 100644 index 00000000..985c6007 Binary files /dev/null and b/mods/tinker/textures/GGE/ItemLBPoleSide.png differ diff --git a/mods/tinker/textures/GGE/achievementsbg.png b/mods/tinker/textures/GGE/achievementsbg.png new file mode 100644 index 00000000..0778b53b Binary files /dev/null and b/mods/tinker/textures/GGE/achievementsbg.png differ diff --git a/mods/tinker/textures/GGE/b.png b/mods/tinker/textures/GGE/b.png new file mode 100644 index 00000000..d7751bbe Binary files /dev/null and b/mods/tinker/textures/GGE/b.png differ diff --git a/mods/tinker/textures/GGE/core.png b/mods/tinker/textures/GGE/core.png new file mode 100644 index 00000000..7cbf9640 Binary files /dev/null and b/mods/tinker/textures/GGE/core.png differ diff --git a/mods/tinker/textures/GGE/corestone.png b/mods/tinker/textures/GGE/corestone.png new file mode 100644 index 00000000..9435d961 Binary files /dev/null and b/mods/tinker/textures/GGE/corestone.png differ diff --git a/mods/tinker/textures/GGE/elderpork.png b/mods/tinker/textures/GGE/elderpork.png new file mode 100644 index 00000000..c28c42c3 Binary files /dev/null and b/mods/tinker/textures/GGE/elderpork.png differ diff --git a/mods/tinker/textures/GGE/face.png b/mods/tinker/textures/GGE/face.png new file mode 100644 index 00000000..db168b01 Binary files /dev/null and b/mods/tinker/textures/GGE/face.png differ diff --git a/mods/tinker/textures/GGE/glowlogside.png b/mods/tinker/textures/GGE/glowlogside.png new file mode 100644 index 00000000..2cc4326e Binary files /dev/null and b/mods/tinker/textures/GGE/glowlogside.png differ diff --git a/mods/tinker/textures/GGE/glowlogtop.png b/mods/tinker/textures/GGE/glowlogtop.png new file mode 100644 index 00000000..a1e3fe27 Binary files /dev/null and b/mods/tinker/textures/GGE/glowlogtop.png differ diff --git a/mods/tinker/textures/GGE/glowsapling.png b/mods/tinker/textures/GGE/glowsapling.png new file mode 100644 index 00000000..7c3db189 Binary files /dev/null and b/mods/tinker/textures/GGE/glowsapling.png differ diff --git a/mods/tinker/textures/GGE/lifebench top.png b/mods/tinker/textures/GGE/lifebench top.png new file mode 100644 index 00000000..d006eb15 Binary files /dev/null and b/mods/tinker/textures/GGE/lifebench top.png differ diff --git a/mods/tinker/textures/GGE/lifebenchside.png b/mods/tinker/textures/GGE/lifebenchside.png new file mode 100644 index 00000000..5135e80b Binary files /dev/null and b/mods/tinker/textures/GGE/lifebenchside.png differ diff --git a/mods/tinker/textures/GGE/lifebenchtop.png b/mods/tinker/textures/GGE/lifebenchtop.png new file mode 100644 index 00000000..00fe69ff Binary files /dev/null and b/mods/tinker/textures/GGE/lifebenchtop.png differ diff --git a/mods/tinker/textures/GGE/notebook.png b/mods/tinker/textures/GGE/notebook.png new file mode 100644 index 00000000..3836208a Binary files /dev/null and b/mods/tinker/textures/GGE/notebook.png differ diff --git a/mods/tinker/textures/GGE/recharger.png b/mods/tinker/textures/GGE/recharger.png new file mode 100644 index 00000000..9051f69b Binary files /dev/null and b/mods/tinker/textures/GGE/recharger.png differ diff --git a/mods/tinker/textures/GGE/transparency.png b/mods/tinker/textures/GGE/transparency.png new file mode 100644 index 00000000..1c65debf Binary files /dev/null and b/mods/tinker/textures/GGE/transparency.png differ diff --git a/mods/tinker/textures/GGE/wand.png b/mods/tinker/textures/GGE/wand.png new file mode 100644 index 00000000..d8e63b7d Binary files /dev/null and b/mods/tinker/textures/GGE/wand.png differ diff --git a/mods/tinker/textures/blocks/golemcore.png b/mods/tinker/textures/blocks/golemcore.png new file mode 100644 index 00000000..69138cf2 Binary files /dev/null and b/mods/tinker/textures/blocks/golemcore.png differ diff --git a/mods/tinker/textures/blocks/golemhead_face.png b/mods/tinker/textures/blocks/golemhead_face.png new file mode 100644 index 00000000..265c8478 Binary files /dev/null and b/mods/tinker/textures/blocks/golemhead_face.png differ diff --git a/mods/tinker/textures/blocks/golemhead_side.png b/mods/tinker/textures/blocks/golemhead_side.png new file mode 100644 index 00000000..27634f02 Binary files /dev/null and b/mods/tinker/textures/blocks/golemhead_side.png differ diff --git a/mods/tinker/textures/blocks/golemhead_top.png b/mods/tinker/textures/blocks/golemhead_top.png new file mode 100644 index 00000000..ac18aca2 Binary files /dev/null and b/mods/tinker/textures/blocks/golemhead_top.png differ diff --git a/mods/tinker/textures/blocks/pedestal.png b/mods/tinker/textures/blocks/pedestal.png new file mode 100644 index 00000000..b1c1cc7b Binary files /dev/null and b/mods/tinker/textures/blocks/pedestal.png differ diff --git a/mods/tinker/textures/blocks/pedestalbottom.png b/mods/tinker/textures/blocks/pedestalbottom.png new file mode 100644 index 00000000..ceb0faf5 Binary files /dev/null and b/mods/tinker/textures/blocks/pedestalbottom.png differ diff --git a/mods/tinker/textures/blocks/pedestalside.png b/mods/tinker/textures/blocks/pedestalside.png new file mode 100644 index 00000000..00e44251 Binary files /dev/null and b/mods/tinker/textures/blocks/pedestalside.png differ diff --git a/mods/tinker/textures/blocks/pedestaltop.png b/mods/tinker/textures/blocks/pedestaltop.png new file mode 100644 index 00000000..c10428cd Binary files /dev/null and b/mods/tinker/textures/blocks/pedestaltop.png differ diff --git a/mods/tinker/textures/blocks/pedestaltopp.png b/mods/tinker/textures/blocks/pedestaltopp.png new file mode 100644 index 00000000..1d9bf4e8 Binary files /dev/null and b/mods/tinker/textures/blocks/pedestaltopp.png differ diff --git a/mods/tinker/textures/blocks/pedestaltops.png b/mods/tinker/textures/blocks/pedestaltops.png new file mode 100644 index 00000000..53167eb1 Binary files /dev/null and b/mods/tinker/textures/blocks/pedestaltops.png differ diff --git a/mods/tinker/textures/items/materials.png b/mods/tinker/textures/items/materials.png deleted file mode 100644 index 37386c5f..00000000 Binary files a/mods/tinker/textures/items/materials.png and /dev/null differ diff --git a/mods/tinker/textures/items/patterns.png b/mods/tinker/textures/items/patterns.png deleted file mode 100644 index c264315c..00000000 Binary files a/mods/tinker/textures/items/patterns.png and /dev/null differ diff --git a/mods/tinker/textures/items/potionlauncher.png b/mods/tinker/textures/items/potionlauncher.png new file mode 100644 index 00000000..9129d408 Binary files /dev/null and b/mods/tinker/textures/items/potionlauncher.png differ diff --git a/test/NegaFood.java b/test/NegaFood.java new file mode 100644 index 00000000..54bd4f76 --- /dev/null +++ b/test/NegaFood.java @@ -0,0 +1,14 @@ +package test; + +import net.minecraft.item.ItemFood; + +public class NegaFood extends ItemFood +{ + + public NegaFood() + { + super(10001, -20, 0, false); + setAlwaysEdible(); + } + +} diff --git a/test/XinStick.java b/test/XinStick.java index 462b2f8e..67450524 100644 --- a/test/XinStick.java +++ b/test/XinStick.java @@ -1,6 +1,6 @@ package test; -import mods.tinker.tconstruct.entity.BlueSlime; +import mods.tinker.tconstruct.entity.UnstableCreeper; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; @@ -28,7 +28,7 @@ public class XinStick extends Item //spawnItem(player.posX, player.posY, player.posZ, tool, world); //CartEntity cart = new CartEntity(world, 1); //cart.cartType = 1; - spawnEntity(player.posX, player.posY+1, player.posZ, new BlueSlime(world), world, player); + spawnEntity(player.posX, player.posY+1, player.posZ, new UnstableCreeper(world), world, player); return stack; } diff --git a/test/mod_Test.java b/test/mod_Test.java index c5bf91ab..8e539a25 100644 --- a/test/mod_Test.java +++ b/test/mod_Test.java @@ -5,6 +5,7 @@ import javax.script.ScriptException; import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; +import net.minecraft.item.ItemFood; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.Mod.PostInit; @@ -24,13 +25,14 @@ public class mod_Test { public static Item xinstick; public static Item TArmorChestplate; + public static Item negaFood; public KeyBinding grabKey; EntityPlayer player; @PreInit public void preInit(FMLPreInitializationEvent evt) { - System.out.println("Test!"); + //System.out.println("Test!"); } @Init @@ -67,6 +69,8 @@ public class mod_Test static { xinstick = new XinStick(10000).setUnlocalizedName("xinstick"); - LanguageRegistry.addName(xinstick, "XinRecord"); + negaFood = new NegaFood().setUnlocalizedName("negaFood"); + LanguageRegistry.addName(xinstick, "XinBroken"); + LanguageRegistry.addName(negaFood, "Negafood"); } }