Fixed fluid syncing issues, fixed liquid item dropping when block broken
This commit is contained in:
parent
f5bd04db3c
commit
755c64369a
7 changed files with 30 additions and 8 deletions
|
@ -2,13 +2,13 @@ package techreborn.blocks;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.EnumCreatureType;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -131,6 +131,11 @@ public class BlockMachineBase extends BlockContainer {
|
|||
|
||||
if (itemStack != null && itemStack.stackSize > 0)
|
||||
{
|
||||
if(itemStack.getItem() instanceof ItemBlock){
|
||||
if(((ItemBlock) itemStack.getItem()).field_150939_a instanceof BlockLiquid || ((ItemBlock) itemStack.getItem()).field_150939_a instanceof BlockStaticLiquid || ((ItemBlock) itemStack.getItem()).field_150939_a instanceof BlockDynamicLiquid){
|
||||
return;
|
||||
}
|
||||
}
|
||||
Random rand = new Random();
|
||||
|
||||
float dX = rand.nextFloat() * 0.8F + 0.1F;
|
||||
|
|
|
@ -21,6 +21,7 @@ public class ContainerAesu extends TechRebornContainer {
|
|||
|
||||
public int euOut;
|
||||
public int storedEu;
|
||||
public int euChange;
|
||||
|
||||
public ContainerAesu(TileAesu tileaesu,
|
||||
EntityPlayer player)
|
||||
|
@ -61,6 +62,9 @@ public class ContainerAesu extends TechRebornContainer {
|
|||
if(this.storedEu != tile.energy){
|
||||
icrafting.sendProgressBarUpdate(this, 1, (int) tile.energy);
|
||||
}
|
||||
if(this.euChange != tile.getEuChange()){
|
||||
icrafting.sendProgressBarUpdate(this, 2, (int) tile.getEuChange());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,6 +73,7 @@ public class ContainerAesu extends TechRebornContainer {
|
|||
super.addCraftingToCrafters(crafting);
|
||||
crafting.sendProgressBarUpdate(this, 0, tile.output);
|
||||
crafting.sendProgressBarUpdate(this, 1, (int) tile.energy);
|
||||
crafting.sendProgressBarUpdate(this, 2 , (int) tile.getEuChange());
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
@ -78,6 +83,8 @@ public class ContainerAesu extends TechRebornContainer {
|
|||
this.euOut = value;
|
||||
} else if(id == 1){
|
||||
this.storedEu = value;
|
||||
} else if(id == 2){
|
||||
this.euChange = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -57,9 +57,10 @@ public class GuiAesu extends GuiContainer {
|
|||
protected void drawGuiContainerForegroundLayer(int p_146979_1_,
|
||||
int p_146979_2_)
|
||||
{
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("tile.techreborn.aesu.name"), 40, 6, Color.WHITE.getRGB());
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("tile.techreborn.aesu.name"), 40, 10, Color.WHITE.getRGB());
|
||||
this.fontRendererObj.drawString(containerAesu.euOut + " eu/tick", 10, 20, Color.WHITE.getRGB());
|
||||
this.fontRendererObj.drawString(containerAesu.storedEu + " eu", 10, 30, Color.WHITE.getRGB());
|
||||
this.fontRendererObj.drawString(containerAesu.euChange + " eu change", 10, 40, Color.WHITE.getRGB());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -16,6 +16,7 @@ public class TileAesu extends TileEntityElectricBlock implements IWrenchable {
|
|||
public static final int MAX_STORAGE = 1000000000; //One billion!
|
||||
public Inventory inventory = new Inventory(2, "TileAesu", 64);
|
||||
private int OUTPUT = 64; //The current output
|
||||
private double euLastTick = 0;
|
||||
|
||||
public TileAesu()
|
||||
{
|
||||
|
@ -26,7 +27,7 @@ public class TileAesu extends TileEntityElectricBlock implements IWrenchable {
|
|||
public void updateEntity()
|
||||
{
|
||||
super.updateEntity();
|
||||
|
||||
euLastTick = energy;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -115,4 +116,9 @@ public class TileAesu extends TileEntityElectricBlock implements IWrenchable {
|
|||
LogHelper.debug("Set output to " + getOutput());
|
||||
}
|
||||
|
||||
public double getEuChange(){
|
||||
return energy - euLastTick;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -157,6 +157,7 @@ public class TileDieselGenerator extends TileEntity implements IWrenchable,
|
|||
public void updateEntity()
|
||||
{
|
||||
super.updateEntity();
|
||||
if(!worldObj.isRemote)
|
||||
FluidUtils.drainContainers(this, inventory, 0, 1);
|
||||
energySource.updateEntity();
|
||||
if (tank.getFluidAmount() > 0
|
||||
|
|
|
@ -180,6 +180,7 @@ public class TileSemifluidGenerator extends TileEntity implements IWrenchable,
|
|||
public void updateEntity()
|
||||
{
|
||||
super.updateEntity();
|
||||
if(!worldObj.isRemote)
|
||||
FluidUtils.drainContainers(this, inventory, 0, 1);
|
||||
energySource.updateEntity();
|
||||
if (tank.getFluidAmount() > 0
|
||||
|
|
|
@ -163,6 +163,7 @@ public class TileThermalGenerator extends TileEntity implements IWrenchable,
|
|||
public void updateEntity()
|
||||
{
|
||||
super.updateEntity();
|
||||
if(!worldObj.isRemote)
|
||||
FluidUtils.drainContainers(this, inventory, 0, 1);
|
||||
energySource.updateEntity();
|
||||
if (tank.getFluidAmount() > 0
|
||||
|
|
Loading…
Reference in a new issue