aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/core/tileentities
diff options
context:
space:
mode:
authorJohann Bernhardt <johann.bernhardt@tum.de>2021-12-12 19:38:06 +0100
committerJohann Bernhardt <johann.bernhardt@tum.de>2021-12-12 19:38:06 +0100
commit311ab89f93558233a40079f7cb16605b141b5346 (patch)
treec5f44ef47f441a57c5f57aa801f639c7879ed760 /src/main/java/gtPlusPlus/core/tileentities
parent896143b96132f5ac54aa8d8f7386f27487e5e530 (diff)
downloadGT5-Unofficial-311ab89f93558233a40079f7cb16605b141b5346.tar.gz
GT5-Unofficial-311ab89f93558233a40079f7cb16605b141b5346.tar.bz2
GT5-Unofficial-311ab89f93558233a40079f7cb16605b141b5346.zip
Move sources and resources
Diffstat (limited to 'src/main/java/gtPlusPlus/core/tileentities')
-rw-r--r--src/main/java/gtPlusPlus/core/tileentities/ModTileEntities.java63
-rw-r--r--src/main/java/gtPlusPlus/core/tileentities/base/TILE_ENTITY_BASE.java39
-rw-r--r--src/main/java/gtPlusPlus/core/tileentities/base/TileBasicTank.java150
-rw-r--r--src/main/java/gtPlusPlus/core/tileentities/base/TileEntityBase.java1347
-rw-r--r--src/main/java/gtPlusPlus/core/tileentities/base/TilePoweredGT.java1168
-rw-r--r--src/main/java/gtPlusPlus/core/tileentities/general/TileEntityCircuitProgrammer.java307
-rw-r--r--src/main/java/gtPlusPlus/core/tileentities/general/TileEntityDecayablesChest.java359
-rw-r--r--src/main/java/gtPlusPlus/core/tileentities/general/TileEntityEggBox.java359
-rw-r--r--src/main/java/gtPlusPlus/core/tileentities/general/TileEntityFirepit.java39
-rw-r--r--src/main/java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java410
-rw-r--r--src/main/java/gtPlusPlus/core/tileentities/general/TileEntityHeliumGenerator.java124
-rw-r--r--src/main/java/gtPlusPlus/core/tileentities/general/TileEntityInfiniteFluid.java139
-rw-r--r--src/main/java/gtPlusPlus/core/tileentities/general/TileEntityPlayerDoorBase.java285
-rw-r--r--src/main/java/gtPlusPlus/core/tileentities/general/TileEntityReverter.java312
-rw-r--r--src/main/java/gtPlusPlus/core/tileentities/general/TileEntityVolumetricFlaskSetter.java403
-rw-r--r--src/main/java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java298
-rw-r--r--src/main/java/gtPlusPlus/core/tileentities/general/redstone/TileEntityRedstoneHandler.java468
-rw-r--r--src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityAdvPooCollector.java155
-rw-r--r--src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityBaseFluidCollector.java238
-rw-r--r--src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityModularityTable.java480
-rw-r--r--src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityPestKiller.java506
-rw-r--r--src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityPooCollector.java147
-rw-r--r--src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityProjectTable.java288
-rw-r--r--src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityRoundRobinator.java739
-rw-r--r--src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityTradeTable.java133
-rw-r--r--src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbench.java172
-rw-r--r--src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbenchAdvanced.java245
27 files changed, 9373 insertions, 0 deletions
diff --git a/src/main/java/gtPlusPlus/core/tileentities/ModTileEntities.java b/src/main/java/gtPlusPlus/core/tileentities/ModTileEntities.java
new file mode 100644
index 0000000000..62b545c5c8
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/tileentities/ModTileEntities.java
@@ -0,0 +1,63 @@
+package gtPlusPlus.core.tileentities;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.block.general.BlockSuperLight.TileEntitySuperLight;
+import gtPlusPlus.core.block.machine.Machine_SuperJukebox.TileEntitySuperJukebox;
+import gtPlusPlus.core.lib.LoadedMods;
+import gtPlusPlus.core.tileentities.general.*;
+import gtPlusPlus.core.tileentities.machines.TileEntityAdvPooCollector;
+import gtPlusPlus.core.tileentities.machines.TileEntityModularityTable;
+import gtPlusPlus.core.tileentities.machines.TileEntityPestKiller;
+import gtPlusPlus.core.tileentities.machines.TileEntityPooCollector;
+import gtPlusPlus.core.tileentities.machines.TileEntityProjectTable;
+import gtPlusPlus.core.tileentities.machines.TileEntityRoundRobinator;
+import gtPlusPlus.core.tileentities.machines.TileEntityTradeTable;
+import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench;
+import gtPlusPlus.core.tileentities.machines.TileEntityWorkbenchAdvanced;
+import gtPlusPlus.plugin.villagers.tile.TileEntityGenericSpawner;
+import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy;
+
+public class ModTileEntities {
+
+ public static void init() {
+ Logger.INFO("Registering Tile Entities.");
+ GameRegistry.registerTileEntity(TileEntityPooCollector.class, "TileEntityPooCollector");
+ GameRegistry.registerTileEntity(TileEntityAdvPooCollector.class, "TileEntityAdvPooCollector");
+ GameRegistry.registerTileEntity(TileEntityWorkbench.class, "TileWorkbench");
+ GameRegistry.registerTileEntity(TileEntityWorkbenchAdvanced.class, "TileWorkbenchAdvanced");
+ GameRegistry.registerTileEntity(TileEntityFishTrap.class, "TileFishTrap");
+ GameRegistry.registerTileEntity(TileEntityFirepit.class, "TileFirePit");
+ GameRegistry.registerTileEntity(TileEntityInfiniteFluid.class, "TileInfiniteFluid");
+ GameRegistry.registerTileEntity(TileEntityProjectTable.class, "TileProjectTable");
+ GameRegistry.registerTileEntity(TileEntityTradeTable.class, "TileTradeTable");
+ GameRegistry.registerTileEntity(TileEntityModularityTable.class, "TileEntityModularityTable");
+ GameRegistry.registerTileEntity(TileEntityXpConverter.class, "TileEntityXpConverter");
+ GameRegistry.registerTileEntity(TileEntityGenericSpawner.class, "TileEntityGenericSpawner");
+ GameRegistry.registerTileEntity(TileEntityCircuitProgrammer.class, "TileCircuitProgrammer");
+ GameRegistry.registerTileEntity(TileEntityPlayerDoorBase.class, "TilePlayerDoorBase");
+ GameRegistry.registerTileEntity(TileEntityDecayablesChest.class, "TileDecayablesChest");
+ GameRegistry.registerTileEntity(TileEntitySuperJukebox.class, "TileEntitySuperJukebox");
+ GameRegistry.registerTileEntity(TileEntitySuperLight.class, "TileEntitySuperLight");
+ GameRegistry.registerTileEntity(TileEntityPestKiller.class, "TileEntityPestKiller");
+ GameRegistry.registerTileEntity(TileEntityRoundRobinator.class, "TileEntityRoundRobinator");
+ GameRegistry.registerTileEntity(TileEntityEggBox.class, "TileEggBox");
+
+ if (Meta_GT_Proxy.sDoesVolumetricFlaskExist) {
+ GameRegistry.registerTileEntity(TileEntityVolumetricFlaskSetter.class, "TileEntityVolumetricFlaskSetter");
+ }
+
+ //Mod TEs
+ if (LoadedMods.Thaumcraft){
+
+ }
+ blacklistTilesFromAcceleration();
+ }
+
+ private static void blacklistTilesFromAcceleration() {
+ Meta_GT_Proxy.setTileEntityClassAsBlacklistedInWorldAccelerator("gtPlusPlus.core.tileentities.general.TileEntityFishTrap");
+ Meta_GT_Proxy.setTileEntityClassAsBlacklistedInWorldAccelerator("gtPlusPlus.core.tileentities.general.TileEntityDecayablesChest");
+ Meta_GT_Proxy.setTileEntityClassAsBlacklistedInWorldAccelerator("gtPlusPlus.core.tileentities.general.TileEggBox");
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/tileentities/base/TILE_ENTITY_BASE.java b/src/main/java/gtPlusPlus/core/tileentities/base/TILE_ENTITY_BASE.java
new file mode 100644
index 0000000000..839bcc353a
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/tileentities/base/TILE_ENTITY_BASE.java
@@ -0,0 +1,39 @@
+package gtPlusPlus.core.tileentities.base;
+
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.network.NetworkManager;
+import net.minecraft.network.Packet;
+import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
+import net.minecraft.tileentity.TileEntity;
+
+public class TILE_ENTITY_BASE extends TileEntity {
+
+ @Override
+ public void writeToNBT(final NBTTagCompound tag) {
+ super.writeToNBT(tag);
+ this.writeCustomNBT(tag);
+ }
+
+ @Override
+ public void readFromNBT(final NBTTagCompound tag) {
+ super.readFromNBT(tag);
+ this.readCustomNBT(tag);
+ }
+
+ public void writeCustomNBT(final NBTTagCompound tag) {}
+ public void readCustomNBT(final NBTTagCompound tag) {}
+
+ @Override
+ public Packet getDescriptionPacket() {
+ final NBTTagCompound tag = new NBTTagCompound();
+ this.writeCustomNBT(tag);
+ return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, -999, tag);
+ }
+
+ @Override
+ public void onDataPacket(final NetworkManager net, final S35PacketUpdateTileEntity packet) {
+ super.onDataPacket(net, packet);
+ this.readCustomNBT(packet.func_148857_g());
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/tileentities/base/TileBasicTank.java b/src/main/java/gtPlusPlus/core/tileentities/base/TileBasicTank.java
new file mode 100644
index 0000000000..671a49fca5
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/tileentities/base/TileBasicTank.java
@@ -0,0 +1,150 @@
+package gtPlusPlus.core.tileentities.base;
+
+import gtPlusPlus.api.objects.minecraft.BTF_FluidTank;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTankInfo;
+import net.minecraftforge.fluids.IFluidHandler;
+import net.minecraftforge.fluids.IFluidTank;
+
+public class TileBasicTank extends TileEntityBase implements IFluidHandler, IFluidTank {
+
+ public final BTF_FluidTank mTank;
+
+ public TileBasicTank(int aMaxSlots, int aFluidCapacity) {
+ super(aMaxSlots);
+ mTank = new BTF_FluidTank(aFluidCapacity);
+ }
+
+ @Override
+ public boolean onPreTick(long aTick) {
+
+ if (this.isServerSide()) {
+ if (mTank.isFluidChangingAllowed() && mTank.getFillableStack() != null
+ && mTank.getFillableStack().amount <= 0) {
+ mTank.setFillableStack((FluidStack) null);
+ }
+ }
+
+ return super.onPreTick(aTick);
+
+ }
+
+
+ private final boolean canFillEx(ForgeDirection aSide, Fluid aFluid) {
+ return this.fill(aSide, new FluidStack(aFluid, 1), false) == 1;
+ }
+
+
+ private final boolean canDrainEx(ForgeDirection aSide, Fluid aFluid) {
+ return this.drain(aSide, new FluidStack(aFluid, 1), false) != null;
+ }
+
+
+ private final FluidTankInfo[] getTankInfoEx(ForgeDirection aSide) {
+ return mTank.getCapacity() <= 0 ? new FluidTankInfo[0]
+ : new FluidTankInfo[]{mTank.getInfo()};
+ }
+
+ private final int fill_default(ForgeDirection aSide, FluidStack aFluid, boolean doFill) {
+ return mTank.fill(aFluid, doFill);
+ }
+
+
+ private final int fillEx(ForgeDirection aSide, FluidStack aFluid, boolean doFill) {
+ return this.fill_default(aSide, aFluid, doFill);
+ }
+
+
+ private final FluidStack drainEx(ForgeDirection aSide, FluidStack aFluid, boolean doDrain) {
+ return mTank.getFluid() != null && aFluid != null && mTank.getFluid().isFluidEqual(aFluid)
+ ? mTank.drain(aFluid.amount, doDrain)
+ : null;
+ }
+
+
+ private final FluidStack drainEx(ForgeDirection aSide, int maxDrain, boolean doDrain) {
+ return mTank.drain(maxDrain, doDrain);
+ }
+
+
+ public boolean isLiquidInput(byte aSide) {
+ return true;
+ }
+
+ public boolean isLiquidOutput(byte aSide) {
+ return true;
+ }
+
+ @Override
+ public int fill(ForgeDirection aSide, FluidStack aFluid, boolean doFill) {
+ if (mTickTimer > 5 && canAccessData() && (mRunningThroughTick || !mInputDisabled) && (aSide == ForgeDirection.UNKNOWN || (this.isLiquidInput((byte) aSide.ordinal()) && getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidIn((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getCoverDataAtSide((byte) aSide.ordinal()), aFluid == null ? null : aFluid.getFluid(), this))))
+ return this.fillEx(aSide, aFluid, doFill);
+ return 0;
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection aSide, int maxDrain, boolean doDrain) {
+ if (mTickTimer > 5 && canAccessData() && (mRunningThroughTick || !mOutputDisabled) && (aSide == ForgeDirection.UNKNOWN || (this.isLiquidOutput((byte) aSide.ordinal()) && getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidOut((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getCoverDataAtSide((byte) aSide.ordinal()), this.getFluid() == null ? null : this.getFluid().getFluid(), this))))
+ return this.drainEx(aSide, maxDrain, doDrain);
+ return null;
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection aSide, FluidStack aFluid, boolean doDrain) {
+ if (mTickTimer > 5 && canAccessData() && (mRunningThroughTick || !mOutputDisabled) && (aSide == ForgeDirection.UNKNOWN || (this.isLiquidOutput((byte) aSide.ordinal()) && getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidOut((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getCoverDataAtSide((byte) aSide.ordinal()), aFluid == null ? null : aFluid.getFluid(), this))))
+ return this.drainEx(aSide, aFluid, doDrain);
+ return null;
+ }
+
+ @Override
+ public boolean canFill(ForgeDirection aSide, Fluid aFluid) {
+ if (mTickTimer > 5 && canAccessData() && (mRunningThroughTick || !mInputDisabled) && (aSide == ForgeDirection.UNKNOWN || (this.isLiquidInput((byte) aSide.ordinal()) && getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidIn((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getCoverDataAtSide((byte) aSide.ordinal()), aFluid, this))))
+ return this.canFillEx(aSide, aFluid);
+ return false;
+ }
+
+ @Override
+ public boolean canDrain(ForgeDirection aSide, Fluid aFluid) {
+ if (mTickTimer > 5 && canAccessData() && (mRunningThroughTick || !mOutputDisabled) && (aSide == ForgeDirection.UNKNOWN || (this.isLiquidOutput((byte) aSide.ordinal()) && getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidOut((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getCoverDataAtSide((byte) aSide.ordinal()), aFluid, this))))
+ return this.canDrainEx(aSide, aFluid);
+ return false;
+ }
+
+ @Override
+ public FluidTankInfo[] getTankInfo(ForgeDirection aSide) {
+ if (canAccessData() && (aSide == ForgeDirection.UNKNOWN || (this.isLiquidInput((byte) aSide.ordinal()) && getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidIn((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getCoverDataAtSide((byte) aSide.ordinal()), null, this)) || (this.isLiquidOutput((byte) aSide.ordinal()) && getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidOut((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getCoverDataAtSide((byte) aSide.ordinal()), null, this))))
+ return this.getTankInfoEx(aSide);
+ return new FluidTankInfo[]{};
+ }
+
+ @Override
+ public FluidStack getFluid() {
+ return mTank.getFluid();
+ }
+
+ @Override
+ public int getFluidAmount() {
+ return mTank.getFluidAmount();
+ }
+
+ @Override
+ public FluidTankInfo getInfo() {
+ return mTank.getInfo();
+ }
+
+ @Override
+ public int fill(FluidStack resource, boolean doFill) {
+ return mTank.fill(resource, doFill);
+ }
+
+ @Override
+ public FluidStack drain(int maxDrain, boolean doDrain) {
+ return mTank.drain(maxDrain, doDrain);
+ }
+
+
+
+
+}
diff --git a/src/main/java/gtPlusPlus/core/tileentities/base/TileEntityBase.java b/src/main/java/gtPlusPlus/core/tileentities/base/TileEntityBase.java
new file mode 100644
index 0000000000..dba96c6ebc
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/tileentities/base/TileEntityBase.java
@@ -0,0 +1,1347 @@
+package gtPlusPlus.core.tileentities.base;
+
+import java.util.UUID;
+
+import gregtech.GT_Mod;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.interfaces.IDescribable;
+import gregtech.api.interfaces.tileentity.IGregTechDeviceInformation;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.net.GT_Packet_Block_Event;
+import gregtech.api.util.GT_CoverBehavior;
+import gregtech.api.util.GT_LanguageManager;
+import gregtech.api.util.GT_OreDictUnificator;
+import gregtech.api.util.GT_Utility;
+import net.minecraft.block.Block;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.IFluidHandler;
+import gtPlusPlus.api.interfaces.ILazyCoverable;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.minecraft.BTF_Inventory;
+import gtPlusPlus.core.util.data.ArrayUtils;
+import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils;
+import ic2.api.Direction;
+
+public class TileEntityBase extends TileEntity implements ILazyCoverable, IGregTechDeviceInformation, IDescribable {
+
+ private String customName;
+ public String mOwnerName = "null";
+ public String mOwnerUUID = "null";
+ private boolean mIsOwnerOP = false;
+
+ public final BTF_Inventory mInventory;
+
+ public TileEntityBase(int aCapacity) {
+ mInventory = new BTF_Inventory(aCapacity, this);
+ }
+
+ public NBTTagCompound getTag(final NBTTagCompound nbt, final String tag){
+ if(!nbt.hasKey(tag))
+ {
+ nbt.setTag(tag, new NBTTagCompound());
+ }
+ return nbt.getCompoundTag(tag);
+ }
+
+ @Override
+ public void writeToNBT(final NBTTagCompound nbt){
+ super.writeToNBT(nbt);
+ if (this.hasCustomInventoryName()) {
+ nbt.setString("CustomName", this.getCustomName());
+ }
+ nbt.setBoolean("mIsOwnerOP", this.mIsOwnerOP);
+ nbt.setString("mOwnerName", this.mOwnerName);
+ nbt.setString("mOwnerUUID", this.mOwnerUUID);
+ }
+
+ @Override
+ public void readFromNBT(final NBTTagCompound nbt){
+
+ super.readFromNBT(nbt);
+
+ if (nbt.hasKey("CustomName", 8)) {
+ this.setCustomName(nbt.getString("CustomName"));
+ }
+
+ this.mIsOwnerOP = nbt.getBoolean("mIsOwnerOP");
+ this.mOwnerName = nbt.getString("mOwnerName");
+ this.mOwnerUUID = nbt.getString("mOwnerUUID");
+ }
+
+ @Override
+ public void updateEntity() {
+ long aTick = System.currentTimeMillis();
+ this.isDead = false;
+ if (!firstTicked) {
+ onFirstTick();
+ }
+ try{
+ if (this.isServerSide()){
+ onPreTick(aTick);
+ }
+ } catch (Throwable t){
+ Logger.ERROR("Tile Entity Encountered an error in it's pre-tick stage.");
+ t.printStackTrace();
+ }
+ try{
+ if (this.isServerSide()){
+ onTick(aTick);
+ }
+ } catch (Throwable t){
+ Logger.ERROR("Tile Entity Encountered an error in it's tick stage.");
+ t.printStackTrace();
+ }
+ try{
+ if (this.isServerSide()){
+ onPostTick(aTick);
+ }
+ } catch (Throwable t){
+ Logger.ERROR("Tile Entity Encountered an error in it's post-tick stage.");
+ t.printStackTrace();
+ }
+ }
+
+ public boolean onPreTick(long aTick) {
+ return true;
+ }
+
+ public boolean onTick(long aTick){
+ try{
+ if (this.isServerSide()){
+ processRecipe();
+ }
+ } catch (Throwable t){
+ Logger.ERROR("Tile Entity Encountered an error in it's processing of a recipe stage.");
+ t.printStackTrace();
+ }
+ return true;
+ }
+
+ public boolean onPostTick(long aTick){
+ return true;
+ }
+
+ public boolean processRecipe(){
+ return true;
+ }
+
+ @Override
+ public boolean canUpdate() {
+ return true;
+ }
+
+ public String getOwner(){
+ if (this.mOwnerName == null){
+ return "null";
+ }
+ return this.mOwnerName;
+ }
+
+ public UUID getOwnerUUID(){
+ return UUID.fromString(this.mOwnerUUID);
+ }
+
+ public boolean isOwnerOP() {
+ return mIsOwnerOP;
+ }
+
+ public void setOwnerInformation(String mName, String mUUID, boolean mOP){
+ if (isServerSide()){
+ if (this.mOwnerName == null || this.mOwnerUUID == null || this.mOwnerName.equals("null") || this.mOwnerUUID.equals("null")){
+ this.mOwnerName = mName;
+ this.mOwnerUUID = mUUID;
+ this.mIsOwnerOP = mOP;
+ }
+ }
+ }
+
+ public boolean isServerSide(){
+ if (this.hasWorldObj()){
+ if (!this.getWorldObj().isRemote){
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public final boolean isClientSide() {
+ return this.worldObj.isRemote;
+ }
+
+ public String getCustomName() {
+ return this.customName;
+ }
+
+ public void setCustomName(String customName) {
+ this.customName = customName;
+ }
+
+ @Override
+ public String getInventoryName() {
+ return this.hasCustomInventoryName() ? this.customName : "container.tileentity.name";
+ }
+
+ @Override
+ public boolean hasCustomInventoryName() {
+ return this.customName != null && !this.customName.equals("");
+ }
+
+ @Override
+ public int getSizeInventory() {
+ return this.mInventory.getSizeInventory();
+ }
+
+ @Override
+ public ItemStack getStackInSlot(int aIndex) {
+ return this.mInventory.getStackInSlot(aIndex);
+ }
+
+ @Override
+ public ItemStack decrStackSize(int aIndex, int aAmount) {
+ if (canAccessData()) {
+ mInventoryChanged = true;
+ return mInventory.decrStackSize(aIndex, aAmount);
+ }
+ return null;
+ }
+
+ @Override
+ public ItemStack getStackInSlotOnClosing(int p_70304_1_) {
+ return this.mInventory.getStackInSlotOnClosing(p_70304_1_);
+ }
+
+ @Override
+ public void setInventorySlotContents(int p_70299_1_, ItemStack p_70299_2_) {
+ this.mInventory.setInventorySlotContents(p_70299_1_, p_70299_2_);
+ }
+
+ @Override
+ public int getInventoryStackLimit() {
+ return this.mInventory.getInventoryStackLimit();
+ }
+
+ @Override
+ public boolean isUseableByPlayer(EntityPlayer p_70300_1_) {
+ return this.mInventory.isUseableByPlayer(p_70300_1_);
+ }
+
+ @Override
+ public void openInventory() {
+ this.mInventory.openInventory();
+ }
+
+ @Override
+ public void closeInventory() {
+ this.mInventory.closeInventory();
+ }
+
+ /**
+ * Can put aStack into Slot
+ */
+ @Override
+ public boolean isItemValidForSlot(int aIndex, ItemStack aStack) {
+ return canAccessData() && mInventory.isItemValidForSlot(aIndex, aStack);
+ }
+
+ /**
+ * returns all valid Inventory Slots, no matter which Side (Unless it's covered).
+ * The Side Stuff is done in the following two Functions.
+ */
+ @Override
+ public int[] getAccessibleSlotsFromSide(int aSide) {
+ if (canAccessData() && (getCoverBehaviorAtSide((byte) aSide).letsItemsOut((byte) aSide, getCoverIDAtSide((byte) aSide), getCoverDataAtSide((byte) aSide), -1, this) || getCoverBehaviorAtSide((byte) aSide).letsItemsIn((byte) aSide, getCoverIDAtSide((byte) aSide), getCoverDataAtSide((byte) aSide), -1, this)))
+ return mInventory.getAccessibleSlotsFromSide(aSide);
+ return new int[0];
+ }
+
+ /**
+ * Can put aStack into Slot at Side
+ */
+ @Override
+ public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) {
+ return canAccessData() && (mRunningThroughTick || !mInputDisabled) && getCoverBehaviorAtSide((byte) aSide).letsItemsIn((byte) aSide, getCoverIDAtSide((byte) aSide), getCoverDataAtSide((byte) aSide), aIndex, this) && mInventory.canInsertItem(aIndex, aStack, aSide);
+ }
+
+ /**
+ * Can pull aStack out of Slot from Side
+ */
+ @Override
+ public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) {
+ return canAccessData() && (mRunningThroughTick || !mOutputDisabled) && getCoverBehaviorAtSide((byte) aSide).letsItemsOut((byte) aSide, getCoverIDAtSide((byte) aSide), getCoverDataAtSide((byte) aSide), aIndex, this) && mInventory.canExtractItem(aIndex, aStack, aSide);
+ }
+
+
+ @Override
+ public boolean isValidSlot(int aIndex) {
+ return this.canAccessData() ? this.mInventory.isValidSlot(aIndex) : false;
+ }
+
+
+
+
+ private final GT_CoverBehavior[] mCoverBehaviors = new GT_CoverBehavior[] { GregTech_API.sNoBehavior,
+ GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior,
+ GregTech_API.sNoBehavior };
+ protected TileEntityBase mMetaTileEntity;
+ protected long mStoredEnergy = 0;
+ protected int mAverageEUInputIndex = 0, mAverageEUOutputIndex = 0;
+ protected boolean mReleaseEnergy = false;
+ protected int[] mAverageEUInput = new int[11], mAverageEUOutput = new int[11];
+ private boolean[] mActiveEUInputs = new boolean[] { false, false, false, false, false, false },
+ mActiveEUOutputs = new boolean[] { false, false, false, false, false, false };
+ private byte[] mSidedRedstone = new byte[] { 15, 15, 15, 15, 15, 15 };
+ private int[] mCoverSides = new int[] { 0, 0, 0, 0, 0, 0 }, mCoverData = new int[] { 0, 0, 0, 0, 0, 0 },
+ mTimeStatistics = new int[GregTech_API.TICKS_FOR_LAG_AVERAGING];
+ private boolean mHasEnoughEnergy = true;
+ protected boolean mRunningThroughTick = false;
+ protected boolean mInputDisabled = false;
+ protected boolean mOutputDisabled = false;
+ private boolean mMuffler = false;
+ private boolean mLockUpgrade = false;
+ private boolean mActive = false;
+ private boolean mRedstone = false;
+ private boolean mWorkUpdate = false;
+ private boolean mSteamConverter = false;
+ private boolean mInventoryChanged = false;
+ private boolean mWorks = true;
+ private boolean mNeedsUpdate = true;
+ private boolean mNeedsBlockUpdate = true;
+ private boolean mSendClientData = false;
+ private boolean oRedstone = false;
+ private boolean mEnergyStateReady = false;
+ private byte mColor = 0, oColor = 0, mStrongRedstone = 0, oRedstoneData = 63, oTextureData = 0, oUpdateData = 0,
+ oTexturePage = 0, oLightValueClient = -1, oLightValue = -1, mLightValue = 0, mOtherUpgrades = 0,
+ mFacing = 0, oFacing = 0, mWorkData = 0;
+ private int mDisplayErrorCode = 0, oX = 0, oY = 0, oZ = 0, mTimeStatisticsIndex = 0, mLagWarningCount = 0;
+ private short mID = 0;
+ protected long mTickTimer = 0;
+ private long oOutput = 0;
+ private long mAcceptedAmperes = Long.MAX_VALUE;
+
+
+ /**
+ * Cover Support
+ */
+
+ public void issueClientUpdate() {
+ this.mSendClientData = true;
+ }
+
+ protected final boolean canAccessData() {
+ return !isDead() && !this.isInvalid();
+ }
+
+ @Override
+ public void issueBlockUpdate() {
+ super.markDirty();
+ }
+
+ @Override
+ public void issueCoverUpdate(byte aSide) {
+ this.issueClientUpdate();
+ }
+
+ @Override
+ public void receiveCoverData(byte coverSide, int coverID, int coverData) {
+ if ((coverSide >= 0 && coverSide < 6) && (mCoverSides[coverSide] == coverID))
+ setCoverDataAtSide(coverSide, coverData);
+ }
+
+ @Override
+ public long getTimer() {
+ return this.mTickTimer;
+ }
+
+
+
+
+
+
+
+ public long getOutputAmperage() {
+ return this.canAccessData() && this.mMetaTileEntity.isElectric() ? this.mMetaTileEntity.maxAmperesOut() : 0L;
+ }
+
+ public long getOutputVoltage() {
+ return this.canAccessData() && this.mMetaTileEntity.isElectric() && this.mMetaTileEntity.isEnetOutput()
+ ? this.mMetaTileEntity.maxEUOutput()
+ : 0L;
+ }
+
+ public long getInputAmperage() {
+ return this.canAccessData() && this.mMetaTileEntity.isElectric() ? this.mMetaTileEntity.maxAmperesIn() : 0L;
+ }
+
+ public long getInputVoltage() {
+ return this.canAccessData() && this.mMetaTileEntity.isElectric()
+ ? this.mMetaTileEntity.maxEUInput()
+ : 2147483647L;
+ }
+
+ @Override
+ public boolean decreaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooLessEnergy) {
+ return !this.canAccessData() ? false : (this.mHasEnoughEnergy = this.decreaseStoredEU(aEnergy, aIgnoreTooLessEnergy));
+ }
+
+ @Override
+ public boolean increaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooMuchEnergy) {
+ if (!this.canAccessData()) {
+ return false;
+ } else if (this.getStoredEU() >= this.getEUCapacity() && !aIgnoreTooMuchEnergy) {
+ return false;
+ } else {
+ this.setStoredEU(this.mMetaTileEntity.getEUVar() + aEnergy);
+ return true;
+ }
+ }
+
+ @Override
+ public boolean inputEnergyFrom(byte aSide) {
+ return aSide == 6
+ ? true
+ : (!this.isServerSide()
+ ? this.isEnergyInputSide(aSide)
+ : aSide >= 0 && aSide < 6 && this.mActiveEUInputs[aSide] && !this.mReleaseEnergy);
+ }
+
+ @Override
+ public boolean outputsEnergyTo(byte aSide) {
+ return aSide == 6
+ ? true
+ : (!this.isServerSide()
+ ? this.isEnergyOutputSide(aSide)
+ : aSide >= 0 && aSide < 6 && this.mActiveEUOutputs[aSide] || this.mReleaseEnergy);
+ }
+
+ private boolean isEnergyInputSide(byte aSide) {
+ if (aSide >= 0 && aSide < 6) {
+ if (!this.getCoverBehaviorAtSide(aSide).letsEnergyIn(aSide, this.getCoverIDAtSide(aSide),
+ this.getCoverDataAtSide(aSide), this)) {
+ return false;
+ }
+
+ if (this.isInvalid() || this.mReleaseEnergy) {
+ return false;
+ }
+
+ if (this.canAccessData() && this.mMetaTileEntity.isElectric() && this.mMetaTileEntity.isEnetInput()) {
+ return this.mMetaTileEntity.isInputFacing(aSide);
+ }
+ }
+
+ return false;
+ }
+
+ private boolean isEnergyOutputSide(byte aSide) {
+ if (aSide >= 0 && aSide < 6) {
+ if (!this.getCoverBehaviorAtSide(aSide).letsEnergyOut(aSide, this.getCoverIDAtSide(aSide),
+ this.getCoverDataAtSide(aSide), this)) {
+ return false;
+ }
+
+ if (this.isInvalid() || this.mReleaseEnergy) {
+ return this.mReleaseEnergy;
+ }
+
+ if (this.canAccessData() && this.mMetaTileEntity.isElectric() && this.mMetaTileEntity.isEnetOutput()) {
+ return this.mMetaTileEntity.isOutputFacing(aSide);
+ }
+ }
+
+ return false;
+ }