cannons
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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;
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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,17 +19,17 @@ 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,
|
||||
@@ -39,31 +40,27 @@ public class CannonBall28 extends BlockContainer {
|
||||
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) {
|
||||
|
||||
@@ -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)
|
||||
@@ -78,36 +79,88 @@ public class Cannon_28 extends BlockContainer{
|
||||
|
||||
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
|
||||
|
||||
@@ -32,7 +32,6 @@ public class formTable extends Block {
|
||||
this.setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
this.setHardness(3.5F);
|
||||
this.setResistance(2.0F);
|
||||
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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_)
|
||||
{
|
||||
|
||||
@@ -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) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
38
src/main/java/com/kitsu/medievalcraft/gui/GuiCannon_28.java
Normal file
38
src/main/java/com/kitsu/medievalcraft/gui/GuiCannon_28.java
Normal file
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
|
||||
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
|
||||
*/
|
||||
|
||||
public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
|
||||
{
|
||||
//System.out.println("doRender Ran");
|
||||
this.doRender((ProjectileCannonBall)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.kitsu.medievalcraft.tileents;
|
||||
|
||||
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;
|
||||
@@ -65,6 +66,7 @@ public class TileEntRegister {
|
||||
GameRegistry.registerTileEntity(TileLapisIngot.class, "LapisIngot");
|
||||
|
||||
GameRegistry.registerTileEntity(TileCannon_28.class, "Cannon_28");
|
||||
GameRegistry.registerTileEntity(TileCannonBall28.class, "CannonBall_28");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
package com.kitsu.medievalcraft.tileents.cannon;
|
||||
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class TileCannonBall28 extends TileEntity {
|
||||
|
||||
private String tileCannonBall28;
|
||||
private String stringCannonBall_28;
|
||||
|
||||
public TileCannonBall28(){
|
||||
public void tileCannonBall28(String string){
|
||||
this.stringCannonBall_28 = string;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,6 +23,11 @@ public class TileCannon_28 extends TileEntity implements IInventory, ISidedInven
|
||||
private NBTTagCompound tag = new NBTTagCompound();
|
||||
private int ticks;
|
||||
public boolean isOn;
|
||||
private static final int[] slots_all = new int[] {0,1};
|
||||
private static final int[] slots_top = new int[] {0};
|
||||
//private static final int[] slots_bottom = new int[] {2, 1};
|
||||
private static final int[] slots_sides = new int[] {1};
|
||||
|
||||
|
||||
public TileCannon_28(){
|
||||
this.inv = new ItemStack[2];
|
||||
@@ -38,25 +43,25 @@ public class TileCannon_28 extends TileEntity implements IInventory, ISidedInven
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int p_70298_1_, int p_70298_2_)
|
||||
public ItemStack decrStackSize(int slot, int par2)
|
||||
{
|
||||
if (this.inv[p_70298_1_] != null)
|
||||
if (this.inv[slot] != null)
|
||||
{
|
||||
ItemStack itemstack;
|
||||
|
||||
if (this.inv[p_70298_1_].stackSize <= p_70298_2_)
|
||||
if (this.inv[slot].stackSize <= par2)
|
||||
{
|
||||
itemstack = this.inv[p_70298_1_];
|
||||
this.inv[p_70298_1_] = null;
|
||||
itemstack = this.inv[slot];
|
||||
this.inv[slot] = null;
|
||||
this.markForUpdate();
|
||||
this.markDirty();
|
||||
return itemstack;
|
||||
}
|
||||
itemstack = this.inv[p_70298_1_].splitStack(p_70298_2_);
|
||||
itemstack = this.inv[slot].splitStack(par2);
|
||||
|
||||
if (this.inv[p_70298_1_].stackSize == 0)
|
||||
if (this.inv[slot].stackSize == 0)
|
||||
{
|
||||
this.inv[p_70298_1_] = null;
|
||||
this.inv[slot] = null;
|
||||
}
|
||||
this.markForUpdate();
|
||||
this.markDirty();
|
||||
@@ -111,7 +116,7 @@ public class TileCannon_28 extends TileEntity implements IInventory, ISidedInven
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 9;
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -126,13 +131,20 @@ public class TileCannon_28 extends TileEntity implements IInventory, ISidedInven
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack itemstack) {
|
||||
if(slot == 0 && itemstack.getItem() == Items.gunpowder){
|
||||
if(this.getStackInSlot(0)==null && slot == 0 && itemstack.getItem() == Items.gunpowder){
|
||||
return true;
|
||||
}
|
||||
if(slot == 1 && itemstack.getItem() == Item.getItemFromBlock(ModBlocks.cannonBall_28)){
|
||||
if(this.getStackInSlot(0)!=null && slot == 0 && itemstack.getItem() == Items.gunpowder && this.getStackInSlot(0).stackSize <= 5){
|
||||
return true;
|
||||
}
|
||||
if(this.getStackInSlot(1)==null && slot == 1 && itemstack.getItem() == Item.getItemFromBlock(ModBlocks.cannonBall_28)){
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
if(this.getStackInSlot(1)!=null){
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void markForUpdate(){
|
||||
@@ -207,20 +219,25 @@ public class TileCannon_28 extends TileEntity implements IInventory, ISidedInven
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int p_94128_1_) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
public int[] getAccessibleSlotsFromSide(int par1) {
|
||||
|
||||
/*if(par1 == 1){
|
||||
return slots_top;
|
||||
}
|
||||
else return slots_sides;*/
|
||||
return slots_all;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int p_102007_1_, ItemStack p_102007_2_, int p_102007_3_) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
public boolean canInsertItem(int slot, ItemStack itemstack, int p_102007_3_) {
|
||||
|
||||
return this.isItemValidForSlot(slot, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_, int p_102008_3_) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user