2015-04-23 18:14:22 +02:00
|
|
|
package gregtech.api.metatileentity;
|
|
|
|
|
2015-10-21 22:06:25 -04:00
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
2015-04-23 18:14:22 +02:00
|
|
|
import gregtech.api.GregTech_API;
|
|
|
|
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
|
|
|
|
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
|
|
|
|
import gregtech.api.objects.GT_ItemStack;
|
|
|
|
import gregtech.api.util.GT_Config;
|
|
|
|
import gregtech.api.util.GT_LanguageManager;
|
|
|
|
import gregtech.api.util.GT_ModHandler;
|
|
|
|
import gregtech.api.util.GT_Utility;
|
|
|
|
import net.minecraft.block.Block;
|
|
|
|
import net.minecraft.client.renderer.RenderBlocks;
|
|
|
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
|
|
import net.minecraft.entity.Entity;
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.entity.player.InventoryPlayer;
|
|
|
|
import net.minecraft.init.Blocks;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.nbt.NBTTagCompound;
|
|
|
|
import net.minecraft.util.AxisAlignedBB;
|
|
|
|
import net.minecraft.world.IBlockAccess;
|
|
|
|
import net.minecraft.world.World;
|
|
|
|
import net.minecraftforge.common.util.ForgeDirection;
|
|
|
|
import net.minecraftforge.fluids.Fluid;
|
|
|
|
import net.minecraftforge.fluids.FluidStack;
|
|
|
|
import net.minecraftforge.fluids.FluidTankInfo;
|
2015-10-21 22:06:25 -04:00
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
2016-08-14 08:06:00 +01:00
|
|
|
import java.util.Locale;
|
2015-10-21 22:06:25 -04:00
|
|
|
|
|
|
|
import static gregtech.api.enums.GT_Values.V;
|
2015-04-23 18:14:22 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* NEVER INCLUDE THIS FILE IN YOUR MOD!!!
|
2015-10-21 22:06:25 -04:00
|
|
|
* <p/>
|
2015-04-23 18:14:22 +02:00
|
|
|
* Extend this Class to add a new MetaMachine
|
|
|
|
* Call the Constructor with the desired ID at the load-phase (not preload and also not postload!)
|
|
|
|
* Implement the newMetaEntity-Method to return a new ready instance of your MetaTileEntity
|
2015-10-21 22:06:25 -04:00
|
|
|
* <p/>
|
|
|
|
* Call the Constructor like the following example inside the Load Phase, to register it.
|
2015-04-23 18:14:22 +02:00
|
|
|
* "new GT_MetaTileEntity_E_Furnace(54, "GT_E_Furnace", "Automatic E-Furnace");"
|
|
|
|
*/
|
|
|
|
public abstract class MetaTileEntity implements IMetaTileEntity {
|
2015-10-21 22:06:25 -04:00
|
|
|
/**
|
|
|
|
* Only assigned for the MetaTileEntity in the List! Also only used to get the localized Name for the ItemStack and for getInvName.
|
|
|
|
*/
|
|
|
|
public final String mName;
|
|
|
|
/**
|
|
|
|
* The Inventory of the MetaTileEntity. Amount of Slots can be larger than 256. HAYO!
|
|
|
|
*/
|
|
|
|
public final ItemStack[] mInventory;
|
|
|
|
public boolean doTickProfilingInThisTick = true;
|
|
|
|
/**
|
|
|
|
* accessibility to this Field is no longer given, see below
|
|
|
|
*/
|
|
|
|
private IGregTechTileEntity mBaseMetaTileEntity;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This registers your Machine at the List.
|
|
|
|
* Use only ID's larger than 2048, because i reserved these ones.
|
|
|
|
* See also the List in the API, as it has a Description containing all the reservations.
|
|
|
|
*
|
|
|
|
* @param aID the ID
|
|
|
|
* @example for Constructor overload.
|
|
|
|
* <p/>
|
|
|
|
* public GT_MetaTileEntity_EBench(int aID, String mName, String mNameRegional) {
|
|
|
|
* super(aID, mName, mNameRegional);
|
|
|
|
* }
|
|
|
|
*/
|
|
|
|
public MetaTileEntity(int aID, String aBasicName, String aRegionalName, int aInvSlotCount) {
|
|
|
|
if (GregTech_API.sPostloadStarted || !GregTech_API.sPreloadStarted)
|
|
|
|
throw new IllegalAccessError("This Constructor has to be called in the load Phase");
|
|
|
|
if (GregTech_API.METATILEENTITIES[aID] == null) {
|
|
|
|
GregTech_API.METATILEENTITIES[aID] = this;
|
|
|
|
} else {
|
|
|
|
throw new IllegalArgumentException("MetaMachine-Slot Nr. " + aID + " is already occupied!");
|
|
|
|
}
|
2016-08-14 08:06:00 +01:00
|
|
|
mName = aBasicName.replaceAll(" ", "_").toLowerCase(Locale.ENGLISH);
|
2015-10-21 22:06:25 -04:00
|
|
|
setBaseMetaTileEntity(GregTech_API.constructBaseMetaTileEntity());
|
|
|
|
getBaseMetaTileEntity().setMetaTileID((short) aID);
|
|
|
|
GT_LanguageManager.addStringLocalization("gt.blockmachines." + mName + ".name", aRegionalName);
|
|
|
|
mInventory = new ItemStack[aInvSlotCount];
|
|
|
|
|
2017-06-01 20:23:13 +05:00
|
|
|
// if (GT.isClientSide()) {
|
|
|
|
// ItemStack tStack = new ItemStack(GregTech_API.sBlockMachines, 1, aID);
|
|
|
|
// tStack.getItem().addInformation(tStack, null, new ArrayList<String>(), true);
|
|
|
|
// }
|
2015-10-21 22:06:25 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This is the normal Constructor.
|
|
|
|
*/
|
|
|
|
public MetaTileEntity(String aName, int aInvSlotCount) {
|
|
|
|
mInventory = new ItemStack[aInvSlotCount];
|
|
|
|
mName = aName;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public IGregTechTileEntity getBaseMetaTileEntity() {
|
|
|
|
return mBaseMetaTileEntity;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void setBaseMetaTileEntity(IGregTechTileEntity aBaseMetaTileEntity) {
|
|
|
|
if (mBaseMetaTileEntity != null && aBaseMetaTileEntity == null) {
|
|
|
|
mBaseMetaTileEntity.getMetaTileEntity().inValidate();
|
|
|
|
mBaseMetaTileEntity.setMetaTileEntity(null);
|
|
|
|
}
|
|
|
|
mBaseMetaTileEntity = aBaseMetaTileEntity;
|
|
|
|
if (mBaseMetaTileEntity != null) {
|
|
|
|
mBaseMetaTileEntity.setMetaTileEntity(this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public ItemStack getStackForm(long aAmount) {
|
|
|
|
return new ItemStack(GregTech_API.sBlockMachines, (int) aAmount, getBaseMetaTileEntity().getMetaTileID());
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getLocalName() {
|
|
|
|
return GT_LanguageManager.getTranslation("gt.blockmachines." + mName + ".name");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onServerStart() {/*Do nothing*/}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onWorldSave(File aSaveDirectory) {/*Do nothing*/}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onWorldLoad(File aSaveDirectory) {/*Do nothing*/}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onConfigLoad(GT_Config aConfig) {/*Do nothing*/}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void setItemNBT(NBTTagCompound aNBT) {/*Do nothing*/}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public void registerIcons(IIconRegister aBlockIconRegister) {/*Do nothing*/}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean allowCoverOnSide(byte aSide, GT_ItemStack aStack) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {/*Do nothing*/}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
|
|
|
|
if (getBaseMetaTileEntity().isValidFacing(aWrenchingSide)) {
|
|
|
|
getBaseMetaTileEntity().setFrontFacing(aWrenchingSide);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onExplosion() {/*Do nothing*/}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) {/*Do nothing*/}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {/*Do nothing*/}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {/*Do nothing*/}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void inValidate() {/*Do nothing*/}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onRemoval() {/*Do nothing*/}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void initDefaultModes(NBTTagCompound aNBT) {/*Do nothing*/}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* When a GUI is opened
|
|
|
|
*/
|
|
|
|
public void onOpenGUI() {/*Do nothing*/}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* When a GUI is closed
|
|
|
|
*/
|
|
|
|
public void onCloseGUI() {/*Do nothing*/}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* a Player rightclicks the Machine
|
|
|
|
* Sneaky rightclicks are not getting passed to this!
|
|
|
|
*/
|
|
|
|
public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) {
|
|
|
|
return onRightclick(aBaseMetaTileEntity, aPlayer);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onLeftclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {/*Do nothing*/}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onValueUpdate(byte aValue) {/*Do nothing*/}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public byte getUpdateData() {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void doSound(byte aIndex, double aX, double aY, double aZ) {/*Do nothing*/}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {/*Do nothing*/}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void stopSoundLoop(byte aValue, double aX, double aY, double aZ) {/*Do nothing*/}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public final void sendSound(byte aIndex) {
|
|
|
|
if (!getBaseMetaTileEntity().hasMufflerUpgrade()) getBaseMetaTileEntity().sendBlockEvent((byte) 4, aIndex);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public final void sendLoopStart(byte aIndex) {
|
|
|
|
if (!getBaseMetaTileEntity().hasMufflerUpgrade()) getBaseMetaTileEntity().sendBlockEvent((byte) 5, aIndex);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public final void sendLoopEnd(byte aIndex) {
|
|
|
|
if (!getBaseMetaTileEntity().hasMufflerUpgrade()) getBaseMetaTileEntity().sendBlockEvent((byte) 6, aIndex);
|
|
|
|
}
|
|
|
|
|
2015-04-23 18:14:22 +02:00
|
|
|
/**
|
|
|
|
* @return true if this Device emits Energy at all
|
|
|
|
*/
|
2015-10-21 22:06:25 -04:00
|
|
|
public boolean isElectric() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-04-23 18:14:22 +02:00
|
|
|
/**
|
|
|
|
* @return true if this Device emits Energy at all
|
|
|
|
*/
|
2015-10-21 22:06:25 -04:00
|
|
|
public boolean isPneumatic() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-04-23 18:14:22 +02:00
|
|
|
/**
|
|
|
|
* @return true if this Device emits Energy at all
|
|
|
|
*/
|
2015-10-21 22:06:25 -04:00
|
|
|
public boolean isSteampowered() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-04-23 18:14:22 +02:00
|
|
|
/**
|
|
|
|
* @return true if this Device emits Energy at all
|
|
|
|
*/
|
2015-10-21 22:06:25 -04:00
|
|
|
public boolean isEnetOutput() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-04-23 18:14:22 +02:00
|
|
|
/**
|
|
|
|
* @return true if this Device consumes Energy at all
|
|
|
|
*/
|
2015-10-21 22:06:25 -04:00
|
|
|
public boolean isEnetInput() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-04-23 18:14:22 +02:00
|
|
|
/**
|
|
|
|
* @return the amount of EU, which can be stored in this Device. Default is 0 EU.
|
|
|
|
*/
|
2015-10-21 22:06:25 -04:00
|
|
|
public long maxEUStore() {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-04-23 18:14:22 +02:00
|
|
|
/**
|
|
|
|
* @return the amount of EU/t, which can be accepted by this Device before it explodes.
|
|
|
|
*/
|
2015-10-21 22:06:25 -04:00
|
|
|
public long maxEUInput() {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-04-23 18:14:22 +02:00
|
|
|
/**
|
|
|
|
* @return the amount of EU/t, which can be outputted by this Device.
|
|
|
|
*/
|
2015-10-21 22:06:25 -04:00
|
|
|
public long maxEUOutput() {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-04-23 18:14:22 +02:00
|
|
|
/**
|
|
|
|
* @return the amount of E-net Impulses of the maxEUOutput size, which can be outputted by this Device.
|
|
|
|
* Default is 1 Pulse, this shouldn't be set to smaller Values than 1, as it won't output anything in that Case!
|
|
|
|
*/
|
2015-10-21 22:06:25 -04:00
|
|
|
public long maxAmperesOut() {
|
|
|
|
return 1;
|
|
|
|
}
|
2015-04-23 18:14:22 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* How many Amperes this Block can suck at max. Surpassing this value won't blow it up.
|
|
|
|
*/
|
2015-10-21 22:06:25 -04:00
|
|
|
public long maxAmperesIn() {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2015-04-23 18:14:22 +02:00
|
|
|
/**
|
|
|
|
* @return true if that Side is an Output.
|
|
|
|
*/
|
2015-10-21 22:06:25 -04:00
|
|
|
public boolean isOutputFacing(byte aSide) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-04-23 18:14:22 +02:00
|
|
|
/**
|
|
|
|
* @return true if that Side is an Input.
|
|
|
|
*/
|
2015-10-21 22:06:25 -04:00
|
|
|
public boolean isInputFacing(byte aSide) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-04-23 18:14:22 +02:00
|
|
|
/**
|
|
|
|
* @return true if Transformer Upgrades increase Packet Amount.
|
|
|
|
*/
|
2015-10-21 22:06:25 -04:00
|
|
|
public boolean isTransformingLowEnergy() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-04-23 18:14:22 +02:00
|
|
|
@Override
|
2015-10-21 22:06:25 -04:00
|
|
|
public boolean isFacingValid(byte aFacing) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-04-23 18:14:22 +02:00
|
|
|
@Override
|
2015-10-21 22:06:25 -04:00
|
|
|
public boolean isAccessAllowed(EntityPlayer aPlayer) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-04-23 18:14:22 +02:00
|
|
|
@Override
|
2015-10-21 22:06:25 -04:00
|
|
|
public boolean isValidSlot(int aIndex) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-04-23 18:14:22 +02:00
|
|
|
@Override
|
2015-10-21 22:06:25 -04:00
|
|
|
public boolean setStackToZeroInsteadOfNull(int aIndex) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This is used to get the internal Energy. I use this for the IDSU.
|
|
|
|
*/
|
|
|
|
public long getEUVar() {
|
|
|
|
return ((BaseMetaTileEntity) mBaseMetaTileEntity).mStoredEnergy;
|
|
|
|
}
|
|
|
|
|
2015-04-23 18:14:22 +02:00
|
|
|
/**
|
|
|
|
* This is used to set the internal Energy to the given Parameter. I use this for the IDSU.
|
|
|
|
*/
|
2015-10-21 22:06:25 -04:00
|
|
|
public void setEUVar(long aEnergy) {
|
|
|
|
((BaseMetaTileEntity) mBaseMetaTileEntity).mStoredEnergy = aEnergy;
|
|
|
|
}
|
|
|
|
|
2015-04-23 18:14:22 +02:00
|
|
|
/**
|
2015-10-21 22:06:25 -04:00
|
|
|
* This is used to get the internal Steam Energy.
|
2015-04-23 18:14:22 +02:00
|
|
|
*/
|
2015-10-21 22:06:25 -04:00
|
|
|
public long getSteamVar() {
|
|
|
|
return ((BaseMetaTileEntity) mBaseMetaTileEntity).mStoredSteam;
|
|
|
|
}
|
|
|
|
|
2015-04-23 18:14:22 +02:00
|
|
|
/**
|
|
|
|
* This is used to set the internal Steam Energy to the given Parameter.
|
|
|
|
*/
|
2015-10-21 22:06:25 -04:00
|
|
|
public void setSteamVar(long aSteam) {
|
|
|
|
((BaseMetaTileEntity) mBaseMetaTileEntity).mStoredSteam = aSteam;
|
|
|
|
}
|
|
|
|
|
2015-04-23 18:14:22 +02:00
|
|
|
/**
|
2015-10-21 22:06:25 -04:00
|
|
|
* @return the amount of Steam, which can be stored in this Device. Default is 0 EU.
|
2015-04-23 18:14:22 +02:00
|
|
|
*/
|
2015-10-21 22:06:25 -04:00
|
|
|
public long maxSteamStore() {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-04-23 18:14:22 +02:00
|
|
|
/**
|
2015-10-21 22:06:25 -04:00
|
|
|
* @return the amount of EU, which this Device stores before starting to emit Energy.
|
|
|
|
* useful if you don't want to emit stored Energy until a certain Level is reached.
|
2015-04-23 18:14:22 +02:00
|
|
|
*/
|
2015-10-21 22:06:25 -04:00
|
|
|
public long getMinimumStoredEU() {
|
|
|
|
return 512;
|
|
|
|
}
|
|
|
|
|
2015-04-23 18:14:22 +02:00
|
|
|
/**
|
|
|
|
* Determines the Tier of the Machine, used for de-charging Tools.
|
|
|
|
*/
|
|
|
|
public long getInputTier() {
|
2015-10-21 22:06:25 -04:00
|
|
|
return GT_Utility.getTier(getBaseMetaTileEntity().getInputVoltage());
|
2015-04-23 18:14:22 +02:00
|
|
|
}
|
2015-10-21 22:06:25 -04:00
|
|
|
|
2015-04-23 18:14:22 +02:00
|
|
|
/**
|
|
|
|
* Determines the Tier of the Machine, used for charging Tools.
|
|
|
|
*/
|
|
|
|
public long getOutputTier() {
|
2015-10-21 22:06:25 -04:00
|
|
|
return GT_Utility.getTier(getBaseMetaTileEntity().getOutputVoltage());
|
2015-04-23 18:14:22 +02:00
|
|
|
}
|
2015-10-21 22:06:25 -04:00
|
|
|
|
2015-04-23 18:14:22 +02:00
|
|
|
/**
|
|
|
|
* gets the first RechargerSlot
|
|
|
|
*/
|
|
|
|
public int rechargerSlotStartIndex() {
|
2015-10-21 22:06:25 -04:00
|
|
|
return 0;
|
2015-04-23 18:14:22 +02:00
|
|
|
}
|
2015-10-21 22:06:25 -04:00
|
|
|
|
2015-04-23 18:14:22 +02:00
|
|
|
/**
|
|
|
|
* gets the amount of RechargerSlots
|
|
|
|
*/
|
|
|
|
public int rechargerSlotCount() {
|
2015-10-21 22:06:25 -04:00
|
|
|
return 0;
|
2015-04-23 18:14:22 +02:00
|
|
|
}
|
2015-10-21 22:06:25 -04:00
|
|
|
|
2015-04-23 18:14:22 +02:00
|
|
|
/**
|
|
|
|
* gets the first DechargerSlot
|
|
|
|
*/
|
|
|
|
public int dechargerSlotStartIndex() {
|
2015-10-21 22:06:25 -04:00
|
|
|
return 0;
|
2015-04-23 18:14:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gets the amount of DechargerSlots
|
|
|
|
*/
|
|
|
|
public int dechargerSlotCount() {
|
2015-10-21 22:06:25 -04:00
|
|
|
return 0;
|
2015-04-23 18:14:22 +02:00
|
|
|
}
|
2015-10-21 22:06:25 -04:00
|
|
|
|
2015-04-23 18:14:22 +02:00
|
|
|
/**
|
|
|
|
* gets if this is protected from other Players per default or not
|
|
|
|
*/
|
|
|
|
public boolean ownerControl() {
|
2015-10-21 22:06:25 -04:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public ArrayList<String> getSpecialDebugInfo(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, int aLogLevel, ArrayList<String> aList) {
|
|
|
|
return aList;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isLiquidInput(byte aSide) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isLiquidOutput(byte aSide) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gets the contained Liquid
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public FluidStack getFluid() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* tries to fill this Tank
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public int fill(FluidStack resource, boolean doFill) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* tries to empty this Tank
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public FluidStack drain(int maxDrain, boolean doDrain) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Tank pressure
|
|
|
|
*/
|
|
|
|
public int getTankPressure() {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Liquid Capacity
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public int getCapacity() {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onMachineBlockUpdate() {/*Do nothing*/}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void receiveClientEvent(byte aEventID, byte aValue) {/*Do nothing*/}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isSimpleMachine() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* If this accepts up to 4 Overclockers
|
|
|
|
*/
|
|
|
|
public boolean isOverclockerUpgradable() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* If this accepts Transformer Upgrades
|
|
|
|
*/
|
|
|
|
public boolean isTransformerUpgradable() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Progress this machine has already made
|
|
|
|
*/
|
|
|
|
public int getProgresstime() {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Progress this Machine has to do to produce something
|
|
|
|
*/
|
|
|
|
public int maxProgresstime() {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Increases the Progress, returns the overflown Progress.
|
|
|
|
*/
|
|
|
|
public int increaseProgress(int aProgress) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* If this TileEntity makes use of Sided Redstone behaviors.
|
|
|
|
* Determines only, if the Output Redstone Array is getting filled with 0 for true, or 15 for false.
|
|
|
|
*/
|
|
|
|
public boolean hasSidedRedstoneOutputBehavior() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* When the Facing gets changed.
|
|
|
|
*/
|
|
|
|
public void onFacingChange() {/*Do nothing*/}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* if the IC2 Teleporter can drain from this.
|
|
|
|
*/
|
|
|
|
public boolean isTeleporterCompatible() {
|
|
|
|
return isEnetOutput() && getBaseMetaTileEntity().getOutputVoltage() >= 128 && getBaseMetaTileEntity().getUniversalEnergyCapacity() >= 500000;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the Output for the comparator on the given Side
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public byte getComparatorValue(byte aSide) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean acceptsRotationalEnergy(byte aSide) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean injectRotationalEnergy(byte aSide, long aSpeed, long aEnergy) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getSpecialVoltageToolTip() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isGivingInformation() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String[] getInfoData() {
|
|
|
|
return new String[]{};
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isDigitalChest() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public ItemStack[] getStoredItemData() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setItemCount(int aCount) {/*Do nothing*/}
|
|
|
|
|
|
|
|
public int getMaxItemCount() {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getSizeInventory() {
|
|
|
|
return mInventory.length;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public ItemStack getStackInSlot(int aIndex) {
|
|
|
|
if (aIndex >= 0 && aIndex < mInventory.length) return mInventory[aIndex];
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void setInventorySlotContents(int aIndex, ItemStack aStack) {
|
|
|
|
if (aIndex >= 0 && aIndex < mInventory.length) mInventory[aIndex] = aStack;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getInventoryName() {
|
|
|
|
if (GregTech_API.METATILEENTITIES[getBaseMetaTileEntity().getMetaTileID()] != null)
|
|
|
|
return GregTech_API.METATILEENTITIES[getBaseMetaTileEntity().getMetaTileID()].getMetaName();
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getInventoryStackLimit() {
|
|
|
|
return 64;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isItemValidForSlot(int aIndex, ItemStack aStack) {
|
|
|
|
return getBaseMetaTileEntity().isValidSlot(aIndex);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public ItemStack decrStackSize(int aIndex, int aAmount) {
|
|
|
|
ItemStack tStack = getStackInSlot(aIndex), rStack = GT_Utility.copy(tStack);
|
|
|
|
if (tStack != null) {
|
|
|
|
if (tStack.stackSize <= aAmount) {
|
|
|
|
if (setStackToZeroInsteadOfNull(aIndex)) tStack.stackSize = 0;
|
|
|
|
else setInventorySlotContents(aIndex, null);
|
|
|
|
} else {
|
|
|
|
rStack = tStack.splitStack(aAmount);
|
|
|
|
if (tStack.stackSize == 0 && !setStackToZeroInsteadOfNull(aIndex))
|
|
|
|
setInventorySlotContents(aIndex, null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return rStack;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int[] getAccessibleSlotsFromSide(int aSide) {
|
|
|
|
ArrayList<Integer> tList = new ArrayList<Integer>();
|
|
|
|
IGregTechTileEntity tTileEntity = getBaseMetaTileEntity();
|
|
|
|
boolean tSkip = tTileEntity.getCoverBehaviorAtSide((byte) aSide).letsItemsIn((byte) aSide, tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getCoverDataAtSide((byte) aSide), -2, tTileEntity) || tTileEntity.getCoverBehaviorAtSide((byte) aSide).letsItemsOut((byte) aSide, tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getCoverDataAtSide((byte) aSide), -2, tTileEntity);
|
|
|
|
for (int i = 0; i < getSizeInventory(); i++)
|
|
|
|
if (isValidSlot(i) && (tSkip || tTileEntity.getCoverBehaviorAtSide((byte) aSide).letsItemsOut((byte) aSide, tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getCoverDataAtSide((byte) aSide), i, tTileEntity) || tTileEntity.getCoverBehaviorAtSide((byte) aSide).letsItemsIn((byte) aSide, tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getCoverDataAtSide((byte) aSide), i, tTileEntity)))
|
|
|
|
tList.add(i);
|
|
|
|
int[] rArray = new int[tList.size()];
|
|
|
|
for (int i = 0; i < rArray.length; i++) rArray[i] = tList.get(i);
|
|
|
|
return rArray;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) {
|
|
|
|
return isValidSlot(aIndex) && aStack != null && aIndex < mInventory.length && (mInventory[aIndex] == null || GT_Utility.areStacksEqual(aStack, mInventory[aIndex])) && allowPutStack(getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) {
|
|
|
|
return isValidSlot(aIndex) && aStack != null && aIndex < mInventory.length && allowPullStack(getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean canFill(ForgeDirection aSide, Fluid aFluid) {
|
|
|
|
return fill(aSide, new FluidStack(aFluid, 1), false) == 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean canDrain(ForgeDirection aSide, Fluid aFluid) {
|
|
|
|
return drain(aSide, new FluidStack(aFluid, 1), false) != null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public FluidTankInfo[] getTankInfo(ForgeDirection aSide) {
|
|
|
|
if (getCapacity() <= 0 && !getBaseMetaTileEntity().hasSteamEngineUpgrade()) return new FluidTankInfo[]{};
|
|
|
|
return new FluidTankInfo[]{getInfo()};
|
|
|
|
}
|
|
|
|
|
2015-04-23 18:14:22 +02:00
|
|
|
public int fill_default(ForgeDirection aSide, FluidStack aFluid, boolean doFill) {
|
|
|
|
return fill(aFluid, doFill);
|
|
|
|
}
|
2015-10-21 22:06:25 -04:00
|
|
|
|
|
|
|
@Override
|
2015-04-23 18:14:22 +02:00
|
|
|
public int fill(ForgeDirection aSide, FluidStack aFluid, boolean doFill) {
|
2015-10-21 22:06:25 -04:00
|
|
|
if (getBaseMetaTileEntity().hasSteamEngineUpgrade() && GT_ModHandler.isSteam(aFluid) && aFluid.amount > 1) {
|
|
|
|
int tSteam = (int) Math.min(Integer.MAX_VALUE, Math.min(aFluid.amount / 2, getBaseMetaTileEntity().getSteamCapacity() - getBaseMetaTileEntity().getStoredSteam()));
|
|
|
|
if (tSteam > 0) {
|
|
|
|
if (doFill) getBaseMetaTileEntity().increaseStoredSteam(tSteam, true);
|
|
|
|
return tSteam * 2;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return fill_default(aSide, aFluid, doFill);
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public FluidStack drain(ForgeDirection aSide, FluidStack aFluid, boolean doDrain) {
|
|
|
|
if (getFluid() != null && aFluid != null && getFluid().isFluidEqual(aFluid))
|
|
|
|
return drain(aFluid.amount, doDrain);
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public FluidStack drain(ForgeDirection aSide, int maxDrain, boolean doDrain) {
|
|
|
|
return drain(maxDrain, doDrain);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getFluidAmount() {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public FluidTankInfo getInfo() {
|
|
|
|
return new FluidTankInfo(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getMetaName() {
|
|
|
|
return mName;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public ItemStack getStackInSlotOnClosing(int i) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean hasCustomInventoryName() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean doTickProfilingMessageDuringThisTick() {
|
|
|
|
return doTickProfilingInThisTick;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void markDirty() {
|
|
|
|
//
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void openInventory() {
|
|
|
|
//
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void closeInventory() {
|
|
|
|
//
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-04-23 18:14:22 +02:00
|
|
|
public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
|
2015-10-21 22:06:25 -04:00
|
|
|
return null;
|
2015-04-23 18:14:22 +02:00
|
|
|
}
|
2015-10-21 22:06:25 -04:00
|
|
|
|
|
|
|
@Override
|
2015-04-23 18:14:22 +02:00
|
|
|
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
|
2015-10-21 22:06:25 -04:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean connectsToItemPipe(byte aSide) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public float getExplosionResistance(byte aSide) {
|
|
|
|
return 10.0F;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public ItemStack[] getRealInventory() {
|
|
|
|
return mInventory;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onColorChangeServer(byte aColor) {
|
|
|
|
//
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onColorChangeClient(byte aColor) {
|
|
|
|
//
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public boolean renderInInventory(Block aBlock, int aMeta, RenderBlocks aRenderer) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public boolean renderInWorld(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, RenderBlocks aRenderer) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-04-23 18:14:22 +02:00
|
|
|
public void doExplosion(long aExplosionPower) {
|
2015-10-21 22:06:25 -04:00
|
|
|
float tStrength = aExplosionPower < V[0] ? 1.0F : aExplosionPower < V[1] ? 2.0F : aExplosionPower < V[2] ? 3.0F : aExplosionPower < V[3] ? 4.0F : aExplosionPower < V[4] ? 5.0F : aExplosionPower < V[4] * 2 ? 6.0F : aExplosionPower < V[5] ? 7.0F : aExplosionPower < V[6] ? 8.0F : aExplosionPower < V[7] ? 9.0F : 10.0F;
|
|
|
|
int tX = getBaseMetaTileEntity().getXCoord(), tY = getBaseMetaTileEntity().getYCoord(), tZ = getBaseMetaTileEntity().getZCoord();
|
|
|
|
World tWorld = getBaseMetaTileEntity().getWorld();
|
|
|
|
GT_Utility.sendSoundToPlayers(tWorld, GregTech_API.sSoundList.get(209), 1.0F, -1, tX, tY, tZ);
|
|
|
|
tWorld.setBlock(tX, tY, tZ, Blocks.air);
|
|
|
|
if (GregTech_API.sMachineExplosions)
|
|
|
|
tWorld.createExplosion(null, tX + 0.5, tY + 0.5, tZ + 0.5, tStrength, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getLightOpacity() {
|
|
|
|
return ((BaseMetaTileEntity) getBaseMetaTileEntity()).getLightValue() > 0 ? 0 : 255;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List<AxisAlignedBB> outputAABB, Entity collider) {
|
2015-04-23 18:14:22 +02:00
|
|
|
AxisAlignedBB axisalignedbb1 = getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ);
|
|
|
|
if (axisalignedbb1 != null && inputAABB.intersectsWith(axisalignedbb1)) outputAABB.add(axisalignedbb1);
|
2015-10-21 22:06:25 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) {
|
|
|
|
return AxisAlignedBB.getBoundingBox(aX, aY, aZ, aX + 1, aY + 1, aZ + 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity collider) {
|
|
|
|
//
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-04-23 18:14:22 +02:00
|
|
|
public void onCreated(ItemStack aStack, World aWorld, EntityPlayer aPlayer) {
|
2015-10-21 22:06:25 -04:00
|
|
|
//
|
|
|
|
}
|
2017-06-04 00:26:31 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean allowGeneralRedstoneOutput(){
|
|
|
|
return false;
|
|
|
|
}
|
2017-06-05 20:45:15 +02:00
|
|
|
|
|
|
|
public String trans(String aKey, String aEnglish){
|
|
|
|
return GT_LanguageManager.addStringLocalization("Interaction_DESCRIPTION_Index_"+aKey, aEnglish, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean hasAlternativeModeText(){
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getAlternativeModeText(){
|
|
|
|
return "";
|
|
|
|
}
|
2015-04-23 18:14:22 +02:00
|
|
|
}
|