PACKET HANDLER TO THE RESCUE
This commit is contained in:
@@ -42,15 +42,15 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
public class Firebox extends BlockContainer{
|
||||
|
||||
private final Random random = new Random();
|
||||
/*
|
||||
*
|
||||
*
|
||||
* [Chimney]
|
||||
* [ Forge ]
|
||||
* [Firebox]
|
||||
*
|
||||
*
|
||||
* */
|
||||
/*
|
||||
*
|
||||
*
|
||||
* [Chimney]
|
||||
* [ Forge ]
|
||||
* [Firebox]
|
||||
*
|
||||
*
|
||||
* */
|
||||
public Firebox(String unlocalizedName, Material material) {
|
||||
super(material.rock);
|
||||
this.setBlockName(unlocalizedName);
|
||||
@@ -64,68 +64,67 @@ public class Firebox extends BlockContainer{
|
||||
//(xmin, ymin, zmin,
|
||||
// xmax, ymax, zmax)
|
||||
this.setBlockBounds(0.0F, 0.00F, 0.0F,
|
||||
1.0F, 0.98F, 1.0F);
|
||||
|
||||
1.0F, 0.98F, 1.0F);
|
||||
|
||||
}
|
||||
@Override
|
||||
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFireSource(World world, int x, int y, int z, ForgeDirection side) {
|
||||
if (this == ModBlocks.firebox && side == UP)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
if (this == ModBlocks.firebox && side == UP)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand)
|
||||
{
|
||||
super.randomDisplayTick(world, x, y, z, random);
|
||||
if(world.getBlock(x, y+1, z).equals(Blocks.fire)){
|
||||
int l;
|
||||
float f;
|
||||
float f1;
|
||||
float f2;
|
||||
for (l = 0; l < 3; ++l)
|
||||
{
|
||||
f = (float)(x+0.25) + (rand.nextFloat()/2);
|
||||
f1 = (float)y + rand.nextFloat() * 0.4F + 0.2F;
|
||||
f2 = (float)(z+0.25) + (rand.nextFloat()/2);
|
||||
world.spawnParticle("fire", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("smoke", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
int l;
|
||||
float f;
|
||||
float f1;
|
||||
float f2;
|
||||
for (l = 0; l < 3; ++l)
|
||||
{
|
||||
f = (float)(x+0.25) + (rand.nextFloat()/2);
|
||||
f1 = (float)y + rand.nextFloat() * 0.4F + 0.2F;
|
||||
f2 = (float)(z+0.25) + (rand.nextFloat()/2);
|
||||
world.spawnParticle("fire", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("smoke", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//PACKETHANDLE FOR C
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {
|
||||
|
||||
TileEntityFirebox tileEnt = (TileEntityFirebox) world.getTileEntity(x, y, z);
|
||||
|
||||
//System.out.println("");
|
||||
if(!world.isRemote){
|
||||
|
||||
|
||||
if(player.inventory.getCurrentItem()!=null){
|
||||
if((player.inventory.getCurrentItem().getItem()==Item.getItemFromBlock(Blocks.torch))||
|
||||
(player.inventory.getCurrentItem().getItem()==Items.flint_and_steel)||
|
||||
(player.inventory.getCurrentItem().getItem()==ModItems.fireBow)
|
||||
(player.inventory.getCurrentItem().getItem()==Items.flint_and_steel)||
|
||||
(player.inventory.getCurrentItem().getItem()==ModItems.fireBow)
|
||||
){
|
||||
tileEnt.isOn=true;
|
||||
if(world.getBlock(x, y, z).equals(Blocks.air)){
|
||||
world.setBlock(x, y+1, z, Blocks.fire, 0, 2);
|
||||
}
|
||||
|
||||
|
||||
System.out.println(tileEnt.isOn);
|
||||
}
|
||||
}
|
||||
|
||||
if(player.inventory.getCurrentItem()!=null){
|
||||
if (tileEnt.getStackInSlot(0)==null){
|
||||
tileEnt.setInventorySlotContents(0, player.inventory.getCurrentItem());
|
||||
@@ -137,11 +136,11 @@ public class Firebox extends BlockContainer{
|
||||
ItemStack sStack = tileEnt.getStackInSlot(0).copy();
|
||||
ItemStack sStackTemp = tileEnt.getStackInSlot(0).copy();
|
||||
if(tileEnt.getStackInSlot(0).stackSize < 64){
|
||||
sStackTemp.stackSize++;
|
||||
if ((sStack.getItem().equals(pStack.getItem())) && (sStack.getItemDamage() == pStack.getItemDamage()) ){
|
||||
tileEnt.setInventorySlotContents(0, sStackTemp);
|
||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
}
|
||||
sStackTemp.stackSize++;
|
||||
if ((sStack.getItem().equals(pStack.getItem())) && (sStack.getItemDamage() == pStack.getItemDamage()) ){
|
||||
tileEnt.setInventorySlotContents(0, sStackTemp);
|
||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -167,7 +166,7 @@ public class Firebox extends BlockContainer{
|
||||
}
|
||||
|
||||
//tileEnt.markDirty();
|
||||
|
||||
|
||||
}
|
||||
|
||||
tileEnt.markForUpdate();
|
||||
@@ -175,21 +174,21 @@ public class Firebox extends BlockContainer{
|
||||
//System.out.println(player.inventory.getCurrentItem());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player) {
|
||||
|
||||
|
||||
if(!world.isRemote){
|
||||
if(player.inventory.getCurrentItem()!= null){
|
||||
if(player.inventory.getCurrentItem().equals(ModItems.fireBow)||player.inventory.getCurrentItem().equals(Items.flint_and_steel)){
|
||||
TileEntityFirebox tileEnt = (TileEntityFirebox) world.getTileEntity(x, y, z);
|
||||
tileEnt.isOn = true;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}*/
|
||||
|
||||
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||
TileEntityFirebox tileEnt = (TileEntityFirebox) world.getTileEntity(x, y, z);
|
||||
|
||||
@@ -271,6 +270,10 @@ public class Firebox extends BlockContainer{
|
||||
if (item == Items.blaze_rod) return 2400;
|
||||
return GameRegistry.getFuelValue(p_145952_0_);
|
||||
}
|
||||
public static boolean isItemFuel(ItemStack stack)
|
||||
{
|
||||
return getItemBurnTime(stack) > 0;
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RenderId.fireboxID;
|
||||
@@ -283,8 +286,5 @@ public class Firebox extends BlockContainer{
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
public static boolean isItemFuel(ItemStack stack)
|
||||
{
|
||||
return getItemBurnTime(stack) > 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,32 +5,44 @@ import java.util.Random;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemHoe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
import net.minecraft.item.ItemTool;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.item.ModItems;
|
||||
import com.kitsu.medievalcraft.renderer.RenderId;
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileForge;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
import com.kitsu.medievalcraft.util.TileForgePlaceables;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class Forge extends BlockContainer implements TileForgePlaceables{
|
||||
|
||||
private final Random random = new Random();
|
||||
|
||||
|
||||
private float mopX, mopY, mopZ, mopBlockX, mopBlockY, mopBlockZ;
|
||||
private int sideMeta, c;
|
||||
|
||||
public Forge(String unlocalizedName, Material material) {
|
||||
super(material.rock);
|
||||
this.setBlockName(unlocalizedName);
|
||||
@@ -44,25 +56,22 @@ public class Forge extends BlockContainer implements TileForgePlaceables{
|
||||
//(xmin, ymin, zmin,
|
||||
// xmax, ymax, zmax)
|
||||
this.setBlockBounds(0.0F, 0.00F, 0.0F,
|
||||
1.0F, 0.5F, 1.0F);
|
||||
1.0F, 1.0F, 1.0F);
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand)
|
||||
{
|
||||
super.randomDisplayTick(world, x, y, z, random);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack p_149689_6_) {
|
||||
if(!world.isRemote){
|
||||
@@ -70,7 +79,7 @@ public class Forge extends BlockContainer implements TileForgePlaceables{
|
||||
}
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
}
|
||||
|
||||
|
||||
private boolean shouldPlace(ItemStack stack, EntityPlayer player){
|
||||
for(int i=0; i<placeMe.size();i++){
|
||||
if(player.inventory.getCurrentItem().getItem()==placeMe.get(i).getItem()){
|
||||
@@ -81,86 +90,126 @@ public class Forge extends BlockContainer implements TileForgePlaceables{
|
||||
}
|
||||
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {
|
||||
|
||||
TileForge tileEnt = (TileForge) world.getTileEntity(x, y, z);
|
||||
|
||||
if(world.isRemote){
|
||||
MovingObjectPosition mop = Minecraft.getMinecraft().renderViewEntity.rayTrace(5, 1.0F);
|
||||
sideMeta = mop.sideHit;
|
||||
//c = sideMeta;
|
||||
System.out.println(c);
|
||||
System.out.println(world.getBlockMetadata(x, y, z));
|
||||
|
||||
}
|
||||
if(!world.isRemote){
|
||||
if(player.inventory.getCurrentItem()!=null){
|
||||
if (tileEnt.getStackInSlot(0)==null){
|
||||
if(player.inventory.getCurrentItem().getItem()==placeMe.get(0).getItem()||
|
||||
player.inventory.getCurrentItem().getItem()==placeMe.get(1).getItem()||
|
||||
player.inventory.getCurrentItem().getItem()==placeMe.get(2).getItem()||
|
||||
player.inventory.getCurrentItem().getItem()==placeMe.get(3).getItem()||
|
||||
player.inventory.getCurrentItem().getItem()==placeMe.get(4).getItem()){
|
||||
ItemStack tempStack = new ItemStack(player.inventory.getCurrentItem().getItem(), 1);
|
||||
tileEnt.setInventorySlotContents(0, tempStack);
|
||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
}
|
||||
if((player.inventory.getCurrentItem().getItem()==Item.getItemFromBlock(Blocks.torch))||
|
||||
(player.inventory.getCurrentItem().getItem()==Items.flint_and_steel)||
|
||||
(player.inventory.getCurrentItem().getItem()==ModItems.fireBow)
|
||||
){
|
||||
tileEnt.isOn=true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (!player.isSneaking()) {
|
||||
if((player.inventory.getCurrentItem()==null)){
|
||||
if(tileEnt.getStackInSlot(0)!=null){
|
||||
ItemStack pStack = tileEnt.getStackInSlot(0).copy();
|
||||
pStack.stackSize = 1;
|
||||
world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, pStack));
|
||||
tileEnt.decrStackSize(0, 1);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* if(player.inventory.getCurrentItem()!=null){
|
||||
if (tileEnt.getStackInSlot(0)==null){
|
||||
tileEnt.setInventorySlotContents(0, player.inventory.getCurrentItem());
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
|
||||
}
|
||||
if (tileEnt.getStackInSlot(0)!=null){
|
||||
if(player.inventory.getCurrentItem()!=null){
|
||||
ItemStack pStack = player.inventory.getCurrentItem().copy();
|
||||
ItemStack sStack = tileEnt.getStackInSlot(0).copy();
|
||||
ItemStack sStackTemp = tileEnt.getStackInSlot(0).copy();
|
||||
if(tileEnt.getStackInSlot(0).stackSize < 64){
|
||||
sStackTemp.stackSize++;
|
||||
if ((sStack.getItem().equals(pStack.getItem())) && (sStack.getItemDamage() == pStack.getItemDamage()) ){
|
||||
tileEnt.setInventorySlotContents(0, sStackTemp);
|
||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
}
|
||||
if(c==1){
|
||||
if(player.inventory.getCurrentItem()!=null){
|
||||
if(tileEnt.getStackInSlot(1)==null){
|
||||
if(player.inventory.getCurrentItem()!=null){
|
||||
if(player.inventory.getCurrentItem().getItem()==Items.coal){
|
||||
tileEnt.setInventorySlotContents(1, player.inventory.getCurrentItem());
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (player.isSneaking() && player.inventory.getCurrentItem()==null) {
|
||||
if(tileEnt.getStackInSlot(0)!=null){
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, tileEnt.getStackInSlot(0));
|
||||
tileEnt.setInventorySlotContents(0, null);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (!player.isSneaking()) {
|
||||
if((player.inventory.getCurrentItem()==null)){
|
||||
if(tileEnt.getStackInSlot(0)!=null){
|
||||
ItemStack pStack = tileEnt.getStackInSlot(0).copy();
|
||||
pStack.stackSize = 1;
|
||||
world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, pStack));
|
||||
tileEnt.decrStackSize(0, 1);
|
||||
if(player.inventory.getCurrentItem()!=null){
|
||||
if(player.inventory.getCurrentItem()!=null){
|
||||
if(player.inventory.getCurrentItem().getItem()==Items.coal){
|
||||
ItemStack pStack = player.inventory.getCurrentItem().copy();
|
||||
ItemStack sStack = tileEnt.getStackInSlot(1).copy();
|
||||
ItemStack sStackTemp = tileEnt.getStackInSlot(1).copy();
|
||||
if(tileEnt.getStackInSlot(0).stackSize < 64){
|
||||
sStackTemp.stackSize++;
|
||||
if ((sStack.getItem().equals(pStack.getItem())) && (sStack.getItemDamage() == pStack.getItemDamage()) ){
|
||||
tileEnt.setInventorySlotContents(1, sStackTemp);
|
||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (player.isSneaking() && player.inventory.getCurrentItem()==null) {
|
||||
if(tileEnt.getStackInSlot(1)!=null){
|
||||
world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, tileEnt.getStackInSlot(1)));
|
||||
tileEnt.setInventorySlotContents(1, null);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (!player.isSneaking()) {
|
||||
if((player.inventory.getCurrentItem()==null)){
|
||||
if(tileEnt.getStackInSlot(1)!=null){
|
||||
ItemStack pStack = tileEnt.getStackInSlot(1).copy();
|
||||
pStack.stackSize = 1;
|
||||
world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, pStack));
|
||||
tileEnt.decrStackSize(1, 1);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if(c!=0 && c!=1){
|
||||
if(player.inventory.getCurrentItem()!=null){
|
||||
if(tileEnt.getStackInSlot(0)==null){
|
||||
if(isItemFuel(player.inventory.getCurrentItem())==true){
|
||||
tileEnt.setInventorySlotContents(0, player.inventory.getCurrentItem());
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
|
||||
}
|
||||
}
|
||||
if(tileEnt.getStackInSlot(0)!=null){
|
||||
if(player.inventory.getCurrentItem()!=null){
|
||||
if(isItemFuel(player.inventory.getCurrentItem())==true){
|
||||
ItemStack pStack = player.inventory.getCurrentItem().copy();
|
||||
ItemStack sStack = tileEnt.getStackInSlot(0).copy();
|
||||
ItemStack sStackTemp = tileEnt.getStackInSlot(0).copy();
|
||||
if(tileEnt.getStackInSlot(0).stackSize < 64){
|
||||
sStackTemp.stackSize++;
|
||||
if ((sStack.getItem().equals(pStack.getItem())) && (sStack.getItemDamage() == pStack.getItemDamage()) ){
|
||||
tileEnt.setInventorySlotContents(0, sStackTemp);
|
||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (player.isSneaking() && player.inventory.getCurrentItem()==null) {
|
||||
if(tileEnt.getStackInSlot(0)!=null){
|
||||
world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, tileEnt.getStackInSlot(0)));
|
||||
tileEnt.setInventorySlotContents(0, null);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (!player.isSneaking()) {
|
||||
if((player.inventory.getCurrentItem()==null)){
|
||||
if(tileEnt.getStackInSlot(0)!=null){
|
||||
ItemStack pStack = tileEnt.getStackInSlot(0).copy();
|
||||
pStack.stackSize = 1;
|
||||
world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, pStack));
|
||||
tileEnt.decrStackSize(0, 1);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//tileEnt.markDirty();
|
||||
*/
|
||||
}
|
||||
|
||||
tileEnt.markForUpdate();
|
||||
tileEnt.markDirty();
|
||||
//System.out.println(player.inventory.getCurrentItem());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||
TileForge tileEnt = (TileForge) world.getTileEntity(x, y, z);
|
||||
|
||||
@@ -200,11 +249,56 @@ public class Forge extends BlockContainer implements TileForgePlaceables{
|
||||
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
return new TileForge();
|
||||
}
|
||||
|
||||
|
||||
public static int getItemBurnTime(ItemStack p_145952_0_)
|
||||
{
|
||||
if (p_145952_0_ == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
Item item = p_145952_0_.getItem();
|
||||
|
||||
if (item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.air)
|
||||
{
|
||||
Block block = Block.getBlockFromItem(item);
|
||||
|
||||
if (block == Blocks.wooden_slab)
|
||||
{
|
||||
return 150;
|
||||
}
|
||||
|
||||
if (block.getMaterial() == Material.wood)
|
||||
{
|
||||
return 300;
|
||||
}
|
||||
|
||||
if (block == Blocks.coal_block)
|
||||
{
|
||||
return 16000;
|
||||
}
|
||||
}
|
||||
|
||||
if (item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD")) return 200;
|
||||
if (item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD")) return 200;
|
||||
if (item instanceof ItemHoe && ((ItemHoe)item).getToolMaterialName().equals("WOOD")) return 200;
|
||||
if (item == Items.stick) return 100;
|
||||
if (item == Items.coal) return 1600;
|
||||
if (item == Items.lava_bucket) return 20000;
|
||||
if (item == Item.getItemFromBlock(Blocks.sapling)) return 100;
|
||||
if (item == Items.blaze_rod) return 2400;
|
||||
return GameRegistry.getFuelValue(p_145952_0_);
|
||||
}
|
||||
|
||||
public static boolean isItemFuel(ItemStack stack)
|
||||
{
|
||||
return getItemBurnTime(stack) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RenderId.forgeID;
|
||||
|
||||
@@ -1106,7 +1106,7 @@ public class ShelfFour extends BlockContainer{
|
||||
|
||||
if(!world.isRemote){
|
||||
world.setBlockMetadataWithNotify(x, y, z, (MathHelper.floor_double((player.rotationYaw * 4F) / 360F + 0.5D) & 3), 2);
|
||||
|
||||
|
||||
}
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ public class ContainerForge extends Container {
|
||||
}
|
||||
}*/
|
||||
addSlotToContainer(new Slot(tileEnt, 0, 80, 34));
|
||||
|
||||
addSlotToContainer(new Slot(tileEnt, 1, 81, 34));
|
||||
//commonly used vanilla code that adds the player's inventory
|
||||
bindPlayerInventory(inventoryPlayer);
|
||||
}
|
||||
|
||||
@@ -32,8 +32,8 @@ public class ForgeRenderer extends TileEntitySpecialRenderer {
|
||||
EntityItem entItem = null;
|
||||
EntityItem entCoal = null;
|
||||
//boolean slotStatus;
|
||||
public static final ResourceLocation MODEL = new ResourceLocation("kitsumedievalcraft:models/Forge.obj");
|
||||
public static final ResourceLocation TEXTURE = new ResourceLocation("kitsumedievalcraft:models/Forge.png");
|
||||
public static final ResourceLocation MODEL = new ResourceLocation("kitsumedievalcraft:models/SingleForge.obj");
|
||||
public static final ResourceLocation TEXTURE = new ResourceLocation("kitsumedievalcraft:models/SingleForge.png");
|
||||
|
||||
IModelCustom model = AdvancedModelLoader.loadModel(MODEL);
|
||||
|
||||
@@ -45,36 +45,7 @@ public class ForgeRenderer extends TileEntitySpecialRenderer {
|
||||
GL11.glTranslatef((float) x, (float) y, (float) z);
|
||||
|
||||
renderBlock(tileEntity, tile.getWorldObj(), tile.xCoord,tile.yCoord, tile.zCoord, ModBlocks.forge);
|
||||
//System.out.println(tileEntity.isCoal);
|
||||
//if(tileEntity.isCoal==true){
|
||||
//System.out.println("Renderer me plz");
|
||||
ItemStack c = new ItemStack(Items.coal, 1 , 1);
|
||||
entCoal = new EntityItem(tileEntity.getWorldObj(), x, y, z, c);
|
||||
GL11.glPushMatrix();
|
||||
this.entCoal.hoverStart = 0.0F;
|
||||
RenderItem.renderInFrame = true;
|
||||
GL11.glScalef(0.5f, 0.5f, 0.5f);
|
||||
|
||||
RenderManager.instance.renderEntityWithPosYaw(entCoal, 1.0D, 1.0D, -0.5D, 0.0F, 0.0F);
|
||||
RenderManager.instance.renderEntityWithPosYaw(entCoal, 1.15D, 1.3D, -0.79D, 0.0F, 0.0F);
|
||||
RenderManager.instance.renderEntityWithPosYaw(entCoal, 0.75D, 1.3D, -0.79D, 0.0F, 0.0F);
|
||||
RenderManager.instance.renderEntityWithPosYaw(entCoal, 0.35D, 1.3D, -0.79D, 0.0F, 0.0F);
|
||||
|
||||
RenderManager.instance.renderEntityWithPosYaw(entCoal, 1.35D, 1.0D, -0.79D, 0.0F, 0.0F);
|
||||
RenderManager.instance.renderEntityWithPosYaw(entCoal, 0.95D, 1.0D, -0.79D, 0.0F, 0.0F);
|
||||
RenderManager.instance.renderEntityWithPosYaw(entCoal, 0.55D, 1.0D, -0.79D, 0.0F, 0.0F);
|
||||
|
||||
RenderManager.instance.renderEntityWithPosYaw(entCoal, 1.55D, 0.7D, -0.79D, 0.0F, 0.0F);
|
||||
RenderManager.instance.renderEntityWithPosYaw(entCoal, 1.15D, 0.7D, -0.79D, 0.0F, 0.0F);
|
||||
RenderManager.instance.renderEntityWithPosYaw(entCoal, 0.75D, 0.7D, -0.79D, 0.0F, 0.0F);
|
||||
RenderManager.instance.renderEntityWithPosYaw(entCoal, 0.35D, 0.7D, -0.79D, 0.0F, 0.0F);
|
||||
|
||||
RenderManager.instance.renderEntityWithPosYaw(entCoal, 1.35D, 0.4D, -0.79D, 0.0F, 0.0F);
|
||||
RenderManager.instance.renderEntityWithPosYaw(entCoal, 0.95D, 0.4D, -0.79D, 0.0F, 0.0F);
|
||||
RenderManager.instance.renderEntityWithPosYaw(entCoal, 0.55D, 0.4D, -0.79D, 0.0F, 0.0F);
|
||||
|
||||
RenderItem.renderInFrame = false;
|
||||
GL11.glPopMatrix();
|
||||
|
||||
|
||||
//}
|
||||
|
||||
@@ -84,8 +55,8 @@ public class ForgeRenderer extends TileEntitySpecialRenderer {
|
||||
this.entItem.hoverStart = 0.0F;
|
||||
RenderItem.renderInFrame = true;
|
||||
GL11.glScalef(1.0f, 1.0f, 1.0f);
|
||||
GL11.glRotatef(10, 0, 1, 0);
|
||||
RenderManager.instance.renderEntityWithPosYaw(entItem, 0.4D, 0.3D, 0.6D, 0.0F, 0.0F);
|
||||
//GL11.glRotatef(10, 0, 1, 0);
|
||||
RenderManager.instance.renderEntityWithPosYaw(entItem, 0.55D, 0.25D, 0.5D, 0.0F, 0.0F);
|
||||
RenderItem.renderInFrame = false;
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
@@ -101,20 +72,24 @@ public class ForgeRenderer extends TileEntitySpecialRenderer {
|
||||
GL11.glPushMatrix();
|
||||
//GL11.glRotatef(15F, 0F, 1F, 0F);
|
||||
float scale = 0.50f;
|
||||
GL11.glScalef(scale, 1f, scale);
|
||||
GL11.glTranslatef(1.0F, 0.2F, 1.0F);
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
GL11.glTranslatef(1.0F, 1.0F, 1.0F);
|
||||
int dir = world.getBlockMetadata(i, j, k);
|
||||
if(dir == 0){
|
||||
//GL11.glTranslatef(-1F, 0F, 1F);
|
||||
GL11.glRotated(90F, 0.0, 1.0F, 0.0F);
|
||||
}
|
||||
if(dir == 1){
|
||||
//GL11.glTranslatef(-1F, 0F, 1F);
|
||||
GL11.glRotated(-90F, 0.0, 1.0F, 0.0F);
|
||||
//GL11.glRotated(90F, 0.0, 1.0F, 0.0F);
|
||||
}
|
||||
if(dir == 2){
|
||||
//GL11.glTranslatef(-2F, 0F, 0F);
|
||||
GL11.glRotated(-180F, 0.0, 1.0F, 0.0F);
|
||||
GL11.glRotated(-90F, 0.0, 1.0F, 0.0F);
|
||||
}
|
||||
if(dir == 3){
|
||||
//GL11.glTranslatef(-1F, 0F, -1F);
|
||||
GL11.glRotated(90F, 0.0, 1.0F, 0.0F);
|
||||
GL11.glRotated(180F, 0.0, 1.0F, 0.0F);
|
||||
}
|
||||
//
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE);
|
||||
|
||||
@@ -19,10 +19,10 @@ public class TileForge extends TileEntity implements IInventory{
|
||||
private ItemStack[] inv;
|
||||
private NBTTagCompound tag = new NBTTagCompound();
|
||||
public int heat;
|
||||
public boolean isCoal;
|
||||
public boolean isOn;
|
||||
|
||||
public TileForge(){
|
||||
this.inv = new ItemStack[1];
|
||||
this.inv = new ItemStack[2];
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -108,7 +108,7 @@ public class TileForge extends TileEntity implements IInventory{
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 1;
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -147,7 +147,7 @@ public class TileForge extends TileEntity implements IInventory{
|
||||
}
|
||||
//this.stack0 = tagCompound.getString("stack0");
|
||||
this.heat = tag.getInteger("HEAT");
|
||||
this.isCoal = tag.getBoolean("ISCOAL");
|
||||
this.isOn = tag.getBoolean("ISCOAL");
|
||||
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ public class TileForge extends TileEntity implements IInventory{
|
||||
}
|
||||
tagCompound.setTag("Inventory", itemList);
|
||||
tag.setInteger("HEAT", this.heat);
|
||||
tag.setBoolean("ISCOAL", this.isCoal);
|
||||
tag.setBoolean("ISCOAL", this.isOn);
|
||||
}
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
|
||||
Reference in New Issue
Block a user