need to check heat addition or heat management
This commit is contained in:
@@ -25,6 +25,8 @@ import net.minecraft.tileentity.TileEntityFurnace;
|
|||||||
import net.minecraft.util.*;
|
import net.minecraft.util.*;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
|
import net.minecraft.util.text.TextComponentString;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
@@ -35,6 +37,7 @@ import nmd.primal.forgecraft.tiles.TileFirebox;
|
|||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import static net.minecraft.block.BlockHorizontal.FACING;
|
import static net.minecraft.block.BlockHorizontal.FACING;
|
||||||
@@ -42,7 +45,7 @@ import static net.minecraft.block.BlockHorizontal.FACING;
|
|||||||
/**
|
/**
|
||||||
* Created by kitsu on 11/26/2016.
|
* Created by kitsu on 11/26/2016.
|
||||||
*/
|
*/
|
||||||
public class Firebox extends CustomContainerFacing implements ITileEntityProvider {
|
public class Firebox extends CustomContainerFacing implements ITileEntityProvider/*, ITextComponent*/ {
|
||||||
|
|
||||||
public static final PropertyBool ACTIVE = PropertyBool.create("active");
|
public static final PropertyBool ACTIVE = PropertyBool.create("active");
|
||||||
protected static final AxisAlignedBB collideBox = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.99D, 1.0D);
|
protected static final AxisAlignedBB collideBox = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.99D, 1.0D);
|
||||||
@@ -75,6 +78,9 @@ public class Firebox extends CustomContainerFacing implements ITileEntityProvide
|
|||||||
return boundBox;
|
return boundBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
|
||||||
{
|
{
|
||||||
@@ -93,6 +99,15 @@ public class Firebox extends CustomContainerFacing implements ITileEntityProvide
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(!player.isSneaking()){
|
||||||
|
if(world.getBlockState(pos).getValue(ACTIVE) == true){
|
||||||
|
Integer tempInt = tile.getHeat();
|
||||||
|
String tempString = tempInt.toString();
|
||||||
|
ITextComponent itextcomponent = new TextComponentString(tempString);
|
||||||
|
player.sendStatusMessage(itextcomponent, true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if((pItem.getItem() == Items.FLINT_AND_STEEL) /*|| (pItem.getItem() == PrimalItems.FIRE_BOW)*/ || pItem.getItem() == Item.getItemFromBlock(Blocks.TORCH)) {
|
if((pItem.getItem() == Items.FLINT_AND_STEEL) /*|| (pItem.getItem() == PrimalItems.FIRE_BOW)*/ || pItem.getItem() == Item.getItemFromBlock(Blocks.TORCH)) {
|
||||||
world.setBlockState(pos, state.withProperty(ACTIVE, true), 2);
|
world.setBlockState(pos, state.withProperty(ACTIVE, true), 2);
|
||||||
@@ -105,7 +120,7 @@ public class Firebox extends CustomContainerFacing implements ITileEntityProvide
|
|||||||
tile.updateBlock();
|
tile.updateBlock();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if((!pItem.isEmpty()) && (CommonUtils.getVanillaItemBurnTime(pItem) > 0)) {
|
if((!pItem.isEmpty()) && tile.isItemValidForSlot(0, pItem)) {
|
||||||
if (!tileItem.isEmpty()){
|
if (!tileItem.isEmpty()){
|
||||||
if(pItem.getItem() == tileItem.getItem()){
|
if(pItem.getItem() == tileItem.getItem()){
|
||||||
if(tileItem.getCount() < 64){
|
if(tileItem.getCount() < 64){
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ import net.minecraft.util.EnumFacing;
|
|||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
|
import net.minecraft.util.text.TextComponentString;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
@@ -44,6 +46,8 @@ public class PistonBellows extends CustomFacing {
|
|||||||
setHardness(3.0f);
|
setHardness(3.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DOESNT SEEM LIKE I'M ADDING HEAT TO THE RIGHT TILE
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
@@ -51,14 +55,50 @@ public class PistonBellows extends CustomFacing {
|
|||||||
if(facing == EnumFacing.NORTH){
|
if(facing == EnumFacing.NORTH){
|
||||||
BlockPos tempPos = new BlockPos(pos.getX()-1, pos.getY(), pos.getZ());
|
BlockPos tempPos = new BlockPos(pos.getX()-1, pos.getY(), pos.getZ());
|
||||||
TileFirebox tile = (TileFirebox) world.getTileEntity(tempPos);
|
TileFirebox tile = (TileFirebox) world.getTileEntity(tempPos);
|
||||||
|
if(world.getBlockState(tempPos) == Firebox.ACTIVE){
|
||||||
if(tile != null){
|
if(tile != null){
|
||||||
tile.setHeat(tile.getHeat() + 25);
|
tile.setHeat(tile.getHeat() + 25);
|
||||||
|
tile.updateBlock();
|
||||||
|
tile.markDirty();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
System.out.println(world.getBlockState(tempPos).getBlock());
|
|
||||||
}
|
}
|
||||||
if(facing == EnumFacing.SOUTH){
|
if(facing == EnumFacing.SOUTH){
|
||||||
BlockPos tempPos = new BlockPos(pos.getX()+1, pos.getY(), pos.getZ());
|
BlockPos tempPos = new BlockPos(pos.getX()+1, pos.getY(), pos.getZ());
|
||||||
System.out.println(world.getBlockState(tempPos).getBlock());
|
TileFirebox tile = (TileFirebox) world.getTileEntity(tempPos);
|
||||||
|
if(world.getBlockState(tempPos) == Firebox.ACTIVE){
|
||||||
|
if(tile != null){
|
||||||
|
tile.setHeat(tile.getHeat() + 25);
|
||||||
|
tile.updateBlock();
|
||||||
|
tile.markDirty();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(facing == EnumFacing.EAST){
|
||||||
|
BlockPos tempPos = new BlockPos(pos.getX(), pos.getY(), pos.getZ()-1);
|
||||||
|
TileFirebox tile = (TileFirebox) world.getTileEntity(tempPos);
|
||||||
|
if(world.getBlockState(tempPos) == Firebox.ACTIVE){
|
||||||
|
if(tile != null){
|
||||||
|
tile.setHeat(tile.getHeat() + 25);
|
||||||
|
tile.updateBlock();
|
||||||
|
tile.markDirty();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(facing == EnumFacing.EAST){
|
||||||
|
BlockPos tempPos = new BlockPos(pos.getX(), pos.getY(), pos.getZ()+1);
|
||||||
|
TileFirebox tile = (TileFirebox) world.getTileEntity(tempPos);
|
||||||
|
if(world.getBlockState(tempPos) == Firebox.ACTIVE){
|
||||||
|
if(tile != null){
|
||||||
|
tile.setHeat(tile.getHeat() + 25);
|
||||||
|
tile.updateBlock();
|
||||||
|
tile.markDirty();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -8,8 +8,10 @@ import net.minecraft.client.gui.GuiChat;
|
|||||||
import net.minecraft.entity.item.EntityItem;
|
import net.minecraft.entity.item.EntityItem;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.inventory.ItemStackHelper;
|
import net.minecraft.inventory.ItemStackHelper;
|
||||||
|
import net.minecraft.inventory.SlotFurnaceFuel;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
@@ -143,5 +145,15 @@ public class TileFirebox extends TileBaseSlot implements ITickable {
|
|||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isItemValidForSlot(int index, ItemStack stack) {
|
||||||
|
if(index == 0){
|
||||||
|
if(stack.getItem() == Items.COAL){
|
||||||
|
if(stack.getMetadata() == 1) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user