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() {
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.8 KiB |
@@ -1,12 +0,0 @@
|
||||
# Blender MTL File: 'SandFilter.blend'
|
||||
# Material Count: 1
|
||||
|
||||
newmtl Material
|
||||
Ns 96.078431
|
||||
Ka 0.000000 0.000000 0.000000
|
||||
Kd 0.640000 0.640000 0.640000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ni 1.000000
|
||||
d 1.000000
|
||||
illum 2
|
||||
map_Kd /home/kitsu/Development/Blends/SandFilter.png
|
||||
@@ -0,0 +1,100 @@
|
||||
# Blender v2.71 (sub 0) OBJ File: 'SingleForge.blend'
|
||||
# www.blender.org
|
||||
mtllib SingleForge.mtl
|
||||
o Cube
|
||||
v 1.000000 -1.000000 -1.000000
|
||||
v 1.000000 -1.000000 1.000000
|
||||
v -1.000000 -1.000000 1.000000
|
||||
v -1.000000 -1.000000 -1.000000
|
||||
v 1.000000 1.000000 -0.999999
|
||||
v 0.999999 1.000000 1.000001
|
||||
v -1.000000 1.000000 1.000000
|
||||
v -1.000000 1.000000 -1.000000
|
||||
v 0.999999 0.520000 0.799998
|
||||
v 1.000000 -0.519997 0.800000
|
||||
v 1.000000 -0.519997 -0.799993
|
||||
v 1.000000 0.520000 -0.799994
|
||||
v -0.800001 0.520000 0.799998
|
||||
v -0.800000 -0.519998 0.799999
|
||||
v -0.800000 -0.519997 -0.799994
|
||||
v -0.800000 0.520000 -0.799994
|
||||
vt 0.981149 0.023858
|
||||
vt 0.981149 0.331444
|
||||
vt 0.672180 0.331444
|
||||
vt 0.310859 0.355729
|
||||
vt 0.310859 0.023720
|
||||
vt 0.642228 0.023720
|
||||
vt 0.310736 0.024172
|
||||
vt 0.642745 0.024129
|
||||
vt 0.642788 0.355498
|
||||
vt 0.642745 0.024153
|
||||
vt 0.021985 0.311183
|
||||
vt 0.021985 0.037220
|
||||
vt 0.251166 0.037220
|
||||
vt 0.100605 0.309645
|
||||
vt 0.100605 0.036968
|
||||
vt 0.249573 0.036968
|
||||
vt 0.100064 0.310093
|
||||
vt 0.100064 0.036130
|
||||
vt 0.249033 0.036130
|
||||
vt 0.021084 0.310487
|
||||
vt 0.021084 0.036524
|
||||
vt 0.250266 0.036524
|
||||
vt 0.101536 0.309820
|
||||
vt 0.101536 0.037184
|
||||
vt 0.248506 0.037184
|
||||
vt 0.754766 0.393358
|
||||
vt 0.754766 0.648521
|
||||
vt 0.683422 0.680417
|
||||
vt 0.909344 0.648521
|
||||
vt 0.980689 0.680417
|
||||
vt 0.984626 0.360150
|
||||
vt 0.913282 0.392046
|
||||
vt 0.758703 0.392046
|
||||
vt 0.909344 0.393358
|
||||
vt 0.672180 0.023858
|
||||
vt 0.642228 0.355729
|
||||
vt 0.310779 0.355541
|
||||
vt 0.310809 0.355595
|
||||
vt 0.251166 0.311183
|
||||
vt 0.292301 0.396658
|
||||
vt 0.623671 0.396658
|
||||
vt 0.623671 0.728667
|
||||
vt 0.249573 0.309645
|
||||
vt 0.249033 0.310093
|
||||
vt 0.250266 0.310487
|
||||
vt 0.248506 0.309820
|
||||
vt 0.683422 0.361462
|
||||
vt 0.687360 0.360150
|
||||
vt 0.980689 0.361463
|
||||
vt 0.292301 0.728667
|
||||
usemtl Material
|
||||
s off
|
||||
f 2/1 3/2 4/3
|
||||
f 2/4 6/5 7/6
|
||||
f 7/7 8/8 4/9
|
||||
f 1/7 4/10 8/9
|
||||
f 9/11 13/12 16/13
|
||||
f 14/14 15/15 16/16
|
||||
f 12/17 16/18 15/19
|
||||
f 11/20 15/21 14/22
|
||||
f 10/23 14/24 13/25
|
||||
f 9/26 12/27 5/28
|
||||
f 12/27 11/29 1/30
|
||||
f 2/31 10/32 9/33
|
||||
f 1/30 11/29 10/34
|
||||
f 1/35 2/1 4/3
|
||||
f 3/36 2/4 7/6
|
||||
f 3/37 7/7 4/9
|
||||
f 5/38 1/7 8/9
|
||||
f 12/39 9/11 16/13
|
||||
f 8/40 7/41 6/42
|
||||
f 13/43 14/14 16/16
|
||||
f 11/44 12/17 15/19
|
||||
f 10/45 11/20 14/22
|
||||
f 9/46 10/23 13/25
|
||||
f 6/47 9/26 5/28
|
||||
f 5/28 12/27 1/30
|
||||
f 6/48 2/31 9/33
|
||||
f 2/49 1/30 10/34
|
||||
f 5/50 8/40 6/42
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
Reference in New Issue
Block a user