making it give off light
This commit is contained in:
@@ -56,19 +56,35 @@ 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, 1.00F, 1.0F);
|
||||
|
||||
}
|
||||
@Override
|
||||
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face)
|
||||
{
|
||||
public void updateTick(World world, int x, int y, int z, Random rand) {
|
||||
if(!world.isRemote){
|
||||
if(world.getBlockMetadata(x, y, z)==1){
|
||||
//this.setLightLevel(9999);
|
||||
this.setLightLevel(1F);
|
||||
//this.setLightOpacity(0);
|
||||
//System.out.println(this.getLightValue()+" "+this.getLightOpacity());
|
||||
}
|
||||
if(world.getBlockMetadata(x, y, z)==0){
|
||||
//this.setLightLevel(9999);
|
||||
this.setLightLevel(0F);
|
||||
//this.setLightOpacity(0);
|
||||
//System.out.println(this.getLightValue()+" "+this.getLightOpacity());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
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)
|
||||
{
|
||||
if (this == ModBlocks.firebox && side == UP){
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
@@ -96,7 +112,7 @@ public class Firebox extends BlockContainer{
|
||||
}
|
||||
|
||||
}
|
||||
//PACKETHANDLE FOR C
|
||||
//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);
|
||||
@@ -107,6 +123,8 @@ public class Firebox extends BlockContainer{
|
||||
(player.inventory.getCurrentItem().getItem()==ModItems.fireBow)
|
||||
){
|
||||
world.setBlockMetadataWithNotify(x, y, z, 1, 2);
|
||||
//world.notifyBlockChange(x, y, z, this);
|
||||
world.scheduleBlockUpdate(x, y, z, this, 10);
|
||||
player.inventory.getCurrentItem().damageItem(1, player);
|
||||
if(world.getBlock(x, y, z).equals(Blocks.air)){
|
||||
world.setBlock(x, y+1, z, Blocks.fire, 0, 2);
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.kitsu.medievalcraft.tileents.machine;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockFurnace;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
@@ -46,6 +47,7 @@ public class TileEntityFirebox extends TileEntity implements IInventory{
|
||||
public int getSizeInventory() {
|
||||
return this.inv.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
return this.inv[slot];
|
||||
@@ -219,17 +221,21 @@ public class TileEntityFirebox extends TileEntity implements IInventory{
|
||||
|
||||
private void fireboxMaint(World world, int x, int y, int z){
|
||||
if(world.getBlockMetadata(x, y, z)==0&&world.getBlock(x, y+1, z).equals(Blocks.fire)){
|
||||
world.setBlock(x, y+1, z, Blocks.air, 0, 2);
|
||||
//world.setBlock(x, y+1, z, Blocks.air, 0, 2);
|
||||
|
||||
world.scheduleBlockUpdate(x, y, z, world.getBlock(x,y,z), 10);
|
||||
}
|
||||
if((this.getStackInSlot(0)==null)){
|
||||
world.setBlockMetadataWithNotify(x, y, z, 0, 2);
|
||||
world.scheduleBlockUpdate(x, y, z, world.getBlock(x, y, z), 10);
|
||||
}
|
||||
if(world.getBlockMetadata(x, y, z)==1 && world.getBlock(x, y+1, z).equals(Blocks.air)){
|
||||
world.setBlock(x, y+1, z, Blocks.fire, 0, 2);
|
||||
}
|
||||
/*if(world.getBlock(x, y+1, z).equals(Blocks.fire)){
|
||||
world.setBlockMetadataWithNotify(x, y, z, 1, 2);
|
||||
}*/
|
||||
if(world.getBlockMetadata(x, y, z)==1){
|
||||
//this.worldObj.markBlockForUpdate(x, y, z);
|
||||
world.scheduleBlockUpdate(x, y, z, world.getBlock(x,y,z), 10);
|
||||
}
|
||||
}
|
||||
private void fireboxFuelDec(World world, int x, int y, int z, ItemStack stack, int time){
|
||||
if(world.getBlock(x, y+1, z).equals(Blocks.fire)){
|
||||
@@ -306,24 +312,20 @@ public class TileEntityFirebox extends TileEntity implements IInventory{
|
||||
return getItemBurnTime(stack) > 0;
|
||||
}
|
||||
public void isFurnace(World world, int x, int y, int z){
|
||||
if(world.getBlock(x, y+2, z).equals(Blocks.furnace) &&(world.getBlock(x, y+1, z).equals(Blocks.fire))){
|
||||
TileEntityFurnace tile = (TileEntityFurnace) world.getTileEntity(x, y+2, z);
|
||||
if(world.getBlock(x, y+1, z).equals(Blocks.furnace)&&(world.getBlockMetadata(x, y, z)==1)){
|
||||
TileEntityFurnace tile = (TileEntityFurnace) world.getTileEntity(x, y+1, z);
|
||||
if(tile.getStackInSlot(0)!=null){
|
||||
//System.out.println(tile.getStackInSlot(0));
|
||||
//System.out.println(tile.getStackInSlot(1));
|
||||
if(isItemFuel(tile.getStackInSlot(1))==false){
|
||||
//System.out.println();
|
||||
tile.furnaceBurnTime = (int)(this.getItemBurnTime(this.getStackInSlot(0))+((fuelMulti(this.getStackInSlot(0).stackSize, this.getStackInSlot(0))*this.getItemBurnTime(this.getStackInSlot(0)))));
|
||||
BlockFurnace.updateFurnaceBlockState(true, world, x, y+2, z);
|
||||
BlockFurnace.updateFurnaceBlockState(true, world, x, y+1, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(world.getBlock(x, y+2, z).equals(Blocks.furnace)&&(world.getBlock(x, y+1, z)!=(Blocks.fire))){
|
||||
TileEntityFurnace tile = (TileEntityFurnace) world.getTileEntity(x, y+2, z);
|
||||
if(world.getBlock(x, y+1, z).equals(Blocks.furnace)&&(world.getBlockMetadata(x, y, z)==1)){
|
||||
TileEntityFurnace tile = (TileEntityFurnace) world.getTileEntity(x, y+1, z);
|
||||
if(tile.getStackInSlot(1)!=null){
|
||||
if(isItemFuel(tile.getStackInSlot(1))==false){
|
||||
//tile.furnaceBurnTime = (int)(this.getItemBurnTime(this.getStackInSlot(0))+((fuelMulti(this.getStackInSlot(0).stackSize, this.getStackInSlot(0))*this.getItemBurnTime(this.getStackInSlot(0)))));
|
||||
BlockFurnace.updateFurnaceBlockState(false, world, x, y+2, z);
|
||||
BlockFurnace.updateFurnaceBlockState(false, world, x, y+1, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user