mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
The great energy massacre part 3
This commit is contained in:
parent
810786fa9d
commit
5b8d478c22
@ -57,4 +57,15 @@ public interface IEnergyConnector {
|
||||
con.getPowerNet().subscribe(this);
|
||||
}
|
||||
}
|
||||
public default void tryUnsubscribe(World world, int x, int y, int z) {
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
|
||||
if(te instanceof IEnergyConductor) {
|
||||
IEnergyConductor con = (IEnergyConductor) te;
|
||||
|
||||
if(con.getPowerNet() != null && con.getPowerNet().isSubscribed(this))
|
||||
con.getPowerNet().unsubscribe(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,6 @@ import java.util.Random;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.machine.TileEntityReiXMainframe;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@ -52,95 +51,9 @@ public class MachineReiXMainframe extends BlockContainer {
|
||||
return side == 1 ? this.iconTop : (side == 0 ? this.iconBottom : this.blockIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
|
||||
{
|
||||
return Item.getItemFromBlock(ModBlocks.machine_reix_mainframe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
|
||||
MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D);
|
||||
|
||||
if(itemStack.hasDisplayName())
|
||||
{
|
||||
((TileEntityReiXMainframe)world.getTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
if(world.isRemote)
|
||||
{
|
||||
return true;
|
||||
} else if(!player.isSneaking())
|
||||
{
|
||||
TileEntityReiXMainframe entity = (TileEntityReiXMainframe) world.getTileEntity(x, y, z);
|
||||
if(entity != null)
|
||||
{
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_machine_reix_mainframe, world, x, y, z);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileEntityReiXMainframe();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_)
|
||||
{
|
||||
if (true)
|
||||
{
|
||||
TileEntityReiXMainframe tileentityfurnace = (TileEntityReiXMainframe)p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_);
|
||||
|
||||
if (tileentityfurnace != null)
|
||||
{
|
||||
for (int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1)
|
||||
{
|
||||
ItemStack itemstack = tileentityfurnace.getStackInSlot(i1);
|
||||
|
||||
if (itemstack != null)
|
||||
{
|
||||
float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while (itemstack.stackSize > 0)
|
||||
{
|
||||
int j1 = this.field_149933_a.nextInt(21) + 10;
|
||||
|
||||
if (j1 > itemstack.stackSize)
|
||||
{
|
||||
j1 = itemstack.stackSize;
|
||||
}
|
||||
|
||||
itemstack.stackSize -= j1;
|
||||
EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
|
||||
|
||||
if (itemstack.hasTagCompound())
|
||||
{
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float)this.field_149933_a.nextGaussian() * f3;
|
||||
entityitem.motionY = (float)this.field_149933_a.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float)this.field_149933_a.nextGaussian() * f3;
|
||||
p_149749_1_.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_);
|
||||
}
|
||||
}
|
||||
|
||||
super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_);
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -49,6 +49,6 @@ public class MachineTransformer extends BlockContainer {
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileEntityMachineTransformer(buffer, delay);
|
||||
return new TileEntityMachineTransformer();
|
||||
}
|
||||
}
|
||||
|
||||
@ -280,13 +280,6 @@ public class GUIHandler implements IGuiHandler {
|
||||
return null;
|
||||
}
|
||||
|
||||
case ModBlocks.guiID_machine_reix_mainframe: {
|
||||
if(entity instanceof TileEntityReiXMainframe) {
|
||||
return new ContainerReiXMainframe(player.inventory, (TileEntityReiXMainframe) entity);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
case ModBlocks.guiID_machine_industrial_generator: {
|
||||
if(entity instanceof TileEntityMachineIGenerator) {
|
||||
return new ContainerIGenerator(player.inventory, (TileEntityMachineIGenerator) entity);
|
||||
@ -1136,13 +1129,6 @@ public class GUIHandler implements IGuiHandler {
|
||||
return null;
|
||||
}
|
||||
|
||||
case ModBlocks.guiID_machine_reix_mainframe: {
|
||||
if(entity instanceof TileEntityReiXMainframe) {
|
||||
return new GUIReiXMainframe(player.inventory, (TileEntityReiXMainframe) entity);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
case ModBlocks.guiID_machine_industrial_generator: {
|
||||
if(entity instanceof TileEntityMachineIGenerator) {
|
||||
return new GUIIGenerator(player.inventory, (TileEntityMachineIGenerator) entity);
|
||||
|
||||
@ -1,76 +0,0 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.tileentity.machine.TileEntityReiXMainframe;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerReiXMainframe extends Container {
|
||||
|
||||
private TileEntityReiXMainframe diFurnace;
|
||||
|
||||
private int power;
|
||||
|
||||
public ContainerReiXMainframe(InventoryPlayer invPlayer, TileEntityReiXMainframe tedf) {
|
||||
|
||||
diFurnace = tedf;
|
||||
|
||||
this.addSlotToContainer(new Slot(tedf, 0, 8, 158));
|
||||
this.addSlotToContainer(new Slot(tedf, 1, 44, 158));
|
||||
this.addSlotToContainer(new Slot(tedf, 2, 80, 158));
|
||||
this.addSlotToContainer(new Slot(tedf, 3, 116, 158));
|
||||
this.addSlotToContainer(new Slot(tedf, 4, 152, 158));
|
||||
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142 + 56));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCraftingToCrafters(ICrafting crafting) {
|
||||
super.addCraftingToCrafters(crafting);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2)
|
||||
{
|
||||
ItemStack var3 = null;
|
||||
Slot var4 = (Slot) this.inventorySlots.get(par2);
|
||||
|
||||
if (var4 != null && var4.getHasStack())
|
||||
{
|
||||
ItemStack var5 = var4.getStack();
|
||||
var3 = var5.copy();
|
||||
|
||||
if (par2 <= 4) {
|
||||
if (!this.mergeItemStack(var5, 5, this.inventorySlots.size(), true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (var5.stackSize == 0)
|
||||
{
|
||||
var4.putStack((ItemStack) null);
|
||||
}
|
||||
else
|
||||
{
|
||||
var4.onSlotChanged();
|
||||
}
|
||||
}
|
||||
|
||||
return var3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return diFurnace.isUseableByPlayer(player);
|
||||
}
|
||||
}
|
||||
@ -1,42 +0,0 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerReiXMainframe;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.machine.TileEntityReiXMainframe;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIReiXMainframe extends GuiContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/reix_cmd.png");
|
||||
private TileEntityReiXMainframe diFurnace;
|
||||
|
||||
public GUIReiXMainframe(InventoryPlayer invPlayer, TileEntityReiXMainframe tedf) {
|
||||
super(new ContainerReiXMainframe(invPlayer, tedf));
|
||||
diFurnace = tedf;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 222;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.diFurnace.hasCustomInventoryName() ? this.diFurnace.getInventoryName() : I18n.format(this.diFurnace.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
}
|
||||
}
|
||||
@ -49,7 +49,7 @@ public class TileEntityCondenser extends TileEntity implements IFluidAcceptor, I
|
||||
|
||||
int light = this.worldObj.getSavedLightValue(EnumSkyBlock.Sky, this.xCoord, this.yCoord, this.zCoord);
|
||||
|
||||
if(ModEventHandler.fire > 0 && light > 7) { // Make both steam and water evaporate during firestorms...{
|
||||
if(ModEventHandler.fire > 0 && light > 7) { // Make both steam and water evaporate during firestorms...
|
||||
tanks[1].setFill(tanks[1].getFill() - convert);
|
||||
} else {
|
||||
tanks[1].setFill(tanks[1].getFill() + convert);
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import com.hbm.calc.Location;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import cofh.api.energy.EnergyStorage;
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
import cofh.api.energy.IEnergyReceiver;
|
||||
@ -11,7 +11,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityConverterHeRf extends TileEntityMachineBase implements IConsumer, IEnergyHandler {
|
||||
public class TileEntityConverterHeRf extends TileEntityMachineBase implements IEnergyUser, IEnergyHandler {
|
||||
|
||||
public TileEntityConverterHeRf() {
|
||||
super(0);
|
||||
@ -34,6 +34,9 @@ public class TileEntityConverterHeRf extends TileEntityMachineBase implements IC
|
||||
public void updateEntity() {
|
||||
if (!worldObj.isRemote) {
|
||||
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
this.trySubscribe(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ);
|
||||
|
||||
storage.setCapacity((int)power * 4);
|
||||
storage.setEnergyStored((int)power * 4);
|
||||
|
||||
|
||||
@ -3,22 +3,19 @@ package com.hbm.tileentity.machine;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.ISource;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
import api.hbm.energy.IEnergyGenerator;
|
||||
import cofh.api.energy.EnergyStorage;
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityConverterRfHe extends TileEntityMachineBase implements ISource, IEnergyHandler {
|
||||
public class TileEntityConverterRfHe extends TileEntityMachineBase implements IEnergyGenerator, IEnergyHandler {
|
||||
|
||||
public long power;
|
||||
public long maxPower = 500000000;
|
||||
public List<IConsumer> list = new ArrayList();
|
||||
public boolean tact;
|
||||
public EnergyStorage storage = new EnergyStorage(2000000000, 2000000000, 2000000000);
|
||||
|
||||
public int buf;
|
||||
@ -42,10 +39,9 @@ public class TileEntityConverterRfHe extends TileEntityMachineBase implements IS
|
||||
|
||||
buf = storage.getEnergyStored();
|
||||
|
||||
tact = false;
|
||||
ffgeuaInit();
|
||||
tact = true;
|
||||
ffgeuaInit();
|
||||
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
this.sendPower(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir);
|
||||
|
||||
storage.setEnergyStored((int)power * 4);
|
||||
|
||||
@ -90,27 +86,6 @@ public class TileEntityConverterRfHe extends TileEntityMachineBase implements IS
|
||||
return storage.getMaxEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeua(int x, int y, int z, boolean newTact) {
|
||||
|
||||
Library.ffgeua(x, y, z, newTact, this, worldObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeuaInit() {
|
||||
ffgeua(this.xCoord, this.yCoord + 1, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord - 1, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord - 1, this.yCoord, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord + 1, this.yCoord, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord, this.zCoord - 1, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord, this.zCoord + 1, getTact());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getTact() {
|
||||
return tact;
|
||||
}
|
||||
|
||||
public long getPowerScaled(long i) {
|
||||
return (power * i) / maxPower;
|
||||
}
|
||||
@ -120,23 +95,18 @@ public class TileEntityConverterRfHe extends TileEntityMachineBase implements IS
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSPower() {
|
||||
public long getPower() {
|
||||
return power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSPower(long i) {
|
||||
public void setPower(long i) {
|
||||
this.power = i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IConsumer> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearList() {
|
||||
this.list.clear();
|
||||
public long getMaxPower() {
|
||||
return this.maxPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -159,5 +129,4 @@ public class TileEntityConverterRfHe extends TileEntityMachineBase implements IS
|
||||
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.IFactory;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemBattery;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@ -16,7 +16,7 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileEntityCoreAdvanced extends TileEntity implements ISidedInventory, IFactory, IConsumer {
|
||||
public class TileEntityCoreAdvanced extends TileEntity implements ISidedInventory, IFactory, IEnergyUser {
|
||||
|
||||
public int progress = 0;
|
||||
public long power = 0;
|
||||
@ -233,6 +233,19 @@ public class TileEntityCoreAdvanced extends TileEntity implements ISidedInventor
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
if(worldObj.getBlock(xCoord, yCoord + 1, zCoord) == ModBlocks.factory_advanced_conductor)
|
||||
this.trySubscribe(worldObj, xCoord, yCoord + 2, zCoord);
|
||||
else
|
||||
this.tryUnsubscribe(worldObj, xCoord, yCoord + 2, zCoord);
|
||||
|
||||
if(worldObj.getBlock(xCoord, yCoord - 1, zCoord) == ModBlocks.factory_advanced_conductor)
|
||||
this.trySubscribe(worldObj, xCoord, yCoord - 2, zCoord);
|
||||
else
|
||||
this.tryUnsubscribe(worldObj, xCoord, yCoord - 2, zCoord);
|
||||
}
|
||||
|
||||
if(this.slots[22] != null && this.slots[22].getItem() == ModItems.factory_core_advanced)
|
||||
{
|
||||
this.power = (int) ((IBatteryItem)slots[22].getItem()).getCharge(slots[22]);
|
||||
|
||||
@ -1,12 +1,13 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.IFactory;
|
||||
import com.hbm.interfaces.Spaghetti;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemBattery;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@ -16,7 +17,7 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileEntityCoreTitanium extends TileEntity implements ISidedInventory, IFactory, IConsumer {
|
||||
public class TileEntityCoreTitanium extends TileEntity implements ISidedInventory, IFactory, IEnergyUser {
|
||||
|
||||
public int progress = 0;
|
||||
public long power = 0;
|
||||
@ -176,6 +177,7 @@ public class TileEntityCoreTitanium extends TileEntity implements ISidedInventor
|
||||
nbt.setTag("items", list);
|
||||
}
|
||||
|
||||
@Spaghetti("2016 bobcode *shudders*")
|
||||
@Override
|
||||
public boolean isStructureValid(World world) {
|
||||
if(world.getBlock(this.xCoord, this.yCoord, this.zCoord) == ModBlocks.factory_titanium_core &&
|
||||
@ -233,6 +235,19 @@ public class TileEntityCoreTitanium extends TileEntity implements ISidedInventor
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
if(worldObj.getBlock(xCoord, yCoord + 1, zCoord) == ModBlocks.factory_titanium_conductor)
|
||||
this.trySubscribe(worldObj, xCoord, yCoord + 2, zCoord);
|
||||
else
|
||||
this.tryUnsubscribe(worldObj, xCoord, yCoord + 2, zCoord);
|
||||
|
||||
if(worldObj.getBlock(xCoord, yCoord - 1, zCoord) == ModBlocks.factory_titanium_conductor)
|
||||
this.trySubscribe(worldObj, xCoord, yCoord - 2, zCoord);
|
||||
else
|
||||
this.tryUnsubscribe(worldObj, xCoord, yCoord - 2, zCoord);
|
||||
}
|
||||
|
||||
if(this.slots[22] != null && this.slots[22].getItem() == ModItems.factory_core_titanium)
|
||||
{
|
||||
this.power = (int) ((IBatteryItem)slots[22].getItem()).getCharge(slots[22]);
|
||||
|
||||
@ -4,7 +4,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.interfaces.IFluidSource;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
@ -13,11 +12,12 @@ import com.hbm.packet.AuxElectricityPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityDeuteriumExtractor extends TileEntityMachineBase implements IFluidAcceptor, IFluidSource, IConsumer {
|
||||
public class TileEntityDeuteriumExtractor extends TileEntityMachineBase implements IFluidAcceptor, IFluidSource, IEnergyUser {
|
||||
|
||||
public int age = 0;
|
||||
public long power = 0;
|
||||
@ -39,8 +39,11 @@ public class TileEntityDeuteriumExtractor extends TileEntityMachineBase implemen
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
this.updateConnections();
|
||||
|
||||
this.tanks[0].updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
|
||||
|
||||
age++;
|
||||
@ -68,6 +71,12 @@ public class TileEntityDeuteriumExtractor extends TileEntityMachineBase implemen
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateConnections() {
|
||||
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
this.trySubscribe(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ);
|
||||
}
|
||||
|
||||
public void networkUnpack(NBTTagCompound data) {
|
||||
this.power = data.getLong("power");
|
||||
}
|
||||
|
||||
@ -2,7 +2,6 @@ package com.hbm.tileentity.machine;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@ -10,7 +9,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityDeuteriumTower extends TileEntityDeuteriumExtractor implements IConsumer {
|
||||
public class TileEntityDeuteriumTower extends TileEntityDeuteriumExtractor {
|
||||
|
||||
public static final long maxPower = 10000000;
|
||||
|
||||
@ -70,6 +69,31 @@ public class TileEntityDeuteriumTower extends TileEntityDeuteriumExtractor imple
|
||||
fillFluid(this.xCoord - offsetX * 1, this.yCoord, this.zCoord - offsetZ * 1, getTact(), type);
|
||||
}
|
||||
|
||||
protected void updateConnections() {
|
||||
|
||||
int offsetX = 0;
|
||||
int offsetZ = 0;
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset);
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.DOWN);
|
||||
offsetX = -dir.offsetX;
|
||||
offsetZ = -rot.offsetZ;
|
||||
|
||||
if(dir == ForgeDirection.NORTH || dir == ForgeDirection.SOUTH) {
|
||||
offsetX = rot.offsetX;
|
||||
offsetZ = dir.offsetZ;
|
||||
}
|
||||
|
||||
this.trySubscribe(worldObj, this.xCoord + offsetX * 2, this.yCoord, this.zCoord - offsetZ * 1);
|
||||
this.trySubscribe(worldObj, this.xCoord + offsetX * 2, this.yCoord, this.zCoord - offsetZ * 0);
|
||||
this.trySubscribe(worldObj, this.xCoord + offsetX * 1, this.yCoord, this.zCoord - offsetZ * 2);
|
||||
this.trySubscribe(worldObj, this.xCoord + offsetX * 0, this.yCoord, this.zCoord - offsetZ * 2);
|
||||
this.trySubscribe(worldObj, this.xCoord + offsetX * 1, this.yCoord, this.zCoord + offsetZ * 1);
|
||||
this.trySubscribe(worldObj, this.xCoord + offsetX * 0, this.yCoord, this.zCoord + offsetZ * 1);
|
||||
this.trySubscribe(worldObj, this.xCoord - offsetX * 1, this.yCoord, this.zCoord + offsetZ * 0);
|
||||
this.trySubscribe(worldObj, this.xCoord - offsetX * 1, this.yCoord, this.zCoord - offsetZ * 1);
|
||||
}
|
||||
|
||||
AxisAlignedBB bb = null;
|
||||
|
||||
@Override
|
||||
|
||||
@ -5,11 +5,9 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.interfaces.IFluidContainer;
|
||||
import com.hbm.interfaces.IReactor;
|
||||
import com.hbm.interfaces.ISource;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.Library;
|
||||
@ -17,6 +15,7 @@ import com.hbm.packet.AuxElectricityPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.world.machine.FWatz;
|
||||
|
||||
import api.hbm.energy.IEnergyGenerator;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
@ -27,7 +26,7 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileEntityFWatzCore extends TileEntity implements ISidedInventory, IReactor, ISource, IFluidContainer, IFluidAcceptor {
|
||||
public class TileEntityFWatzCore extends TileEntity implements ISidedInventory, IReactor, IEnergyGenerator, IFluidContainer, IFluidAcceptor {
|
||||
|
||||
public long power;
|
||||
public final static long maxPower = 10000000000L;
|
||||
@ -38,8 +37,6 @@ public class TileEntityFWatzCore extends TileEntity implements ISidedInventory,
|
||||
Random rand = new Random();
|
||||
|
||||
private ItemStack slots[];
|
||||
public int age = 0;
|
||||
public List<IConsumer> list = new ArrayList();
|
||||
|
||||
private String customName;
|
||||
|
||||
@ -266,13 +263,10 @@ public class TileEntityFWatzCore extends TileEntity implements ISidedInventory,
|
||||
public void updateEntity() {
|
||||
if (this.isStructureValid(this.worldObj) && !worldObj.isRemote) {
|
||||
|
||||
age++;
|
||||
if (age >= 20) {
|
||||
age = 0;
|
||||
}
|
||||
|
||||
if (age == 9 || age == 19)
|
||||
ffgeuaInit();
|
||||
this.sendPower(worldObj, xCoord + 10, yCoord - 11, zCoord, Library.POS_X);
|
||||
this.sendPower(worldObj, xCoord - 10, yCoord - 11, zCoord, Library.NEG_X);
|
||||
this.sendPower(worldObj, xCoord, yCoord - 11, zCoord + 10, Library.POS_Z);
|
||||
this.sendPower(worldObj, xCoord, yCoord - 11, zCoord - 10, Library.NEG_Z);
|
||||
|
||||
if (hasFuse() && getSingularityType() > 0) {
|
||||
if(cooldown) {
|
||||
@ -376,49 +370,20 @@ public class TileEntityFWatzCore extends TileEntity implements ISidedInventory,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeua(int x, int y, int z, boolean newTact) {
|
||||
|
||||
Library.ffgeua(x, y, z, newTact, this, worldObj);
|
||||
public long getMaxPower() {
|
||||
return this.maxPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeuaInit() {
|
||||
ffgeua(this.xCoord + 10, this.yCoord - 11, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord - 10, this.yCoord - 11, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord - 11, this.zCoord + 10, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord - 11, this.zCoord - 10, getTact());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getTact() {
|
||||
if(age >= 0 && age < 10)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSPower() {
|
||||
public long getPower() {
|
||||
return power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSPower(long i) {
|
||||
public void setPower(long i) {
|
||||
this.power = i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IConsumer> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearList() {
|
||||
this.list.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFillstate(int fill, int index) {
|
||||
if(index < 3 && tanks[index] != null)
|
||||
|
||||
@ -5,11 +5,9 @@ import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.interfaces.IFluidContainer;
|
||||
import com.hbm.interfaces.IReactor;
|
||||
import com.hbm.interfaces.ISource;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.Library;
|
||||
@ -26,13 +24,12 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileEntityFusionMultiblock extends TileEntity implements ISidedInventory, IReactor, ISource, IFluidContainer, IFluidAcceptor {
|
||||
public class TileEntityFusionMultiblock extends TileEntity implements ISidedInventory, IReactor, IFluidContainer, IFluidAcceptor {
|
||||
|
||||
public long power;
|
||||
public final static long maxPower = 100000000;
|
||||
private ItemStack slots[];
|
||||
public int age = 0;
|
||||
public List<IConsumer> list = new ArrayList();
|
||||
public FluidTank tanks[];
|
||||
|
||||
private String customName;
|
||||
@ -203,6 +200,7 @@ public class TileEntityFusionMultiblock extends TileEntity implements ISidedInve
|
||||
public boolean isStructureValid(World world) {
|
||||
|
||||
//...and I wrote all of this by hand! Ha!
|
||||
//update, about 5 years later: what the fuck was wrong with me
|
||||
|
||||
if(world.getBlock(this.xCoord + 5, this.yCoord - 2, this.zCoord - 3) == ModBlocks.fusion_conductor &&
|
||||
world.getBlock(this.xCoord + 5, this.yCoord - 2, this.zCoord - 2) == ModBlocks.fusion_conductor &&
|
||||
@ -974,14 +972,6 @@ public class TileEntityFusionMultiblock extends TileEntity implements ISidedInve
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
age++;
|
||||
if(age >= 20)
|
||||
{
|
||||
age = 0;
|
||||
}
|
||||
|
||||
if(age == 9 || age == 19)
|
||||
ffgeuaInit();
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
@ -1205,48 +1195,6 @@ public class TileEntityFusionMultiblock extends TileEntity implements ISidedInve
|
||||
worldObj.setBlock(x, y, z, Blocks.air);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeua(int x, int y, int z, boolean newTact) {
|
||||
|
||||
Library.ffgeua(x, y, z, newTact, this, worldObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeuaInit() {
|
||||
ffgeua(this.xCoord, this.yCoord + 3, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord - 3, this.zCoord, getTact());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getTact() {
|
||||
if(age >= 0 && age < 10)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSPower() {
|
||||
return power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSPower(long i) {
|
||||
this.power = i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IConsumer> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearList() {
|
||||
this.list.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFillstate(int fill, int index) {
|
||||
if(index < 3 && tanks[index] != null)
|
||||
|
||||
@ -5,7 +5,6 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.inventory.RecipesCommon.AStack;
|
||||
import com.hbm.inventory.recipes.AssemblerRecipes;
|
||||
import com.hbm.inventory.UpgradeManager;
|
||||
@ -22,6 +21,7 @@ import com.hbm.sound.AudioWrapper;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -37,7 +37,7 @@ import net.minecraft.tileentity.TileEntityHopper;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineAssembler extends TileEntityMachineBase implements IConsumer {
|
||||
public class TileEntityMachineAssembler extends TileEntityMachineBase implements IEnergyUser {
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 100000;
|
||||
@ -125,6 +125,8 @@ public class TileEntityMachineAssembler extends TileEntityMachineBase implements
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
this.updateConnections();
|
||||
|
||||
this.consumption = 100;
|
||||
this.speed = 100;
|
||||
|
||||
@ -241,6 +243,35 @@ public class TileEntityMachineAssembler extends TileEntityMachineBase implements
|
||||
}
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
this.getBlockMetadata();
|
||||
|
||||
if(this.blockMetadata == 5) {
|
||||
this.trySubscribe(worldObj, xCoord - 2, yCoord, zCoord);
|
||||
this.trySubscribe(worldObj, xCoord - 2, yCoord, zCoord + 1);
|
||||
this.trySubscribe(worldObj, xCoord + 3, yCoord, zCoord);
|
||||
this.trySubscribe(worldObj, xCoord + 3, yCoord, zCoord + 1);
|
||||
|
||||
} else if(this.blockMetadata == 3) {
|
||||
this.trySubscribe(worldObj, xCoord, yCoord, zCoord - 2);
|
||||
this.trySubscribe(worldObj, xCoord - 1, yCoord, zCoord - 2);
|
||||
this.trySubscribe(worldObj, xCoord, yCoord, zCoord + 3);
|
||||
this.trySubscribe(worldObj, xCoord - 1, yCoord, zCoord + 3);
|
||||
|
||||
} else if(this.blockMetadata == 4) {
|
||||
this.trySubscribe(worldObj, xCoord + 2, yCoord, zCoord);
|
||||
this.trySubscribe(worldObj, xCoord + 2, yCoord, zCoord - 1);
|
||||
this.trySubscribe(worldObj, xCoord - 3, yCoord, zCoord);
|
||||
this.trySubscribe(worldObj, xCoord - 3, yCoord, zCoord - 2);
|
||||
|
||||
} else if(this.blockMetadata == 2) {
|
||||
this.trySubscribe(worldObj, xCoord, yCoord, zCoord + 2);
|
||||
this.trySubscribe(worldObj, xCoord + 1, yCoord, zCoord + 2);
|
||||
this.trySubscribe(worldObj, xCoord, yCoord, zCoord - 3);
|
||||
this.trySubscribe(worldObj, xCoord + 1, yCoord, zCoord - 3);
|
||||
}
|
||||
}
|
||||
|
||||
public void onChunkUnload() {
|
||||
|
||||
if(audio != null) {
|
||||
|
||||
@ -162,9 +162,35 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
|
||||
|
||||
this.maxPower = ((MachineBattery)worldObj.getBlock(xCoord, yCoord, zCoord)).maxPower;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
this.transmitPower();
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
power = Library.chargeTEFromItems(slots, 0, power, maxPower);
|
||||
power = Library.chargeItemsFromTE(slots, 1, power, maxPower);
|
||||
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setLong("power", power);
|
||||
nbt.setLong("maxPower", maxPower);
|
||||
nbt.setShort("redLow", redLow);
|
||||
nbt.setShort("redHigh", redHigh);
|
||||
this.networkPack(nbt, 20);
|
||||
}
|
||||
|
||||
if(worldObj.isRemote) {
|
||||
|
||||
for(int i = 1; i < this.log.length; i++) {
|
||||
this.log[i - 1] = this.log[i];
|
||||
}
|
||||
|
||||
this.log[19] = this.power;
|
||||
}
|
||||
}
|
||||
|
||||
protected void transmitPower() {
|
||||
|
||||
short mode = (short) this.getRelevantMode();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
|
||||
TileEntity te = worldObj.getTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ);
|
||||
@ -195,27 +221,6 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
|
||||
con.getPowerNet().subscribe(this);
|
||||
}
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
power = Library.chargeTEFromItems(slots, 0, power, maxPower);
|
||||
power = Library.chargeItemsFromTE(slots, 1, power, maxPower);
|
||||
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setLong("power", power);
|
||||
nbt.setLong("maxPower", maxPower);
|
||||
nbt.setShort("redLow", redLow);
|
||||
nbt.setShort("redHigh", redHigh);
|
||||
this.networkPack(nbt, 20);
|
||||
}
|
||||
|
||||
if(worldObj.isRemote) {
|
||||
|
||||
for(int i = 1; i < this.log.length; i++) {
|
||||
this.log[i - 1] = this.log[i];
|
||||
}
|
||||
|
||||
this.log[19] = this.power;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -6,7 +6,6 @@ import java.util.List;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.machine.MachineBoiler;
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.interfaces.IFluidContainer;
|
||||
import com.hbm.interfaces.IFluidSource;
|
||||
@ -18,6 +17,7 @@ import com.hbm.packet.AuxGaugePacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
@ -26,8 +26,9 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineBoilerElectric extends TileEntity implements ISidedInventory, IFluidContainer, IFluidAcceptor, IFluidSource, IConsumer {
|
||||
public class TileEntityMachineBoilerElectric extends TileEntity implements ISidedInventory, IFluidContainer, IFluidAcceptor, IFluidSource, IEnergyUser {
|
||||
|
||||
private ItemStack slots[];
|
||||
|
||||
@ -225,6 +226,8 @@ public class TileEntityMachineBoilerElectric extends TileEntity implements ISide
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
this.updateConnections();
|
||||
|
||||
age++;
|
||||
if(age >= 20)
|
||||
{
|
||||
@ -305,6 +308,12 @@ public class TileEntityMachineBoilerElectric extends TileEntity implements ISide
|
||||
}
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
this.trySubscribe(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ);
|
||||
}
|
||||
|
||||
public boolean isItemValid() {
|
||||
|
||||
if(slots[1] != null && TileEntityFurnace.getItemBurnTime(slots[1]) > 0)
|
||||
|
||||
@ -4,7 +4,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.interfaces.IFluidContainer;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
@ -14,6 +13,7 @@ import com.hbm.packet.AuxElectricityPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
@ -22,8 +22,9 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineCMBFactory extends TileEntity implements ISidedInventory, IConsumer, IFluidContainer, IFluidAcceptor {
|
||||
public class TileEntityMachineCMBFactory extends TileEntity implements ISidedInventory, IEnergyUser, IFluidContainer, IFluidAcceptor {
|
||||
|
||||
private ItemStack slots[];
|
||||
|
||||
@ -286,6 +287,8 @@ public class TileEntityMachineCMBFactory extends TileEntity implements ISidedInv
|
||||
|
||||
if (!worldObj.isRemote) {
|
||||
|
||||
this.updateConnections();
|
||||
|
||||
power = Library.chargeTEFromItems(slots, 0, power, maxPower);
|
||||
|
||||
tank.loadTank(2, 5, slots);
|
||||
@ -307,6 +310,12 @@ public class TileEntityMachineCMBFactory extends TileEntity implements ISidedInv
|
||||
}
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
this.trySubscribe(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(long i) {
|
||||
power = i;
|
||||
|
||||
@ -5,7 +5,6 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.interfaces.IFluidContainer;
|
||||
import com.hbm.interfaces.IFluidSource;
|
||||
@ -24,6 +23,7 @@ import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.TEChemplantPacket;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -39,7 +39,7 @@ import net.minecraft.tileentity.TileEntityHopper;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class TileEntityMachineChemplant extends TileEntity implements ISidedInventory, IConsumer, IFluidContainer, IFluidAcceptor, IFluidSource {
|
||||
public class TileEntityMachineChemplant extends TileEntity implements ISidedInventory, IEnergyUser, IFluidContainer, IFluidAcceptor, IFluidSource {
|
||||
|
||||
private ItemStack slots[];
|
||||
|
||||
@ -243,6 +243,10 @@ public class TileEntityMachineChemplant extends TileEntity implements ISidedInve
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
this.updateConnections();
|
||||
|
||||
this.consumption = 100;
|
||||
this.speed = 100;
|
||||
|
||||
@ -259,8 +263,6 @@ public class TileEntityMachineChemplant extends TileEntity implements ISidedInve
|
||||
speed /= (overLevel + 1);
|
||||
consumption *= (overLevel + 1);
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
isProgressing = false;
|
||||
|
||||
age++;
|
||||
@ -438,6 +440,35 @@ public class TileEntityMachineChemplant extends TileEntity implements ISidedInve
|
||||
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
this.getBlockMetadata();
|
||||
|
||||
if(this.blockMetadata == 5) {
|
||||
this.trySubscribe(worldObj, xCoord - 2, yCoord, zCoord);
|
||||
this.trySubscribe(worldObj, xCoord - 2, yCoord, zCoord + 1);
|
||||
this.trySubscribe(worldObj, xCoord + 3, yCoord, zCoord);
|
||||
this.trySubscribe(worldObj, xCoord + 3, yCoord, zCoord + 1);
|
||||
|
||||
} else if(this.blockMetadata == 3) {
|
||||
this.trySubscribe(worldObj, xCoord, yCoord, zCoord - 2);
|
||||
this.trySubscribe(worldObj, xCoord - 1, yCoord, zCoord - 2);
|
||||
this.trySubscribe(worldObj, xCoord, yCoord, zCoord + 3);
|
||||
this.trySubscribe(worldObj, xCoord - 1, yCoord, zCoord + 3);
|
||||
|
||||
} else if(this.blockMetadata == 4) {
|
||||
this.trySubscribe(worldObj, xCoord + 2, yCoord, zCoord);
|
||||
this.trySubscribe(worldObj, xCoord + 2, yCoord, zCoord - 1);
|
||||
this.trySubscribe(worldObj, xCoord - 3, yCoord, zCoord);
|
||||
this.trySubscribe(worldObj, xCoord - 3, yCoord, zCoord - 2);
|
||||
|
||||
} else if(this.blockMetadata == 2) {
|
||||
this.trySubscribe(worldObj, xCoord, yCoord, zCoord + 2);
|
||||
this.trySubscribe(worldObj, xCoord + 1, yCoord, zCoord + 2);
|
||||
this.trySubscribe(worldObj, xCoord, yCoord, zCoord - 3);
|
||||
this.trySubscribe(worldObj, xCoord + 1, yCoord, zCoord - 3);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean tryExchangeTemplates(TileEntity te1, TileEntity te2) {
|
||||
//validateTe sees if it's a valid inventory tile entity
|
||||
boolean te1Valid = validateTe(te1);
|
||||
|
||||
@ -8,16 +8,15 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.machine.MachineCoal;
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.interfaces.IFluidContainer;
|
||||
import com.hbm.interfaces.ISource;
|
||||
import com.hbm.inventory.FluidContainerRegistry;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.items.ModItems;
|
||||
@ -27,17 +26,16 @@ import com.hbm.packet.AuxGaugePacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import api.hbm.energy.IEnergyGenerator;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
|
||||
public class TileEntityMachineCoal extends TileEntity implements ISidedInventory, ISource, IFluidContainer, IFluidAcceptor {
|
||||
public class TileEntityMachineCoal extends TileEntity implements ISidedInventory, IEnergyGenerator, IFluidContainer, IFluidAcceptor {
|
||||
|
||||
private ItemStack slots[];
|
||||
|
||||
public long power;
|
||||
public int burnTime;
|
||||
public static final long maxPower = 100000;
|
||||
public int age = 0;
|
||||
public List<IConsumer> list = new ArrayList();
|
||||
public FluidTank tank;
|
||||
|
||||
private static final int[] slots_top = new int[] {1};
|
||||
@ -223,17 +221,11 @@ public class TileEntityMachineCoal extends TileEntity implements ISidedInventory
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
age++;
|
||||
if(age >= 20)
|
||||
{
|
||||
age = 0;
|
||||
}
|
||||
|
||||
if(age == 9 || age == 19)
|
||||
ffgeuaInit();
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
this.sendPower(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir);
|
||||
|
||||
//Water
|
||||
tank.loadTank(0, 3, slots);
|
||||
@ -306,49 +298,18 @@ public class TileEntityMachineCoal extends TileEntity implements ISidedInventory
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeua(int x, int y, int z, boolean newTact) {
|
||||
|
||||
Library.ffgeua(x, y, z, newTact, this, worldObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeuaInit() {
|
||||
ffgeua(this.xCoord, this.yCoord + 1, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord - 1, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord - 1, this.yCoord, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord + 1, this.yCoord, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord, this.zCoord - 1, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord, this.zCoord + 1, getTact());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getTact() {
|
||||
if(age >= 0 && age < 10)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSPower() {
|
||||
public long getPower() {
|
||||
return power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSPower(long i) {
|
||||
public void setPower(long i) {
|
||||
this.power = i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IConsumer> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearList() {
|
||||
this.list.clear();
|
||||
public long getMaxPower() {
|
||||
return this.maxPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -3,8 +3,8 @@ package com.hbm.tileentity.machine;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.inventory.recipes.CrystallizerRecipes;
|
||||
@ -14,14 +14,16 @@ import com.hbm.lib.Library;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineCrystallizer extends TileEntityMachineBase implements IConsumer, IFluidAcceptor {
|
||||
public class TileEntityMachineCrystallizer extends TileEntityMachineBase implements IEnergyUser, IFluidAcceptor {
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 1000000;
|
||||
@ -50,6 +52,8 @@ public class TileEntityMachineCrystallizer extends TileEntityMachineBase impleme
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
this.updateConnections();
|
||||
|
||||
power = Library.chargeTEFromItems(slots, 1, power, maxPower);
|
||||
tank.loadTank(3, 4, slots);
|
||||
|
||||
@ -94,6 +98,21 @@ public class TileEntityMachineCrystallizer extends TileEntityMachineBase impleme
|
||||
}
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset);
|
||||
|
||||
if(dir == ForgeDirection.NORTH || dir == ForgeDirection.SOUTH) {
|
||||
this.trySubscribe(worldObj, xCoord + 2, yCoord + 5, zCoord);
|
||||
this.trySubscribe(worldObj, xCoord - 2, yCoord + 5, zCoord);
|
||||
}
|
||||
|
||||
if(dir == ForgeDirection.EAST || dir == ForgeDirection.WEST) {
|
||||
this.trySubscribe(worldObj, xCoord, yCoord + 5, zCoord + 2);
|
||||
this.trySubscribe(worldObj, xCoord, yCoord + 5, zCoord - 2);
|
||||
}
|
||||
}
|
||||
|
||||
public void networkUnpack(NBTTagCompound data) {
|
||||
|
||||
this.power = data.getLong("power");
|
||||
|
||||
@ -11,7 +11,6 @@ import com.hbm.entity.logic.EntityNukeExplosionMK4;
|
||||
import com.hbm.explosion.ExplosionLarge;
|
||||
import com.hbm.explosion.ExplosionThermo;
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.interfaces.IFluidSource;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
@ -23,6 +22,7 @@ import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -31,7 +31,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
public class TileEntityMachineCyclotron extends TileEntityMachineBase implements IFluidSource, IFluidAcceptor, IConsumer {
|
||||
public class TileEntityMachineCyclotron extends TileEntityMachineBase implements IFluidSource, IFluidAcceptor, IEnergyUser {
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 100000000;
|
||||
@ -69,6 +69,8 @@ public class TileEntityMachineCyclotron extends TileEntityMachineBase implements
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
this.updateConnections();
|
||||
|
||||
age++;
|
||||
if(age >= 20)
|
||||
{
|
||||
@ -152,6 +154,18 @@ public class TileEntityMachineCyclotron extends TileEntityMachineBase implements
|
||||
}
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
|
||||
this.trySubscribe(worldObj, xCoord + 3, yCoord, zCoord + 1);
|
||||
this.trySubscribe(worldObj, xCoord + 3, yCoord, zCoord - 1);
|
||||
this.trySubscribe(worldObj, xCoord - 3, yCoord, zCoord + 1);
|
||||
this.trySubscribe(worldObj, xCoord - 3, yCoord, zCoord - 1);
|
||||
this.trySubscribe(worldObj, xCoord + 1, yCoord, zCoord + 3);
|
||||
this.trySubscribe(worldObj, xCoord - 1, yCoord, zCoord + 3);
|
||||
this.trySubscribe(worldObj, xCoord + 1, yCoord, zCoord - 3);
|
||||
this.trySubscribe(worldObj, xCoord - 1, yCoord, zCoord - 3);
|
||||
}
|
||||
|
||||
public void networkUnpack(NBTTagCompound data) {
|
||||
this.isOn = data.getBoolean("isOn");
|
||||
this.power = data.getLong("power");
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineDetector extends TileEntity implements IConsumer {
|
||||
public class TileEntityMachineDetector extends TileEntity implements IEnergyUser {
|
||||
|
||||
long power;
|
||||
|
||||
@ -13,6 +13,8 @@ public class TileEntityMachineDetector extends TileEntity implements IConsumer {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
this.updateConnections();
|
||||
|
||||
int meta = this.getBlockMetadata();
|
||||
int state = 0;
|
||||
|
||||
@ -28,6 +30,12 @@ public class TileEntityMachineDetector extends TileEntity implements IConsumer {
|
||||
}
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
this.trySubscribe(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(long i) {
|
||||
power = i;
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.Library;
|
||||
|
||||
@ -12,7 +11,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class TileEntityMachineDeuterium extends TileEntity implements ISidedInventory, IConsumer {
|
||||
public class TileEntityMachineDeuterium extends TileEntity implements ISidedInventory {
|
||||
|
||||
private ItemStack slots[];
|
||||
|
||||
@ -321,21 +320,4 @@ public class TileEntityMachineDeuterium extends TileEntity implements ISidedInve
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(long i) {
|
||||
power = i;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPower() {
|
||||
return power;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getMaxPower() {
|
||||
return maxPower;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,10 +4,8 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.interfaces.IFluidContainer;
|
||||
import com.hbm.interfaces.ISource;
|
||||
import com.hbm.inventory.FluidContainerRegistry;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.items.ModItems;
|
||||
@ -15,17 +13,17 @@ import com.hbm.lib.Library;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import api.hbm.energy.IEnergyGenerator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineDiesel extends TileEntityMachineBase implements ISource, IFluidContainer, IFluidAcceptor {
|
||||
public class TileEntityMachineDiesel extends TileEntityMachineBase implements IEnergyGenerator, IFluidContainer, IFluidAcceptor {
|
||||
|
||||
public long power;
|
||||
public int soundCycle = 0;
|
||||
public static final long maxPower = 50000;
|
||||
public long powerCap = 50000;
|
||||
public int age = 0;
|
||||
public List<IConsumer> list = new ArrayList();
|
||||
public FluidTank tank;
|
||||
|
||||
private static final int[] slots_top = new int[] { 0 };
|
||||
@ -97,13 +95,9 @@ public class TileEntityMachineDiesel extends TileEntityMachineBase implements IS
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
age++;
|
||||
if (age >= 20) {
|
||||
age = 0;
|
||||
}
|
||||
|
||||
if (age == 9 || age == 19)
|
||||
ffgeuaInit();
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
this.sendPower(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir);
|
||||
|
||||
//Tank Management
|
||||
tank.setType(3, 4, slots);
|
||||
@ -186,47 +180,18 @@ public class TileEntityMachineDiesel extends TileEntityMachineBase implements IS
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeua(int x, int y, int z, boolean newTact) {
|
||||
Library.ffgeua(x, y, z, newTact, this, worldObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeuaInit() {
|
||||
ffgeua(this.xCoord, this.yCoord + 1, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord - 1, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord - 1, this.yCoord, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord + 1, this.yCoord, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord, this.zCoord - 1, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord, this.zCoord + 1, getTact());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getTact() {
|
||||
if (age >= 0 && age < 10) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSPower() {
|
||||
public long getPower() {
|
||||
return power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSPower(long i) {
|
||||
public void setPower(long i) {
|
||||
this.power = i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IConsumer> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearList() {
|
||||
this.list.clear();
|
||||
public long getMaxPower() {
|
||||
return this.maxPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.inventory.recipes.MachineRecipes;
|
||||
import com.hbm.inventory.recipes.PressRecipes;
|
||||
import com.hbm.items.machine.ItemStamp;
|
||||
@ -9,6 +8,7 @@ import com.hbm.packet.AuxElectricityPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.TEPressPacket;
|
||||
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -20,8 +20,9 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineEPress extends TileEntity implements ISidedInventory, IConsumer {
|
||||
public class TileEntityMachineEPress extends TileEntity implements ISidedInventory, IEnergyUser {
|
||||
|
||||
private ItemStack slots[];
|
||||
|
||||
@ -200,8 +201,10 @@ public class TileEntityMachineEPress extends TileEntity implements ISidedInvento
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
this.updateConnections();
|
||||
|
||||
power = Library.chargeTEFromItems(slots, 0, power, maxPower);
|
||||
|
||||
if(!worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)) {
|
||||
@ -267,6 +270,12 @@ public class TileEntityMachineEPress extends TileEntity implements ISidedInvento
|
||||
}
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
this.trySubscribe(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ);
|
||||
}
|
||||
|
||||
public long getPowerScaled(int i) {
|
||||
return (power * i) / maxPower;
|
||||
}
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import com.hbm.blocks.machine.MachineElectricFurnace;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.packet.AuxElectricityPacket;
|
||||
import com.hbm.packet.AuxGaugePacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
@ -16,8 +16,9 @@ import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineElectricFurnace extends TileEntity implements ISidedInventory, IConsumer {
|
||||
public class TileEntityMachineElectricFurnace extends TileEntity implements ISidedInventory, IEnergyUser {
|
||||
|
||||
private ItemStack slots[];
|
||||
|
||||
@ -274,8 +275,10 @@ public class TileEntityMachineElectricFurnace extends TileEntity implements ISid
|
||||
this.hasPower();
|
||||
boolean flag1 = false;
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
this.updateConnections();
|
||||
|
||||
if(hasPower() && canProcess())
|
||||
{
|
||||
dualCookTime++;
|
||||
@ -318,6 +321,12 @@ public class TileEntityMachineElectricFurnace extends TileEntity implements ISid
|
||||
}
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
this.trySubscribe(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(long i) {
|
||||
power = i;
|
||||
|
||||
@ -2,11 +2,14 @@ package com.hbm.tileentity.machine;
|
||||
|
||||
import com.hbm.lib.Library;
|
||||
|
||||
import api.hbm.energy.IEnergyConductor;
|
||||
import api.hbm.energy.IEnergyConnector;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineFENSU extends TileEntityMachineBattery {
|
||||
|
||||
@ -20,20 +23,6 @@ public class TileEntityMachineFENSU extends TileEntityMachineBattery {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
short mode = (short) this.getRelevantMode();
|
||||
|
||||
if(mode == 1 || mode == 2)
|
||||
{
|
||||
age++;
|
||||
if(age >= 20)
|
||||
{
|
||||
age = 0;
|
||||
}
|
||||
|
||||
if(age == 9 || age == 19)
|
||||
ffgeuaInit();
|
||||
}
|
||||
|
||||
power = Library.chargeTEFromItems(slots, 0, power, maxPower);
|
||||
power = Library.chargeItemsFromTE(slots, 1, power, maxPower);
|
||||
|
||||
@ -54,6 +43,38 @@ public class TileEntityMachineFENSU extends TileEntityMachineBattery {
|
||||
}
|
||||
}
|
||||
|
||||
protected void transmitPower() {
|
||||
|
||||
short mode = (short) this.getRelevantMode();
|
||||
|
||||
ForgeDirection dir = ForgeDirection.DOWN;
|
||||
|
||||
TileEntity te = worldObj.getTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ);
|
||||
|
||||
if(te instanceof IEnergyConductor) {
|
||||
IEnergyConductor con = (IEnergyConductor) te;
|
||||
|
||||
if(con.getPowerNet() != null && con.getPowerNet().isSubscribed(this))
|
||||
con.getPowerNet().unsubscribe(this);
|
||||
}
|
||||
|
||||
if(mode == 1 || mode == 2) {
|
||||
if(te instanceof IEnergyConnector) {
|
||||
IEnergyConnector con = (IEnergyConnector) te;
|
||||
long oldPower = this.power;
|
||||
long transfer = this.power - con.transferPower(this.power);
|
||||
this.power = oldPower - transfer;
|
||||
}
|
||||
}
|
||||
|
||||
if(te instanceof IEnergyConductor) {
|
||||
IEnergyConductor con = (IEnergyConductor) te;
|
||||
|
||||
if(con.getPowerNet() != null && !con.getPowerNet().isSubscribed(this))
|
||||
con.getPowerNet().subscribe(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPowerRemainingScaled(long i) {
|
||||
|
||||
|
||||
@ -5,7 +5,6 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.interfaces.IFluidContainer;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
@ -17,6 +16,7 @@ import com.hbm.packet.AuxGaugePacket;
|
||||
import com.hbm.packet.LoopedSoundPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -29,7 +29,7 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
public class TileEntityMachineGasCent extends TileEntity implements ISidedInventory, IConsumer, IFluidContainer, IFluidAcceptor {
|
||||
public class TileEntityMachineGasCent extends TileEntity implements ISidedInventory, IEnergyUser, IFluidContainer, IFluidAcceptor {
|
||||
|
||||
private ItemStack slots[];
|
||||
|
||||
@ -281,6 +281,8 @@ public class TileEntityMachineGasCent extends TileEntity implements ISidedInvent
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
this.updateStandardConnections(worldObj, xCoord, yCoord, zCoord);
|
||||
|
||||
power = Library.chargeTEFromItems(slots, 0, power, maxPower);
|
||||
tank.setType(1, 2, slots);
|
||||
tank.loadTank(3, 4, slots);
|
||||
|
||||
@ -7,10 +7,8 @@ import java.util.Random;
|
||||
import com.hbm.blocks.machine.MachineGenerator;
|
||||
import com.hbm.explosion.ExplosionNukeGeneric;
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.interfaces.IFluidContainer;
|
||||
import com.hbm.interfaces.ISource;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemFuelRod;
|
||||
@ -29,7 +27,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class TileEntityMachineGenerator extends TileEntity implements ISidedInventory, ISource, IFluidContainer, IFluidAcceptor {
|
||||
public class TileEntityMachineGenerator extends TileEntity implements ISidedInventory, IFluidContainer, IFluidAcceptor {
|
||||
|
||||
private ItemStack slots[];
|
||||
|
||||
@ -38,8 +36,6 @@ public class TileEntityMachineGenerator extends TileEntity implements ISidedInve
|
||||
public long power;
|
||||
public final long powerMax = 100000;
|
||||
public boolean isLoaded = false;
|
||||
public int age = 0;
|
||||
public List<IConsumer> list = new ArrayList();
|
||||
public FluidTank[] tanks;
|
||||
|
||||
private static final int[] slots_top = new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8};
|
||||
@ -276,15 +272,6 @@ public class TileEntityMachineGenerator extends TileEntity implements ISidedInve
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
age++;
|
||||
if(age >= 20)
|
||||
{
|
||||
age = 0;
|
||||
}
|
||||
|
||||
if(age == 9 || age == 19)
|
||||
ffgeuaInit();
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
tanks[0].loadTank(9, 12, slots);
|
||||
@ -531,52 +518,6 @@ public class TileEntityMachineGenerator extends TileEntity implements ISidedInve
|
||||
worldObj.setBlock(this.xCoord, this.yCoord, this.zCoord, Blocks.flowing_lava);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeua(int x, int y, int z, boolean newTact) {
|
||||
|
||||
Library.ffgeua(x, y, z, newTact, this, worldObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeuaInit() {
|
||||
ffgeua(this.xCoord, this.yCoord + 1, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord - 1, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord - 1, this.yCoord, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord + 1, this.yCoord, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord, this.zCoord - 1, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord, this.zCoord + 1, getTact());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getTact() {
|
||||
if(age >= 0 && age < 10)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSPower() {
|
||||
return power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSPower(long i) {
|
||||
this.power = i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IConsumer> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearList() {
|
||||
this.list.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxFluidFill(FluidType type) {
|
||||
if(type.name().equals(tanks[0].getTankType().name()))
|
||||
|
||||
@ -8,9 +8,7 @@ import com.google.common.collect.HashBiMap;
|
||||
import com.hbm.handler.MultiblockHandlerXR;
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.interfaces.ISource;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.Library;
|
||||
@ -26,7 +24,7 @@ import net.minecraft.tileentity.TileEntityFurnace;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineIGenerator extends TileEntityMachineBase implements ISource, IFluidAcceptor {
|
||||
public class TileEntityMachineIGenerator extends TileEntityMachineBase implements IFluidAcceptor {
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 1000000;
|
||||
@ -49,7 +47,6 @@ public class TileEntityMachineIGenerator extends TileEntityMachineBase implement
|
||||
public FluidTank[] tanks;
|
||||
|
||||
public int age = 0;
|
||||
public List<IConsumer> list = new ArrayList();
|
||||
|
||||
public TileEntityMachineIGenerator() {
|
||||
super(15);
|
||||
@ -74,9 +71,6 @@ public class TileEntityMachineIGenerator extends TileEntityMachineBase implement
|
||||
age = 0;
|
||||
}
|
||||
|
||||
if (age == 9 || age == 19)
|
||||
ffgeuaInit();
|
||||
|
||||
tanks[0].loadTank(7, 8, slots);
|
||||
tanks[1].loadTank(9, 10, slots);
|
||||
tanks[1].setType(11, 12, slots);
|
||||
@ -389,62 +383,6 @@ public class TileEntityMachineIGenerator extends TileEntityMachineBase implement
|
||||
ignoreNext = 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeuaInit() {
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset);
|
||||
|
||||
int[] rot = MultiblockHandlerXR.rotate(new int [] {1,0,2,2,8,8}, dir);
|
||||
|
||||
boolean tact = this.getTact();
|
||||
|
||||
for(int iy = 0; iy <= 1; iy++) {
|
||||
for(int ix = -rot[4]; ix <= rot[5]; ix++) {
|
||||
for(int iz = -rot[2]; iz <= rot[3]; iz++) {
|
||||
|
||||
if(ix == -rot[4] || ix == rot[5] || iz == -rot[2] || iz == rot[3]) {
|
||||
|
||||
ffgeua(xCoord + dir.offsetX * 2 + ix, yCoord + iy, zCoord + dir.offsetZ * 2 + iz, tact);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeua(int x, int y, int z, boolean newTact) {
|
||||
Library.ffgeua(x, y, z, newTact, this, worldObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getTact() {
|
||||
if (age >= 0 && age < 10) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSPower() {
|
||||
return this.power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSPower(long i) {
|
||||
this.power = i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IConsumer> getList() {
|
||||
return this.list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearList() {
|
||||
this.list.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFillstate(int fill, int index) {
|
||||
tanks[index].setFill(fill);
|
||||
|
||||
@ -5,16 +5,15 @@ import java.util.List;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.interfaces.IFluidContainer;
|
||||
import com.hbm.interfaces.IFluidSource;
|
||||
import com.hbm.interfaces.ISource;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.inventory.recipes.MachineRecipes;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
import api.hbm.energy.IEnergyGenerator;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@ -22,12 +21,11 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineLargeTurbine extends TileEntityMachineBase implements IFluidContainer, IFluidAcceptor, IFluidSource, ISource {
|
||||
public class TileEntityMachineLargeTurbine extends TileEntityMachineBase implements IFluidContainer, IFluidAcceptor, IFluidSource, IEnergyGenerator {
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 100000000;
|
||||
public int age = 0;
|
||||
public List<IConsumer> list1 = new ArrayList();
|
||||
public List<IFluidAcceptor> list2 = new ArrayList();
|
||||
public FluidTank[] tanks;
|
||||
|
||||
@ -60,7 +58,9 @@ public class TileEntityMachineLargeTurbine extends TileEntityMachineBase impleme
|
||||
}
|
||||
|
||||
fillFluidInit(tanks[1].getTankType());
|
||||
ffgeuaInit();
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset);
|
||||
this.sendPower(worldObj, xCoord + dir.offsetX * -4, yCoord, zCoord + dir.offsetZ * -4, dir.getOpposite());
|
||||
|
||||
tanks[0].setType(0, 1, slots);
|
||||
tanks[0].loadTank(2, 3, slots);
|
||||
@ -143,19 +143,6 @@ public class TileEntityMachineLargeTurbine extends TileEntityMachineBase impleme
|
||||
nbt.setLong("power", power);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeua(int x, int y, int z, boolean newTact) {
|
||||
|
||||
Library.ffgeua(x, y, z, newTact, this, worldObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeuaInit() {
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset);
|
||||
ffgeua(xCoord + dir.offsetX * -4, yCoord, zCoord + dir.offsetZ * -4, getTact());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillFluidInit(FluidType type) {
|
||||
|
||||
@ -239,23 +226,18 @@ public class TileEntityMachineLargeTurbine extends TileEntityMachineBase impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSPower() {
|
||||
public long getPower() {
|
||||
return power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSPower(long i) {
|
||||
public void setPower(long i) {
|
||||
this.power = i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IConsumer> getList() {
|
||||
return list1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearList() {
|
||||
this.list1.clear();
|
||||
public long getMaxPower() {
|
||||
return this.maxPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -4,15 +4,14 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.ISource;
|
||||
import com.hbm.lib.Library;
|
||||
|
||||
import api.hbm.energy.IEnergyGenerator;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineMiniRTG extends TileEntity implements ISource {
|
||||
public class TileEntityMachineMiniRTG extends TileEntity implements IEnergyGenerator {
|
||||
|
||||
public List<IConsumer> list = new ArrayList();
|
||||
public long power;
|
||||
boolean tact = false;
|
||||
|
||||
@ -29,14 +28,14 @@ public class TileEntityMachineMiniRTG extends TileEntity implements ISource {
|
||||
if(power > getMaxPower())
|
||||
power = getMaxPower();
|
||||
|
||||
tact = false;
|
||||
ffgeuaInit();
|
||||
tact = true;
|
||||
ffgeuaInit();
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
this.sendPower(worldObj, xCoord, yCoord, zCoord, dir);
|
||||
}
|
||||
}
|
||||
|
||||
private int getMaxPower() {
|
||||
|
||||
@Override
|
||||
public long getMaxPower() {
|
||||
|
||||
if(this.getBlockType() == ModBlocks.machine_powerrtg)
|
||||
return 50000;
|
||||
@ -45,43 +44,12 @@ public class TileEntityMachineMiniRTG extends TileEntity implements ISource {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeuaInit() {
|
||||
ffgeua(this.xCoord, this.yCoord + 1, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord - 1, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord - 1, this.yCoord, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord + 1, this.yCoord, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord, this.zCoord - 1, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord, this.zCoord + 1, getTact());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeua(int x, int y, int z, boolean newTact) {
|
||||
|
||||
Library.ffgeua(x, y, z, newTact, this, worldObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getTact() {
|
||||
return tact;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSPower() {
|
||||
public long getPower() {
|
||||
return power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSPower(long i) {
|
||||
public void setPower(long i) {
|
||||
power = i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IConsumer> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearList() {
|
||||
list.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,7 +3,6 @@ package com.hbm.tileentity.machine;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.Spaghetti;
|
||||
import com.hbm.inventory.UpgradeManager;
|
||||
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
|
||||
@ -18,6 +17,7 @@ import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import api.hbm.block.IDrillInteraction;
|
||||
import api.hbm.block.IMiningDrill;
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -29,7 +29,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
public class TileEntityMachineMiningDrill extends TileEntityMachineBase implements IConsumer, IMiningDrill {
|
||||
public class TileEntityMachineMiningDrill extends TileEntityMachineBase implements IEnergyUser, IMiningDrill {
|
||||
|
||||
public long power;
|
||||
public int warning;
|
||||
@ -86,6 +86,8 @@ public class TileEntityMachineMiningDrill extends TileEntityMachineBase implemen
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
this.updateConnections();
|
||||
|
||||
this.consumption = 100;
|
||||
this.timer = 50;
|
||||
this.radius = 1;
|
||||
@ -207,6 +209,19 @@ public class TileEntityMachineMiningDrill extends TileEntityMachineBase implemen
|
||||
}
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
this.getBlockMetadata();
|
||||
|
||||
if(this.blockMetadata == 5 || this.blockMetadata == 4) {
|
||||
this.trySubscribe(worldObj, xCoord + 2, yCoord, zCoord);
|
||||
this.trySubscribe(worldObj, xCoord - 2, yCoord, zCoord);
|
||||
|
||||
} else if(this.blockMetadata == 3 || this.blockMetadata == 2) {
|
||||
this.trySubscribe(worldObj, xCoord, yCoord, zCoord + 2);
|
||||
this.trySubscribe(worldObj, xCoord, yCoord, zCoord - 2);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean tryFillContainer(IInventory inventory, int slot) {
|
||||
|
||||
int size = inventory.getSizeInventory();
|
||||
|
||||
@ -7,7 +7,6 @@ import java.util.Set;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.interfaces.IFluidSource;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
@ -24,6 +23,7 @@ import com.hbm.util.InventoryUtil;
|
||||
|
||||
import api.hbm.block.IDrillInteraction;
|
||||
import api.hbm.block.IMiningDrill;
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
@ -39,7 +39,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
public class TileEntityMachineMiningLaser extends TileEntityMachineBase implements IConsumer, IFluidSource, IMiningDrill {
|
||||
public class TileEntityMachineMiningLaser extends TileEntityMachineBase implements IEnergyUser, IFluidSource, IMiningDrill {
|
||||
|
||||
public long power;
|
||||
public int age = 0;
|
||||
@ -78,6 +78,8 @@ public class TileEntityMachineMiningLaser extends TileEntityMachineBase implemen
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
this.updateConnections();
|
||||
|
||||
age++;
|
||||
if (age >= 20) {
|
||||
age = 0;
|
||||
@ -175,6 +177,10 @@ public class TileEntityMachineMiningLaser extends TileEntityMachineBase implemen
|
||||
}
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
this.trySubscribe(worldObj, xCoord, yCoord + 2, zCoord);
|
||||
}
|
||||
|
||||
public void networkUnpack(NBTTagCompound data) {
|
||||
|
||||
this.power = data.getLong("power");
|
||||
|
||||
@ -7,12 +7,12 @@ import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.machine.MachineITER;
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@ -20,7 +20,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachinePlasmaHeater extends TileEntityMachineBase implements IFluidAcceptor, IConsumer {
|
||||
public class TileEntityMachinePlasmaHeater extends TileEntityMachineBase implements IFluidAcceptor, IEnergyUser {
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 100000000;
|
||||
@ -46,6 +46,8 @@ public class TileEntityMachinePlasmaHeater extends TileEntityMachineBase impleme
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
this.updateConnections();
|
||||
|
||||
/// START Managing all the internal stuff ///
|
||||
power = Library.chargeTEFromItems(slots, 0, power, maxPower);
|
||||
tanks[0].setType(1, 2, slots);
|
||||
@ -122,6 +124,20 @@ public class TileEntityMachinePlasmaHeater extends TileEntityMachineBase impleme
|
||||
}
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
|
||||
this.getBlockMetadata();
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.blockMetadata);
|
||||
ForgeDirection side = dir.getRotation(ForgeDirection.UP);
|
||||
|
||||
for(int i = 1; i < 4; i++) {
|
||||
for(int j = -1; j < 2; j++) {
|
||||
this.trySubscribe(worldObj, xCoord + side.offsetX * j + dir.offsetX * 2, yCoord + i, zCoord + side.offsetZ * j + dir.offsetZ * 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
this.power = nbt.getLong("power");
|
||||
}
|
||||
|
||||
@ -2,13 +2,12 @@ package com.hbm.tileentity.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.ISource;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.packet.AuxElectricityPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
|
||||
import api.hbm.energy.IEnergyGenerator;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
@ -16,8 +15,9 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineRTG extends TileEntity implements ISidedInventory, ISource {
|
||||
public class TileEntityMachineRTG extends TileEntity implements ISidedInventory, IEnergyGenerator {
|
||||
|
||||
private ItemStack slots[];
|
||||
|
||||
@ -25,8 +25,6 @@ public class TileEntityMachineRTG extends TileEntity implements ISidedInventory,
|
||||
public final int heatMax = 150;
|
||||
public long power;
|
||||
public final long powerMax = 90000;
|
||||
public int age = 0;
|
||||
public List<IConsumer> list = new ArrayList();
|
||||
|
||||
private static final int[] slots_top = new int[] { 0 };
|
||||
private static final int[] slots_bottom = new int[] { 0 };
|
||||
@ -209,16 +207,10 @@ public class TileEntityMachineRTG extends TileEntity implements ISidedInventory,
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
age++;
|
||||
if(age >= 20)
|
||||
{
|
||||
age = 0;
|
||||
}
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
if(age == 9 || age == 19)
|
||||
ffgeuaInit();
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
this.sendPower(worldObj, xCoord, yCoord, zCoord, dir);
|
||||
|
||||
heat = 0;
|
||||
|
||||
@ -255,48 +247,17 @@ public class TileEntityMachineRTG extends TileEntity implements ISidedInventory,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeua(int x, int y, int z, boolean newTact) {
|
||||
|
||||
Library.ffgeua(x, y, z, newTact, this, worldObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeuaInit() {
|
||||
ffgeua(this.xCoord, this.yCoord + 1, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord - 1, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord - 1, this.yCoord, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord + 1, this.yCoord, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord, this.zCoord - 1, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord, this.zCoord + 1, getTact());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getTact() {
|
||||
if(age >= 0 && age < 10)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSPower() {
|
||||
public long getPower() {
|
||||
return power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSPower(long i) {
|
||||
public long getMaxPower() {
|
||||
return powerMax;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(long i) {
|
||||
this.power = i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IConsumer> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearList() {
|
||||
this.list.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,8 +5,6 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.ISource;
|
||||
import com.hbm.inventory.RecipesCommon.ComparableStack;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.special.ItemWasteLong;
|
||||
@ -15,6 +13,7 @@ import com.hbm.lib.Library;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.Tuple.Triplet;
|
||||
|
||||
import api.hbm.energy.IEnergyGenerator;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.item.Item;
|
||||
@ -25,7 +24,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineRadGen extends TileEntityMachineBase implements ISource {
|
||||
public class TileEntityMachineRadGen extends TileEntityMachineBase implements IEnergyGenerator {
|
||||
|
||||
public int[] progress = new int[12];
|
||||
public int[] maxProgress = new int[12];
|
||||
@ -34,7 +33,6 @@ public class TileEntityMachineRadGen extends TileEntityMachineBase implements IS
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 1000000;
|
||||
public List<IConsumer> list = new ArrayList();
|
||||
|
||||
public boolean isOn = false;
|
||||
|
||||
@ -52,9 +50,8 @@ public class TileEntityMachineRadGen extends TileEntityMachineBase implements IS
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
if(worldObj.getTotalWorldTime() % 10 == 0) {
|
||||
ffgeuaInit();
|
||||
}
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset);
|
||||
this.sendPower(worldObj, this.xCoord - dir.offsetX * 4, this.yCoord, this.zCoord - dir.offsetZ * 4, dir.getOpposite());
|
||||
|
||||
//check if reload necessary for any queues
|
||||
for(int i = 0; i < 12; i++) {
|
||||
@ -249,41 +246,20 @@ public class TileEntityMachineRadGen extends TileEntityMachineBase implements IS
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeuaInit() {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset);
|
||||
ffgeua(this.xCoord - dir.offsetX * 4, this.yCoord, this.zCoord - dir.offsetZ * 4, getTact());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeua(int x, int y, int z, boolean newTact) {
|
||||
Library.ffgeua(x, y, z, newTact, this, worldObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getTact() {
|
||||
return worldObj.getTotalWorldTime() % 20 < 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSPower() {
|
||||
public long getPower() {
|
||||
return power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSPower(long i) {
|
||||
public long getMaxPower() {
|
||||
return maxPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(long i) {
|
||||
this.power = i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IConsumer> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearList() {
|
||||
this.list.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
return TileEntity.INFINITE_EXTENT_AABB;
|
||||
|
||||
@ -5,10 +5,10 @@ import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.config.WeaponConfig;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.Untested;
|
||||
import com.hbm.tileentity.TileEntityTickingBase;
|
||||
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import api.hbm.entity.IRadarDetectable;
|
||||
import api.hbm.entity.IRadarDetectable.RadarTargetType;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@ -19,7 +19,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
public class TileEntityMachineRadar extends TileEntityTickingBase implements IConsumer {
|
||||
public class TileEntityMachineRadar extends TileEntityTickingBase implements IEnergyUser {
|
||||
|
||||
public List<Entity> entList = new ArrayList();
|
||||
public List<int[]> nearbyMissiles = new ArrayList();
|
||||
@ -50,6 +50,9 @@ public class TileEntityMachineRadar extends TileEntityTickingBase implements ICo
|
||||
return;
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
this.updateStandardConnections(worldObj, xCoord, yCoord, zCoord);
|
||||
|
||||
nearbyMissiles.clear();
|
||||
|
||||
if(power > 0) {
|
||||
|
||||
@ -1,656 +0,0 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.explosion.ExplosionNukeGeneric;
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.handler.radiation.ChunkRadiationManager;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.interfaces.IFluidContainer;
|
||||
import com.hbm.interfaces.ISource;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemFuelRod;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.packet.AuxElectricityPacket;
|
||||
import com.hbm.packet.AuxGaugePacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
public class TileEntityMachineReactorSmallOld extends TileEntity
|
||||
implements ISidedInventory, ISource, IFluidContainer, IFluidAcceptor {
|
||||
|
||||
private ItemStack slots[];
|
||||
|
||||
public int hullHeat;
|
||||
public final int maxHullHeat = 100000;
|
||||
public int coreHeat;
|
||||
public final int maxCoreHeat = 50000;
|
||||
public long power;
|
||||
public final long powerMax = 250000;
|
||||
public int rods;
|
||||
public final int rodsMax = 100;
|
||||
public boolean retracting = true;
|
||||
public int age = 0;
|
||||
public List<IConsumer> list = new ArrayList();
|
||||
public FluidTank[] tanks;
|
||||
|
||||
private static final int[] slots_top = new int[] { 16 };
|
||||
private static final int[] slots_bottom = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 16 };
|
||||
private static final int[] slots_side = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16 };
|
||||
|
||||
private String customName;
|
||||
|
||||
public TileEntityMachineReactorSmallOld() {
|
||||
slots = new ItemStack[17];
|
||||
tanks = new FluidTank[2];
|
||||
tanks[0] = new FluidTank(FluidType.WATER, 32000, 0);
|
||||
tanks[1] = new FluidTank(FluidType.COOLANT, 16000, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return slots.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
return slots[i];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i) {
|
||||
if (slots[i] != null) {
|
||||
ItemStack itemStack = slots[i];
|
||||
slots[i] = null;
|
||||
return itemStack;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemStack) {
|
||||
slots[i] = itemStack;
|
||||
if (itemStack != null && itemStack.stackSize > getInventoryStackLimit()) {
|
||||
itemStack.stackSize = getInventoryStackLimit();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return this.hasCustomInventoryName() ? this.customName : "container.reactorSmall";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return this.customName != null && this.customName.length() > 0;
|
||||
}
|
||||
|
||||
public void setCustomName(String name) {
|
||||
this.customName = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
if (worldObj.getTileEntity(xCoord, yCoord, zCoord) != this) {
|
||||
return false;
|
||||
} else {
|
||||
return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64;
|
||||
}
|
||||
}
|
||||
|
||||
// You scrubs aren't needed for anything (right now)
|
||||
@Override
|
||||
public void openInventory() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemStack) {
|
||||
if (i == 0 || i == 1 || i == 2 || i == 3 || i == 4 || i == 5 || i == 6 || i == 7 || i == 8 || i == 9 || i == 10
|
||||
|| i == 11)
|
||||
if (itemStack.getItem() instanceof ItemFuelRod)
|
||||
return true;
|
||||
if (i == 12)
|
||||
if (itemStack.getItem() == ModItems.rod_water || itemStack.getItem() == ModItems.rod_dual_water
|
||||
|| itemStack.getItem() == ModItems.rod_quad_water || itemStack.getItem() == Items.water_bucket)
|
||||
return true;
|
||||
if (i == 14)
|
||||
if (itemStack.getItem() == ModItems.rod_coolant || itemStack.getItem() == ModItems.rod_dual_coolant
|
||||
|| itemStack.getItem() == ModItems.rod_quad_coolant)
|
||||
return true;
|
||||
if (i == 16)
|
||||
if (itemStack.getItem() instanceof IBatteryItem)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
if (slots[i] != null) {
|
||||
if (slots[i].stackSize <= j) {
|
||||
ItemStack itemStack = slots[i];
|
||||
slots[i] = null;
|
||||
return itemStack;
|
||||
}
|
||||
ItemStack itemStack1 = slots[i].splitStack(j);
|
||||
if (slots[i].stackSize == 0) {
|
||||
slots[i] = null;
|
||||
}
|
||||
|
||||
return itemStack1;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
NBTTagList list = nbt.getTagList("items", 10);
|
||||
|
||||
power = nbt.getLong("power");
|
||||
coreHeat = nbt.getInteger("heat");
|
||||
hullHeat = nbt.getInteger("hullHeat");
|
||||
slots = new ItemStack[getSizeInventory()];
|
||||
tanks[0].readFromNBT(nbt, "water");
|
||||
tanks[1].readFromNBT(nbt, "coolant");
|
||||
|
||||
for (int i = 0; i < list.tagCount(); i++) {
|
||||
NBTTagCompound nbt1 = list.getCompoundTagAt(i);
|
||||
byte b0 = nbt1.getByte("slot");
|
||||
if (b0 >= 0 && b0 < slots.length) {
|
||||
slots[b0] = ItemStack.loadItemStackFromNBT(nbt1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setLong("power", power);
|
||||
nbt.setInteger("heat", coreHeat);
|
||||
nbt.setInteger("hullHeat", hullHeat);
|
||||
NBTTagList list = new NBTTagList();
|
||||
tanks[0].writeToNBT(nbt, "water");
|
||||
tanks[1].writeToNBT(nbt, "coolant");
|
||||
|
||||
for (int i = 0; i < slots.length; i++) {
|
||||
if (slots[i] != null) {
|
||||
NBTTagCompound nbt1 = new NBTTagCompound();
|
||||
nbt1.setByte("slot", (byte) i);
|
||||
slots[i].writeToNBT(nbt1);
|
||||
list.appendTag(nbt1);
|
||||
}
|
||||
}
|
||||
nbt.setTag("items", list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int p_94128_1_) {
|
||||
return p_94128_1_ == 0 ? slots_bottom : (p_94128_1_ == 1 ? slots_top : slots_side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int i, ItemStack itemStack, int j) {
|
||||
return this.isItemValidForSlot(i, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
|
||||
if (i == 0 || i == 1 || i == 2 || i == 3 || i == 4 || i == 5 || i == 6 || i == 7 || i == 8 || i == 9 || i == 10
|
||||
|| i == 11)
|
||||
if (itemStack.getItem() == ModItems.rod_uranium_fuel_depleted
|
||||
|| itemStack.getItem() == ModItems.rod_dual_uranium_fuel_depleted
|
||||
|| itemStack.getItem() == ModItems.rod_quad_uranium_fuel_depleted
|
||||
|| itemStack.getItem() == ModItems.rod_plutonium_fuel_depleted
|
||||
|| itemStack.getItem() == ModItems.rod_dual_plutonium_fuel_depleted
|
||||
|| itemStack.getItem() == ModItems.rod_quad_plutonium_fuel_depleted
|
||||
|| itemStack.getItem() == ModItems.rod_mox_fuel_depleted
|
||||
|| itemStack.getItem() == ModItems.rod_dual_mox_fuel_depleted
|
||||
|| itemStack.getItem() == ModItems.rod_quad_mox_fuel_depleted
|
||||
|| itemStack.getItem() == ModItems.rod_schrabidium_fuel_depleted
|
||||
|| itemStack.getItem() == ModItems.rod_dual_schrabidium_fuel_depleted
|
||||
|| itemStack.getItem() == ModItems.rod_quad_schrabidium_fuel_depleted)
|
||||
return true;
|
||||
if (i == 13 || i == 15)
|
||||
if (itemStack.getItem() == Items.bucket || itemStack.getItem() == ModItems.rod_empty
|
||||
|| itemStack.getItem() == ModItems.rod_dual_empty || itemStack.getItem() == ModItems.rod_quad_empty
|
||||
|| itemStack.getItem() == ModItems.fluid_tank_empty
|
||||
|| itemStack.getItem() == ModItems.fluid_barrel_empty)
|
||||
return true;
|
||||
if (i == 16)
|
||||
if (itemStack.getItem() instanceof IBatteryItem && ((IBatteryItem)itemStack.getItem()).getCharge(itemStack) == ((IBatteryItem)itemStack.getItem()).getMaxCharge())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public long getPowerScaled(long i) {
|
||||
return (power * i) / powerMax;
|
||||
}
|
||||
|
||||
public int getCoreHeatScaled(int i) {
|
||||
return (coreHeat * i) / maxCoreHeat;
|
||||
}
|
||||
|
||||
public int getHullHeatScaled(int i) {
|
||||
return (hullHeat * i) / maxHullHeat;
|
||||
}
|
||||
|
||||
public boolean hasPower() {
|
||||
return power > 0;
|
||||
}
|
||||
|
||||
public boolean hasCoreHeat() {
|
||||
return coreHeat > 0;
|
||||
}
|
||||
|
||||
public boolean hasHullHeat() {
|
||||
return hullHeat > 0;
|
||||
}
|
||||
|
||||
private int[] getNeighbouringSlots(int id) {
|
||||
|
||||
switch (id) {
|
||||
case 0:
|
||||
return new int[] { 1, 5 };
|
||||
case 1:
|
||||
return new int[] { 0, 6 };
|
||||
case 2:
|
||||
return new int[] { 3, 7 };
|
||||
case 3:
|
||||
return new int[] { 2, 4, 8 };
|
||||
case 4:
|
||||
return new int[] { 3, 9 };
|
||||
case 5:
|
||||
return new int[] { 0, 6, 0xA };
|
||||
case 6:
|
||||
return new int[] { 1, 5, 0xB };
|
||||
case 7:
|
||||
return new int[] { 2, 8 };
|
||||
case 8:
|
||||
return new int[] { 3, 7, 9 };
|
||||
case 9:
|
||||
return new int[] { 4, 8 };
|
||||
case 10:
|
||||
return new int[] { 5, 0xB };
|
||||
case 11:
|
||||
return new int[] { 6, 0xA };
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if (!worldObj.isRemote) {
|
||||
|
||||
age++;
|
||||
if (age >= 20) {
|
||||
age = 0;
|
||||
}
|
||||
|
||||
if (age == 9 || age == 19)
|
||||
ffgeuaInit();
|
||||
|
||||
if (tanks[0].getFill() < tanks[0].getMaxFill()) {
|
||||
|
||||
if (worldObj.getBlock(xCoord + 1, yCoord + 1, zCoord) == Blocks.water
|
||||
|| worldObj.getBlock(xCoord + 1, yCoord + 1, zCoord) == Blocks.flowing_water)
|
||||
tanks[0].setFill(tanks[0].getFill() + 25);
|
||||
|
||||
if (worldObj.getBlock(xCoord - 1, yCoord + 1, zCoord) == Blocks.water
|
||||
|| worldObj.getBlock(xCoord - 1, yCoord + 1, zCoord) == Blocks.flowing_water)
|
||||
tanks[0].setFill(tanks[0].getFill() + 25);
|
||||
|
||||
if (worldObj.getBlock(xCoord, yCoord + 1, zCoord + 1) == Blocks.water
|
||||
|| worldObj.getBlock(xCoord, yCoord + 1, zCoord + 1) == Blocks.flowing_water)
|
||||
tanks[0].setFill(tanks[0].getFill() + 25);
|
||||
|
||||
if (worldObj.getBlock(xCoord, yCoord + 1, zCoord - 1) == Blocks.water
|
||||
|| worldObj.getBlock(xCoord, yCoord + 1, zCoord - 1) == Blocks.flowing_water)
|
||||
tanks[0].setFill(tanks[0].getFill() + 25);
|
||||
|
||||
if (tanks[0].getFill() > tanks[0].getMaxFill())
|
||||
tanks[0].setFill(tanks[0].getMaxFill());
|
||||
}
|
||||
|
||||
tanks[0].loadTank(12, 13, slots);
|
||||
tanks[1].loadTank(14, 15, slots);
|
||||
|
||||
if (retracting && rods > 0) {
|
||||
|
||||
if (rods == rodsMax)
|
||||
this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "hbm:block.reactorStart", 1.0F,
|
||||
0.75F);
|
||||
|
||||
rods--;
|
||||
|
||||
if (rods == 0)
|
||||
this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "hbm:block.reactorStop", 1.0F,
|
||||
1.0F);
|
||||
}
|
||||
if (!retracting && rods < rodsMax) {
|
||||
|
||||
if (rods == 0)
|
||||
this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "hbm:block.reactorStart", 1.0F,
|
||||
0.75F);
|
||||
|
||||
rods++;
|
||||
|
||||
if (rods == rodsMax)
|
||||
this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "hbm:block.reactorStop", 1.0F,
|
||||
1.0F);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
tanks[i].updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
|
||||
|
||||
// Batteries
|
||||
power = Library.chargeItemsFromTE(slots, 11, power, powerMax);
|
||||
|
||||
if (rods >= rodsMax)
|
||||
for (int i = 0; i < 12; i++) {
|
||||
if (slots[i] != null && slots[i].getItem() instanceof ItemFuelRod)
|
||||
decay(i);
|
||||
}
|
||||
|
||||
if (this.coreHeat > 0 && this.tanks[1].getFill() > 0 && this.hullHeat < this.maxHullHeat) {
|
||||
this.hullHeat += this.coreHeat * 0.175;
|
||||
this.coreHeat -= this.coreHeat * 0.1;
|
||||
|
||||
this.tanks[1].setFill(this.tanks[1].getFill() - 10);
|
||||
|
||||
if (this.tanks[1].getFill() < 0)
|
||||
this.tanks[1].setFill(0);
|
||||
}
|
||||
|
||||
if (this.hullHeat > maxHullHeat) {
|
||||
this.hullHeat = maxHullHeat;
|
||||
}
|
||||
|
||||
if (this.hullHeat > 0 && this.tanks[0].getFill() > 0) {
|
||||
this.power += this.hullHeat * 0.1;
|
||||
this.hullHeat -= this.hullHeat * 0.085;
|
||||
|
||||
this.tanks[0].setFill(this.tanks[0].getFill() - 100);
|
||||
|
||||
if (this.tanks[0].getFill() < 0)
|
||||
this.tanks[0].setFill(0);
|
||||
}
|
||||
|
||||
if (this.power > powerMax) {
|
||||
this.power = powerMax;
|
||||
}
|
||||
|
||||
if (this.coreHeat > maxCoreHeat) {
|
||||
this.explode();
|
||||
}
|
||||
|
||||
if (rods > 0 && coreHeat > 0
|
||||
&& !(worldObj.getBlock(xCoord + 1, yCoord + 1, zCoord).isNormalCube()
|
||||
&& worldObj.getBlock(xCoord - 1, yCoord + 1, zCoord).isNormalCube()
|
||||
&& worldObj.getBlock(xCoord, yCoord + 1, zCoord + 1).isNormalCube()
|
||||
&& worldObj.getBlock(xCoord, yCoord + 1, zCoord - 1).isNormalCube()
|
||||
&& worldObj.getBlock(xCoord + 1, yCoord + 1, zCoord) != Blocks.air
|
||||
&& worldObj.getBlock(xCoord - 1, yCoord + 1, zCoord) != Blocks.air
|
||||
&& worldObj.getBlock(xCoord, yCoord + 1, zCoord + 1) != Blocks.air
|
||||
&& worldObj.getBlock(xCoord, yCoord + 1, zCoord - 1) != Blocks.air)) {
|
||||
|
||||
worldObj.getEntitiesWithinAABBExcludingEntity(null,
|
||||
AxisAlignedBB.getBoundingBox(xCoord + 0.5 - 5, yCoord + 1.5 - 5, zCoord + 0.5 - 5,
|
||||
xCoord + 0.5 + 5, yCoord + 1.5 + 5, zCoord + 0.5 + 5));
|
||||
|
||||
/*for (Entity e : list) {
|
||||
if (e instanceof EntityLivingBase)
|
||||
Library.applyRadiation((EntityLivingBase)e, 80, 24, 60, 19);
|
||||
}*/
|
||||
|
||||
float rad = (float)coreHeat / (float)maxCoreHeat * 50F;
|
||||
ChunkRadiationManager.proxy.incrementRad(worldObj, xCoord, yCoord, zCoord, rad);
|
||||
}
|
||||
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxElectricityPacket(xCoord, yCoord, zCoord, power), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxGaugePacket(xCoord, yCoord, zCoord, rods, 0), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 150));
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxGaugePacket(xCoord, yCoord, zCoord, retracting ? 1 : 0, 1), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxGaugePacket(xCoord, yCoord, zCoord, coreHeat, 2), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxGaugePacket(xCoord, yCoord, zCoord, hullHeat, 3), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasFuelRod(int id) {
|
||||
if (id > 11)
|
||||
return false;
|
||||
|
||||
if (slots[id] != null)
|
||||
return slots[id].getItem() instanceof ItemFuelRod;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private int getNeightbourCount(int id) {
|
||||
|
||||
int[] neighbours = this.getNeighbouringSlots(id);
|
||||
|
||||
if (neighbours == null)
|
||||
return 0;
|
||||
|
||||
int count = 0;
|
||||
|
||||
for (int i = 0; i < neighbours.length; i++)
|
||||
if (hasFuelRod(neighbours[i]))
|
||||
count++;
|
||||
|
||||
return count;
|
||||
|
||||
}
|
||||
|
||||
// itemstack in slots[id] has to contain ItemFuelRod item
|
||||
private void decay(int id) {
|
||||
if (id > 11)
|
||||
return;
|
||||
|
||||
int decay = getNeightbourCount(id) + 1;
|
||||
|
||||
for (int i = 0; i < decay; i++) {
|
||||
ItemFuelRod rod = ((ItemFuelRod) slots[id].getItem());
|
||||
this.coreHeat += rod.heat;
|
||||
ItemFuelRod.setLifeTime(slots[id], ItemFuelRod.getLifeTime(slots[id]) + 1);
|
||||
|
||||
if (ItemFuelRod.getLifeTime(slots[id]) > ((ItemFuelRod) slots[id].getItem()).lifeTime) {
|
||||
onRunOut(id);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// itemstack in slots[id] has to contain ItemFuelRod item
|
||||
private void onRunOut(int id) {
|
||||
|
||||
Item item = slots[id].getItem();
|
||||
|
||||
if (item == ModItems.rod_uranium_fuel) {
|
||||
slots[id] = new ItemStack(ModItems.rod_uranium_fuel_depleted);
|
||||
|
||||
} else if (item == ModItems.rod_plutonium_fuel) {
|
||||
slots[id] = new ItemStack(ModItems.rod_plutonium_fuel_depleted);
|
||||
|
||||
} else if (item == ModItems.rod_mox_fuel) {
|
||||
slots[id] = new ItemStack(ModItems.rod_mox_fuel_depleted);
|
||||
|
||||
} else if (item == ModItems.rod_schrabidium_fuel) {
|
||||
slots[id] = new ItemStack(ModItems.rod_schrabidium_fuel_depleted);
|
||||
|
||||
} else if (item == ModItems.rod_dual_uranium_fuel) {
|
||||
slots[id] = new ItemStack(ModItems.rod_dual_uranium_fuel_depleted);
|
||||
|
||||
} else if (item == ModItems.rod_dual_plutonium_fuel) {
|
||||
slots[id] = new ItemStack(ModItems.rod_dual_plutonium_fuel_depleted);
|
||||
|
||||
} else if (item == ModItems.rod_dual_mox_fuel) {
|
||||
slots[id] = new ItemStack(ModItems.rod_dual_mox_fuel_depleted);
|
||||
|
||||
} else if (item == ModItems.rod_dual_schrabidium_fuel) {
|
||||
slots[id] = new ItemStack(ModItems.rod_dual_schrabidium_fuel_depleted);
|
||||
|
||||
} else if (item == ModItems.rod_quad_uranium_fuel) {
|
||||
slots[id] = new ItemStack(ModItems.rod_quad_uranium_fuel_depleted);
|
||||
|
||||
} else if (item == ModItems.rod_quad_plutonium_fuel) {
|
||||
slots[id] = new ItemStack(ModItems.rod_quad_plutonium_fuel_depleted);
|
||||
|
||||
} else if (item == ModItems.rod_quad_mox_fuel) {
|
||||
slots[id] = new ItemStack(ModItems.rod_quad_mox_fuel_depleted);
|
||||
|
||||
} else if (item == ModItems.rod_quad_schrabidium_fuel) {
|
||||
slots[id] = new ItemStack(ModItems.rod_quad_schrabidium_fuel_depleted);
|
||||
}
|
||||
}
|
||||
|
||||
private void explode() {
|
||||
for (int i = 0; i < slots.length; i++) {
|
||||
this.slots[i] = null;
|
||||
}
|
||||
|
||||
worldObj.createExplosion(null, this.xCoord, this.yCoord, this.zCoord, 18.0F, true);
|
||||
ExplosionNukeGeneric.waste(worldObj, this.xCoord, this.yCoord, this.zCoord, 35);
|
||||
worldObj.setBlock(this.xCoord, this.yCoord, this.zCoord, Blocks.flowing_lava);
|
||||
|
||||
ChunkRadiationManager.proxy.incrementRad(worldObj, xCoord, yCoord, zCoord, 1000F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeua(int x, int y, int z, boolean newTact) {
|
||||
|
||||
Library.ffgeua(x, y, z, newTact, this, worldObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeuaInit() {
|
||||
ffgeua(this.xCoord - 1, this.yCoord, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord + 1, this.yCoord, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord, this.zCoord - 1, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord, this.zCoord + 1, getTact());
|
||||
|
||||
ffgeua(this.xCoord - 1, this.yCoord + 2, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord + 1, this.yCoord + 2, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord + 2, this.zCoord - 1, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord + 2, this.zCoord + 1, getTact());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getTact() {
|
||||
if (age >= 0 && age < 10) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSPower() {
|
||||
return power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSPower(long i) {
|
||||
this.power = i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IConsumer> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearList() {
|
||||
this.list.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxFluidFill(FluidType type) {
|
||||
if (type.name().equals(tanks[0].getTankType().name()))
|
||||
return tanks[0].getMaxFill();
|
||||
else if (type.name().equals(tanks[1].getTankType().name()))
|
||||
return tanks[1].getMaxFill();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFluidFill(int i, FluidType type) {
|
||||
if (type.name().equals(tanks[0].getTankType().name()))
|
||||
tanks[0].setFill(i);
|
||||
else if (type.name().equals(tanks[1].getTankType().name()))
|
||||
tanks[1].setFill(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFluidFill(FluidType type) {
|
||||
if (type.name().equals(tanks[0].getTankType().name()))
|
||||
return tanks[0].getFill();
|
||||
else if (type.name().equals(tanks[1].getTankType().name()))
|
||||
return tanks[1].getFill();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFillstate(int fill, int index) {
|
||||
if (index < 2 && tanks[index] != null)
|
||||
tanks[index].setFill(fill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setType(FluidType type, int index) {
|
||||
if (index < 2 && tanks[index] != null)
|
||||
tanks[index].setTankType(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FluidTank> getTanks() {
|
||||
List<FluidTank> list = new ArrayList();
|
||||
list.add(tanks[0]);
|
||||
list.add(tanks[1]);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
return TileEntity.INFINITE_EXTENT_AABB;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public double getMaxRenderDistanceSquared() {
|
||||
return 65536.0D;
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,6 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import com.hbm.config.VersatileConfig;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.inventory.recipes.MachineRecipes;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemCapacitor;
|
||||
@ -11,10 +10,12 @@ import com.hbm.sound.AudioWrapper;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineSchrabidiumTransmutator extends TileEntityMachineBase implements IConsumer {
|
||||
public class TileEntityMachineSchrabidiumTransmutator extends TileEntityMachineBase implements IEnergyUser {
|
||||
|
||||
public long power = 0;
|
||||
public int process = 0;
|
||||
@ -149,6 +150,8 @@ public class TileEntityMachineSchrabidiumTransmutator extends TileEntityMachineB
|
||||
|
||||
if (!worldObj.isRemote) {
|
||||
|
||||
this.updateConnections();
|
||||
|
||||
power = Library.chargeTEFromItems(slots, 3, power, maxPower);
|
||||
|
||||
if(canProcess()) {
|
||||
@ -180,6 +183,12 @@ public class TileEntityMachineSchrabidiumTransmutator extends TileEntityMachineB
|
||||
}
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
this.trySubscribe(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ);
|
||||
}
|
||||
|
||||
public void onChunkUnload() {
|
||||
|
||||
if(audio != null) {
|
||||
|
||||
@ -4,10 +4,8 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.interfaces.IFluidContainer;
|
||||
import com.hbm.interfaces.ISource;
|
||||
import com.hbm.inventory.FluidContainerRegistry;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.items.ModItems;
|
||||
@ -17,6 +15,7 @@ import com.hbm.packet.AuxGaugePacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import api.hbm.energy.IEnergyGenerator;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
@ -24,8 +23,9 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineSeleniumEngine extends TileEntity implements ISidedInventory, ISource, IFluidContainer, IFluidAcceptor {
|
||||
public class TileEntityMachineSeleniumEngine extends TileEntity implements ISidedInventory, IEnergyGenerator, IFluidContainer, IFluidAcceptor {
|
||||
|
||||
private ItemStack slots[];
|
||||
|
||||
@ -33,8 +33,6 @@ public class TileEntityMachineSeleniumEngine extends TileEntity implements ISide
|
||||
public int soundCycle = 0;
|
||||
public static final long maxPower = 250000;
|
||||
public long powerCap = 250000;
|
||||
public int age = 0;
|
||||
public List<IConsumer> list = new ArrayList();
|
||||
public FluidTank tank;
|
||||
public int pistonCount = 0;
|
||||
|
||||
@ -215,13 +213,7 @@ public class TileEntityMachineSeleniumEngine extends TileEntity implements ISide
|
||||
|
||||
if (!worldObj.isRemote) {
|
||||
|
||||
age++;
|
||||
if (age >= 20) {
|
||||
age = 0;
|
||||
}
|
||||
|
||||
if (age == 9 || age == 19)
|
||||
ffgeuaInit();
|
||||
this.sendPower(worldObj, xCoord, yCoord - 1, zCoord, ForgeDirection.DOWN);
|
||||
|
||||
pistonCount = countPistons();
|
||||
|
||||
@ -315,45 +307,20 @@ public class TileEntityMachineSeleniumEngine extends TileEntity implements ISide
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeua(int x, int y, int z, boolean newTact) {
|
||||
|
||||
Library.ffgeua(x, y, z, newTact, this, worldObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeuaInit() {
|
||||
ffgeua(this.xCoord, this.yCoord - 1, this.zCoord, getTact());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getTact() {
|
||||
if (age >= 0 && age < 10) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSPower() {
|
||||
public long getPower() {
|
||||
return power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSPower(long i) {
|
||||
public long getMaxPower() {
|
||||
return maxPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(long i) {
|
||||
this.power = i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IConsumer> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearList() {
|
||||
this.list.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFillstate(int fill, int index) {
|
||||
tank.setFill(fill);
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.Untested;
|
||||
import com.hbm.inventory.recipes.ShredderRecipes;
|
||||
import com.hbm.items.machine.ItemBlades;
|
||||
@ -9,6 +8,7 @@ import com.hbm.packet.AuxElectricityPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
@ -16,8 +16,9 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineShredder extends TileEntity implements ISidedInventory, IConsumer {
|
||||
public class TileEntityMachineShredder extends TileEntity implements ISidedInventory, IEnergyUser {
|
||||
|
||||
private ItemStack slots[];
|
||||
|
||||
@ -235,11 +236,12 @@ public class TileEntityMachineShredder extends TileEntity implements ISidedInven
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
this.hasPower();
|
||||
boolean flag1 = false;
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
this.updateConnections();
|
||||
|
||||
if(hasPower() && canProcess())
|
||||
{
|
||||
progress++;
|
||||
@ -289,6 +291,12 @@ public class TileEntityMachineShredder extends TileEntity implements ISidedInven
|
||||
}
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
this.trySubscribe(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ);
|
||||
}
|
||||
|
||||
public void processItem() {
|
||||
|
||||
for(int inpSlot = 0; inpSlot < 9; inpSlot++)
|
||||
|
||||
@ -2,11 +2,11 @@ package com.hbm.tileentity.machine;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.packet.AuxElectricityPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@ -14,7 +14,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
public class TileEntityMachineTeleporter extends TileEntity implements IConsumer {
|
||||
public class TileEntityMachineTeleporter extends TileEntity implements IEnergyUser {
|
||||
|
||||
public long power = 0;
|
||||
public int targetX = 0;
|
||||
@ -55,6 +55,8 @@ public class TileEntityMachineTeleporter extends TileEntity implements IConsumer
|
||||
boolean b0 = false;
|
||||
|
||||
if (!this.worldObj.isRemote) {
|
||||
this.updateStandardConnections(worldObj, xCoord, yCoord, zCoord);
|
||||
|
||||
List<Entity> entities = this.worldObj.getEntitiesWithinAABB(Entity.class,
|
||||
AxisAlignedBB.getBoundingBox(this.xCoord - 0.25, this.yCoord, this.zCoord - 0.25, this.xCoord + 1.5,
|
||||
this.yCoord + 2, this.zCoord + 1.5));
|
||||
|
||||
@ -1,133 +1,6 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.ISource;
|
||||
import com.hbm.lib.Library;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class TileEntityMachineTransformer extends TileEntity implements ISource, IConsumer {
|
||||
|
||||
public long power;
|
||||
public long maxPower = 10000;
|
||||
public int delay = 1;
|
||||
public List<IConsumer> list = new ArrayList();
|
||||
boolean tact;
|
||||
int age;
|
||||
|
||||
public TileEntityMachineTransformer() { }
|
||||
|
||||
public TileEntityMachineTransformer(long buffer, int d) {
|
||||
maxPower = buffer;
|
||||
delay = d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
this.power = nbt.getLong("powerTime");
|
||||
this.maxPower = nbt.getLong("maxPower");
|
||||
this.delay = nbt.getInteger("delay");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setLong("powerTime", power);
|
||||
nbt.setLong("maxPower", maxPower);
|
||||
nbt.setInteger("delay", delay);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
age++;
|
||||
|
||||
if(age == delay) {
|
||||
|
||||
maxPower /= (20D / delay);
|
||||
long saved = 0;
|
||||
|
||||
if(power > maxPower) {
|
||||
saved = power - maxPower;
|
||||
power = maxPower;
|
||||
}
|
||||
|
||||
tact = true;
|
||||
ffgeuaInit();
|
||||
tact = false;
|
||||
ffgeuaInit();
|
||||
|
||||
age = 0;
|
||||
|
||||
maxPower *= (20D / delay);
|
||||
|
||||
power += saved;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeua(int x, int y, int z, boolean newTact) {
|
||||
|
||||
Library.ffgeua(x, y, z, newTact, this, worldObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeuaInit() {
|
||||
ffgeua(this.xCoord + 1, this.yCoord, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord - 1, this.yCoord, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord + 1, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord - 1, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord, this.zCoord + 1, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord, this.zCoord - 1, getTact());
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSPower() {
|
||||
return power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSPower(long i) {
|
||||
this.power = i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IConsumer> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearList() {
|
||||
this.list.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getTact() {
|
||||
return this.tact;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(long i) {
|
||||
power = i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPower() {
|
||||
return power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getMaxPower() {
|
||||
return maxPower;
|
||||
}
|
||||
public class TileEntityMachineTransformer extends TileEntity {
|
||||
}
|
||||
|
||||
@ -2,9 +2,9 @@ package com.hbm.tileentity.machine;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.Entity;
|
||||
@ -13,8 +13,9 @@ import net.minecraft.entity.monster.IMob;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityRadiobox extends TileEntity implements IConsumer {
|
||||
public class TileEntityRadiobox extends TileEntity implements IEnergyUser {
|
||||
|
||||
long power;
|
||||
public static long maxPower = 500000;
|
||||
@ -23,6 +24,9 @@ public class TileEntityRadiobox extends TileEntity implements IConsumer {
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
this.updateConnections();
|
||||
|
||||
if(!worldObj.isRemote && this.getBlockMetadata() > 5 && (power >= 25000 || infinite)) {
|
||||
|
||||
if(!infinite) {
|
||||
@ -38,6 +42,12 @@ public class TileEntityRadiobox extends TileEntity implements IConsumer {
|
||||
}
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
this.trySubscribe(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
@ -1,731 +0,0 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.entity.logic.EntityNukeExplosionMK4;
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.handler.radiation.ChunkRadiationManager;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.interfaces.IFluidContainer;
|
||||
import com.hbm.interfaces.ISource;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemFuelRod;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.packet.AuxElectricityPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileEntityReactorMultiblock extends TileEntity implements ISidedInventory, ISource, IFluidContainer, IFluidAcceptor {
|
||||
|
||||
public int heat;
|
||||
public final static int heatMax = 1000000;
|
||||
public long power;
|
||||
public final static long maxPower = 1000000;
|
||||
private ItemStack slots[];
|
||||
public int age = 0;
|
||||
public List<IConsumer> list = new ArrayList();
|
||||
public FluidTank[] tanks;
|
||||
|
||||
public boolean isLoaded = false;
|
||||
|
||||
private String customName;
|
||||
|
||||
public TileEntityReactorMultiblock() {
|
||||
slots = new ItemStack[36];
|
||||
tanks = new FluidTank[2];
|
||||
tanks[0] = new FluidTank(FluidType.WATER, 128000, 0);
|
||||
tanks[1] = new FluidTank(FluidType.COOLANT, 64000, 1);
|
||||
}
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return slots.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
return slots[i];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i) {
|
||||
if(slots[i] != null)
|
||||
{
|
||||
ItemStack itemStack = slots[i];
|
||||
slots[i] = null;
|
||||
return itemStack;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemStack) {
|
||||
slots[i] = itemStack;
|
||||
if(itemStack != null && itemStack.stackSize > getInventoryStackLimit())
|
||||
{
|
||||
itemStack.stackSize = getInventoryStackLimit();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return this.hasCustomInventoryName() ? this.customName : "container.reactorMultiblock";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return this.customName != null && this.customName.length() > 0;
|
||||
}
|
||||
|
||||
public void setCustomName(String name) {
|
||||
this.customName = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
if(worldObj.getTileEntity(xCoord, yCoord, zCoord) != this)
|
||||
{
|
||||
return false;
|
||||
}else{
|
||||
return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <=64;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemStack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
if(slots[i] != null)
|
||||
{
|
||||
if(slots[i].stackSize <= j)
|
||||
{
|
||||
ItemStack itemStack = slots[i];
|
||||
slots[i] = null;
|
||||
return itemStack;
|
||||
}
|
||||
ItemStack itemStack1 = slots[i].splitStack(j);
|
||||
if (slots[i].stackSize == 0)
|
||||
{
|
||||
slots[i] = null;
|
||||
}
|
||||
|
||||
return itemStack1;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int p_94128_1_) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int p_102007_1_, ItemStack p_102007_2_, int p_102007_3_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_, int p_102008_3_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
NBTTagList list = nbt.getTagList("items", 10);
|
||||
|
||||
tanks[0].readFromNBT(nbt, "water");
|
||||
tanks[1].readFromNBT(nbt, "coolant");
|
||||
power = nbt.getLong("power");
|
||||
heat = nbt.getInteger("heat");
|
||||
|
||||
slots = new ItemStack[getSizeInventory()];
|
||||
|
||||
for(int i = 0; i < list.tagCount(); i++)
|
||||
{
|
||||
NBTTagCompound nbt1 = list.getCompoundTagAt(i);
|
||||
byte b0 = nbt1.getByte("slot");
|
||||
if(b0 >= 0 && b0 < slots.length)
|
||||
{
|
||||
slots[b0] = ItemStack.loadItemStackFromNBT(nbt1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
tanks[0].writeToNBT(nbt, "water");
|
||||
tanks[1].writeToNBT(nbt, "coolant");
|
||||
nbt.setLong("power", power);
|
||||
nbt.setInteger("heat", heat);
|
||||
NBTTagList list = new NBTTagList();
|
||||
|
||||
for(int i = 0; i < slots.length; i++)
|
||||
{
|
||||
if(slots[i] != null)
|
||||
{
|
||||
NBTTagCompound nbt1 = new NBTTagCompound();
|
||||
nbt1.setByte("slot", (byte)i);
|
||||
slots[i].writeToNBT(nbt1);
|
||||
list.appendTag(nbt1);
|
||||
}
|
||||
}
|
||||
nbt.setTag("items", list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if(isStructureValid(worldObj))
|
||||
{
|
||||
age++;
|
||||
if(age >= 20)
|
||||
{
|
||||
age = 0;
|
||||
}
|
||||
|
||||
if(age == 9 || age == 19)
|
||||
ffgeuaInit();
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
tanks[0].loadTank(30, 31, slots);
|
||||
tanks[1].loadTank(32, 33, slots);
|
||||
|
||||
for(int i = 0; i < 2; i++)
|
||||
tanks[i].updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
|
||||
|
||||
|
||||
if(hasFuse())
|
||||
{
|
||||
for(int i = 0; i < 30; i++)
|
||||
{
|
||||
if(slots[i] != null && slots[i].getItem() == ModItems.rod_uranium_fuel)
|
||||
{
|
||||
int j = ItemFuelRod.getLifeTime(slots[i]);
|
||||
ItemFuelRod.setLifeTime(slots[i], j + 1);
|
||||
attemptHeat(1);
|
||||
attemptPower(250);
|
||||
|
||||
if(ItemFuelRod.getLifeTime(slots[i]) == ((ItemFuelRod)slots[i].getItem()).lifeTime)
|
||||
{
|
||||
this.slots[i] = new ItemStack(ModItems.rod_uranium_fuel_depleted);
|
||||
}
|
||||
}
|
||||
if(slots[i] != null && slots[i].getItem() == ModItems.rod_dual_uranium_fuel)
|
||||
{
|
||||
int j = ItemFuelRod.getLifeTime(slots[i]);
|
||||
ItemFuelRod.setLifeTime(slots[i], j + 1);
|
||||
attemptHeat(1);
|
||||
attemptPower(250);
|
||||
|
||||
if(ItemFuelRod.getLifeTime(slots[i]) == ((ItemFuelRod)slots[i].getItem()).lifeTime)
|
||||
{
|
||||
this.slots[i] = new ItemStack(ModItems.rod_dual_uranium_fuel_depleted);
|
||||
}
|
||||
}
|
||||
if(slots[i] != null && slots[i].getItem() == ModItems.rod_quad_uranium_fuel)
|
||||
{
|
||||
int j = ItemFuelRod.getLifeTime(slots[i]);
|
||||
ItemFuelRod.setLifeTime(slots[i], j + 1);
|
||||
attemptHeat(1);
|
||||
attemptPower(250);
|
||||
|
||||
if(ItemFuelRod.getLifeTime(slots[i]) == ((ItemFuelRod)slots[i].getItem()).lifeTime)
|
||||
{
|
||||
this.slots[i] = new ItemStack(ModItems.rod_quad_uranium_fuel_depleted);
|
||||
}
|
||||
}
|
||||
if(slots[i] != null && slots[i].getItem() == ModItems.rod_plutonium_fuel)
|
||||
{
|
||||
int j = ItemFuelRod.getLifeTime(slots[i]);
|
||||
ItemFuelRod.setLifeTime(slots[i], j + 1);
|
||||
attemptHeat(2);
|
||||
attemptPower(375);
|
||||
|
||||
if(ItemFuelRod.getLifeTime(slots[i]) == ((ItemFuelRod)slots[i].getItem()).lifeTime)
|
||||
{
|
||||
this.slots[i] = new ItemStack(ModItems.rod_plutonium_fuel_depleted);
|
||||
}
|
||||
}
|
||||
if(slots[i] != null && slots[i].getItem() == ModItems.rod_dual_plutonium_fuel)
|
||||
{
|
||||
int j = ItemFuelRod.getLifeTime(slots[i]);
|
||||
ItemFuelRod.setLifeTime(slots[i], j + 1);
|
||||
attemptHeat(2);
|
||||
attemptPower(375);
|
||||
|
||||
if(ItemFuelRod.getLifeTime(slots[i]) == ((ItemFuelRod)slots[i].getItem()).lifeTime)
|
||||
{
|
||||
this.slots[i] = new ItemStack(ModItems.rod_dual_plutonium_fuel_depleted);
|
||||
}
|
||||
}
|
||||
if(slots[i] != null && slots[i].getItem() == ModItems.rod_quad_plutonium_fuel)
|
||||
{
|
||||
int j = ItemFuelRod.getLifeTime(slots[i]);
|
||||
ItemFuelRod.setLifeTime(slots[i], j + 1);
|
||||
attemptHeat(2);
|
||||
attemptPower(375);
|
||||
|
||||
if(ItemFuelRod.getLifeTime(slots[i]) == ((ItemFuelRod)slots[i].getItem()).lifeTime)
|
||||
{
|
||||
this.slots[i] = new ItemStack(ModItems.rod_quad_plutonium_fuel_depleted);
|
||||
}
|
||||
}
|
||||
if(slots[i] != null && slots[i].getItem() == ModItems.rod_mox_fuel)
|
||||
{
|
||||
int j = ItemFuelRod.getLifeTime(slots[i]);
|
||||
ItemFuelRod.setLifeTime(slots[i], j + 1);
|
||||
attemptHeat(1);
|
||||
attemptPower(125);
|
||||
|
||||
if(ItemFuelRod.getLifeTime(slots[i]) == ((ItemFuelRod)slots[i].getItem()).lifeTime)
|
||||
{
|
||||
this.slots[i] = new ItemStack(ModItems.rod_mox_fuel_depleted);
|
||||
}
|
||||
}
|
||||
if(slots[i] != null && slots[i].getItem() == ModItems.rod_dual_mox_fuel)
|
||||
{
|
||||
int j = ItemFuelRod.getLifeTime(slots[i]);
|
||||
ItemFuelRod.setLifeTime(slots[i], j + 1);
|
||||
attemptHeat(1);
|
||||
attemptPower(125);
|
||||
|
||||
if(ItemFuelRod.getLifeTime(slots[i]) == ((ItemFuelRod)slots[i].getItem()).lifeTime)
|
||||
{
|
||||
this.slots[i] = new ItemStack(ModItems.rod_dual_mox_fuel_depleted);
|
||||
}
|
||||
}
|
||||
if(slots[i] != null && slots[i].getItem() == ModItems.rod_quad_mox_fuel)
|
||||
{
|
||||
int j = ItemFuelRod.getLifeTime(slots[i]);
|
||||
ItemFuelRod.setLifeTime(slots[i], j + 1);
|
||||
attemptHeat(1);
|
||||
attemptPower(125);
|
||||
|
||||
if(ItemFuelRod.getLifeTime(slots[i]) == ((ItemFuelRod)slots[i].getItem()).lifeTime)
|
||||
{
|
||||
this.slots[i] = new ItemStack(ModItems.rod_quad_mox_fuel_depleted);
|
||||
}
|
||||
}
|
||||
if(slots[i] != null && slots[i].getItem() == ModItems.rod_schrabidium_fuel)
|
||||
{
|
||||
int j = ItemFuelRod.getLifeTime(slots[i]);
|
||||
ItemFuelRod.setLifeTime(slots[i], j + 1);
|
||||
attemptHeat(10);
|
||||
attemptPower(62500);
|
||||
|
||||
if(ItemFuelRod.getLifeTime(slots[i]) == ((ItemFuelRod)slots[i].getItem()).lifeTime)
|
||||
{
|
||||
this.slots[i] = new ItemStack(ModItems.rod_schrabidium_fuel_depleted);
|
||||
}
|
||||
}
|
||||
if(slots[i] != null && slots[i].getItem() == ModItems.rod_dual_schrabidium_fuel)
|
||||
{
|
||||
int j = ItemFuelRod.getLifeTime(slots[i]);
|
||||
ItemFuelRod.setLifeTime(slots[i], j + 1);
|
||||
attemptHeat(10);
|
||||
attemptPower(62500);
|
||||
|
||||
if(ItemFuelRod.getLifeTime(slots[i]) == ((ItemFuelRod)slots[i].getItem()).lifeTime)
|
||||
{
|
||||
this.slots[i] = new ItemStack(ModItems.rod_dual_schrabidium_fuel_depleted);
|
||||
}
|
||||
}
|
||||
if(slots[i] != null && slots[i].getItem() == ModItems.rod_quad_schrabidium_fuel)
|
||||
{
|
||||
int j = ItemFuelRod.getLifeTime(slots[i]);
|
||||
ItemFuelRod.setLifeTime(slots[i], j + 1);
|
||||
attemptHeat(10);
|
||||
attemptPower(62500);
|
||||
|
||||
if(ItemFuelRod.getLifeTime(slots[i]) == ((ItemFuelRod)slots[i].getItem()).lifeTime)
|
||||
{
|
||||
this.slots[i] = new ItemStack(ModItems.rod_quad_schrabidium_fuel_depleted);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(this.power > maxPower)
|
||||
{
|
||||
this.power = maxPower;
|
||||
}
|
||||
|
||||
if(this.heat > heatMax)
|
||||
{
|
||||
this.explode();
|
||||
}
|
||||
|
||||
if(((slots[0] != null && slots[0].getItem() instanceof ItemFuelRod) || slots[0] == null) &&
|
||||
((slots[1] != null && !(slots[1].getItem() instanceof ItemFuelRod)) || slots[1] == null) &&
|
||||
((slots[2] != null && !(slots[2].getItem() instanceof ItemFuelRod)) || slots[2] == null) &&
|
||||
((slots[3] != null && !(slots[3].getItem() instanceof ItemFuelRod)) || slots[3] == null) &&
|
||||
((slots[4] != null && !(slots[4].getItem() instanceof ItemFuelRod)) || slots[4] == null) &&
|
||||
((slots[5] != null && !(slots[5].getItem() instanceof ItemFuelRod)) || slots[5] == null) &&
|
||||
((slots[6] != null && !(slots[6].getItem() instanceof ItemFuelRod)) || slots[6] == null) &&
|
||||
((slots[7] != null && !(slots[7].getItem() instanceof ItemFuelRod)) || slots[7] == null) &&
|
||||
((slots[8] != null && !(slots[8].getItem() instanceof ItemFuelRod)) || slots[8] == null) &&
|
||||
((slots[9] != null && !(slots[9].getItem() instanceof ItemFuelRod)) || slots[9] == null) &&
|
||||
((slots[10] != null && !(slots[10].getItem() instanceof ItemFuelRod)) || slots[10] == null) &&
|
||||
((slots[11] != null && !(slots[11].getItem() instanceof ItemFuelRod)) || slots[11] == null) &&
|
||||
((slots[12] != null && !(slots[12].getItem() instanceof ItemFuelRod)) || slots[12] == null) &&
|
||||
((slots[13] != null && !(slots[13].getItem() instanceof ItemFuelRod)) || slots[13] == null) &&
|
||||
((slots[14] != null && !(slots[14].getItem() instanceof ItemFuelRod)) || slots[14] == null) &&
|
||||
((slots[15] != null && !(slots[15].getItem() instanceof ItemFuelRod)) || slots[15] == null) &&
|
||||
((slots[16] != null && !(slots[16].getItem() instanceof ItemFuelRod)) || slots[16] == null) &&
|
||||
((slots[17] != null && !(slots[17].getItem() instanceof ItemFuelRod)) || slots[17] == null) &&
|
||||
((slots[18] != null && !(slots[18].getItem() instanceof ItemFuelRod)) || slots[18] == null) &&
|
||||
((slots[19] != null && !(slots[19].getItem() instanceof ItemFuelRod)) || slots[19] == null) &&
|
||||
((slots[20] != null && !(slots[20].getItem() instanceof ItemFuelRod)) || slots[20] == null) &&
|
||||
((slots[21] != null && !(slots[21].getItem() instanceof ItemFuelRod)) || slots[21] == null) &&
|
||||
((slots[22] != null && !(slots[22].getItem() instanceof ItemFuelRod)) || slots[22] == null) &&
|
||||
((slots[23] != null && !(slots[23].getItem() instanceof ItemFuelRod)) || slots[23] == null) &&
|
||||
((slots[24] != null && !(slots[24].getItem() instanceof ItemFuelRod)) || slots[24] == null) &&
|
||||
((slots[25] != null && !(slots[25].getItem() instanceof ItemFuelRod)) || slots[25] == null) &&
|
||||
((slots[26] != null && !(slots[26].getItem() instanceof ItemFuelRod)) || slots[26] == null) &&
|
||||
((slots[27] != null && !(slots[27].getItem() instanceof ItemFuelRod)) || slots[27] == null) &&
|
||||
((slots[28] != null && !(slots[28].getItem() instanceof ItemFuelRod)) || slots[28] == null) &&
|
||||
((slots[29] != null && !(slots[29].getItem() instanceof ItemFuelRod)) || slots[29] == null))
|
||||
{
|
||||
if(this.heat - 10 >= 0 && tanks[1].getFill() - 2 >= 0)
|
||||
{
|
||||
this.heat -= 10;
|
||||
this.tanks[1].setFill(tanks[1].getFill() - 2);
|
||||
}
|
||||
|
||||
if(this.heat < 10 && heat != 0 && this.tanks[1].getFill() != 0)
|
||||
{
|
||||
this.heat--;
|
||||
this.tanks[1].setFill(tanks[1].getFill() - 1);
|
||||
}
|
||||
|
||||
if(this.heat != 0 && this.tanks[1].getFill() == 0)
|
||||
{
|
||||
this.heat--;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if(!this.isCoatingValid(worldObj))
|
||||
{
|
||||
/*int strength = 20;
|
||||
float f = strength;
|
||||
HashSet hashset = new HashSet();
|
||||
int i;
|
||||
int j;
|
||||
int k;
|
||||
double d5;
|
||||
double d6;
|
||||
double d7;
|
||||
double wat = 20;
|
||||
boolean isOccupied = false;
|
||||
|
||||
i = MathHelper.floor_double(this.xCoord - wat - 1.0D);
|
||||
j = MathHelper.floor_double(this.xCoord + wat + 1.0D);
|
||||
k = MathHelper.floor_double(this.yCoord - wat - 1.0D);
|
||||
int i2 = MathHelper.floor_double(this.yCoord + wat + 1.0D);
|
||||
int l = MathHelper.floor_double(this.zCoord - wat - 1.0D);
|
||||
int j2 = MathHelper.floor_double(this.zCoord + wat + 1.0D);
|
||||
List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(null, AxisAlignedBB.getBoundingBox(i, k, l, j, i2, j2));
|
||||
Vec3 vec3 = Vec3.createVectorHelper(this.xCoord, this.yCoord, this.zCoord);
|
||||
|
||||
for (int i1 = 0; i1 < list.size(); ++i1)
|
||||
{
|
||||
Entity entity = (Entity)list.get(i1);
|
||||
double d4 = entity.getDistance(this.xCoord, this.yCoord, this.zCoord) / 4;
|
||||
|
||||
if (d4 <= 20)
|
||||
{
|
||||
d5 = entity.posX - this.xCoord;
|
||||
d6 = entity.posY + entity.getEyeHeight() - this.yCoord;
|
||||
d7 = entity.posZ - this.zCoord;
|
||||
double d9 = MathHelper.sqrt_double(d5 * d5 + d6 * d6 + d7 * d7);
|
||||
if (d9 < wat)
|
||||
{
|
||||
if (entity instanceof EntityLivingBase)
|
||||
Library.applyRadiation((EntityLivingBase)entity, 80, 24, 60, 19);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
ChunkRadiationManager.proxy.incrementRad(worldObj, xCoord, yCoord, zCoord, 50F);
|
||||
}
|
||||
}
|
||||
|
||||
//Batteries
|
||||
power = Library.chargeItemsFromTE(slots, 34, power, maxPower);
|
||||
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxElectricityPacket(xCoord, yCoord, zCoord, power), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean isStructureValid(World world) {
|
||||
if(world.getBlock(this.xCoord, this.yCoord, this.zCoord) == ModBlocks.reactor_computer &&
|
||||
world.getBlock(this.xCoord, this.yCoord + 1, this.zCoord) == ModBlocks.reactor_conductor &&
|
||||
world.getBlock(this.xCoord, this.yCoord - 1, this.zCoord) == ModBlocks.reactor_conductor &&
|
||||
world.getBlock(this.xCoord + 1, this.yCoord + 1, this.zCoord) == ModBlocks.reactor_control &&
|
||||
world.getBlock(this.xCoord + 1, this.yCoord + 0, this.zCoord) == ModBlocks.reactor_control &&
|
||||
world.getBlock(this.xCoord + 1, this.yCoord - 1, this.zCoord) == ModBlocks.reactor_control &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord + 1, this.zCoord) == ModBlocks.reactor_control &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord + 0, this.zCoord) == ModBlocks.reactor_control &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord - 1, this.zCoord) == ModBlocks.reactor_control &&
|
||||
world.getBlock(this.xCoord, this.yCoord + 1, this.zCoord + 1) == ModBlocks.reactor_control &&
|
||||
world.getBlock(this.xCoord, this.yCoord + 0, this.zCoord + 1) == ModBlocks.reactor_control &&
|
||||
world.getBlock(this.xCoord, this.yCoord - 1, this.zCoord + 1) == ModBlocks.reactor_control &&
|
||||
world.getBlock(this.xCoord, this.yCoord + 1, this.zCoord - 1) == ModBlocks.reactor_control &&
|
||||
world.getBlock(this.xCoord, this.yCoord + 0, this.zCoord - 1) == ModBlocks.reactor_control &&
|
||||
world.getBlock(this.xCoord, this.yCoord - 1, this.zCoord - 1) == ModBlocks.reactor_control &&
|
||||
world.getBlock(this.xCoord + 1, this.yCoord + 1, this.zCoord + 1) == ModBlocks.reactor_element &&
|
||||
world.getBlock(this.xCoord + 1, this.yCoord + 0, this.zCoord + 1) == ModBlocks.reactor_element &&
|
||||
world.getBlock(this.xCoord + 1, this.yCoord - 1, this.zCoord + 1) == ModBlocks.reactor_element &&
|
||||
world.getBlock(this.xCoord + 1, this.yCoord + 1, this.zCoord - 1) == ModBlocks.reactor_element &&
|
||||
world.getBlock(this.xCoord + 1, this.yCoord + 0, this.zCoord - 1) == ModBlocks.reactor_element &&
|
||||
world.getBlock(this.xCoord + 1, this.yCoord - 1, this.zCoord - 1) == ModBlocks.reactor_element &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord + 1, this.zCoord - 1) == ModBlocks.reactor_element &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord + 0, this.zCoord - 1) == ModBlocks.reactor_element &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord - 1, this.zCoord - 1) == ModBlocks.reactor_element &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord + 1, this.zCoord + 1) == ModBlocks.reactor_element &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord + 0, this.zCoord + 1) == ModBlocks.reactor_element &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord - 1, this.zCoord + 1) == ModBlocks.reactor_element &&
|
||||
world.getBlock(this.xCoord + 2, this.yCoord, this.zCoord) == ModBlocks.reactor_hatch &&
|
||||
world.getBlock(this.xCoord - 2, this.yCoord, this.zCoord) == ModBlocks.reactor_hatch &&
|
||||
world.getBlock(this.xCoord, this.yCoord, this.zCoord + 2) == ModBlocks.reactor_hatch &&
|
||||
world.getBlock(this.xCoord, this.yCoord, this.zCoord - 2) == ModBlocks.reactor_hatch)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isCoatingValid(World world) {
|
||||
if(world.getBlock(this.xCoord - 1, this.yCoord + 2, this.zCoord - 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord + 1, this.yCoord + 2, this.zCoord + 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord + 1, this.yCoord + 2, this.zCoord)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord + 1, this.yCoord + 2, this.zCoord - 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord + 2, this.zCoord + 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord + 2, this.zCoord)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord, this.yCoord + 2, this.zCoord - 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord, this.yCoord + 2, this.zCoord + 1)== ModBlocks.brick_concrete &&
|
||||
|
||||
world.getBlock(this.xCoord + 1, this.yCoord - 2, this.zCoord + 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord + 1, this.yCoord - 2, this.zCoord)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord + 1, this.yCoord - 2, this.zCoord - 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord - 2, this.zCoord + 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord - 2, this.zCoord)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord - 2, this.zCoord - 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord, this.yCoord - 2, this.zCoord + 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord, this.yCoord - 2, this.zCoord - 1)== ModBlocks.brick_concrete &&
|
||||
|
||||
world.getBlock(this.xCoord + 2, this.yCoord - 1, this.zCoord + 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord + 2, this.yCoord - 1, this.zCoord)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord + 2, this.yCoord - 1, this.zCoord - 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord + 2, this.yCoord, this.zCoord + 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord + 2, this.yCoord, this.zCoord - 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord + 2, this.yCoord + 1, this.zCoord + 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord + 2, this.yCoord + 1, this.zCoord)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord + 2, this.yCoord + 1, this.zCoord - 1)== ModBlocks.brick_concrete &&
|
||||
|
||||
world.getBlock(this.xCoord - 2, this.yCoord - 1, this.zCoord + 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord - 2, this.yCoord - 1, this.zCoord)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord - 2, this.yCoord - 1, this.zCoord - 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord - 2, this.yCoord, this.zCoord + 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord - 2, this.yCoord, this.zCoord - 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord - 2, this.yCoord + 1, this.zCoord + 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord - 2, this.yCoord + 1, this.zCoord)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord - 2, this.yCoord + 1, this.zCoord - 1)== ModBlocks.brick_concrete &&
|
||||
|
||||
world.getBlock(this.xCoord + 1, this.yCoord - 1, this.zCoord + 2)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord, this.yCoord - 1, this.zCoord + 2)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord - 1, this.zCoord + 2)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord + 1, this.yCoord, this.zCoord + 2)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord, this.zCoord + 2)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord + 1, this.yCoord + 1, this.zCoord + 2)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord, this.yCoord + 1, this.zCoord + 2)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord + 1, this.zCoord + 2)== ModBlocks.brick_concrete &&
|
||||
|
||||
world.getBlock(this.xCoord + 1, this.yCoord - 1, this.zCoord - 2)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord, this.yCoord - 1, this.zCoord - 2)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord - 1, this.zCoord - 2)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord + 1, this.yCoord, this.zCoord - 2)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord, this.zCoord - 2)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord + 1, this.yCoord + 1, this.zCoord - 2)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord, this.yCoord + 1, this.zCoord - 2)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord + 1, this.zCoord - 2)== ModBlocks.brick_concrete)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public long getPowerScaled(long i) {
|
||||
return (power * i) / maxPower;
|
||||
}
|
||||
|
||||
public int getHeatScaled(int i) {
|
||||
return (heat * i) / heatMax;
|
||||
}
|
||||
|
||||
public boolean hasFuse() {
|
||||
return slots[35] != null && (slots[35].getItem() == ModItems.fuse || slots[35].getItem() == ModItems.screwdriver);
|
||||
}
|
||||
|
||||
public void attemptPower(int i) {
|
||||
|
||||
int j = (int) Math.ceil(i / 100);
|
||||
|
||||
if(this.tanks[0].getFill() - j >= 0)
|
||||
{
|
||||
this.power += i;
|
||||
if(j > tanks[0].getMaxFill() / 25)
|
||||
j = tanks[0].getMaxFill() / 25;
|
||||
this.tanks[0].setFill(tanks[0].getFill() - j);
|
||||
}
|
||||
}
|
||||
|
||||
public void attemptHeat(int i) {
|
||||
Random rand = new Random();
|
||||
|
||||
int j = rand.nextInt(i + 1);
|
||||
|
||||
if(this.tanks[1].getFill() - j >= 0)
|
||||
{
|
||||
this.tanks[1].setFill(tanks[1].getFill() - j);
|
||||
} else {
|
||||
this.heat += i;
|
||||
}
|
||||
}
|
||||
|
||||
public void explode() {
|
||||
for(int i = 0; i < slots.length; i++)
|
||||
{
|
||||
this.slots[i] = null;
|
||||
}
|
||||
|
||||
worldObj.spawnEntityInWorld(EntityNukeExplosionMK4.statFac(worldObj, 50, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5));
|
||||
|
||||
ChunkRadiationManager.proxy.incrementRad(worldObj, xCoord, yCoord, zCoord, 1000F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeua(int x, int y, int z, boolean newTact) {
|
||||
|
||||
Library.ffgeua(x, y, z, newTact, this, worldObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeuaInit() {
|
||||
ffgeua(this.xCoord, this.yCoord + 2, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord - 2, this.zCoord, getTact());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getTact() {
|
||||
if(age >= 0 && age < 10)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSPower() {
|
||||
return power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSPower(long i) {
|
||||
this.power = i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IConsumer> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearList() {
|
||||
this.list.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFillstate(int fill, int index) {
|
||||
if(index < 2 && tanks[index] != null)
|
||||
tanks[index].setFill(fill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setType(FluidType type, int index) {
|
||||
if(index < 2 && tanks[index] != null)
|
||||
tanks[index].setTankType(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFluidFill(int i, FluidType type) {
|
||||
if(type.name().equals(tanks[0].getTankType().name()))
|
||||
tanks[0].setFill(i);
|
||||
else if(type.name().equals(tanks[1].getTankType().name()))
|
||||
tanks[1].setFill(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFluidFill(FluidType type) {
|
||||
if(type.name().equals(tanks[0].getTankType().name()))
|
||||
return tanks[0].getFill();
|
||||
else if(type.name().equals(tanks[1].getTankType().name()))
|
||||
return tanks[1].getFill();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxFluidFill(FluidType type) {
|
||||
if(type.name().equals(tanks[0].getTankType().name()))
|
||||
return tanks[0].getMaxFill();
|
||||
else if(type.name().equals(tanks[1].getTankType().name()))
|
||||
return tanks[1].getMaxFill();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FluidTank> getTanks() {
|
||||
List<FluidTank> list = new ArrayList();
|
||||
list.add(tanks[0]);
|
||||
list.add(tanks[1]);
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@ -1,233 +0,0 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.items.ModItems;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class TileEntityReiXMainframe extends TileEntity implements ISidedInventory, IConsumer {
|
||||
|
||||
private ItemStack slots[];
|
||||
|
||||
public long power = 0;
|
||||
public int waste = 0;
|
||||
public int process = 0;
|
||||
public int soundCycle = 0;
|
||||
public static final int maxFill = 1000;
|
||||
public static final long maxPower = 10000;
|
||||
public static final int processSpeed = 200;
|
||||
|
||||
private static final int[] slots_top = new int[] { 0, 2 };
|
||||
private static final int[] slots_bottom = new int[] { 1, 3 };
|
||||
private static final int[] slots_side = new int[] { 4 };
|
||||
|
||||
private String customName;
|
||||
|
||||
public TileEntityReiXMainframe() {
|
||||
slots = new ItemStack[5];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return slots.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
return slots[i];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i) {
|
||||
if(slots[i] != null)
|
||||
{
|
||||
ItemStack itemStack = slots[i];
|
||||
slots[i] = null;
|
||||
return itemStack;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemStack) {
|
||||
slots[i] = itemStack;
|
||||
if(itemStack != null && itemStack.stackSize > getInventoryStackLimit())
|
||||
{
|
||||
itemStack.stackSize = getInventoryStackLimit();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return this.hasCustomInventoryName() ? this.customName : "container.machineReiX";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return this.customName != null && this.customName.length() > 0;
|
||||
}
|
||||
|
||||
public void setCustomName(String name) {
|
||||
this.customName = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
if(worldObj.getTileEntity(xCoord, yCoord, zCoord) != this)
|
||||
{
|
||||
return false;
|
||||
}else{
|
||||
return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <=64;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {}
|
||||
@Override
|
||||
public void closeInventory() {}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack) {
|
||||
switch(i)
|
||||
{
|
||||
case 0:
|
||||
if(stack.getItem() instanceof IBatteryItem)
|
||||
return true;
|
||||
break;
|
||||
case 1:
|
||||
if(stack.getItem() == ModItems.ingot_magnetized_tungsten || stack.getItem() == ModItems.powder_magnetized_tungsten)
|
||||
return true;
|
||||
break;
|
||||
case 2:
|
||||
if(stack.getItem() == ModItems.bucket_mud || (stack.getItem() == ModItems.tank_waste && stack.getItemDamage() > 0))
|
||||
return true;
|
||||
break;
|
||||
case 3:
|
||||
if(stack.getItem() == ModItems.ingot_advanced_alloy || stack.getItem() == ModItems.powder_advanced_alloy)
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
if(slots[i] != null)
|
||||
{
|
||||
if(slots[i].stackSize <= j)
|
||||
{
|
||||
ItemStack itemStack = slots[i];
|
||||
slots[i] = null;
|
||||
return itemStack;
|
||||
}
|
||||
ItemStack itemStack1 = slots[i].splitStack(j);
|
||||
if (slots[i].stackSize == 0)
|
||||
{
|
||||
slots[i] = null;
|
||||
}
|
||||
|
||||
return itemStack1;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
NBTTagList list = nbt.getTagList("items", 10);
|
||||
|
||||
power = nbt.getShort("power");
|
||||
waste = nbt.getShort("waste");
|
||||
process = nbt.getShort("process");
|
||||
slots = new ItemStack[getSizeInventory()];
|
||||
|
||||
for(int i = 0; i < list.tagCount(); i++)
|
||||
{
|
||||
NBTTagCompound nbt1 = list.getCompoundTagAt(i);
|
||||
byte b0 = nbt1.getByte("slot");
|
||||
if(b0 >= 0 && b0 < slots.length)
|
||||
{
|
||||
slots[b0] = ItemStack.loadItemStackFromNBT(nbt1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setShort("power", (short) power);
|
||||
nbt.setShort("waste", (short) waste);
|
||||
nbt.setShort("process", (short) process);
|
||||
NBTTagList list = new NBTTagList();
|
||||
|
||||
for(int i = 0; i < slots.length; i++)
|
||||
{
|
||||
if(slots[i] != null)
|
||||
{
|
||||
NBTTagCompound nbt1 = new NBTTagCompound();
|
||||
nbt1.setByte("slot", (byte)i);
|
||||
slots[i].writeToNBT(nbt1);
|
||||
list.appendTag(nbt1);
|
||||
}
|
||||
}
|
||||
nbt.setTag("items", list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int p_94128_1_)
|
||||
{
|
||||
return p_94128_1_ == 0 ? slots_bottom : (p_94128_1_ == 1 ? slots_top : slots_side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int i, ItemStack itemStack, int j) {
|
||||
return this.isItemValidForSlot(i, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
|
||||
if(i == 4)
|
||||
return true;
|
||||
if(i == 2)
|
||||
if(itemStack.getItem() == Items.bucket || (itemStack.getItem() == ModItems.tank_waste && itemStack.getItemDamage() <= 0))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(long i) {
|
||||
power = i;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPower() {
|
||||
return power;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getMaxPower() {
|
||||
return maxPower;
|
||||
}
|
||||
}
|
||||
@ -8,12 +8,12 @@ import com.hbm.entity.mob.EntityCyberCrab;
|
||||
import com.hbm.entity.mob.EntityNuclearCreeper;
|
||||
import com.hbm.entity.mob.EntityTaintCrab;
|
||||
import com.hbm.entity.mob.EntityTeslaCrab;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.ArmorUtil;
|
||||
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.Entity;
|
||||
@ -27,8 +27,9 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityTesla extends TileEntityMachineBase implements IConsumer {
|
||||
public class TileEntityTesla extends TileEntityMachineBase implements IEnergyUser {
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 100000;
|
||||
@ -52,6 +53,8 @@ public class TileEntityTesla extends TileEntityMachineBase implements IConsumer
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
this.updateConnections();
|
||||
|
||||
this.targets.clear();
|
||||
|
||||
if(worldObj.getBlock(xCoord, yCoord - 1, zCoord) == ModBlocks.meteor_battery)
|
||||
@ -81,6 +84,12 @@ public class TileEntityTesla extends TileEntityMachineBase implements IConsumer
|
||||
}
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
this.trySubscribe(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ);
|
||||
}
|
||||
|
||||
public static List<double[]> zap(World worldObj, double x, double y, double z, double radius, Entity source) {
|
||||
|
||||
List<double[]> ret = new ArrayList();
|
||||
|
||||
@ -8,12 +8,10 @@ import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.config.BombConfig;
|
||||
import com.hbm.entity.logic.EntityNukeExplosionMK3;
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.interfaces.IFluidContainer;
|
||||
import com.hbm.interfaces.IFluidSource;
|
||||
import com.hbm.interfaces.IReactor;
|
||||
import com.hbm.interfaces.ISource;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemCapacitor;
|
||||
@ -23,6 +21,7 @@ import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.AuxElectricityPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
|
||||
import api.hbm.energy.IEnergyGenerator;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
@ -32,8 +31,9 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityWatzCore extends TileEntity implements ISidedInventory, IReactor, ISource, IFluidContainer, IFluidSource {
|
||||
public class TileEntityWatzCore extends TileEntity implements ISidedInventory, IReactor, IEnergyGenerator, IFluidContainer, IFluidSource {
|
||||
|
||||
public long power;
|
||||
public final static long maxPower = 100000000;
|
||||
@ -51,7 +51,6 @@ public class TileEntityWatzCore extends TileEntity implements ISidedInventory, I
|
||||
|
||||
private ItemStack slots[];
|
||||
public int age = 0;
|
||||
public List<IConsumer> list = new ArrayList();
|
||||
public List<IFluidAcceptor> list1 = new ArrayList();
|
||||
public FluidTank tank;
|
||||
|
||||
@ -551,8 +550,10 @@ public class TileEntityWatzCore extends TileEntity implements ISidedInventory, I
|
||||
age = 0;
|
||||
}
|
||||
|
||||
this.sendPower(worldObj, xCoord, yCoord + 7, zCoord, ForgeDirection.UP);
|
||||
this.sendPower(worldObj, xCoord, yCoord - 7, zCoord, ForgeDirection.DOWN);
|
||||
|
||||
if (age == 9 || age == 19) {
|
||||
ffgeuaInit();
|
||||
fillFluidInit(tank.getTankType());
|
||||
}
|
||||
|
||||
@ -665,18 +666,6 @@ public class TileEntityWatzCore extends TileEntity implements ISidedInventory, I
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeua(int x, int y, int z, boolean newTact) {
|
||||
|
||||
Library.ffgeua(x, y, z, newTact, this, worldObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeuaInit() {
|
||||
ffgeua(this.xCoord, this.yCoord + 7, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord - 7, this.zCoord, getTact());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getTact() {
|
||||
if(age >= 0 && age < 10)
|
||||
@ -688,23 +677,18 @@ public class TileEntityWatzCore extends TileEntity implements ISidedInventory, I
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSPower() {
|
||||
public long getPower() {
|
||||
return power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSPower(long i) {
|
||||
public void setPower(long i) {
|
||||
this.power = i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IConsumer> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearList() {
|
||||
this.list.clear();
|
||||
public long getMaxPower() {
|
||||
return this.maxPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user