diff --git a/bin/com/kitsu/medievalcraft/ClientProxy.class b/bin/com/kitsu/medievalcraft/ClientProxy.class index cbb060ad..76b6f6bf 100644 Binary files a/bin/com/kitsu/medievalcraft/ClientProxy.class and b/bin/com/kitsu/medievalcraft/ClientProxy.class differ diff --git a/bin/com/kitsu/medievalcraft/block/ModBlocks.class b/bin/com/kitsu/medievalcraft/block/ModBlocks.class index fc50aca6..56cab13c 100644 Binary files a/bin/com/kitsu/medievalcraft/block/ModBlocks.class and b/bin/com/kitsu/medievalcraft/block/ModBlocks.class differ diff --git a/bin/com/kitsu/medievalcraft/block/machines/formTable.class b/bin/com/kitsu/medievalcraft/block/machines/formTable.class index 2dd19098..7f03dc4b 100644 Binary files a/bin/com/kitsu/medievalcraft/block/machines/formTable.class and b/bin/com/kitsu/medievalcraft/block/machines/formTable.class differ diff --git a/bin/com/kitsu/medievalcraft/contain/ContainerFormTable.class b/bin/com/kitsu/medievalcraft/contain/ContainerFormTable.class index 65689f75..5e2834d2 100644 Binary files a/bin/com/kitsu/medievalcraft/contain/ContainerFormTable.class and b/bin/com/kitsu/medievalcraft/contain/ContainerFormTable.class differ diff --git a/bin/com/kitsu/medievalcraft/events/EventHandle.class b/bin/com/kitsu/medievalcraft/events/EventHandle.class index 395008e2..b0e5552b 100644 Binary files a/bin/com/kitsu/medievalcraft/events/EventHandle.class and b/bin/com/kitsu/medievalcraft/events/EventHandle.class differ diff --git a/bin/com/kitsu/medievalcraft/gui/GuiHandler.class b/bin/com/kitsu/medievalcraft/gui/GuiHandler.class index 4b4ee023..1fe6ef18 100644 Binary files a/bin/com/kitsu/medievalcraft/gui/GuiHandler.class and b/bin/com/kitsu/medievalcraft/gui/GuiHandler.class differ diff --git a/bin/com/kitsu/medievalcraft/renderer/RendererRegistry.class b/bin/com/kitsu/medievalcraft/renderer/RendererRegistry.class index 9b4b16f7..7f11056f 100644 Binary files a/bin/com/kitsu/medievalcraft/renderer/RendererRegistry.class and b/bin/com/kitsu/medievalcraft/renderer/RendererRegistry.class differ diff --git a/bin/com/kitsu/medievalcraft/tileents/TileEntRegister.class b/bin/com/kitsu/medievalcraft/tileents/TileEntRegister.class index 6ed17501..be2d1c3a 100644 Binary files a/bin/com/kitsu/medievalcraft/tileents/TileEntRegister.class and b/bin/com/kitsu/medievalcraft/tileents/TileEntRegister.class differ diff --git a/src/main/java/com/kitsu/medievalcraft/ClientProxy.java b/src/main/java/com/kitsu/medievalcraft/ClientProxy.java index 8bdc2e8f..17447768 100644 --- a/src/main/java/com/kitsu/medievalcraft/ClientProxy.java +++ b/src/main/java/com/kitsu/medievalcraft/ClientProxy.java @@ -6,7 +6,6 @@ import com.kitsu.medievalcraft.entity.EntityModelArrow; import com.kitsu.medievalcraft.entity.EntityModelITArrow; import com.kitsu.medievalcraft.entity.EntityShit; import com.kitsu.medievalcraft.entity.EntityTester; -import com.kitsu.medievalcraft.entity.ProjectileCannonBall; import com.kitsu.medievalcraft.item.ModItems; import com.kitsu.medievalcraft.renderer.RenderId; import com.kitsu.medievalcraft.renderer.RendererRegistry; @@ -14,7 +13,6 @@ import com.kitsu.medievalcraft.renderer.blocks.RenderModelArrow; import com.kitsu.medievalcraft.renderer.blocks.RenderModelITArrow; import com.kitsu.medievalcraft.renderer.blocks.RenderModelITSpear; import com.kitsu.medievalcraft.renderer.blocks.cannons.Render_CannonBall_Iron; -import com.kitsu.medievalcraft.renderer.blocks.cannons.Render_CannonBall_Projectile; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.registry.RenderingRegistry; diff --git a/src/main/java/com/kitsu/medievalcraft/block/ModBlocks.java b/src/main/java/com/kitsu/medievalcraft/block/ModBlocks.java index b493f455..229cf1bb 100644 --- a/src/main/java/com/kitsu/medievalcraft/block/ModBlocks.java +++ b/src/main/java/com/kitsu/medievalcraft/block/ModBlocks.java @@ -17,7 +17,7 @@ import com.kitsu.medievalcraft.block.crucible.empty.EmptySoftCrucible; import com.kitsu.medievalcraft.block.crucible.empty.FilledWaterCrucible; import com.kitsu.medievalcraft.block.crucible.empty.SlackWaterCrucible; import com.kitsu.medievalcraft.block.crucible.empty.TanWaterCrucible; -import com.kitsu.medievalcraft.block.decorative.CannonBall28; +import com.kitsu.medievalcraft.block.decorative.CannonBallBlock28; import com.kitsu.medievalcraft.block.decorative.EggWashedBrick; import com.kitsu.medievalcraft.block.decorative.EggWashedWall; import com.kitsu.medievalcraft.block.decorative.LimestoneRaw; @@ -191,7 +191,7 @@ public class ModBlocks { GameRegistry.registerBlock(forge = new Forge("forge", Material.rock), "forge"); GameRegistry.registerBlock(cannon_28 = new Cannon_28("cannon_28", Material.iron), "cannon_28"); - GameRegistry.registerBlock(cannonBall_28 = new CannonBall28("cannonBall28", Material.iron), "cannonBall28"); + GameRegistry.registerBlock(cannonBall_28 = new CannonBallBlock28("cannonBallBlock_28", Material.iron), "cannonBallBlock_28"); /*GameRegistry.registerBlock(myIronIngot = new MyIronIngot("myIronIngot", Material.iron), "myIronIngot"); GameRegistry.registerBlock(damascusIngot = new DamascusIngot("damascusIngot", Material.iron), "damascusIngot"); diff --git a/src/main/java/com/kitsu/medievalcraft/block/decorative/CannonBall28.java b/src/main/java/com/kitsu/medievalcraft/block/decorative/CannonBallBlock28.java similarity index 67% rename from src/main/java/com/kitsu/medievalcraft/block/decorative/CannonBall28.java rename to src/main/java/com/kitsu/medievalcraft/block/decorative/CannonBallBlock28.java index 22b6a6ca..57dd33ec 100644 --- a/src/main/java/com/kitsu/medievalcraft/block/decorative/CannonBall28.java +++ b/src/main/java/com/kitsu/medievalcraft/block/decorative/CannonBallBlock28.java @@ -7,6 +7,7 @@ import com.kitsu.medievalcraft.block.ModBlocks; import com.kitsu.medievalcraft.renderer.RenderId; import com.kitsu.medievalcraft.tileents.cannon.TileCannonBall28; import com.kitsu.medievalcraft.tileents.ingots.TileEntityMyDiamond; +import com.kitsu.medievalcraft.util.CustomTab; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; @@ -18,58 +19,54 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -public class CannonBall28 extends BlockContainer { +public class CannonBallBlock28 extends BlockContainer { - public CannonBall28(String unlocalizedName, Material material) { + public CannonBallBlock28(String unlocalizedName, Material material) { super(material); this.setBlockName(unlocalizedName); this.setBlockTextureName(Main.MODID + ":" + unlocalizedName); - //this.setCreativeTab(CustomTab.MedievalCraftTab); - this.setHardness(1.0F); - this.setResistance(1.0F); - this.setHarvestLevel(null, 0); - this.setStepSound(soundTypeGlass); + this.setCreativeTab(CustomTab.MedievalCraftTab); + this.setHardness(3.0F); + this.setResistance(8.0F); + this.setHarvestLevel("pickaxe",1, 0); + this.setStepSound(soundTypeStone); //this.setLightLevel(2.0F); //xmin, ymin, zmin, this.setBlockBounds(0.38F, 0.0F, 0.38F, //xmax, ymax, zmax 0.62F, 0.2F, 0.62F); } - + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_){ int a = player.inventory.currentItem; - - if(player.inventory.getStackInSlot(a)!=null){ - if(player.getHeldItem().getItem()==Item.getItemFromBlock(this)){ + if(!world.isRemote){ + if(player.inventory.getStackInSlot(a)!=null){ + if(player.getHeldItem().getItem()==Item.getItemFromBlock(this)){ + ItemStack jar = new ItemStack(this); + player.inventory.addItemStackToInventory(jar); + if(!world.isRemote){ + world.setBlock(x, y, z, Blocks.air, 0, 2); + } + } + } + if(player.inventory.getStackInSlot(a)==null){ ItemStack jar = new ItemStack(this); - player.inventory.addItemStackToInventory(jar); + player.inventory.setInventorySlotContents(a, jar); if(!world.isRemote){ world.setBlock(x, y, z, Blocks.air, 0, 2); } } } - if(player.inventory.getStackInSlot(a)==null){ - ItemStack jar = new ItemStack(this); - player.inventory.setInventorySlotContents(a, jar); - if(!world.isRemote){ - world.setBlock(x, y, z, Blocks.air, 0, 2); - } - } return false; } - @Override - public Item getItemDropped(int metadata, Random random, int fortune) { - return Item.getItemFromBlock(this); - } - @Override public TileEntity createNewTileEntity(World world, int i) { return new TileCannonBall28(); } - + @Override public int getRenderType() { return RenderId.my28CannonBallID; diff --git a/src/main/java/com/kitsu/medievalcraft/block/machines/Cannon_28.java b/src/main/java/com/kitsu/medievalcraft/block/machines/Cannon_28.java index 0bf8583d..17d9b0fd 100644 --- a/src/main/java/com/kitsu/medievalcraft/block/machines/Cannon_28.java +++ b/src/main/java/com/kitsu/medievalcraft/block/machines/Cannon_28.java @@ -9,6 +9,7 @@ import com.kitsu.medievalcraft.block.ModBlocks; import com.kitsu.medievalcraft.entity.EntityCannonBall; import com.kitsu.medievalcraft.entity.EntityModelArrow; import com.kitsu.medievalcraft.entity.ProjectileCannonBall; +import com.kitsu.medievalcraft.gui.GuiHandler; import com.kitsu.medievalcraft.item.ModItems; import com.kitsu.medievalcraft.renderer.RenderId; import com.kitsu.medievalcraft.tileents.cannon.TileCannon_28; @@ -54,7 +55,7 @@ public class Cannon_28 extends BlockContainer{ this.setHardness(3.0F); this.setResistance(5.0F); this.setHarvestLevel("pickaxe", 1, 0); - this.setStepSound(Block.soundTypeAnvil); + this.setStepSound(Block.soundTypeMetal); //this.isFlammable(world, x, y, z, face); //(xmin, ymin, zmin, // xmax, ymax, zmax) @@ -75,39 +76,91 @@ public class Cannon_28 extends BlockContainer{ super.randomDisplayTick(world, x, y, z, random); } - + private Entity shootCannon(World world, Integer x, Integer y, Integer z){ EntityCannonBall cannonball = null; + TileCannon_28 tile = (TileCannon_28) world.getTileEntity(x, y, z); + Item ball = new ItemStack(ModBlocks.cannonBall_28, 0, 1).getItem(); - if(world.getBlockMetadata(x, y, z)==3){ - cannonball = new EntityCannonBall(world, (double)x+2, (double)y, (double)z, null); - cannonball.setVelocity(5+world.rand.nextFloat(), 0.25, (world.rand.nextFloat()*2-1)/5); + if(tile.getStackInSlot(0)!=null){ + if(world.getBlockMetadata(x, y, z)==3){ + tile.isOn=true; + world.playSoundEffect(x, y, z, "random.fizz", 0.1f, world.rand.nextFloat()/0.5f * 0.1F + 0.8F); + world.playSoundEffect(x, y, z, "random.explode", 0.5f, world.rand.nextFloat()/0.5f * 0.1F + 0.8F); + if(tile.getStackInSlot(1)!=null){ + if(tile.getStackInSlot(1).getItem()==ball){ + tile.decrStackSize(1, 1); + cannonball = new EntityCannonBall(world, (double)x+2, (double)y, (double)z, null); + cannonball.setVelocity(tile.getStackInSlot(0).stackSize-world.rand.nextFloat(), 0.25, (world.rand.nextFloat()*2-1)/5); + tile.markForUpdate(); + tile.markDirty(); + } + } + } } - if(world.getBlockMetadata(x, y, z)==2){ - cannonball = new EntityCannonBall(world, (double)x, (double)y, (double)z-2, null); - cannonball.setVelocity((world.rand.nextFloat()*2-1)/5, 0.25, -5-world.rand.nextFloat()); + if(tile.getStackInSlot(0)!=null){ + if(world.getBlockMetadata(x, y, z)==2){ + tile.isOn=true; + world.playSoundEffect(x, y, z, "random.fizz", 0.1f, world.rand.nextFloat()/0.5f * 0.1F + 0.8F); + world.playSoundEffect(x, y, z, "random.explode", 0.5f, world.rand.nextFloat()/0.5f * 0.1F + 0.8F); + if(tile.getStackInSlot(1)!=null){ + if(tile.getStackInSlot(1).getItem()==ball){ + tile.decrStackSize(1, 1); + cannonball = new EntityCannonBall(world, (double)x, (double)y, (double)z-2, null); + cannonball.setVelocity((world.rand.nextFloat()*2-1)/5, 0.25, -tile.getStackInSlot(0).stackSize+world.rand.nextFloat()); + tile.markForUpdate(); + tile.markDirty(); + } + } + } } - if(world.getBlockMetadata(x, y, z)==1){ - cannonball = new EntityCannonBall(world, (double)x-2, (double)y, (double)z, null); - cannonball.setVelocity(-5-world.rand.nextFloat(), 0.25, (world.rand.nextFloat()*2-1)/5); + if(tile.getStackInSlot(0)!=null){ + if(world.getBlockMetadata(x, y, z)==1){ + tile.isOn=true; + world.playSoundEffect(x, y, z, "random.fizz", 0.1f, world.rand.nextFloat()/0.5f * 0.1F + 0.8F); + world.playSoundEffect(x, y, z, "random.explode", 0.5f, world.rand.nextFloat()/0.5f * 0.1F + 0.8F); + if(tile.getStackInSlot(1)!=null){ + if(tile.getStackInSlot(1).getItem()==ball){ + tile.decrStackSize(1, 1); + cannonball = new EntityCannonBall(world, (double)x-2, (double)y, (double)z, null); + cannonball.setVelocity(-tile.getStackInSlot(0).stackSize+world.rand.nextFloat(), 0.25, (world.rand.nextFloat()*2-1)/5); + tile.markForUpdate(); + tile.markDirty(); + } + } + } } - if(world.getBlockMetadata(x, y, z)==0){ - cannonball = new EntityCannonBall(world, (double)x, (double)y, (double)z+2, null); - cannonball.setVelocity((world.rand.nextFloat()*2-1)/5, 0.25, 5+world.rand.nextFloat()); + if(tile.getStackInSlot(0)!=null){ + if(world.getBlockMetadata(x, y, z)==0){ + tile.isOn=true; + world.playSoundEffect(x, y, z, "random.fizz", 0.1f, world.rand.nextFloat()/0.5f * 0.1F + 0.8F); + world.playSoundEffect(x, y, z, "random.explode", 0.5f, world.rand.nextFloat()/0.5f * 0.1F + 0.8F); + if(tile.getStackInSlot(1)!=null){ + if(tile.getStackInSlot(1).getItem()==ball){ + tile.decrStackSize(1, 1); + cannonball = new EntityCannonBall(world, (double)x, (double)y, (double)z+2, null); + cannonball.setVelocity((world.rand.nextFloat()*2-1)/5, 0.25, tile.getStackInSlot(0).stackSize-world.rand.nextFloat()); + tile.markForUpdate(); + tile.markDirty(); + } + } + } } + tile.setInventorySlotContents(0, null); + tile.markForUpdate(); + tile.markDirty(); return cannonball; } + + + public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) { if(!world.isRemote){ TileCannon_28 tileEnt = (TileCannon_28) world.getTileEntity(x, y, z); if(tileEnt.isOn==false){ if(player.inventory.getCurrentItem()!=null){ if(player.inventory.getCurrentItem().getItem()==Items.flint_and_steel){ - tileEnt.isOn=true; - world.playSoundEffect(x, y, z, "random.fizz", 0.1f, world.rand.nextFloat()/0.5f * 0.1F + 0.8F); - world.playSoundEffect(x, y, z, "random.explode", 0.5f, world.rand.nextFloat()/0.5f * 0.1F + 0.8F); - world.spawnEntityInWorld(shootCannon(world,x,y,z)); tileEnt.markForUpdate(); tileEnt.markDirty(); @@ -115,7 +168,14 @@ public class Cannon_28 extends BlockContainer{ } } } + if (!player.isSneaking()) { + if(player.inventory.getCurrentItem()==null||player.inventory.getCurrentItem().getItem()!=Items.flint_and_steel){ + player.openGui(Main.instance, GuiHandler.guiIDcannon28, world, x, y, z); + return true; + } + } } + return false; } @Override diff --git a/src/main/java/com/kitsu/medievalcraft/block/machines/formTable.java b/src/main/java/com/kitsu/medievalcraft/block/machines/formTable.java index 332d5a18..934d83a0 100644 --- a/src/main/java/com/kitsu/medievalcraft/block/machines/formTable.java +++ b/src/main/java/com/kitsu/medievalcraft/block/machines/formTable.java @@ -32,7 +32,6 @@ public class formTable extends Block { this.setCreativeTab(CustomTab.MedievalCraftTab); this.setHardness(3.5F); this.setResistance(2.0F); - } @SideOnly(Side.CLIENT) diff --git a/src/main/java/com/kitsu/medievalcraft/contain/ContainerCannon_28.java b/src/main/java/com/kitsu/medievalcraft/contain/ContainerCannon_28.java new file mode 100644 index 00000000..b75b3456 --- /dev/null +++ b/src/main/java/com/kitsu/medievalcraft/contain/ContainerCannon_28.java @@ -0,0 +1,81 @@ +package com.kitsu.medievalcraft.contain; + +import com.kitsu.medievalcraft.tileents.cannon.TileCannon_28; +import com.kitsu.medievalcraft.tileents.machine.TileForge; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class ContainerCannon_28 extends Container { + + protected TileCannon_28 tileEnt; + + @Override + public boolean canInteractWith(EntityPlayer player) { + return tileEnt.isUseableByPlayer(player); + } + + public ContainerCannon_28 (InventoryPlayer inventoryPlayer, TileCannon_28 te){ + tileEnt = te; + + //the Slot constructor takes the IInventory and the slot number in that it binds to + //and the x-y coordinates it resides on-screen + /* for (int i = 0; i < 2; i++) { + for (int j = 0; j < 2; j++) { + addSlotToContainer(new Slot(tileEnt, j + i * 3, 62 + j * 18, 17 + i * 18)); + } + }*/ + addSlotToContainer(new Slot(tileEnt, 0, 80, 34)); + addSlotToContainer(new Slot(tileEnt, 1, 100, 34)); + //commonly used vanilla code that adds the player's inventory + bindPlayerInventory(inventoryPlayer); + } + + protected void bindPlayerInventory(InventoryPlayer inventoryPlayer) { + for (int i = 0; i < 3; i++) { + for (int j = 0; j < 9; j++) { + addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9, + 8 + j * 18, 84 + i * 18)); + } + } + + for (int i = 0; i < 9; i++) { + addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 142)); + } + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer player, int slot) { + ItemStack stack = null; + Slot slotObject = (Slot) inventorySlots.get(slot); + + //null checks and checks if the item can be stacked (maxStackSize > 1) + /*if (slotObject != null && slotObject.getHasStack()) { + ItemStack stackInSlot = slotObject.getStack(); + stack = stackInSlot.copy(); + + //merges the item into player inventory since its in the tileEntity + if (slot < 9) { + if (!this.mergeItemStack(stackInSlot, 9, this.inventorySlots.size(), true)) { + return null; + } + } + //places it into the tileEntity is possible since its in the player inventory + else if (!this.mergeItemStack(stackInSlot, 0, 9, false)) { + return null; + } + + if (stackInSlot.stackSize == 0) { + slotObject.putStack((ItemStack)null); + } else { + slotObject.onSlotChanged(); + } + + }*/ + return stack; + } + +} \ No newline at end of file diff --git a/src/main/java/com/kitsu/medievalcraft/contain/ContainerFormTable.java b/src/main/java/com/kitsu/medievalcraft/contain/ContainerFormTable.java index bb475a8b..5fb7b3da 100644 --- a/src/main/java/com/kitsu/medievalcraft/contain/ContainerFormTable.java +++ b/src/main/java/com/kitsu/medievalcraft/contain/ContainerFormTable.java @@ -68,7 +68,7 @@ public class ContainerFormTable extends Container { /** * Called when the container is closed. */ - public void onContainerClosed(EntityPlayer player) + /*public void onContainerClosed(EntityPlayer player) { super.onContainerClosed(player); @@ -84,7 +84,7 @@ public class ContainerFormTable extends Container { } } } - } + }*/ public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_) { diff --git a/src/main/java/com/kitsu/medievalcraft/events/EventHandle.java b/src/main/java/com/kitsu/medievalcraft/events/EventHandle.java index ac504be6..f5a31135 100644 --- a/src/main/java/com/kitsu/medievalcraft/events/EventHandle.java +++ b/src/main/java/com/kitsu/medievalcraft/events/EventHandle.java @@ -75,47 +75,47 @@ public void zombieJoinsEvent(EntityJoinWorldEvent event){ longbowTicks = player.getItemInUseDuration(); ItemStack stack = player.inventory.getCurrentItem(); - if((longbowTicks > 0) && (longbowTicks <=10)){ + if((longbowTicks > 0) && (longbowTicks <=5)){ stack.stackTagCompound = new NBTTagCompound(); stack.stackTagCompound.setInteger("D", 1); } - if((longbowTicks > 10) && (longbowTicks <=20)){ + if((longbowTicks > 5) && (longbowTicks <=10)){ stack.stackTagCompound = new NBTTagCompound(); stack.stackTagCompound.setInteger("D", 2); } - if((longbowTicks > 20) && (longbowTicks <=30)){ + if((longbowTicks > 10) && (longbowTicks <=15)){ stack.stackTagCompound = new NBTTagCompound(); stack.stackTagCompound.setInteger("D", 3); } - if((longbowTicks > 30) && (longbowTicks <=40)){ + if((longbowTicks > 15) && (longbowTicks <=20)){ stack.stackTagCompound = new NBTTagCompound(); stack.stackTagCompound.setInteger("D", 4); } - if((longbowTicks > 40) && (longbowTicks <=50)){ + if((longbowTicks > 20) && (longbowTicks <=25)){ stack.stackTagCompound = new NBTTagCompound(); stack.stackTagCompound.setInteger("D", 5); } - if((longbowTicks > 50) && (longbowTicks <=60)){ + if((longbowTicks > 25) && (longbowTicks <=30)){ stack.stackTagCompound = new NBTTagCompound(); stack.stackTagCompound.setInteger("D", 6); } - if((longbowTicks > 60) && (longbowTicks <=70)){ + if((longbowTicks > 30) && (longbowTicks <=35)){ stack.stackTagCompound = new NBTTagCompound(); stack.stackTagCompound.setInteger("D", 7); } - if((longbowTicks > 70) && (longbowTicks <=80)){ + if((longbowTicks > 35) && (longbowTicks <=40)){ stack.stackTagCompound = new NBTTagCompound(); stack.stackTagCompound.setInteger("D", 8); } - if((longbowTicks > 80) && (longbowTicks <=90)){ + if((longbowTicks > 40) && (longbowTicks <=45)){ stack.stackTagCompound = new NBTTagCompound(); stack.stackTagCompound.setInteger("D", 9); } - if(longbowTicks == 99){ + if(longbowTicks == 45){ player.playSound((Main.MODID + ":tautBow"), 0.8F, 1.0F); //player.worldObj.playSoundAtEntity(player, (Main.MODID + ":tautBow"), 0.8F, 1.0F); } - if((longbowTicks > 90) && (longbowTicks <=100)){ + if((longbowTicks > 45) && (longbowTicks <=55)){ stack.stackTagCompound = new NBTTagCompound(); stack.stackTagCompound.setInteger("D", 10); } @@ -540,7 +540,7 @@ public void onPlayerUpdateMaceWoodenShield (LivingUpdateEvent event) { } } }*/ - +/* @SubscribeEvent @SideOnly(Side.CLIENT) public void SwordToShieldSwitch (LivingUpdateEvent event) { @@ -637,7 +637,7 @@ public void onPlayerUpdateMaceWoodenShield (LivingUpdateEvent event) { } } } - +*/ } diff --git a/src/main/java/com/kitsu/medievalcraft/gui/GuiCannon_28.java b/src/main/java/com/kitsu/medievalcraft/gui/GuiCannon_28.java new file mode 100644 index 00000000..6f785bd5 --- /dev/null +++ b/src/main/java/com/kitsu/medievalcraft/gui/GuiCannon_28.java @@ -0,0 +1,38 @@ +package com.kitsu.medievalcraft.gui; + +import org.lwjgl.opengl.GL11; + +import com.kitsu.medievalcraft.Main; +import com.kitsu.medievalcraft.contain.ContainerCannon_28; +import com.kitsu.medievalcraft.tileents.cannon.TileCannon_28; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.ResourceLocation; + +public class GuiCannon_28 extends GuiContainer { + private ResourceLocation texture = new ResourceLocation(Main.MODID + ":" + "textures/gui/forgeovengui.png"); + + public GuiCannon_28(InventoryPlayer inventoryPlayer, TileCannon_28 tileEntity) { + super(new ContainerCannon_28(inventoryPlayer, tileEntity)); + // TODO Auto-generated constructor stub + } + + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + //String name = "Forge"; + + //this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752); + //this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752); + + } + + @Override + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + GL11.glColor4f(1F, 1F, 1F, 1F); + Minecraft.getMinecraft().getTextureManager().bindTexture(texture); + drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); + } + +} diff --git a/src/main/java/com/kitsu/medievalcraft/gui/GuiHandler.java b/src/main/java/com/kitsu/medievalcraft/gui/GuiHandler.java index a4a8f074..a658cc64 100644 --- a/src/main/java/com/kitsu/medievalcraft/gui/GuiHandler.java +++ b/src/main/java/com/kitsu/medievalcraft/gui/GuiHandler.java @@ -1,19 +1,20 @@ package com.kitsu.medievalcraft.gui; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - import com.kitsu.medievalcraft.block.ModBlocks; +import com.kitsu.medievalcraft.contain.ContainerCannon_28; import com.kitsu.medievalcraft.contain.ContainerForgeAnvil; import com.kitsu.medievalcraft.contain.ContainerFormTable; import com.kitsu.medievalcraft.contain.ContainerSolidFilter; import com.kitsu.medievalcraft.contain.ContainerTestForge; +import com.kitsu.medievalcraft.tileents.cannon.TileCannon_28; import com.kitsu.medievalcraft.tileents.machine.TileEntityAnvilForge; import com.kitsu.medievalcraft.tileents.machine.TileEntitySolidFilter; import com.kitsu.medievalcraft.tileents.machine.TileEntityTestForge; import cpw.mods.fml.common.network.IGuiHandler; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; public class GuiHandler implements IGuiHandler { @@ -21,6 +22,7 @@ public class GuiHandler implements IGuiHandler { public static final int guiIDforge = 2; public static final int guiIDforgeAnvil = 3; public static final int guiIDsolidFilter = 4; + public static final int guiIDcannon28 = 5; //returns an instance of the Container you made earlier @Override @@ -39,6 +41,9 @@ public class GuiHandler implements IGuiHandler { if (entity instanceof TileEntitySolidFilter) { return new ContainerSolidFilter(player.inventory, (TileEntitySolidFilter) entity); } + if (entity instanceof TileCannon_28) { + return new ContainerCannon_28(player.inventory, (TileCannon_28) entity); + } return null; } @@ -59,6 +64,9 @@ public class GuiHandler implements IGuiHandler { if (entity instanceof TileEntitySolidFilter) { return new GuiSolidFilter(player.inventory, (TileEntitySolidFilter) entity); } + if (entity instanceof TileCannon_28) { + return new GuiCannon_28(player.inventory, (TileCannon_28) entity); + } return null; } diff --git a/src/main/java/com/kitsu/medievalcraft/renderer/RendererRegistry.java b/src/main/java/com/kitsu/medievalcraft/renderer/RendererRegistry.java index 4ab16a6f..aa5da441 100644 --- a/src/main/java/com/kitsu/medievalcraft/renderer/RendererRegistry.java +++ b/src/main/java/com/kitsu/medievalcraft/renderer/RendererRegistry.java @@ -5,6 +5,7 @@ import com.kitsu.medievalcraft.item.ModItems; import com.kitsu.medievalcraft.renderer.blocks.BarrelLidRender; import com.kitsu.medievalcraft.renderer.blocks.SmallBarrelRender; import com.kitsu.medievalcraft.renderer.blocks.TestBlockRenderer; +import com.kitsu.medievalcraft.renderer.blocks.cannons.Render_CannonBall_Iron; import com.kitsu.medievalcraft.renderer.blocks.cannons.Render_Cannon_28; import com.kitsu.medievalcraft.renderer.blocks.crucibles.IronOreCrucibleRenderer; import com.kitsu.medievalcraft.renderer.blocks.crucibles.LapisCrucibleRenderer; @@ -66,6 +67,7 @@ import com.kitsu.medievalcraft.renderer.itemrenderer.weapons.NewIronShield; import com.kitsu.medievalcraft.tileents.TileEntitySmallBarrel; import com.kitsu.medievalcraft.tileents.TileEntitySmallLid; import com.kitsu.medievalcraft.tileents.TileEntityTestBlock; +import com.kitsu.medievalcraft.tileents.cannon.TileCannonBall28; import com.kitsu.medievalcraft.tileents.cannon.TileCannon_28; import com.kitsu.medievalcraft.tileents.crucible.TileCrucibleIronOre; import com.kitsu.medievalcraft.tileents.crucible.TileCrucibleLapis; @@ -184,6 +186,7 @@ public class RendererRegistry { ClientRegistry.bindTileEntitySpecialRenderer(TileLapisIngot.class, new LapisIngotRenderer()); ClientRegistry.bindTileEntitySpecialRenderer(TileCannon_28.class, new Render_Cannon_28()); + //ClientRegistry.bindTileEntitySpecialRenderer(TileCannonBall28.class, new Render_CannonBall_Iron()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTestBlock.class, new TestBlockRenderer()); diff --git a/src/main/java/com/kitsu/medievalcraft/renderer/blocks/cannons/Render_CannonBall_Projectile.java b/src/main/java/com/kitsu/medievalcraft/renderer/blocks/cannons/Render_CannonBall_Projectile.java deleted file mode 100644 index 706e688d..00000000 --- a/src/main/java/com/kitsu/medievalcraft/renderer/blocks/cannons/Render_CannonBall_Projectile.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.kitsu.medievalcraft.renderer.blocks.cannons; - -import org.lwjgl.opengl.GL11; - -import com.kitsu.medievalcraft.entity.EntityCannonBall; -import com.kitsu.medievalcraft.entity.ProjectileCannonBall; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.entity.Render; -import net.minecraft.entity.Entity; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.model.AdvancedModelLoader; -import net.minecraftforge.client.model.IModelCustom; - -public class Render_CannonBall_Projectile extends Render -{ - - //private static final ResourceLocation arrowTextures = new ResourceLocation("textures/entity/arrow.png"); - private static final ResourceLocation arrowTextures = new ResourceLocation("kitsumedievalcraft:textures/items/Cannon.png"); - public static final ResourceLocation MODEL = new ResourceLocation("kitsumedievalcraft:models/cannon_ball.obj"); - public static final ResourceLocation TEXTURE = new ResourceLocation("kitsumedievalcraft:models/Cannon.png"); - - public IModelCustom model = AdvancedModelLoader.loadModel(MODEL); - - public void doRender(ProjectileCannonBall ent, double x, double y, double z, float p_76986_8_, float p_76986_9_) - { - GL11.glPushMatrix(); - float scale = 0.01f; - GL11.glScalef(scale, scale, scale); - GL11.glTranslatef((float)x, (float)y, (float)z ); - //GL11.glRotatef(ent.prevRotationYaw + (ent.rotationYaw - ent.prevRotationYaw) * p_76986_9_ - 90.0F, 0.0F, 1.0F, 0.0F); - //GL11.glRotatef(ent.prevRotationPitch + (ent.rotationPitch - ent.prevRotationPitch) * p_76986_9_, 0.0F, 0.0F, 1.0F); - Minecraft.getMinecraft().renderEngine.bindTexture(TEXTURE); - model.renderAll(); - - GL11.glPopMatrix(); - } - - protected ResourceLocation getEntityTexture(ProjectileCannonBall p_110775_1_) - { - return arrowTextures; - } - - /** - * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. - */ - protected ResourceLocation getEntityTexture(Entity p_110775_1_) - { - return this.getEntityTexture((ProjectileCannonBall)p_110775_1_); - } - - /** - * 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