Now shows the heat of the multiblock

This commit is contained in:
modmuss50 2015-04-26 16:22:26 +01:00
parent d70038b77f
commit db62b7a8b8
4 changed files with 136 additions and 123 deletions

View file

@ -90,4 +90,16 @@ public class BlockMachineCasing extends BlockMultiblockBase {
{
return new TileMachineCasing();
}
public static int getHeatFromMeta(int meta){
switch (meta){
case 0:
return 1020;
case 1:
return 1700;
case 2:
return 2380;
}
return 0;
}
}

View file

@ -37,6 +37,7 @@ public class GuiBlastFurnace extends GuiContainer {
int p_146979_2_)
{
this.fontRendererObj.drawString("Blastfurnace", 60, 6, 4210752);
this.fontRendererObj.drawString(blastfurnace.getHeat() + " heat", 75, 20, 4210752);
this.fontRendererObj.drawString(
I18n.format("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);

View file

@ -1,163 +1,143 @@
package techreborn.multiblocks;
import net.minecraft.block.Block;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import techreborn.util.LogHelper;
import erogenousbeef.coreTR.multiblock.IMultiblockPart;
import erogenousbeef.coreTR.multiblock.MultiblockControllerBase;
import erogenousbeef.coreTR.multiblock.MultiblockValidationException;
import erogenousbeef.coreTR.multiblock.rectangular.RectangularMultiblockControllerBase;
import net.minecraft.block.Block;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import techreborn.util.LogHelper;
public class MultiBlockCasing extends RectangularMultiblockControllerBase {
public MultiBlockCasing(World world)
{
public boolean hasLava;
public MultiBlockCasing(World world) {
super(world);
}
@Override
public void onAttachedPartWithMultiblockData(IMultiblockPart part,
NBTTagCompound data)
{
NBTTagCompound data) {
}
@Override
protected void onBlockAdded(IMultiblockPart newPart)
{
protected void onBlockAdded(IMultiblockPart newPart) {
}
@Override
protected void onBlockRemoved(IMultiblockPart oldPart)
{
protected void onBlockRemoved(IMultiblockPart oldPart) {
}
@Override
protected void onMachineAssembled()
{
protected void onMachineAssembled() {
LogHelper.warn("New multiblock created!");
}
@Override
protected void onMachineRestored()
{
protected void onMachineRestored() {
}
@Override
protected void onMachinePaused()
{
protected void onMachinePaused() {
}
@Override
protected void onMachineDisassembled()
{
protected void onMachineDisassembled() {
}
@Override
protected int getMinimumNumberOfBlocksForAssembledMachine()
{
protected int getMinimumNumberOfBlocksForAssembledMachine() {
return 1;
}
@Override
protected int getMaximumXSize()
{
protected int getMaximumXSize() {
return 3;
}
@Override
protected int getMaximumZSize()
{
protected int getMaximumZSize() {
return 3;
}
@Override
protected int getMaximumYSize()
{
protected int getMaximumYSize() {
return 4;
}
@Override
protected int getMinimumXSize()
{
protected int getMinimumXSize() {
return 3;
}
@Override
protected int getMinimumYSize()
{
protected int getMinimumYSize() {
return 4;
}
@Override
protected int getMinimumZSize()
{
protected int getMinimumZSize() {
return 3;
}
@Override
protected void onAssimilate(MultiblockControllerBase assimilated)
{
protected void onAssimilate(MultiblockControllerBase assimilated) {
}
@Override
protected void onAssimilated(MultiblockControllerBase assimilator)
{
protected void onAssimilated(MultiblockControllerBase assimilator) {
}
@Override
protected boolean updateServer()
{
protected boolean updateServer() {
return true;
}
@Override
protected void updateClient()
{
protected void updateClient() {
}
@Override
public void writeToNBT(NBTTagCompound data)
{
public void writeToNBT(NBTTagCompound data) {
}
@Override
public void readFromNBT(NBTTagCompound data)
{
public void readFromNBT(NBTTagCompound data) {
}
@Override
public void formatDescriptionPacket(NBTTagCompound data)
{
public void formatDescriptionPacket(NBTTagCompound data) {
}
@Override
public void decodeDescriptionPacket(NBTTagCompound data)
{
public void decodeDescriptionPacket(NBTTagCompound data) {
}
@Override
protected void isBlockGoodForInterior(World world, int x, int y, int z)
throws MultiblockValidationException
{
throws MultiblockValidationException {
Block block = world.getBlock(x, y, z);
if (block.getUnlocalizedName().equals("tile.lava")
|| block.getUnlocalizedName().equals("tile.air"))
{
} else
{
if (block.getUnlocalizedName().equals("tile.air")) {
} else if (block.getUnlocalizedName().equals("tile.lava")) {
hasLava = true;
} else {
super.isBlockGoodForInterior(world, x, y, z);
}
}

View file

@ -4,7 +4,12 @@ import ic2.api.energy.prefab.BasicSink;
import ic2.api.tile.IWrenchable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import techreborn.blocks.BlockMachineCasing;
import techreborn.init.ModBlocks;
import techreborn.lib.Location;
import techreborn.multiblocks.MultiBlockCasing;
import techreborn.util.Inventory;
public class TileBlastFurnace extends TileMachineBase implements IWrenchable {
@ -48,9 +53,24 @@ public class TileBlastFurnace extends TileMachineBase implements IWrenchable {
return new ItemStack(ModBlocks.BlastFurnace, 1);
}
public boolean isComplete()
{
return false;
public int getHeat(){
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
TileEntity tileEntity = worldObj.getTileEntity(xCoord + direction.offsetX, yCoord + direction.offsetY, zCoord + direction.offsetZ);
if (tileEntity instanceof TileMachineCasing) {
if((tileEntity.getBlockType() instanceof BlockMachineCasing)){
int heat;
heat = BlockMachineCasing.getHeatFromMeta(tileEntity.getBlockMetadata());
Location location = new Location(xCoord, yCoord, zCoord, direction);
location.modifyPositionFromSide(direction, 1);
if(worldObj.getBlock(location.getX(), location.getY(), location.getZ()).getUnlocalizedName().equals("tile.lava")){
heat += 500;
}
return heat;
}
}
}
return 0;
}
}