cannon_orientation

This commit is contained in:
KitsuShadow
2016-02-18 06:20:18 -05:00
parent 10d984b561
commit e1fe0be8eb
19 changed files with 442 additions and 61 deletions

View File

@@ -302,6 +302,7 @@ item.halfSplitBoard.name=Half Split Board
item.woodPulp.name=Wood Pulp item.woodPulp.name=Wood Pulp
item.charcoalFilter.name=Charcoal Filter item.charcoalFilter.name=Charcoal Filter
item.slottedTongs.name=Stone Tongs item.slottedTongs.name=Stone Tongs
item.flintKnapped.name=Knapped Flint
tile.shitBlock.name=Shit Block tile.shitBlock.name=Shit Block
tile.formTable.name=Form Table tile.formTable.name=Form Table
@@ -352,7 +353,10 @@ tile.smallBarrelLid.name=Small Barrel Lid
tile.shelfFour.name=Shelf tile.shelfFour.name=Shelf
tile.firebox.name=Clay Firebox tile.firebox.name=Clay Firebox
tile.emptySoftCrucible.name=Empty Soft Crucible tile.emptySoftCrucible.name=Empty Soft Crucible
tile.emptyCookedCrucible=Empty Crucible tile.emptyCookedCrucible.name=Empty Crucible
tile.cannon_28.name=Cannon 28lb
tile.cannonBallBlock_28.name=Cannon Ball 28lb
itemGroup.MedievalCraftTab=ForgeCraft itemGroup.MedievalCraftTab=ForgeCraft

View File

@@ -6,6 +6,8 @@ import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidRegistry;
import com.kitsu.medievalcraft.Main; import com.kitsu.medievalcraft.Main;
import com.kitsu.medievalcraft.block.cannon.CannonBallBlock28;
import com.kitsu.medievalcraft.block.cannon.Cannon_28;
import com.kitsu.medievalcraft.block.crucible.CrucibleIronIngot; import com.kitsu.medievalcraft.block.crucible.CrucibleIronIngot;
import com.kitsu.medievalcraft.block.crucible.CrucibleIronOre; import com.kitsu.medievalcraft.block.crucible.CrucibleIronOre;
import com.kitsu.medievalcraft.block.crucible.CrucibleLapis; import com.kitsu.medievalcraft.block.crucible.CrucibleLapis;
@@ -17,7 +19,6 @@ import com.kitsu.medievalcraft.block.crucible.empty.EmptySoftCrucible;
import com.kitsu.medievalcraft.block.crucible.empty.FilledWaterCrucible; import com.kitsu.medievalcraft.block.crucible.empty.FilledWaterCrucible;
import com.kitsu.medievalcraft.block.crucible.empty.SlackWaterCrucible; import com.kitsu.medievalcraft.block.crucible.empty.SlackWaterCrucible;
import com.kitsu.medievalcraft.block.crucible.empty.TanWaterCrucible; import com.kitsu.medievalcraft.block.crucible.empty.TanWaterCrucible;
import com.kitsu.medievalcraft.block.decorative.CannonBallBlock28;
import com.kitsu.medievalcraft.block.decorative.EggWashedBrick; import com.kitsu.medievalcraft.block.decorative.EggWashedBrick;
import com.kitsu.medievalcraft.block.decorative.EggWashedWall; import com.kitsu.medievalcraft.block.decorative.EggWashedWall;
import com.kitsu.medievalcraft.block.decorative.LimestoneRaw; import com.kitsu.medievalcraft.block.decorative.LimestoneRaw;
@@ -32,7 +33,6 @@ import com.kitsu.medievalcraft.block.ingots.IronPlate;
import com.kitsu.medievalcraft.block.ingots.LapisIngot; import com.kitsu.medievalcraft.block.ingots.LapisIngot;
import com.kitsu.medievalcraft.block.ingots.RedstoneIngot; import com.kitsu.medievalcraft.block.ingots.RedstoneIngot;
import com.kitsu.medievalcraft.block.ingots.RefinedIron; import com.kitsu.medievalcraft.block.ingots.RefinedIron;
import com.kitsu.medievalcraft.block.machines.Cannon_28;
import com.kitsu.medievalcraft.block.machines.Firebox; import com.kitsu.medievalcraft.block.machines.Firebox;
import com.kitsu.medievalcraft.block.machines.Forge; import com.kitsu.medievalcraft.block.machines.Forge;
import com.kitsu.medievalcraft.block.machines.ForgeAnvil; import com.kitsu.medievalcraft.block.machines.ForgeAnvil;

View File

@@ -1,4 +1,4 @@
package com.kitsu.medievalcraft.block.decorative; package com.kitsu.medievalcraft.block.cannon;
import java.util.Random; import java.util.Random;
@@ -34,7 +34,7 @@ public class CannonBallBlock28 extends BlockContainer {
//xmin, ymin, zmin, //xmin, ymin, zmin,
this.setBlockBounds(0.38F, 0.0F, 0.38F, this.setBlockBounds(0.38F, 0.0F, 0.38F,
//xmax, ymax, zmax //xmax, ymax, zmax
0.62F, 0.2F, 0.62F); 0.62F, 0.35F, 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_){ 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_){

View File

@@ -1,4 +1,4 @@
package com.kitsu.medievalcraft.block.machines; package com.kitsu.medievalcraft.block.cannon;
import static net.minecraftforge.common.util.ForgeDirection.UP; import static net.minecraftforge.common.util.ForgeDirection.UP;
@@ -38,6 +38,7 @@ import net.minecraft.item.ItemSword;
import net.minecraft.item.ItemTool; import net.minecraft.item.ItemTool;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
@@ -82,7 +83,7 @@ public class Cannon_28 extends BlockContainer{
TileCannon_28 tile = (TileCannon_28) world.getTileEntity(x, y, z); TileCannon_28 tile = (TileCannon_28) world.getTileEntity(x, y, z);
Item ball = new ItemStack(ModBlocks.cannonBall_28, 0, 1).getItem(); Item ball = new ItemStack(ModBlocks.cannonBall_28, 0, 1).getItem();
if(tile.getStackInSlot(0)!=null){ if(tile.getStackInSlot(0)!=null && tile.getStackInSlot(0).getItem()==Items.gunpowder){
if(world.getBlockMetadata(x, y, z)==3){ if(world.getBlockMetadata(x, y, z)==3){
tile.isOn=true; 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.fizz", 0.1f, world.rand.nextFloat()/0.5f * 0.1F + 0.8F);
@@ -92,13 +93,14 @@ public class Cannon_28 extends BlockContainer{
tile.decrStackSize(1, 1); tile.decrStackSize(1, 1);
cannonball = new EntityCannonBall(world, (double)x+2, (double)y, (double)z, null); 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); cannonball.setVelocity(tile.getStackInSlot(0).stackSize-world.rand.nextFloat(), 0.25, (world.rand.nextFloat()*2-1)/5);
tile.setInventorySlotContents(0, null);
tile.markForUpdate(); tile.markForUpdate();
tile.markDirty(); tile.markDirty();
} }
} }
} }
} }
if(tile.getStackInSlot(0)!=null){ if(tile.getStackInSlot(0)!=null && tile.getStackInSlot(0).getItem()==Items.gunpowder){
if(world.getBlockMetadata(x, y, z)==2){ if(world.getBlockMetadata(x, y, z)==2){
tile.isOn=true; 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.fizz", 0.1f, world.rand.nextFloat()/0.5f * 0.1F + 0.8F);
@@ -108,13 +110,14 @@ public class Cannon_28 extends BlockContainer{
tile.decrStackSize(1, 1); tile.decrStackSize(1, 1);
cannonball = new EntityCannonBall(world, (double)x, (double)y, (double)z-2, null); 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()); cannonball.setVelocity((world.rand.nextFloat()*2-1)/5, 0.25, -tile.getStackInSlot(0).stackSize+world.rand.nextFloat());
tile.setInventorySlotContents(0, null);
tile.markForUpdate(); tile.markForUpdate();
tile.markDirty(); tile.markDirty();
} }
} }
} }
} }
if(tile.getStackInSlot(0)!=null){ if(tile.getStackInSlot(0)!=null && tile.getStackInSlot(0).getItem()==Items.gunpowder){
if(world.getBlockMetadata(x, y, z)==1){ if(world.getBlockMetadata(x, y, z)==1){
tile.isOn=true; 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.fizz", 0.1f, world.rand.nextFloat()/0.5f * 0.1F + 0.8F);
@@ -124,13 +127,14 @@ public class Cannon_28 extends BlockContainer{
tile.decrStackSize(1, 1); tile.decrStackSize(1, 1);
cannonball = new EntityCannonBall(world, (double)x-2, (double)y, (double)z, null); 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); cannonball.setVelocity(-tile.getStackInSlot(0).stackSize+world.rand.nextFloat(), 0.25, (world.rand.nextFloat()*2-1)/5);
tile.setInventorySlotContents(0, null);
tile.markForUpdate(); tile.markForUpdate();
tile.markDirty(); tile.markDirty();
} }
} }
} }
} }
if(tile.getStackInSlot(0)!=null){ if(tile.getStackInSlot(0)!=null && tile.getStackInSlot(0).getItem()==Items.gunpowder){
if(world.getBlockMetadata(x, y, z)==0){ if(world.getBlockMetadata(x, y, z)==0){
tile.isOn=true; 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.fizz", 0.1f, world.rand.nextFloat()/0.5f * 0.1F + 0.8F);
@@ -140,21 +144,19 @@ public class Cannon_28 extends BlockContainer{
tile.decrStackSize(1, 1); tile.decrStackSize(1, 1);
cannonball = new EntityCannonBall(world, (double)x, (double)y, (double)z+2, null); 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()); cannonball.setVelocity((world.rand.nextFloat()*2-1)/5, 0.25, tile.getStackInSlot(0).stackSize-world.rand.nextFloat());
tile.setInventorySlotContents(0, null);
tile.markForUpdate(); tile.markForUpdate();
tile.markDirty(); tile.markDirty();
} }
} }
} }
} }
tile.setInventorySlotContents(0, null);
tile.markForUpdate(); tile.markForUpdate();
tile.markDirty(); tile.markDirty();
return cannonball; return cannonball;
} }
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) { public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {
if(!world.isRemote){ if(!world.isRemote){
TileCannon_28 tileEnt = (TileCannon_28) world.getTileEntity(x, y, z); TileCannon_28 tileEnt = (TileCannon_28) world.getTileEntity(x, y, z);
@@ -194,12 +196,94 @@ public class Cannon_28 extends BlockContainer{
} }
} }
@Override /**
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack p_149689_6_) { * Updates the blocks bounds based on its current state. Args: world, x, y, z
int dir = MathHelper.floor_double((player.rotationYaw * 4F) / 360F + 0.5D) & 3; */
world.setBlockMetadataWithNotify(x, y, z, dir, 0); @Override
System.out.println(dir); public void setBlockBoundsBasedOnState(IBlockAccess iBlock, int x, int y, int z)
} {
int l = iBlock.getBlockMetadata(x, y, z) & 7;
switch (l)
{
case 1:
default:
this.setBlockBounds(0F, 0.0F, 0F, 1F, 1F, 1F);
break;
case 2:
this.setBlockBounds(0F, 0.0F, 0F, 1F, 1F, 1F);
break;
case 3:
this.setBlockBounds(0F, 0.0F, 0F, 1F, 1F, 1F);
break;
case 4:
this.setBlockBounds(0F, 0.0F, 0F, 1F, 1F, 1F);
break;
case 5:
this.setBlockBounds(0F, 0.0F, 0F, 1F, 1F, 1F);
}
}
/**
* Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been
* cleared to be reused)
*/
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z)
{
this.setBlockBoundsBasedOnState(world, x, y, z);
return super.getCollisionBoundingBoxFromPool(world, x, y, z);
}
/**
* Called when the block is placed in the world.
*/
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase living, ItemStack stack)
{
//22.5
//11.25
if(!world.isRemote){
double a = living.rotationYaw*(-1);
if(a >= 180-11.25 && a <= 180+11.25){
world.setBlockMetadataWithNotify(x, y, z, 0, 2);
System.out.println("0");
}
if(a >= 202.5-11.25 && a <= 202.5+11.25){
world.setBlockMetadataWithNotify(x, y, z, 1, 2);
System.out.println("1");
}
if(a >= 225-11.25 && a <= 225+11.25){
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
System.out.println("2");
}
/*int l = MathHelper.floor_double((double)(living.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3;
world.setBlockMetadataWithNotify(x, y, z, l, 2);*/
System.out.println((a));
}
//System.out.println(l);
}
public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player) {
if(!world.isRemote){
if(player.isSneaking()==true){
if(world.getBlockMetadata(x, y, z)==15){
world.setBlockMetadataWithNotify(x, y, z, 0, 2);
}
if(world.getBlockMetadata(x, y, z)<15){
world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z)+1, 2);
}
}
if(!player.isSneaking()==true){
if(world.getBlockMetadata(x, y, z)==0){
world.setBlockMetadataWithNotify(x, y, z, 15, 2);
}
if(world.getBlockMetadata(x, y, z)>0){
world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z)-1, 2);
}
}
}
}
public void breakBlock(World world, int x, int y, int z, Block block, int meta) { public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
TileCannon_28 tileEnt = (TileCannon_28) world.getTileEntity(x, y, z); TileCannon_28 tileEnt = (TileCannon_28) world.getTileEntity(x, y, z);

View File

@@ -13,41 +13,41 @@ public class ContainerCannon_28 extends Container {
protected TileCannon_28 tileEnt; protected TileCannon_28 tileEnt;
@Override @Override
public boolean canInteractWith(EntityPlayer player) { public boolean canInteractWith(EntityPlayer player) {
return tileEnt.isUseableByPlayer(player); return tileEnt.isUseableByPlayer(player);
} }
public ContainerCannon_28 (InventoryPlayer inventoryPlayer, TileCannon_28 te){ public ContainerCannon_28 (InventoryPlayer inventoryPlayer, TileCannon_28 te){
tileEnt = te; tileEnt = te;
//the Slot constructor takes the IInventory and the slot number in that it binds to //the Slot constructor takes the IInventory and the slot number in that it binds to
//and the x-y coordinates it resides on-screen //and the x-y coordinates it resides on-screen
/* for (int i = 0; i < 2; i++) { /* for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++) { for (int j = 0; j < 2; j++) {
addSlotToContainer(new Slot(tileEnt, j + i * 3, 62 + j * 18, 17 + i * 18)); addSlotToContainer(new Slot(tileEnt, j + i * 3, 62 + j * 18, 17 + i * 18));
} }
}*/ }*/
addSlotToContainer(new Slot(tileEnt, 0, 80, 34)); addSlotToContainer(new Slot(tileEnt, 0, 30, 34));
addSlotToContainer(new Slot(tileEnt, 1, 100, 34)); addSlotToContainer(new Slot(tileEnt, 1, 48, 34));
//commonly used vanilla code that adds the player's inventory //commonly used vanilla code that adds the player's inventory
bindPlayerInventory(inventoryPlayer); bindPlayerInventory(inventoryPlayer);
} }
protected void bindPlayerInventory(InventoryPlayer inventoryPlayer) { protected void bindPlayerInventory(InventoryPlayer inventoryPlayer) {
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
for (int j = 0; j < 9; j++) { for (int j = 0; j < 9; j++) {
addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9, addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9,
8 + j * 18, 84 + i * 18)); 8 + j * 18, 84 + i * 18));
} }
} }
for (int i = 0; i < 9; i++) { for (int i = 0; i < 9; i++) {
addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 142)); addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 142));
} }
} }
@Override @Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot) { public ItemStack transferStackInSlot(EntityPlayer player, int slot) {
ItemStack stack = null; ItemStack stack = null;
Slot slotObject = (Slot) inventorySlots.get(slot); Slot slotObject = (Slot) inventorySlots.get(slot);

View File

@@ -12,7 +12,7 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
public class GuiCannon_28 extends GuiContainer { public class GuiCannon_28 extends GuiContainer {
private ResourceLocation texture = new ResourceLocation(Main.MODID + ":" + "textures/gui/forgeovengui.png"); private ResourceLocation texture = new ResourceLocation(Main.MODID + ":" + "textures/gui/cannongui.png");
public GuiCannon_28(InventoryPlayer inventoryPlayer, TileCannon_28 tileEntity) { public GuiCannon_28(InventoryPlayer inventoryPlayer, TileCannon_28 tileEntity) {
super(new ContainerCannon_28(inventoryPlayer, tileEntity)); super(new ContainerCannon_28(inventoryPlayer, tileEntity));

View File

@@ -17,12 +17,11 @@ public class GuiSolidFilter extends GuiContainer {
public GuiSolidFilter(InventoryPlayer inventoryPlayer, TileEntitySolidFilter tileEntity) { public GuiSolidFilter(InventoryPlayer inventoryPlayer, TileEntitySolidFilter tileEntity) {
super(new ContainerSolidFilter(inventoryPlayer, tileEntity)); super(new ContainerSolidFilter(inventoryPlayer, tileEntity));
// TODO Auto-generated constructor stub
} }
@Override @Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) { protected void drawGuiContainerForegroundLayer(int par1, int par2) {
//String name = "Forge"; //String name = "28lb Cannon";
//this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752); //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); //this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);

View File

@@ -5,7 +5,7 @@ import com.kitsu.medievalcraft.item.ModItems;
import com.kitsu.medievalcraft.renderer.blocks.BarrelLidRender; import com.kitsu.medievalcraft.renderer.blocks.BarrelLidRender;
import com.kitsu.medievalcraft.renderer.blocks.SmallBarrelRender; import com.kitsu.medievalcraft.renderer.blocks.SmallBarrelRender;
import com.kitsu.medievalcraft.renderer.blocks.TestBlockRenderer; 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_CannonBall_Iron_Block;
import com.kitsu.medievalcraft.renderer.blocks.cannons.Render_Cannon_28; 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.IronOreCrucibleRenderer;
import com.kitsu.medievalcraft.renderer.blocks.crucibles.LapisCrucibleRenderer; import com.kitsu.medievalcraft.renderer.blocks.crucibles.LapisCrucibleRenderer;
@@ -34,6 +34,7 @@ import com.kitsu.medievalcraft.renderer.itemrenderer.IRITSpear;
import com.kitsu.medievalcraft.renderer.itemrenderer.ItemRendererITModelArrow; import com.kitsu.medievalcraft.renderer.itemrenderer.ItemRendererITModelArrow;
import com.kitsu.medievalcraft.renderer.itemrenderer.ItemRendererLongbow; import com.kitsu.medievalcraft.renderer.itemrenderer.ItemRendererLongbow;
import com.kitsu.medievalcraft.renderer.itemrenderer.ItemRendererModelArrow; import com.kitsu.medievalcraft.renderer.itemrenderer.ItemRendererModelArrow;
import com.kitsu.medievalcraft.renderer.itemrenderer.cannons.IR_CannonBall_28;
import com.kitsu.medievalcraft.renderer.itemrenderer.cannons.IR_Cannon_28; import com.kitsu.medievalcraft.renderer.itemrenderer.cannons.IR_Cannon_28;
import com.kitsu.medievalcraft.renderer.itemrenderer.crucibles.IRCrucible; import com.kitsu.medievalcraft.renderer.itemrenderer.crucibles.IRCrucible;
import com.kitsu.medievalcraft.renderer.itemrenderer.crucibles.empty.IRSlackCrucible; import com.kitsu.medievalcraft.renderer.itemrenderer.crucibles.empty.IRSlackCrucible;
@@ -55,7 +56,6 @@ import com.kitsu.medievalcraft.renderer.itemrenderer.machines.IRSmallBarrel;
import com.kitsu.medievalcraft.renderer.itemrenderer.machines.IRSolidFilter; import com.kitsu.medievalcraft.renderer.itemrenderer.machines.IRSolidFilter;
import com.kitsu.medievalcraft.renderer.itemrenderer.machines.IRWaterFilter; import com.kitsu.medievalcraft.renderer.itemrenderer.machines.IRWaterFilter;
import com.kitsu.medievalcraft.renderer.itemrenderer.tongs.IRSlottedTongs; import com.kitsu.medievalcraft.renderer.itemrenderer.tongs.IRSlottedTongs;
import com.kitsu.medievalcraft.renderer.itemrenderer.tools.IRCraftingBlade;
import com.kitsu.medievalcraft.renderer.itemrenderer.tools.IRForgeHammer; import com.kitsu.medievalcraft.renderer.itemrenderer.tools.IRForgeHammer;
import com.kitsu.medievalcraft.renderer.itemrenderer.tools.IRInlayHammer; import com.kitsu.medievalcraft.renderer.itemrenderer.tools.IRInlayHammer;
import com.kitsu.medievalcraft.renderer.itemrenderer.weapons.IRBattleAxe; import com.kitsu.medievalcraft.renderer.itemrenderer.weapons.IRBattleAxe;
@@ -123,6 +123,7 @@ public class RendererRegistry {
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.cannon_28), new IR_Cannon_28()); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.cannon_28), new IR_Cannon_28());
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.cannonBall_28), new IR_CannonBall_28());
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.emptySoftCrucible), new ItemRendererSECrucible()); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.emptySoftCrucible), new ItemRendererSECrucible());
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.emptyCookedCrucible), new ItemRendererECCrucible()); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.emptyCookedCrucible), new ItemRendererECCrucible());
@@ -186,7 +187,7 @@ public class RendererRegistry {
ClientRegistry.bindTileEntitySpecialRenderer(TileLapisIngot.class, new LapisIngotRenderer()); ClientRegistry.bindTileEntitySpecialRenderer(TileLapisIngot.class, new LapisIngotRenderer());
ClientRegistry.bindTileEntitySpecialRenderer(TileCannon_28.class, new Render_Cannon_28()); ClientRegistry.bindTileEntitySpecialRenderer(TileCannon_28.class, new Render_Cannon_28());
//ClientRegistry.bindTileEntitySpecialRenderer(TileCannonBall28.class, new Render_CannonBall_Iron()); ClientRegistry.bindTileEntitySpecialRenderer(TileCannonBall28.class, new Render_CannonBall_Iron_Block());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTestBlock.class, new TestBlockRenderer()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTestBlock.class, new TestBlockRenderer());

View File

@@ -0,0 +1,95 @@
package com.kitsu.medievalcraft.renderer.blocks.cannons;
import org.lwjgl.opengl.GL11;
import com.kitsu.medievalcraft.block.ModBlocks;
import com.kitsu.medievalcraft.entity.EntityCannonBall;
import com.kitsu.medievalcraft.tileents.cannon.TileCannonBall28;
import com.kitsu.medievalcraft.tileents.cannon.TileCannon_28;
import cpw.mods.fml.client.FMLClientHandler;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
public class Render_CannonBall_Iron_Block extends TileEntitySpecialRenderer {
EntityItem entItem = null;
private static final ResourceLocation MODEL_CRUCIBLE = new ResourceLocation("kitsumedievalcraft:models/cannon_ball.obj");
private static final ResourceLocation TEXTURE = new ResourceLocation("kitsumedievalcraft:models/CannonBall.png");
private IModelCustom model = AdvancedModelLoader.loadModel(MODEL_CRUCIBLE);
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float scale) {
TileCannonBall28 tileEntity = (TileCannonBall28)tile;
GL11.glPushMatrix();
GL11.glTranslatef((float) x, (float) y, (float) z);
renderBlock(tileEntity, tile.getWorldObj(), tile.xCoord,tile.yCoord, tile.zCoord, ModBlocks.cannonBall_28);
GL11.glPopMatrix();
}
public void renderBlock(TileCannonBall28 tl, World world, int i, int j,int k, Block block) {
Tessellator tessellator = Tessellator.instance;
// This will make your block brightness dependent from surroundings
// lighting.
/*float f = block.getLightOpacity(world, i, j, k);
int l = world.getLightBrightnessForSkyBlocks(i, j, k, 0);
int l1 = l % 65536;
int l2 = l / 65536;
tessellator.setNormal(0.0F, 1.0F, 0.0F);*/
//OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit,(float) l1, (float) l2);
/*
* This will rotate your model corresponding to player direction that
* was when you placed the block. If you want this to work, add these
* lines to onBlockPlacedBy method in your block class. int dir =
* MathHelper.floor_double((double)((player.rotationYaw * 4F) / 360F) +
* 0.5D) & 3; world.setBlockMetadataWithNotify(x, y, z, dir, 0);
*/
int dir = world.getBlockMetadata(i, j, k);
GL11.glPushMatrix();
//GL11.glRotatef(15F, 0F, 1F, 0F);
float scale = 0.25f;
GL11.glScalef(scale, scale, scale);
/*if(dir == 0){
GL11.glTranslatef(0.48F, 0.5F, 0.7F);
GL11.glRotated(180F, 0.0, 1.0F, 0.0F);
}
if(dir == 1){
GL11.glTranslatef(0.3F, 0.5F, 0.48F);
GL11.glRotated(90F, 0.0, 1.0F, 0.0F);
}
if(dir == 2){
GL11.glTranslatef(0.48F, 0.5F, 0.3F);
GL11.glRotated(0F, 0.0, 1.0F, 0.0F);
}*/
GL11.glTranslatef(2.0F, 0.5F, 2.0F);
//GL11.glRotated(-90F, 0.0, 1.0F, 0.0F);
//
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE);
/*
* Place your rendering code here.
*/
this.model.renderAll();
GL11.glPopMatrix();
}
}

View File

@@ -85,19 +85,67 @@ public class Render_Cannon_28 extends TileEntitySpecialRenderer {
if(dir == 0){ if(dir == 0){
GL11.glTranslatef(0.48F, 0.5F, 0.7F); GL11.glTranslatef(0.48F, 0.5F, 0.7F);
GL11.glRotated(180F, 0.0, 1.0F, 0.0F); GL11.glRotated(0, 0.0, 1.0F, 0.0F);
} }
if(dir == 1){ if(dir == 1){
GL11.glTranslatef(0.3F, 0.5F, 0.48F); GL11.glTranslatef(0.3F, 0.5F, 0.48F);
GL11.glRotated(90F, 0.0, 1.0F, 0.0F); GL11.glRotated(22.5F, 0.0, 1.0F, 0.0F);
} }
if(dir == 2){ if(dir == 2){
GL11.glTranslatef(0.48F, 0.5F, 0.3F); GL11.glTranslatef(0.48F, 0.5F, 0.3F);
GL11.glRotated(0F, 0.0, 1.0F, 0.0F); GL11.glRotated(22.5F*dir, 0.0, 1.0F, 0.0F);
} }
if(dir == 3){ if(dir == 3){
GL11.glTranslatef(0.7F, 0.5F, 0.48F); GL11.glTranslatef(0.7F, 0.5F, 0.48F);
GL11.glRotated(-90F, 0.0, 1.0F, 0.0F); GL11.glRotated(22.5F*dir, 0.0, 1.0F, 0.0F);
}
if(dir == 3){
GL11.glTranslatef(0.7F, 0.5F, 0.48F);
GL11.glRotated(22.5F*dir, 0.0, 1.0F, 0.0F);
}
if(dir == 4){
GL11.glTranslatef(0.7F, 0.5F, 0.48F);
GL11.glRotated(22.5F*dir, 0.0, 1.0F, 0.0F);
}
if(dir == 5){
GL11.glTranslatef(0.7F, 0.5F, 0.48F);
GL11.glRotated(22.5F*dir, 0.0, 1.0F, 0.0F);
}
if(dir == 6){
GL11.glTranslatef(0.7F, 0.5F, 0.48F);
GL11.glRotated(22.5F*dir, 0.0, 1.0F, 0.0F);
}
if(dir == 7){
GL11.glTranslatef(0.7F, 0.5F, 0.48F);
GL11.glRotated(22.5F*dir, 0.0, 1.0F, 0.0F);
}
if(dir == 8){
GL11.glTranslatef(0.7F, 0.5F, 0.48F);
GL11.glRotated(22.5F*dir, 0.0, 1.0F, 0.0F);
}
if(dir == 9){
GL11.glTranslatef(0.7F, 0.5F, 0.48F);
GL11.glRotated(22.5F*dir, 0.0, 1.0F, 0.0F);
}
if(dir == 10){
GL11.glTranslatef(0.7F, 0.5F, 0.48F);
GL11.glRotated(22.5F*dir, 0.0, 1.0F, 0.0F);
}
if(dir == 11){
GL11.glTranslatef(0.7F, 0.5F, 0.48F);
GL11.glRotated(22.5F*dir, 0.0, 1.0F, 0.0F);
}
if(dir == 12){
GL11.glTranslatef(0.7F, 0.5F, 0.48F);
GL11.glRotated(22.5F*dir, 0.0, 1.0F, 0.0F);
}
if(dir == 13){
GL11.glTranslatef(0.7F, 0.5F, 0.48F);
GL11.glRotated(22.5F*dir, 0.0, 1.0F, 0.0F);
}
if(dir == 14){
GL11.glTranslatef(0.7F, 0.5F, 0.48F);
GL11.glRotated(22.5F*dir, 0.0, 1.0F, 0.0F);
} }
// //
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE); FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE);

View File

@@ -0,0 +1,143 @@
package com.kitsu.medievalcraft.renderer.itemrenderer.cannons;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
import net.minecraftforge.client.IItemRenderer.ItemRendererHelper;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
public class IR_CannonBall_28 implements IItemRenderer {
public static final ResourceLocation MODEL_CRUCIBLE = new ResourceLocation("kitsumedievalcraft:models/cannon_ball.obj");
public static final ResourceLocation TEXTURE = new ResourceLocation("kitsumedievalcraft:models/CannonBall.png");
public IModelCustom model = AdvancedModelLoader.loadModel(MODEL_CRUCIBLE);
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
switch(type) {
case EQUIPPED: {
return true;
}
case EQUIPPED_FIRST_PERSON: {
return true;
}
case INVENTORY: {
return true;
}
case ENTITY: {
return true;
}
default: return false;
}
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item,
ItemRendererHelper helper) {
switch(type) {
case EQUIPPED: {
return helper == ItemRendererHelper.BLOCK_3D;
}
case EQUIPPED_FIRST_PERSON: {
return helper == ItemRendererHelper.EQUIPPED_BLOCK;
}
case INVENTORY: {
return helper == ItemRendererHelper.INVENTORY_BLOCK;
}
case ENTITY: {
return (helper == ItemRendererHelper.ENTITY_BOBBING ||
helper == ItemRendererHelper.ENTITY_ROTATION ||
helper == ItemRendererHelper.BLOCK_3D);
}
default: return false;
}
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
switch(type) {
case EQUIPPED: {
GL11.glPushMatrix();
float scale = 0.5F;
GL11.glScalef(scale, scale, scale);
//ANGLE, X ROTATE, Y ROTATE, Z ROTATE
//GL11.glRotatef(22F, 0.0F, 0.0F, 1.0F);
//GL11.glRotatef(-90F, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(1.8F, 0.4F, 0.3F);
Minecraft.getMinecraft().renderEngine.bindTexture(TEXTURE);
model.renderAll();
GL11.glPopMatrix();
} break;
case EQUIPPED_FIRST_PERSON: {
float f = 0.8F;
GL11.glPushMatrix();
GL11.glScalef(f, f, f);
GL11.glTranslatef(0.5F, 1.F, 1.0F);
//ANGLE, X ROTATE, Y ROTATE, Z ROTATE
GL11.glRotatef(-50F, 0.0F, 1.0F, 0.0F);
//GL11.glRotatef(-45F, 0.0F, 1.0F, 0.0F);
Minecraft.getMinecraft().renderEngine.bindTexture(TEXTURE);
model.renderAll();
GL11.glPopMatrix();
} break;
case INVENTORY: {
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_TEXTURE_2D);
float scale = 1.4F;
GL11.glScalef(scale, scale, scale);
//GL11.glRotatef(90, 1.0F, 0.0F, 0.0F);
GL11.glTranslatef(0.0F, -0.05F, 0.0F);
Minecraft.getMinecraft().renderEngine.bindTexture(TEXTURE);
model.renderAll();
GL11.glPopMatrix();
} break;
case ENTITY: {
GL11.glPushMatrix();
//GL11.glScalef(1.75F, 1.75F, 1.75F);
//GL11.glTranslatef(0.0F, 0.0F, 0.0F);
Minecraft.getMinecraft().renderEngine.bindTexture(TEXTURE);
model.renderAll();
GL11.glPopMatrix();
} break;
default:
break;
}
}
}

View File

@@ -12,4 +12,5 @@ public class TileCannonBall28 extends TileEntity {
public void tileCannonBall28(String string){ public void tileCannonBall28(String string){
this.stringCannonBall_28 = string; this.stringCannonBall_28 = string;
} }
} }

View File

@@ -127,7 +127,9 @@ public class TileCannon_28 extends TileEntity implements IInventory, ISidedInven
@Override @Override
public void openInventory() {} public void openInventory() {}
@Override @Override
public void closeInventory() {} public void closeInventory() {
}
@Override @Override
public boolean isItemValidForSlot(int slot, ItemStack itemstack) { public boolean isItemValidForSlot(int slot, ItemStack itemstack) {

View File

@@ -302,6 +302,7 @@ item.halfSplitBoard.name=Half Split Board
item.woodPulp.name=Wood Pulp item.woodPulp.name=Wood Pulp
item.charcoalFilter.name=Charcoal Filter item.charcoalFilter.name=Charcoal Filter
item.slottedTongs.name=Stone Tongs item.slottedTongs.name=Stone Tongs
item.flintKnapped.name=Knapped Flint
tile.shitBlock.name=Shit Block tile.shitBlock.name=Shit Block
tile.formTable.name=Form Table tile.formTable.name=Form Table
@@ -352,7 +353,10 @@ tile.smallBarrelLid.name=Small Barrel Lid
tile.shelfFour.name=Shelf tile.shelfFour.name=Shelf
tile.firebox.name=Clay Firebox tile.firebox.name=Clay Firebox
tile.emptySoftCrucible.name=Empty Soft Crucible tile.emptySoftCrucible.name=Empty Soft Crucible
tile.emptyCookedCrucible=Empty Crucible tile.emptyCookedCrucible.name=Empty Crucible
tile.cannon_28.name=Cannon 28lb
tile.cannonBallBlock_28.name=Cannon Ball 28lb
itemGroup.MedievalCraftTab=ForgeCraft itemGroup.MedievalCraftTab=ForgeCraft

Binary file not shown.

After

Width:  |  Height:  |  Size: 604 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB