diff options
Diffstat (limited to 'src/Java/miscutil/gregtech')
11 files changed, 723 insertions, 46 deletions
diff --git a/src/Java/miscutil/gregtech/enums/MaterialsNew.java b/src/Java/miscutil/gregtech/enums/MaterialsNew.java new file mode 100644 index 0000000000..ae3ed019cd --- /dev/null +++ b/src/Java/miscutil/gregtech/enums/MaterialsNew.java @@ -0,0 +1,44 @@ +package miscutil.gregtech.enums; + +import miscutil.core.util.reflection.EnumBuster; + + +public class MaterialsNew { + + EnumBuster EB = new EnumBuster(null, null); +/* + public static void getGregMaterials() throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, SecurityException{ + Utils.LOG_WARNING("Stepping through the process of Greg's materials."); + + Constructor<?> con = Materials.class.getDeclaredConstructors()[0]; + Utils.LOG_WARNING("Logging Value for Variable "+"Constructor"+":"+con.getName()); + java.lang.reflect.Method[] methods = con.getClass().getDeclaredMethods(); + Utils.LOG_WARNING("Logging Value for Variable "+"methods"+":"+methods.toString()); + for (java.lang.reflect.Method m1 : methods) { + Utils.LOG_WARNING("Logging Value for Variable "+"m1"+":"+m1.getName()+"| Accessible? "+m1.isAccessible()); + if (m1.getName().equals("acquireConstructorAccessor")) { + Utils.LOG_WARNING("Logging Value for Variable "+"m1"+":"+m1.getName()+"| Accessible? "+m1.isAccessible()); + m1.setAccessible(true); + Utils.LOG_WARNING("Logging Value for Variable "+"m1"+":"+m1.toGenericString()); + m1.invoke(con, new Object[0]);} + } + Field[] fields = con.getClass().getDeclaredFields(); + Utils.LOG_WARNING("Logging Value for Variable "+"fields"+":"+fields.toString()+"|"+fields.getClass()); + Object ca = null; + for (Field f : fields) { + Utils.LOG_WARNING("Logging Value for Variable "+"f"+":"+f.getName()+"|"+f.getModifiers()+"|"+f.isAccessible()); + if (f.getName().equals("constructorAccessor")) { + Utils.LOG_WARNING("Logging Value for Variable "+"f"+":"+f.isAccessible()); + f.setAccessible(true); + ca = f.get(con); + Utils.LOG_WARNING("Logging Value for Variable "+"ca"+":"+ca.toString()+"|"+ca.getClass()); + } + } + Method m = ca.getClass().getMethod( "newInstance", new Class[] { Object[].class }); + Utils.LOG_WARNING("Logging Value for Variable "+"m"+":"+m.getModifiers()+"|"+m.getName()+"|"+m.toGenericString()+"|"+m.isAccessible()); + m.setAccessible(true); + Materials v = (Materials) m.invoke(ca, new Object[] { new Object[] { "NEWMATERIAL", Integer.MAX_VALUE } }); + System.out.println(v.getClass() + ":" + v.name() + ":" + v.ordinal()); + +}*/ +} diff --git a/src/Java/miscutil/gregtech/gui/CONTAINER_SteamCondenser.java b/src/Java/miscutil/gregtech/gui/CONTAINER_SteamCondenser.java new file mode 100644 index 0000000000..c466839c9d --- /dev/null +++ b/src/Java/miscutil/gregtech/gui/CONTAINER_SteamCondenser.java @@ -0,0 +1,92 @@ +package miscutil.gregtech.gui; + +import gregtech.api.gui.GT_ContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; + +import java.util.Iterator; + +import miscutil.gregtech.metatileentity.implementations.base.GregtechMetaBoilerBase; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class CONTAINER_SteamCondenser extends GT_ContainerMetaTile_Machine +{ + public CONTAINER_SteamCondenser(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, int aSteamCapacity) + { + super(aInventoryPlayer, aTileEntity); + this.mSteamCapacity = aSteamCapacity; + } + + public void addSlots(InventoryPlayer aInventoryPlayer) + { + addSlotToContainer(new Slot(this.mTileEntity, 2, 116, 62)); + addSlotToContainer(new Slot(this.mTileEntity, 0, 44, 26)); + addSlotToContainer(new Slot(this.mTileEntity, 1, 44, 62)); + addSlotToContainer(new Slot(this.mTileEntity, 3, 116, 26)); + } + + public int getSlotCount() + { + return 4; + } + + public int getShiftClickSlotCount() + { + return 1; + } + + public int mWaterAmount = 0; + public int mSteamAmount = 0; + public int mProcessingEnergy = 0; + public int mTemperature = 2; + private final int mSteamCapacity; + public long mTickingTime = ((GregtechMetaBoilerBase)this.mTileEntity.getMetaTileEntity()).RI; + + public void detectAndSendChanges() + { + super.detectAndSendChanges(); + if ((this.mTileEntity.isClientSide()) || (this.mTileEntity.getMetaTileEntity() == null)) { + return; + } + this.mTemperature = ((GregtechMetaBoilerBase)this.mTileEntity.getMetaTileEntity()).mTemperature; + this.mProcessingEnergy = ((GregtechMetaBoilerBase)this.mTileEntity.getMetaTileEntity()).mProcessingEnergy; + this.mSteamAmount = (((GregtechMetaBoilerBase)this.mTileEntity.getMetaTileEntity()).mSteam == null ? 0 : ((GregtechMetaBoilerBase)this.mTileEntity.getMetaTileEntity()).mSteam.amount); + this.mWaterAmount = (((GregtechMetaBoilerBase)this.mTileEntity.getMetaTileEntity()).mFluid == null ? 0 : ((GregtechMetaBoilerBase)this.mTileEntity.getMetaTileEntity()).mFluid.amount); + this.mTickingTime = ((GregtechMetaBoilerBase)this.mTileEntity.getMetaTileEntity()).RI; + + this.mTemperature = Math.min(54, Math.max(0, this.mTemperature * 54 / (((GregtechMetaBoilerBase)this.mTileEntity.getMetaTileEntity()).maxProgresstime() - 10))); + this.mSteamAmount = Math.min(54, Math.max(0, this.mSteamAmount * 54 / (this.mSteamCapacity - 100))); + this.mWaterAmount = Math.min(54, Math.max(0, this.mWaterAmount * 54 / 15900)); + this.mProcessingEnergy = Math.min(14, Math.max(this.mProcessingEnergy > 0 ? 1 : 0, this.mProcessingEnergy * 14 / 1000)); + + Iterator var2 = this.crafters.iterator(); + while (var2.hasNext()) + { + ICrafting var1 = (ICrafting)var2.next(); + var1.sendProgressBarUpdate(this, 100, this.mTemperature); + var1.sendProgressBarUpdate(this, 101, this.mProcessingEnergy); + var1.sendProgressBarUpdate(this, 102, this.mSteamAmount); + var1.sendProgressBarUpdate(this, 103, this.mWaterAmount); + } + } + + @SideOnly(Side.CLIENT) + public void updateProgressBar(int par1, int par2) + { + super.updateProgressBar(par1, par2); + switch (par1) + { + case 100: + this.mTemperature = par2; break; + case 101: + this.mProcessingEnergy = par2; break; + case 102: + this.mSteamAmount = par2; break; + case 103: + this.mWaterAmount = par2; + } + } +}
\ No newline at end of file diff --git a/src/Java/miscutil/gregtech/gui/GUI_SteamCondenser.java b/src/Java/miscutil/gregtech/gui/GUI_SteamCondenser.java new file mode 100644 index 0000000000..f758e5c693 --- /dev/null +++ b/src/Java/miscutil/gregtech/gui/GUI_SteamCondenser.java @@ -0,0 +1,53 @@ +package miscutil.gregtech.gui; + +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import miscutil.core.lib.Strings; +import net.minecraft.entity.player.InventoryPlayer; + +public class GUI_SteamCondenser extends GT_GUIContainerMetaTile_Machine +{ + long tickTime = 0; + + public GUI_SteamCondenser(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aTextureName, int aSteamCapacity) + { + super(new CONTAINER_SteamCondenser(aInventoryPlayer, aTileEntity, aSteamCapacity), Strings.MODID + ":" + "textures/gui/" + aTextureName); + } + + protected void drawGuiContainerForegroundLayer(int par1, int par2) + { + this.fontRendererObj.drawString("Condenser", 8, 4, 4210752); + if (!Strings.DEBUG){ + tickTime = ((CONTAINER_SteamCondenser)this.mContainer).mTickingTime; + this.fontRendererObj.drawString("Tick Time: "+tickTime, 8, 12, 4210752); + } + } + + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) + { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + int x = (this.width - this.xSize) / 2; + int y = (this.height - this.ySize) / 2; + drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); + if (this.mContainer != null) + { + + int tScale = ((CONTAINER_SteamCondenser)this.mContainer).mSteamAmount; + if (tScale > 0) { + drawTexturedModalRect(x + 70, y + 25 + 54 - tScale, 194, 54 - tScale, 10, tScale); + } + tScale = ((CONTAINER_SteamCondenser)this.mContainer).mWaterAmount; + if (tScale > 0) { + drawTexturedModalRect(x + 83, y + 25 + 54 - tScale, 204, 54 - tScale, 10, tScale); + } + tScale = ((CONTAINER_SteamCondenser)this.mContainer).mTemperature; + if (tScale > 0) { + drawTexturedModalRect(x + 96, y + 25 + 54 - tScale, 214, 54 - tScale, 10, tScale); + } + tScale = ((CONTAINER_SteamCondenser)this.mContainer).mProcessingEnergy; + if (tScale > 0) { + drawTexturedModalRect(x + 115, y + 44 + 2/* - tScale*/, 177, 14 - tScale, 15, 1+tScale); + } + } + } +}
\ No newline at end of file diff --git a/src/Java/miscutil/gregtech/init/machines/GregtechCobbleGenerator.java b/src/Java/miscutil/gregtech/init/machines/GregtechCobbleGenerator.java index 79e70e0625..306f4f45f1 100644 --- a/src/Java/miscutil/gregtech/init/machines/GregtechCobbleGenerator.java +++ b/src/Java/miscutil/gregtech/init/machines/GregtechCobbleGenerator.java @@ -6,7 +6,7 @@ import gregtech.api.enums.OreDictNames; import gregtech.api.enums.OrePrefixes; import gregtech.api.util.GT_ModHandler; import miscutil.gregtech.enums.GregtechItemList; -import miscutil.gregtech.metatileentity.implementations.GregtechSteelBoiler; +import miscutil.gregtech.metatileentity.implementations.base.GregtechSteelBoiler; import cpw.mods.fml.common.FMLLog; public class GregtechCobbleGenerator diff --git a/src/Java/miscutil/gregtech/init/machines/GregtechSteamCondenser.java b/src/Java/miscutil/gregtech/init/machines/GregtechSteamCondenser.java new file mode 100644 index 0000000000..767321de7b --- /dev/null +++ b/src/Java/miscutil/gregtech/init/machines/GregtechSteamCondenser.java @@ -0,0 +1,36 @@ +package miscutil.gregtech.init.machines; + +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GT_ModHandler; +import miscutil.core.util.Utils; +import miscutil.gregtech.enums.GregtechItemList; +import miscutil.gregtech.metatileentity.implementations.GregtechMetaCondensor; + +public class GregtechSteamCondenser +{ + + + + public static void run() + { + if (miscutil.core.lib.LoadedMods.Gregtech){ + Utils.LOG_INFO("MiscUtils: Gregtech5u Content | Registering Steam Condensor."); + run1(); + } + + } + + private static void run1() + { + //Steam Condensors + GregtechItemList.Condensor_MAX.set(new GregtechMetaCondensor(780, "steamcondensor.01.tier.single", "Steam Condensor").getStackForm(1L)); + GT_ModHandler.addCraftingRecipe(GregtechItemList.Condensor_MAX.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "WTW", "WMW", Character.valueOf('M'), ItemList.Hull_HV, Character.valueOf('W'),OrePrefixes.wireGt04.get(Materials.Nickel),Character.valueOf('T'), ItemList.Pump_MV }); + /*Steam Condensors + GregtechItemList.Condensor_MAX.set(new GregtechMetaCondensorII(780, "steamcondensor.01.tier.single", "Steam CondensorII").getStackForm(1L)); + GT_ModHandler.addCraftingRecipe(GregtechItemList.Condensor_MAX.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "WTW", "WMW", Character.valueOf('M'), ItemList.Hull_HV, Character.valueOf('W'),OrePrefixes.wireGt04.get(Materials.Nickel),Character.valueOf('T'), ItemList.Pump_MV }); + */ + + } +} diff --git a/src/Java/miscutil/gregtech/metatileentity/implementations/GregtechMetaCondensor.java b/src/Java/miscutil/gregtech/metatileentity/implementations/GregtechMetaCondensor.java new file mode 100644 index 0000000000..9a0baf38f6 --- /dev/null +++ b/src/Java/miscutil/gregtech/metatileentity/implementations/GregtechMetaCondensor.java @@ -0,0 +1,164 @@ +package miscutil.gregtech.metatileentity.implementations; + +import gregtech.api.enums.Dyes; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_ModHandler; +import miscutil.core.util.Utils; +import miscutil.gregtech.gui.CONTAINER_SteamCondenser; +import miscutil.gregtech.gui.GUI_SteamCondenser; +import miscutil.gregtech.metatileentity.implementations.base.GregtechMetaBoilerBase; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.IFluidHandler; + +public class GregtechMetaCondensor extends GregtechMetaBoilerBase{ + + public GregtechMetaCondensor(int aID, String aName, String aNameRegional) + { + super(aID, aName, aNameRegional, "A Steam condenser - [IC2->Steam]", new ITexture[0]); + } + + public GregtechMetaCondensor(String aName, int aTier, String aDescription, ITexture[][][] aTextures) + { + super(aName, aTier, aDescription, aTextures); + } + + @Override + public String[] getDescription() { + return new String[] {mDescription, "Added by: " + EnumChatFormatting.DARK_GREEN+"Alkalus"}; + } + + public ITexture[][][] getTextureSet(ITexture[] aTextures) + { + ITexture[][][] rTextures = new ITexture[5][17][]; + for (byte i = -1; i < 16; i++){ + rTextures[0][(i + 1)] = new ITexture [] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_VENT, Dyes.getModulation(i, Dyes.MACHINE_METAL.mRGBa))}; + rTextures[1][(i + 1)] = new ITexture [] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_VENT, Dyes.getModulation(i, Dyes.MACHINE_METAL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE) }; + rTextures[2][(i + 1)] = new ITexture [] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_VENT, Dyes.getModulation(i, Dyes.MACHINE_METAL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE) }; + rTextures[3][(i + 1)] = new ITexture [] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_VENT, Dyes.getModulation(i, Dyes.MACHINE_METAL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_MASSFAB) }; + rTextures[4][(i + 1)] = new ITexture [] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_VENT, Dyes.getModulation(i, Dyes.MACHINE_METAL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_MASSFAB_ACTIVE) }; + } + return rTextures; + } + + public int maxProgresstime() + { + return 1000; + } + + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) + { + return new CONTAINER_SteamCondenser(aPlayerInventory, aBaseMetaTileEntity, 32000); + } + + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) + { + return new GUI_SteamCondenser(aPlayerInventory, aBaseMetaTileEntity, "SteelBoiler.png", 32000); + } + + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) + { + return new GregtechMetaCondensor(this.mName, this.mTier, this.mDescription, this.mTextures); + } + + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) + { + this.RI = Utils.randLong(5L, 30L); + if ((aBaseMetaTileEntity.isServerSide()) && (aTick > 20L)) + { + if (this.mTemperature <= 5) + { + this.mTemperature = 5; + this.mLossTimer = 0; + } + if (++this.mLossTimer > 10) + { + this.mTemperature -= 1; + this.mLossTimer = 0; + } + for (byte i = 1; (this.mSteam != null) && (i < 6); i = (byte)(i + 1)) { + if (i != aBaseMetaTileEntity.getFrontFacing()) + { + IFluidHandler tTileEntity = aBaseMetaTileEntity.getITankContainerAtSide(i); + if (tTileEntity != null) + { + FluidStack tDrained = aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), Math.max(1, this.mSteam.amount / 2), false); + if (tDrained != null) + { + int tFilledAmount = tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), tDrained, false); + if (tFilledAmount > 0) { + tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), tFilledAmount, true), true); + } + } + } + } + } + if (aTick % 10L == 0L) { + if (this.mTemperature > 5) + { + if ((this.mFluid == null) || (!GT_ModHandler.isWater(this.mFluid)) || (this.mFluid.amount <= 0)) + { + this.mHadNoWater = true; + } + else + { + if (this.mHadNoWater) + { + aBaseMetaTileEntity.doExplosion(2048L); + return; + } + this.mFluid.amount -= 1; + if (this.mSteam == null) { + this.mSteam = GT_ModHandler.getSteam(30L); + } else if (GT_ModHandler.isSteam(this.mSteam)) { + this.mSteam.amount += 30; + } else { + this.mSteam = GT_ModHandler.getSteam(30L); + } + } + } + else { + this.mHadNoWater = false; + } + } + if ((this.mSteam != null) && + (this.mSteam.amount > 32000)) + { + sendSound((byte)1); + this.mSteam.amount = 24000; + } + /*if ((this.mProcessingEnergy <= 0) && (aBaseMetaTileEntity.isAllowedToWork()) && + (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.bucket.get(IC2.getItemFromBlock(p_150898_0_))))) + { + this.mProcessingEnergy += 1000; + aBaseMetaTileEntity.decrStackSize(2, 1); + aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.bucket, Materials.Empty, 1L)); + }*/ + if ((this.mTemperature < 1000) && (this.mProcessingEnergy > 0) && (aTick % RI == 0L)) + { + this.mProcessingEnergy -= 40; + this.mTemperature += 2; + } + aBaseMetaTileEntity.setActive(this.mProcessingEnergy > 0); + } + } + + public final int fill(FluidStack aFluid, boolean doFill) + { + if ((Utils.isIC2Steam(aFluid)) && (this.mProcessingEnergy < 50)) + { + int tFilledAmount = Math.min(50, aFluid.amount); + if (doFill) { + this.mProcessingEnergy += tFilledAmount; + } + return tFilledAmount; + } + return super.fill(aFluid, doFill); + } +} diff --git a/src/Java/miscutil/gregtech/metatileentity/implementations/GregtechMetaEnergyBuffer.java b/src/Java/miscutil/gregtech/metatileentity/implementations/GregtechMetaEnergyBuffer.java index 7f70b7bff6..7d6a8b61bd 100644 --- a/src/Java/miscutil/gregtech/metatileentity/implementations/GregtechMetaEnergyBuffer.java +++ b/src/Java/miscutil/gregtech/metatileentity/implementations/GregtechMetaEnergyBuffer.java @@ -24,6 +24,7 @@ import java.util.List; import miscutil.core.handler.GuiHandler; import miscutil.core.util.Utils; import miscutil.core.waila.IWailaInfoProvider; +import miscutil.gregtech.metatileentity.implementations.base.GregtechMetaTileEntity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; diff --git a/src/Java/miscutil/gregtech/metatileentity/implementations/base/GregtechMetaBoilerBase.java b/src/Java/miscutil/gregtech/metatileentity/implementations/base/GregtechMetaBoilerBase.java new file mode 100644 index 0000000000..553740d28a --- /dev/null +++ b/src/Java/miscutil/gregtech/metatileentity/implementations/base/GregtechMetaBoilerBase.java @@ -0,0 +1,328 @@ +package miscutil.gregtech.metatileentity.implementations.base; + +import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; +import gregtech.api.objects.GT_ItemStack; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Utility; +import miscutil.core.util.Utils; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.IFluidHandler; + +public abstract class GregtechMetaBoilerBase extends GT_MetaTileEntity_BasicTank +{ + public int mTemperature = 20; + public int mProcessingEnergy = 0; + public int mLossTimer = 0; + public FluidStack mSteam = null; + public boolean mHadNoWater = false; + public long RI = Utils.randLong(5L, 30L); + + public GregtechMetaBoilerBase(int aID, String aName, String aNameRegional, String aDescription, ITexture... aTextures) + { + super(aID, aName, aNameRegional, 0, 4, aDescription, aTextures); + } + + public GregtechMetaBoilerBase(String aName, int aTier, String aDescription, ITexture[][][] aTextures) + { + super(aName, aTier, 4, aDescription, aTextures); + } + + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) + { + ITexture[] tmp = mTextures[aSide >= 2 ? aSide != aFacing ? 2 : ((byte)(aActive ? 4 : 3)) : aSide][aColorIndex + 1]; + //mTextures[(aSide==aFacing?(aActive?4:3):aSide==GT_Utility.getOppositeSide(aFacing)?2:aSide==0?0:aSide==1?1:2)][aColorIndex+1]; + if(aSide!=aFacing&&tmp.length==2){ + tmp = new ITexture[]{tmp[0]}; + } + return tmp; + } + + public boolean isElectric() + { + return false; + } + + public boolean isPneumatic() + { + return false; + } + + public boolean isSteampowered() + { + return false; + } + + public boolean isSimpleMachine() + { + return false; + } + + public boolean isFacingValid(byte aFacing) + { + return aFacing > 1; + } + + public boolean isAccessAllowed(EntityPlayer aPlayer) + { + return true; + } + + public boolean isValidSlot(int aIndex) + { + return true; + } + + public int getProgresstime() + { + return this.mTemperature; + } + + public int maxProgresstime() + { + return 500; + } + + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) + { + if (aBaseMetaTileEntity.isClientSide()) { + return true; + } + if (aPlayer != null) { + if (GT_Utility.areStacksEqual(aPlayer.getCurrentEquippedItem(), new ItemStack(Items.water_bucket, 1))) + { + fill(Materials.Water.getFluid(1000 * aPlayer.getCurrentEquippedItem().stackSize), true); + aPlayer.getCurrentEquippedItem().func_150996_a(Items.bucket); + } + else + { + aBaseMetaTileEntity.openGUI(aPlayer); + } + } + return true; + } + + public boolean doesFillContainers() + { + return true; + } + + public boolean doesEmptyContainers() + { + return true; + } + + public boolean canTankBeFilled() + { + return true; + } + + public boolean canTankBeEmptied() + { + return true; + } + + public boolean displaysItemStack() + { + return false; + } + + public boolean displaysStackSize() + { + return false; + } + + public boolean isFluidInputAllowed(FluidStack aFluid) + { + return GT_ModHandler.isWater(aFluid); + } + + public FluidStack getDrainableStack() + { + return this.mSteam; + } + + public FluidStack setDrainableStack(FluidStack aFluid) + { + this.mSteam = aFluid;return this.mSteam; + } + + public boolean allowCoverOnSide(byte aSide, GT_ItemStack aCover) + { + return GregTech_API.getCoverBehavior(aCover.toStack()).isSimpleCover(); + } + + public void saveNBTData(NBTTagCompound aNBT) + { + super.saveNBTData(aNBT); + aNBT.setInteger("mLossTimer", this.mLossTimer); + aNBT.setInteger("mTemperature", this.mTemperature); + aNBT.setInteger("mProcessingEnergy", this.mProcessingEnergy); + if (this.mSteam != null) { + try + { + aNBT.setTag("mSteam", this.mSteam.writeToNBT(new NBTTagCompound())); + } + catch (Throwable e) {} + } + } + + public void loadNBTData(NBTTagCompound aNBT) + { + super.loadNBTData(aNBT); + this.mLossTimer = aNBT.getInteger("mLossTimer"); + this.mTemperature = aNBT.getInteger("mTemperature"); + this.mProcessingEnergy = aNBT.getInteger("mProcessingEnergy"); + this.mSteam = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mSteam")); + } + + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) + { + if ((aBaseMetaTileEntity.isServerSide()) && (aTick > 20L)) + { + if (this.mTemperature <= 20) + { + this.mTemperature = 20; + this.mLossTimer = 0; + } + if (++this.mLossTimer > 40) + { + this.mTemperature -= 1; + this.mLossTimer = 0; + } + for (byte i = 1; (this.mSteam != null) && (i < 6); i = (byte)(i + 1)) { + if (i != aBaseMetaTileEntity.getFrontFacing()) + { + IFluidHandler tTileEntity = aBaseMetaTileEntity.getITankContainerAtSide(i); + if (tTileEntity != null) + { + FluidStack tDrained = aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), Math.max(1, this.mSteam.amount / 2), false); + if (tDrained != null) + { + int tFilledAmount = tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), tDrained, false); + if (tFilledAmount > 0) { + tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), tFilledAmount, true), true); + } + } + } + } + } + if (aTick % 10L == 0L) { + if (this.mTemperature > 100) + { + if ((this.mFluid == null) || (!GT_ModHandler.isWater(this.mFluid)) || (this.mFluid.amount <= 0)) + { + this.mHadNoWater = true; + } + else + { + if (this.mHadNoWater) + { + aBaseMetaTileEntity.doExplosion(2048L); + return; + } + this.mFluid.amount -= 1; + if (this.mSteam == null) { + this.mSteam = GT_ModHandler.getSteam(150L); + } else if (GT_ModHandler.isSteam(this.mSteam)) { + this.mSteam.amount += 150; + } else { + this.mSteam = GT_ModHandler.getSteam(150L); + } + } + } + else { + this.mHadNoWater = false; + } + } + if ((this.mSteam != null) && + (this.mSteam.amount > 32000)) + { + sendSound((byte)1); + this.mSteam.amount = 24000; + } + if ((this.mProcessingEnergy <= 0) && (aBaseMetaTileEntity.isAllowedToWork()) && + (this.mInventory[2] != null)) { + if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.gem.get(Materials.Coal))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.dust.get(Materials.Coal))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.dustImpure.get(Materials.Coal))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.crushed.get(Materials.Coal)))) + { + this.mProcessingEnergy += 160; + aBaseMetaTileEntity.decrStackSize(2, 1); + if (aBaseMetaTileEntity.getRandomNumber(3) == 0) { + aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 1L)); + } + } + else if (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.gem.get(Materials.Charcoal))) + { + this.mProcessingEnergy += 160; + aBaseMetaTileEntity.decrStackSize(2, 1); + if (aBaseMetaTileEntity.getRandomNumber(3) == 0) { + aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Ash, 1L)); + } + } + else if (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], "fuelCoke")) + { + this.mProcessingEnergy += 640; + aBaseMetaTileEntity.decrStackSize(2, 1); + if (aBaseMetaTileEntity.getRandomNumber(2) == 0) { + aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Ash, 1L)); + } + } + else if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.gem.get(Materials.Lignite))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.dust.get(Materials.Lignite))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.dustImpure.get(Materials.Lignite))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.crushed.get(Materials.Lignite)))) + { + this.mProcessingEnergy += 40; + aBaseMetaTileEntity.decrStackSize(2, 1); + if (aBaseMetaTileEntity.getRandomNumber(8) == 0) { + aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 1L)); + } + } + } + if ((this.mTemperature < 1000) && (this.mProcessingEnergy > 0) && (aTick % 12L == 0L)) + { + this.mProcessingEnergy -= 2; + this.mTemperature += 1; + } + aBaseMetaTileEntity.setActive(this.mProcessingEnergy > 0); + } + } + + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) + { + return (aIndex == 1) || (aIndex == 3); + } + + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) + { + return aIndex == 2; + } + + public void doSound(byte aIndex, double aX, double aY, double aZ) + { + if (aIndex == 1) + { + GT_Utility.doSoundAtClient((String)GregTech_API.sSoundList.get(Integer.valueOf(4)), 2, 1.0F, aX, aY, aZ); + for (int l = 0; l < 8; l++) { + getBaseMetaTileEntity().getWorld().spawnParticle("largesmoke", aX - 0.5D + Math.random(), aY, aZ - 0.5D + Math.random(), 0.0D, 0.0D, 0.0D); + } + } + } + + public int getCapacity() + { + return 16000; + } + + public int getTankPressure() + { + return 100; + } +} diff --git a/src/Java/miscutil/gregtech/metatileentity/implementations/GregtechMetaTileEntity.java b/src/Java/miscutil/gregtech/metatileentity/implementations/base/GregtechMetaTileEntity.java index 669786c423..bc3d2f4967 100644 --- a/src/Java/miscutil/gregtech/metatileentity/implementations/GregtechMetaTileEntity.java +++ b/src/Java/miscutil/gregtech/metatileentity/implementations/base/GregtechMetaTileEntity.java @@ -1,8 +1,9 @@ -package miscutil.gregtech.metatileentity.implementations; +package miscutil.gregtech.metatileentity.implementations.base; import static gregtech.api.enums.GT_Values.GT; import gregtech.api.interfaces.ITexture; import gregtech.api.metatileentity.MetaTileEntity; +import net.minecraft.util.EnumChatFormatting; public abstract class GregtechMetaTileEntity extends MetaTileEntity { /** @@ -54,7 +55,7 @@ public abstract class GregtechMetaTileEntity extends MetaTileEntity { @Override public String[] getDescription() { - return new String[] {mDescription}; + return new String[] {mDescription, "Added by: " + EnumChatFormatting.DARK_GREEN+"Alkalus"}; } /** diff --git a/src/Java/miscutil/gregtech/metatileentity/implementations/GregtechSteelBoiler.java b/src/Java/miscutil/gregtech/metatileentity/implementations/base/GregtechSteelBoiler.java index 45b6fa5f86..511cb0e8df 100644 --- a/src/Java/miscutil/gregtech/metatileentity/implementations/GregtechSteelBoiler.java +++ b/src/Java/miscutil/gregtech/metatileentity/implementations/base/GregtechSteelBoiler.java @@ -1,4 +1,4 @@ -package miscutil.gregtech.metatileentity.implementations; +package miscutil.gregtech.metatileentity.implementations.base; import gregtech.api.enums.Dyes; import gregtech.api.enums.Materials; diff --git a/src/Java/miscutil/gregtech/objects/GregMaterialStack.java b/src/Java/miscutil/gregtech/objects/GregMaterialStack.java deleted file mode 100644 index 2be3341ad9..0000000000 --- a/src/Java/miscutil/gregtech/objects/GregMaterialStack.java +++ /dev/null @@ -1,42 +0,0 @@ -package miscutil.gregtech.objects; - -import miscutil.gregtech.enums.Materials2; - - -public class GregMaterialStack implements Cloneable { - public long mAmount; - public Materials2 mMaterial; - - public GregMaterialStack(Materials2 nitrogen, long aAmount) { - mMaterial = nitrogen==null?Materials2._NULL:nitrogen; - mAmount = aAmount; - } - - public GregMaterialStack copy(long aAmount) { - return new GregMaterialStack(mMaterial, aAmount); - } - - @Override - public GregMaterialStack clone() { - return new GregMaterialStack(mMaterial, mAmount); - } - - @Override - public boolean equals(Object aObject) { - if (aObject == this) return true; - if (aObject == null) return false; - if (aObject instanceof Materials2) return aObject == mMaterial; - if (aObject instanceof GregMaterialStack) return ((GregMaterialStack)aObject).mMaterial == mMaterial && (mAmount < 0 || ((GregMaterialStack)aObject).mAmount < 0 || ((GregMaterialStack)aObject).mAmount == mAmount); - return false; - } - - @Override - public String toString() { - return (mMaterial.mMaterialList.size() > 1 && mAmount > 1 ? "(" : "") + mMaterial.getToolTip(true) + (mMaterial.mMaterialList.size() > 1 && mAmount > 1 ? ")" : "") + (mAmount > 1 ? mAmount : ""); - } - - @Override - public int hashCode() { - return mMaterial.hashCode(); - } -}
\ No newline at end of file |