mirror of
https://github.com/GTNewHorizons/Electro-Magic-Tools.git
synced 2026-11-21 12:32:12 +00:00
+updated Single Block Solars and Single Block Essentia Gen to use @mitchej123 fix +added Large Essentia Gen support Blocks +added Super Nice Textures thanks to @LogicFalls +added Essentia Hatch +added Essentia Filler to support the Essentia Hatch
177 lines
5.5 KiB
Java
177 lines
5.5 KiB
Java
package emt.gthandler.common.implementations;
|
|
|
|
import gregtech.api.enums.GT_Values;
|
|
import gregtech.api.gui.GT_Container;
|
|
import gregtech.api.gui.GT_GUIContainer;
|
|
import gregtech.api.interfaces.ITexture;
|
|
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
|
|
import gregtech.api.metatileentity.MetaTileEntity;
|
|
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input;
|
|
import gregtech.api.util.GT_Utility;
|
|
import net.minecraft.entity.player.InventoryPlayer;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.nbt.NBTTagCompound;
|
|
import net.minecraft.nbt.NBTTagList;
|
|
import net.minecraftforge.fluids.FluidStack;
|
|
import thaumcraft.api.aspects.Aspect;
|
|
import thaumcraft.api.aspects.AspectList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
public class EssentiaHatch extends GT_MetaTileEntity_Hatch_Input {
|
|
|
|
private AspectList current = new AspectList();
|
|
private static int ApTe = (int) Math.ceil(Aspect.aspects.size()/GT_Values.V.length);
|
|
|
|
public boolean addAspectList(final AspectList A){
|
|
|
|
if ((this.mTier+1)*ApTe > A.size()+current.size()){
|
|
if (current.visSize() + A.visSize() < (this.mTier+1)*ApTe*64)
|
|
current.add(A);
|
|
return true;
|
|
}else
|
|
return false;
|
|
|
|
}
|
|
|
|
public EssentiaHatch(int aID, String aName, String aNameRegional, int aTier) {
|
|
super(aID, aName, aNameRegional, aTier);
|
|
}
|
|
|
|
public EssentiaHatch(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
|
|
super(aName, aTier, aDescription, aTextures);
|
|
}
|
|
|
|
public EssentiaHatch(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) {
|
|
super(aName, aTier, aDescription, aTextures);
|
|
}
|
|
|
|
public void setCurrent(AspectList List){
|
|
this.current = List;
|
|
}
|
|
|
|
public AspectList getAspects() {
|
|
return current;
|
|
}
|
|
|
|
public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
|
|
return new EssentiaHatch("Essentia Hatch "+ GT_Values.VN[this.mTier],this.mTier,this.getDescription(),this.mTextures);
|
|
}
|
|
|
|
|
|
@Override
|
|
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
|
|
//TODO: new GUI.
|
|
return null;
|
|
}
|
|
|
|
@Override
|
|
public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
|
|
//TODO: new contanier GUI.
|
|
return null;
|
|
}
|
|
|
|
@Override
|
|
public String[] getInfoData() {
|
|
ArrayList<String> list = new ArrayList<String>();
|
|
list.add("This Essentia-Hatch contains:");
|
|
for (final Aspect A : this.current.aspects.keySet())
|
|
list.add(A.getName()+": "+Integer.toString(current.getAmount(A)));
|
|
|
|
String[] ret = new String[list.size()];
|
|
for (int i = 0; i < list.size(); i++) {
|
|
ret[i]=list.get(i);
|
|
}
|
|
|
|
return ret;
|
|
|
|
/*String[] old = super.getInfoData();
|
|
if (old.length!=0) {
|
|
String[] newDescription = new String[old.length + 1];
|
|
for (int i = 0; i < old.length; i++) {
|
|
newDescription[i] = old[i];
|
|
}
|
|
newDescription[old.length] = "This Contains: " + current.size() + " different Aspects";
|
|
return newDescription;
|
|
}else
|
|
return new String[]{"This Contains: " + current.size() + " different Aspects"};*/
|
|
}
|
|
|
|
@Override
|
|
public String[] getDescription(){ //this is the fucking tooltip -_-'
|
|
return new String[] {
|
|
"Essentia Hatch for usage in Multiblocks",
|
|
"Can only be filled with the Essentia Filler",
|
|
"Can hold "+Integer.toString((ApTe*(mTier+1)))+" Different Essentia Types",
|
|
"Can hold "+Integer.toString((64*ApTe*(mTier+1)))+" Essentia in total"
|
|
};
|
|
}
|
|
|
|
@Override
|
|
public boolean isGivingInformation() {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public void saveNBTData(NBTTagCompound var1){
|
|
|
|
NBTTagList tlist = new NBTTagList();
|
|
var1.setTag("Aspects", tlist);
|
|
Aspect[] aspectA = current.getAspects();
|
|
|
|
for(int i = 0; i < aspectA.length; ++i) {
|
|
Aspect aspect = aspectA[i];
|
|
if (aspect != null) {
|
|
NBTTagCompound f = new NBTTagCompound();
|
|
f.setString("key", aspect.getTag());
|
|
f.setInteger("amount", current.getAmount(aspect));
|
|
tlist.appendTag(f);
|
|
}
|
|
}
|
|
|
|
super.saveNBTData(var1);
|
|
}
|
|
|
|
@Override
|
|
public void loadNBTData(NBTTagCompound var1){
|
|
current = new AspectList();
|
|
NBTTagList tlist = var1.getTagList("Aspects", 10);
|
|
|
|
for(int j = 0; j < tlist.tagCount(); ++j) {
|
|
NBTTagCompound rs = tlist.getCompoundTagAt(j);
|
|
if (rs.hasKey("key")) {
|
|
current.add(Aspect.getAspect(rs.getString("key")), rs.getInteger("amount"));
|
|
}
|
|
}
|
|
|
|
super.loadNBTData(var1);
|
|
}
|
|
|
|
public int fuelleft() {
|
|
int ret = 0;
|
|
for (final Aspect A : current.aspects.keySet()){
|
|
ret += current.getAmount(A);
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
|
|
public boolean isFluidInputAllowed(FluidStack aFluid) {
|
|
return false;
|
|
}
|
|
|
|
public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
|
|
return false;
|
|
}
|
|
|
|
public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
|
|
return false;
|
|
}
|
|
|
|
public int getCapacity() {
|
|
return 0;
|
|
}
|
|
|
|
}
|