diff options
45 files changed, 6197 insertions, 427 deletions
diff --git a/src/Java/gtPlusPlus/core/block/ModBlocks.java b/src/Java/gtPlusPlus/core/block/ModBlocks.java index eb40fd080e..dc1239f4be 100644 --- a/src/Java/gtPlusPlus/core/block/ModBlocks.java +++ b/src/Java/gtPlusPlus/core/block/ModBlocks.java @@ -3,6 +3,7 @@ package gtPlusPlus.core.block; import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.block.Block; +import net.minecraft.block.BlockJukebox; import net.minecraft.block.material.Material; import gtPlusPlus.api.objects.Logger; @@ -73,8 +74,10 @@ public final class ModBlocks { public static Block blockPlayerDoorCustom_Glass; public static Block blockPlayerDoorCustom_Ice; public static Block blockPlayerDoorCustom_Cactus; - + public static Block blockCustomMobSpawner; + public static Block blockCustomSuperLight; + public static Block blockCustomJukebox; public static void init() { Logger.INFO("Initializing Blocks."); @@ -86,7 +89,7 @@ public final class ModBlocks { public static void registerBlocks(){ Logger.INFO("Registering Blocks."); - GameRegistry.registerBlock(MatterFabricatorEffectBlock = new LightGlass(Material.glass, false).setHardness(0.1F).setBlockTextureName(CORE.MODID + ":" + "blockMFEffect").setStepSound(Block.soundTypeGlass), "blockMFEffect"); + MatterFabricatorEffectBlock = new LightGlass(false); //Fluids FluidRegistryHandler.registerFluids(); @@ -121,6 +124,9 @@ public final class ModBlocks { blockPlayerDoorCustom_Glass = new PlayerDoors(Material.glass, "door_glass", false); blockPlayerDoorCustom_Ice = new PlayerDoors(Material.ice, "door_ice", false); blockPlayerDoorCustom_Cactus = new PlayerDoors(Material.cactus, "door_cactus", false, 0.6f, Block.soundTypeGrass, "Cactus"); + + blockCustomSuperLight = new BlockSuperLight(); + blockCustomJukebox = new Machine_SuperJukebox(); } diff --git a/src/Java/gtPlusPlus/core/block/general/FluidTankInfinite.java b/src/Java/gtPlusPlus/core/block/general/FluidTankInfinite.java index bbec95a28e..b979f7864b 100644 --- a/src/Java/gtPlusPlus/core/block/general/FluidTankInfinite.java +++ b/src/Java/gtPlusPlus/core/block/general/FluidTankInfinite.java @@ -4,7 +4,10 @@ import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; - +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.tileentities.general.TileEntityInfiniteFluid; +import gtPlusPlus.core.util.minecraft.PlayerUtils; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -14,12 +17,10 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; - -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.tileentities.general.TileEntityInfiniteFluid; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import net.minecraftforge.fluids.*; +import net.minecraftforge.fluids.FluidContainerRegistry; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.IFluidContainerItem; +import net.minecraftforge.fluids.ItemFluidContainer; public class FluidTankInfinite extends BlockContainer { @@ -68,69 +69,68 @@ public class FluidTankInfinite extends BlockContainer { final int side, final float lx, final float ly, final float lz) { if (world.isRemote) { return true; - } - else { + } else { TileEntityInfiniteFluid tank = (TileEntityInfiniteFluid) world.getTileEntity(x, y, z); - if (tank != null){ + if (tank != null) { Item handItem; try { handItem = player.getHeldItem().getItem(); - } - catch (Throwable t){ + } catch (Throwable t) { handItem = null; } - if (handItem != null && (handItem instanceof IFluidContainerItem || handItem instanceof ItemFluidContainer || FluidContainerRegistry.isFilledContainer(player.getHeldItem()))){ - if (tank.tank.getFluid() == null){ - try { - if (!FluidContainerRegistry.isFilledContainer(player.getHeldItem())){ - ItemStack handItemStack = player.getHeldItem(); - IFluidContainerItem container = (IFluidContainerItem) handItem; - FluidStack containerFluid = container.getFluid(handItemStack); - container.drain(handItemStack, container.getFluid(handItemStack).amount, true); - tank.tank.setFluid(containerFluid); - } - else { - ItemStack handItemStack = player.getHeldItem(); - FluidContainerRegistry.drainFluidContainer(handItemStack); - FluidStack containerFluid = FluidContainerRegistry.getFluidForFilledItem(handItemStack); - ItemStack emptyContainer = FluidContainerRegistry.drainFluidContainer(handItemStack); - player.setItemInUse(emptyContainer, 0); - - tank.tank.setFluid(containerFluid); + if (handItem != null + && (handItem instanceof IFluidContainerItem || handItem instanceof ItemFluidContainer + || FluidContainerRegistry.isFilledContainer(player.getHeldItem()))) { + if (tank.tank.getFluid() == null) { + try { + if (!FluidContainerRegistry.isFilledContainer(player.getHeldItem())) { + ItemStack handItemStack = player.getHeldItem(); + IFluidContainerItem container = (IFluidContainerItem) handItem; + FluidStack containerFluid = container.getFluid(handItemStack); + container.drain(handItemStack, container.getFluid(handItemStack).amount, true); + tank.tank.setFluid(containerFluid); + } else { + ItemStack handItemStack = player.getHeldItem(); + FluidContainerRegistry.drainFluidContainer(handItemStack); + FluidStack containerFluid = FluidContainerRegistry.getFluidForFilledItem(handItemStack); + ItemStack emptyContainer = FluidContainerRegistry.drainFluidContainer(handItemStack); + player.setItemInUse(emptyContainer, 0); + + tank.tank.setFluid(containerFluid); + } + } catch (Throwable t) { + t.printStackTrace(); } } - catch (Throwable t){ - t.printStackTrace(); - } + + } + if (tank.tank.getFluid() != null) { + PlayerUtils.messagePlayer(player, "This tank contains " + tank.tank.getFluidAmount() + "L of " + + tank.tank.getFluid().getLocalizedName()); } - - } - if (tank.tank.getFluid() != null){ - PlayerUtils.messagePlayer(player, "This tank contains "+tank.tank.getFluidAmount()+"L of "+tank.tank.getFluid().getLocalizedName()); } } + return true; } - return true; -} -@Override -public int getRenderBlockPass() { - return 1; -} + @Override + public int getRenderBlockPass() { + return 1; + } -@Override -public boolean isOpaqueCube() { - return false; -} + @Override + public boolean isOpaqueCube() { + return false; + } -@Override -public TileEntity createNewTileEntity(final World world, final int p_149915_2_) { - return new TileEntityInfiniteFluid(); -} + @Override + public TileEntity createNewTileEntity(final World world, final int p_149915_2_) { + return new TileEntityInfiniteFluid(); + } -@Override -public void onBlockAdded(World world, int x, int y, int z) { - super.onBlockAdded(world, x, y, z); -} + @Override + public void onBlockAdded(World world, int x, int y, int z) { + super.onBlockAdded(world, x, y, z); + } } diff --git a/src/Java/gtPlusPlus/core/block/general/LightGlass.java b/src/Java/gtPlusPlus/core/block/general/LightGlass.java index 5a265ed7ef..30da7f1d56 100644 --- a/src/Java/gtPlusPlus/core/block/general/LightGlass.java +++ b/src/Java/gtPlusPlus/core/block/general/LightGlass.java @@ -2,37 +2,46 @@ package gtPlusPlus.core.block.general; import java.util.Random; +import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.block.BlockBreakable; -import net.minecraft.block.material.Material; +import net.minecraft.block.Block; +import net.minecraft.block.BlockAir; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; -public class LightGlass extends BlockBreakable +/*public class LightGlass extends BlockBreakable +{*/ +public class LightGlass extends BlockAir { - private int state = 0; + +private int state = 0; private final int a = 255; private int r = 255; private int g = 0; private int b = 0; private int hex; - public LightGlass(final Material mat, final boolean bool) + public LightGlass(final boolean bool) { - super("blockMFEffect", mat, bool); + //super("blockMFEffect", Material.air, bool); + super(); this.setCreativeTab(AddToCreativeTab.tabBlock); this.setBlockName("blockMFEffect"); this.setLightLevel(12F); + setHardness(0.1F); + setBlockTextureName(CORE.MODID + ":" + "blockMFEffect"); + setStepSound(Block.soundTypeGlass); + GameRegistry.registerBlock(this, "blockMFEffect"); + + /* this.setLightOpacity(0); this.setTickRandomly(true); - this.setResistance(1); + this.setResistance(1);*/ } /** @@ -60,7 +69,7 @@ public class LightGlass extends BlockBreakable @Override public boolean renderAsNormalBlock() { - return true; + return false; } /** @@ -129,7 +138,7 @@ public class LightGlass extends BlockBreakable @Override @SideOnly(Side.CLIENT) public void randomDisplayTick(final World world, final int posX, final int posY, final int posZ, final Random random){ - Utils.spawnFX(world, posX, posY, posZ, "smoke", "cloud"); + //Utils.spawnFX(world, posX, posY, posZ, "smoke", "cloud"); } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_SuperJukebox.java b/src/Java/gtPlusPlus/core/block/machine/Machine_SuperJukebox.java new file mode 100644 index 0000000000..e3d9d0e646 --- /dev/null +++ b/src/Java/gtPlusPlus/core/block/machine/Machine_SuperJukebox.java @@ -0,0 +1,215 @@ +package gtPlusPlus.core.block.machine; + +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.common.registry.LanguageRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.Block; +import net.minecraft.block.BlockJukebox; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; + +public class Machine_SuperJukebox extends BlockJukebox +{ + @SideOnly(Side.CLIENT) + private IIcon mIcon; + + public Machine_SuperJukebox(){ + this.setBlockName("blockSuperJukebox"); + this.setCreativeTab(CreativeTabs.tabRedstone); + setHardness(2.0F); + setResistance(10.0F); + setStepSound(soundTypePiston); + setBlockTextureName("jukebox"); + GameRegistry.registerBlock(this, "blockSuperJukebox"); + LanguageRegistry.addName(this, "Sir Mixalot [Jukebox]"); + } + + /** + * Gets the block's texture. Args: side, meta + */ + @SideOnly(Side.CLIENT) + public IIcon getIcon(int aSide, int aMeta) + { + return aSide == 1 ? this.mIcon : this.blockIcon; + } + + /** + * Called upon block activation (right click on the block.) + */ + @Override + public boolean onBlockActivated(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) + { + if (aWorld.getBlockMetadata(aX, aY, aZ) == 0) + { + return false; + } + else + { + this.func_149925_e(aWorld, aX, aY, aZ); + return true; + } + } + + /** + * Set the record in the {@link SuperJukebox} {@link TileEntity}. + */ + @Override + public final void func_149926_b(World aWorld, int aX, int aY, int aZ, ItemStack aStackToSet) { + setRecordInJukeBox(aWorld, aX, aY, aZ, aStackToSet); + } + + public void setRecordInJukeBox(World aWorld, int aX, int aY, int aZ, ItemStack aStackToSet) { + if (!aWorld.isRemote) { + TileEntitySuperJukebox tileentityjukebox = (TileEntitySuperJukebox) aWorld.getTileEntity(aX, aY, aZ); + if (tileentityjukebox != null) { + tileentityjukebox.func_145857_a(aStackToSet.copy()); + aWorld.setBlockMetadataWithNotify(aX, aY, aZ, 1, 2); + } + } + } + + /** + * Function to handle playing of records. + */ + @Override + public final void func_149925_e(World aWorld, int aX, int aY, int aZ) { + playerJukeboxRecord(aWorld, aX, aY, aZ); + } + + public void playerJukeboxRecord(World aWorld, int aX, int aY, int aZ) { + if (!aWorld.isRemote) { + TileEntitySuperJukebox tileentityjukebox = (TileEntitySuperJukebox) aWorld.getTileEntity(aX, + aY, aZ); + + if (tileentityjukebox != null) { + ItemStack itemstack = tileentityjukebox.func_145856_a(); + + if (itemstack != null) { + aWorld.playAuxSFX(1005, aX, aY, aZ, 0); + aWorld.playRecord((String) null, aX, aY, aZ); + tileentityjukebox.func_145857_a((ItemStack) null); + aWorld.setBlockMetadataWithNotify(aX, aY, aZ, 0, 2); + float f = 0.7F; + double d0 = (double) (aWorld.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D; + double d1 = (double) (aWorld.rand.nextFloat() * f) + (double) (1.0F - f) * 0.2D + 0.6D; + double d2 = (double) (aWorld.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D; + ItemStack itemstack1 = itemstack.copy(); + EntityItem entityitem = new EntityItem(aWorld, (double) aX + d0, + (double) aY + d1, (double) aZ + d2, itemstack1); + entityitem.delayBeforeCanPickup = 10; + aWorld.spawnEntityInWorld(entityitem); + } + } + } + } + + @Override + public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) + { + this.func_149925_e(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_); + super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); + } + + /** + * Drops the block items with a specified chance of dropping the specified items + */ + @Override + public void dropBlockAsItemWithChance(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_) + { + if (!p_149690_1_.isRemote) + { + super.dropBlockAsItemWithChance(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, 0); + } + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + @Override + public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) + { + return new TileEntitySuperJukebox(); + } + + @SideOnly(Side.CLIENT) + @Override + public void registerBlockIcons(IIconRegister p_149651_1_) + { + this.blockIcon = p_149651_1_.registerIcon(this.getTextureName() + "_side"); + this.mIcon = p_149651_1_.registerIcon(this.getTextureName() + "_top"); + } + + public static class TileEntitySuperJukebox extends TileEntityJukebox { + + private ItemStack field_145858_a; + + @Override + public void readFromNBT(NBTTagCompound aNBT) + { + super.readFromNBT(aNBT); + + if (aNBT.hasKey("RecordItem", 10)) + { + this.func_145857_a(ItemStack.loadItemStackFromNBT(aNBT.getCompoundTag("RecordItem"))); + } + else if (aNBT.getInteger("Record") > 0) + { + this.func_145857_a(new ItemStack(Item.getItemById(aNBT.getInteger("Record")), 1, 0)); + } + } + + @Override + public void writeToNBT(NBTTagCompound aNBT) + { + super.writeToNBT(aNBT); + + if (this.func_145856_a() != null) + { + aNBT.setTag("RecordItem", this.func_145856_a().writeToNBT(new NBTTagCompound())); + aNBT.setInteger("Record", Item.getIdFromItem(this.func_145856_a().getItem())); + } + } + + /** + * Called to get the internal stack + */ + @Override + public ItemStack func_145856_a() + { + return this.field_145858_a; + } + + /** + * Called to get the internal stack, wraps vanilla function {@link func_145856_a}. + */ + public ItemStack getCurrentRecord() { + return func_145856_a(); + } + + /** + * Called to set the internal stack + */ + @Override + public void func_145857_a(ItemStack p_145857_1_) + { + this.field_145858_a = p_145857_1_; + this.markDirty(); + } + + /** + * Called to set the internal stack, wraps vanilla function {@link func_145857_a}. + */ + public void setCurrentRecord(ItemStack aStack) { + func_145857_a(aStack); + } + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/client/renderer/RenderBatKing.java b/src/Java/gtPlusPlus/core/client/renderer/RenderBatKing.java new file mode 100644 index 0000000000..fb260eedeb --- /dev/null +++ b/src/Java/gtPlusPlus/core/client/renderer/RenderBatKing.java @@ -0,0 +1,150 @@ +package gtPlusPlus.core.client.renderer; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.model.ModelBat; +import net.minecraft.client.renderer.entity.RenderLiving; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.passive.EntityBat; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +@SideOnly(Side.CLIENT) +public class RenderBatKing extends RenderLiving { + + private static final ResourceLocation batTextures = new ResourceLocation("textures/entity/bat.png"); + + /** + * not actually sure this is size, is not used as of now, but the model would be + * recreated if the value changed and it seems a good match for a bats size + */ + private int renderedBatSize; + + public RenderBatKing() { + super(new ModelBat(), 1F); + this.renderedBatSize = ((ModelBat) this.mainModel).getBatSize(); + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, + * always casting down its argument and then handing it off to a worker function + * which does the actual work. In all probabilty, the class Render is generic + * (Render<T extends Entity) and this method has signature public void + * func_76986_a(T entity, double d, double d1, double d2, float f, float f1). + * But JAD is pre 1.5 so doesn't do that. + */ + public void doRender(EntityBat p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, + float p_76986_8_, float p_76986_9_) { + int i = ((ModelBat) this.mainModel).getBatSize(); + + if (i != this.renderedBatSize) { + this.renderedBatSize = i; + this.mainModel = new ModelBat(); + } + + super.doRender((EntityLiving) p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless + * you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityBat p_110775_1_) { + return batTextures; + } + + /** + * Allows the render to do any OpenGL state modifications necessary before the + * model is rendered. Args: entityLiving, partialTickTime + */ + protected void preRenderCallback(EntityBat p_77041_1_, float p_77041_2_) { + GL11.glScalef(0.35F, 0.35F, 0.35F); + } + + /** + * Sets a simple glTranslate on a LivingEntity. + */ + protected void renderLivingAt(EntityBat p_77039_1_, double p_77039_2_, double p_77039_4_, double p_77039_6_) { + super.renderLivingAt(p_77039_1_, p_77039_2_, p_77039_4_, p_77039_6_); + } + + protected void rotateCorpse(EntityBat p_77043_1_, float p_77043_2_, float p_77043_3_, float p_77043_4_) { + if (!p_77043_1_.getIsBatHanging()) { + GL11.glTranslatef(0.0F, MathHelper.cos(p_77043_2_ * 0.3F) * 0.1F, 0.0F); + } else { + GL11.glTranslatef(0.0F, -0.1F, 0.0F); + } + + super.rotateCorpse(p_77043_1_, p_77043_2_, p_77043_3_, p_77043_4_); + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, + * always casting down its argument and then handing it off to a worker function + * which does the actual work. In all probabilty, the class Render is generic + * (Render<T extends Entity) and this method has signature public void + * func_76986_a(T entity, double d, double d1, double d2, float f, float f1). + * But JAD is pre 1.5 so doesn't do that. + */ + public void doRender(EntityLiving p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, + float p_76986_8_, float p_76986_9_) { + this.doRender((EntityBat) p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); + } + + /** + * Allows the render to do any OpenGL state modifications necessary before the + * model is rendered. Args: entityLiving, partialTickTime + */ + protected void preRenderCallback(EntityLivingBase p_77041_1_, float p_77041_2_) { + this.preRenderCallback((EntityBat) p_77041_1_, p_77041_2_); + } + + protected void rotateCorpse(EntityLivingBase p_77043_1_, float p_77043_2_, float p_77043_3_, float p_77043_4_) { + this.rotateCorpse((EntityBat) p_77043_1_, p_77043_2_, p_77043_3_, p_77043_4_); + } + + /** + * Sets a simple glTranslate on a LivingEntity. + */ + protected void renderLivingAt(EntityLivingBase p_77039_1_, double p_77039_2_, double p_77039_4_, + double p_77039_6_) { + this.renderLivingAt((EntityBat) p_77039_1_, p_77039_2_, p_77039_4_, p_77039_6_); + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, + * always casting down its argument and then handing it off to a worker function + * which does the actual work. In all probabilty, the class Render is generic + * (Render<T extends Entity) and this method has signature public void + * func_76986_a(T entity, double d, double d1, double d2, float f, float f1). + * But JAD is pre 1.5 so doesn't do that. + */ + public void doRender(EntityLivingBase p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, + float p_76986_8_, float p_76986_9_) { + this.doRender((EntityBat) p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless + * you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(Entity p_110775_1_) { + return this.getEntityTexture((EntityBat) p_110775_1_); + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, + * always casting down its argument and then handing it off to a worker function + * which does the actual work. In all probabilty, the class Render is generic + * (Render<T extends Entity) and this method has signature public void + * func_76986_a(T entity, double d, double d1, double d2, float f, float f1). + * But JAD is pre 1.5 so doesn't do that. + */ + public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, + float p_76986_9_) { + this.doRender((EntityBat) p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/common/CommonProxy.java b/src/Java/gtPlusPlus/core/common/CommonProxy.java index 9e75cd4a16..6bced739c7 100644 --- a/src/Java/gtPlusPlus/core/common/CommonProxy.java +++ b/src/Java/gtPlusPlus/core/common/CommonProxy.java @@ -41,23 +41,16 @@ public class CommonProxy { public static Meta_GT_Proxy GtProxy; private boolean mFluidsGenerated = false; - public CommonProxy(){ - //Should Register Gregtech Materials I've Made + public CommonProxy() { + // Should Register Gregtech Materials I've Made Utils.registerEvent(this); - if (LoadedMods.Gregtech){ - if (!CORE.GTNH) { - Logger.INFO("We're using Gregtech "+Utils.getGregtechVersionAsString()); - } - else { - Logger.INFO("We're using GTNH's Gregtech "+Utils.getGregtechVersionAsString()); - } - - Logger.INFO("Setting up our own GT_Proxy."); - GtProxy = new Meta_GT_Proxy(); - } - else { - GtProxy = null; + if (!CORE.GTNH) { + Logger.INFO("We're using Gregtech " + Utils.getGregtechVersionAsString()); + } else { + Logger.INFO("We're using GTNH's Gregtech " + Utils.getGregtechVersionAsString()); } + Logger.INFO("Setting up our own GT_Proxy."); + GtProxy = Meta_GT_Proxy.instance; } public void preInit(final FMLPreInitializationEvent e) { @@ -108,6 +101,9 @@ public class CommonProxy { //Must be done in pre-init. generateMobSpawners(); + //Internal GT Proxy + GtProxy.preInit(); + } public void init(final FMLInitializationEvent e) { @@ -160,6 +156,9 @@ public class CommonProxy { COMPAT_HANDLER.registerMyModsOreDictEntries(); COMPAT_HANDLER.intermodOreDictionarySupport(); COMPAT_IntermodStaging.init(); + + //Internal GT Proxy + GtProxy.init(); } public void postInit(final FMLPostInitializationEvent e) { @@ -179,6 +178,8 @@ public class CommonProxy { COMPAT_HANDLER.startLoadingGregAPIBasedRecipes(); COMPAT_IntermodStaging.postInit(); COMPAT_HANDLER.runQueuedRecipes(); + //Internal GT Proxy + GtProxy.postInit(); } diff --git a/src/Java/gtPlusPlus/core/container/Container_SuperJukebox.java b/src/Java/gtPlusPlus/core/container/Container_SuperJukebox.java new file mode 100644 index 0000000000..cb2f33dd47 --- /dev/null +++ b/src/Java/gtPlusPlus/core/container/Container_SuperJukebox.java @@ -0,0 +1,190 @@ +package gtPlusPlus.core.container; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.core.inventories.InventoryCircuitProgrammer; +import gtPlusPlus.core.slots.SlotIntegratedCircuit; +import gtPlusPlus.core.slots.SlotNoInput; +import gtPlusPlus.core.tileentities.general.TileEntityCircuitProgrammer; + +public class Container_SuperJukebox extends Container { + + protected TileEntityCircuitProgrammer tile_entity; + public final InventoryCircuitProgrammer inventoryChest; + + private final World worldObj; + private final int posX; + private final int posY; + private final int posZ; + + public static final int SLOT_OUTPUT = 25; + + public static int StorageSlotNumber = 26; // Number of slots in storage area + public static int InventorySlotNumber = 36; // Inventory Slots (Inventory + // and Hotbar) + public static int FullSlotNumber = InventorySlotNumber + StorageSlotNumber; // All + // slots + + public Container_SuperJukebox(final InventoryPlayer inventory, final TileEntityCircuitProgrammer te) { + this.tile_entity = te; + this.inventoryChest = te.getInventory(); + + int var6; + int var7; + this.worldObj = te.getWorldObj(); + this.posX = te.xCoord; + this.posY = te.yCoord; + this.posZ = te.zCoord; + Logger.INFO("1"); + + int o = 0; + + // Storage Side + /*for (var6 = 0; var6 < 3; var6++) { + for (var7 = 0; var7 < 5; var7++) { + this.addSlotToContainer(new SlotIntegratedCircuit(o, this.inventoryChest, o, 44 + (var7 * 18), 15 + (var6 * 18))); + o++; + } + }*/ + + + int xStart = 8; + int yStart = 5; + + try { + //0 + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart, yStart)); + //1-10 + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+18, yStart)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+36, yStart)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+54, yStart)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+72, yStart)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+90, yStart)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+108, yStart)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+18, yStart+18)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+36, yStart+18)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+54, yStart+18)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+72, yStart+18)); + //11-20 + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+90, yStart+18)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+108, yStart+18)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+18, yStart+36)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+36, yStart+36)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+54, yStart+36)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+72, yStart+36)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+90, yStart+36)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+108, yStart+36)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+18, yStart+54)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+36, yStart+54)); + //21-24 + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+54, yStart+54)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+72, yStart+54)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+90, yStart+54)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+108, yStart+54)); + Logger.INFO("2"); + + //Add Output + this.addSlotToContainer(new SlotNoInput(this.inventoryChest, SLOT_OUTPUT, xStart+(8*18), yStart+54)); + o++; + Logger.INFO("3"); + + + + // Player Inventory + for (var6 = 0; var6 < 3; ++var6) { + for (var7 = 0; var7 < 9; ++var7) { + this.addSlotToContainer(new Slot(inventory, var7 + (var6 * 9) + 9, 8 + (var7 * 18), 84 + (var6 * 18))); + } + } + // Player Hotbar + for (var6 = 0; var6 < 9; ++var6) { + this.addSlotToContainer(new Slot(inventory, var6, 8 + (var6 * 18), 142)); + } + + + + Logger.INFO("4"); + } + catch (Throwable t) {} + + } + + @Override + public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, + final EntityPlayer aPlayer) { + + if (!aPlayer.worldObj.isRemote) { + if ((aSlotIndex == 999) || (aSlotIndex == -999)) { + // Utils.LOG_WARNING("??? - "+aSlotIndex); + } + } + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + + @Override + public void onContainerClosed(final EntityPlayer par1EntityPlayer) { + super.onContainerClosed(par1EntityPlayer); + } + + @Override + public boolean canInteractWith(final EntityPlayer par1EntityPlayer) { + if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockCircuitProgrammer) { + return false; + } + + return par1EntityPlayer.getDistanceSq(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D) <= 64D; + } + + @Override + public ItemStack transferStackInSlot(final EntityPlayer par1EntityPlayer, final int par2) { + ItemStack var3 = null; + final Slot var4 = (Slot) this.inventorySlots.get(par2); + + if ((var4 != null) && var4.getHasStack()) { + final ItemStack var5 = var4.getStack(); + var3 = var5.copy(); + + /* + * if (par2 == 0) { if (!this.mergeItemStack(var5, + * InOutputSlotNumber, FullSlotNumber, true)) { return null; } + * + * var4.onSlotChange(var5, var3); } else if (par2 >= + * InOutputSlotNumber && par2 < InventoryOutSlotNumber) { if + * (!this.mergeItemStack(var5, InventoryOutSlotNumber, + * FullSlotNumber, false)) { return null; } } else if (par2 >= + * InventoryOutSlotNumber && par2 < FullSlotNumber) { if + * (!this.mergeItemStack(var5, InOutputSlotNumber, + * InventoryOutSlotNumber, false)) { return null; } } else if + * (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, + * false)) { return null; } + */ + + if (var5.stackSize == 0) { + var4.putStack((ItemStack) null); + } else { + var4.onSlotChanged(); + } + + if (var5.stackSize == var3.stackSize) { + return null; + } + + var4.onPickupFromSlot(par1EntityPlayer, var5); + } + + return var3; + } + + // Can merge Slot + @Override + public boolean func_94530_a(final ItemStack p_94530_1_, final Slot p_94530_2_) { + return super.func_94530_a(p_94530_1_, p_94530_2_); + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/entity/InternalEntityRegistry.java b/src/Java/gtPlusPlus/core/entity/InternalEntityRegistry.java index f130a1f936..36f5b86184 100644 --- a/src/Java/gtPlusPlus/core/entity/InternalEntityRegistry.java +++ b/src/Java/gtPlusPlus/core/entity/InternalEntityRegistry.java @@ -8,6 +8,7 @@ import gtPlusPlus.australia.entity.type.EntityAustralianSpiderBase; import gtPlusPlus.australia.entity.type.EntityBoar; import gtPlusPlus.australia.entity.type.EntityDingo; import gtPlusPlus.australia.entity.type.EntityOctopus; +import gtPlusPlus.core.entity.monster.EntityBatKing; import gtPlusPlus.core.entity.monster.EntityGiantChickenBase; import gtPlusPlus.core.entity.monster.EntitySickBlaze; import gtPlusPlus.core.entity.monster.EntityStaballoyConstruct; @@ -55,6 +56,7 @@ public class InternalEntityRegistry { */ EntityRegistry.registerGlobalEntityID(EntityGiantChickenBase.class, "bigChickenFriendly", EntityRegistry.findGlobalUniqueEntityId(), Utils.rgbtoHexValue(255, 0, 0), Utils.rgbtoHexValue(175, 175, 175)); + EntityRegistry.registerGlobalEntityID(EntityBatKing.class, "batKing", EntityRegistry.findGlobalUniqueEntityId(), Utils.rgbtoHexValue(175, 175, 0), Utils.rgbtoHexValue(0, 175, 175)); //EntityRegistry.registerModEntity(EntityGiantChickenBase.class, "bigChickenFriendly", mEntityID++, GTplusplus.instance, 64, 20, true); diff --git a/src/Java/gtPlusPlus/core/entity/monster/EntityBatKing.java b/src/Java/gtPlusPlus/core/entity/monster/EntityBatKing.java new file mode 100644 index 0000000000..114ca50b4b --- /dev/null +++ b/src/Java/gtPlusPlus/core/entity/monster/EntityBatKing.java @@ -0,0 +1,228 @@ +package gtPlusPlus.core.entity.monster; + +import java.util.Calendar; +import net.minecraft.entity.Entity; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.passive.EntityBat; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class EntityBatKing extends EntityBat +{ + /** Coordinates of where the bat spawned. */ + private ChunkCoordinates spawnPosition; + + public EntityBatKing(World p_i1680_1_) + { + super(p_i1680_1_); + this.setSize(2F, 3.6F); + this.setIsBatHanging(false); + } + + protected void entityInit() + { + super.entityInit(); + } + + /** + * Returns the volume for the sounds this mob makes. + */ + protected float getSoundVolume() + { + return 0.3F; + } + + /** + * Gets the pitch of living sounds in living entities. + */ + protected float getSoundPitch() + { + return super.getSoundPitch() * 0.35F; + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return this.getIsBatHanging() && this.rand.nextInt(4) != 0 ? null : "mob.bat.idle"; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.bat.hurt"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.bat.death"; + } + + /** + * Returns true if this entity should push and be pushed by other entities when colliding. + */ + public boolean canBePushed() + { + return false; + } + + protected void collideWithEntity(Entity p_82167_1_) {} + + protected void collideWithNearbyEntities() {} + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(60.0D); + } + + public boolean getIsBatHanging() + { + return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0; + } + + public void setIsBatHanging(boolean p_82236_1_) + { + byte b0 = this.dataWatcher.getWatchableObjectByte(16); + + if (p_82236_1_) + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 1))); + } + else + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -2))); + } + } + + /** + * Returns true if the newer Entity AI code should be run + */ + protected boolean isAIEnabled() + { + return true; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + super.onUpdate(); + } + + protected void updateAITasks() + { + super.updateAITasks(); + + } + + /** + * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to + * prevent them from trampling crops + */ + protected boolean canTriggerWalking() + { + return false; + } + + /** + * Called when the mob is falling. Calculates and applies fall damage. + */ + protected void fall(float p_70069_1_) {} + + /** + * Takes in the distance the entity has fallen this tick and whether its on the ground to update the fall distance + * and deal fall damage if landing on the ground. Args: distanceFallenThisTick, onGround + */ + protected void updateFallState(double p_70064_1_, boolean p_70064_3_) {} + + /** + * Return whether this entity should NOT trigger a pressure plate or a tripwire. + */ + public boolean doesEntityNotTriggerPressurePlate() + { + return true; + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_) + { + if (this.isEntityInvulnerable()) + { + return false; + } + else + { + if (!this.worldObj.isRemote && this.getIsBatHanging()) + { + this.setIsBatHanging(false); + } + + return super.attackEntityFrom(p_70097_1_, p_70097_2_); + } + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound p_70037_1_) + { + super.readEntityFromNBT(p_70037_1_); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound p_70014_1_) + { + super.writeEntityToNBT(p_70014_1_); + } + + /** + * Checks if the entity's current position is a valid location to spawn this entity. + */ + public boolean getCanSpawnHere() + { + int i = MathHelper.floor_double(this.boundingBox.minY); + + if (i >= 63) + { + return false; + } + else + { + int j = MathHelper.floor_double(this.posX); + int k = MathHelper.floor_double(this.posZ); + int l = this.worldObj.getBlockLightValue(j, i, k); + byte b0 = 4; + Calendar calendar = this.worldObj.getCurrentDate(); + + if ((calendar.get(2) + 1 != 10 || calendar.get(5) < 20) && (calendar.get(2) + 1 != 11 || calendar.get(5) > 3)) + { + if (this.rand.nextBoolean()) + { + return false; + } + } + else + { + b0 = 7; + } + + return l > this.rand.nextInt(b0) ? false : super.getCanSpawnHere(); + } + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_SuperJukebox.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_SuperJukebox.java new file mode 100644 index 0000000000..adaf8469ad --- /dev/null +++ b/src/Java/gtPlusPlus/core/gui/machine/GUI_SuperJukebox.java @@ -0,0 +1,44 @@ +package gtPlusPlus.core.gui.machine; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.ResourceLocation; +import gtPlusPlus.core.container.Container_CircuitProgrammer; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.tileentities.general.TileEntityCircuitProgrammer; + +@SideOnly(Side.CLIENT) +public class GUI_SuperJukebox extends GuiContainer { + + private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/CircuitProgrammer.png"); + + public GUI_SuperJukebox(final InventoryPlayer player_inventory, final TileEntityCircuitProgrammer te){ + super(new Container_CircuitProgrammer(player_inventory, te)); + } + + @Override + protected void drawGuiContainerForegroundLayer(final int i, final int j){ + super.drawGuiContainerForegroundLayer(i, j); + } + + @Override + protected void drawGuiContainerBackgroundLayer(final float f, final int i, final int j){ + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + this.mc.renderEngine.bindTexture(craftingTableGuiTextures); + final int x = (this.width - this.xSize) / 2; + final int y = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); + } + + //This method is called when the Gui is first called! + @Override + public void initGui(){ + super.initGui(); + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java index c37369b00f..eaa17f9f87 100644 --- a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java +++ b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java @@ -120,6 +120,7 @@ public class COMPAT_HANDLER { GregtechIndustrialArcFurnace.run(); GregtechSolarTower.run(); GregtechLargeTurbinesAndHeatExchanger.run(); + GregtechPowerBreakers.run(); //New Horizons Content NewHorizonsAccelerator.run(); diff --git a/src/Java/gtPlusPlus/core/lib/CORE.java b/src/Java/gtPlusPlus/core/lib/CORE.java index 3c18e2f6f7..97da974967 100644 --- a/src/Java/gtPlusPlus/core/lib/CORE.java +++ b/src/Java/gtPlusPlus/core/lib/CORE.java @@ -115,7 +115,6 @@ public class CORE { @Deprecated public static IGregtech_RecipeAdder sRecipeAdder; public static IGregtech_RecipeAdder RA; - public static GregtechRecipe GT_Recipe = new GregtechRecipe(); public static final GT_Materials[] sMU_GeneratedMaterials = new GT_Materials[1000]; diff --git a/src/Java/gtPlusPlus/core/lib/LoadedMods.java b/src/Java/gtPlusPlus/core/lib/LoadedMods.java index 2a7ef9bc39..da0357a9c4 100644 --- a/src/Java/gtPlusPlus/core/lib/LoadedMods.java +++ b/src/Java/gtPlusPlus/core/lib/LoadedMods.java @@ -11,7 +11,6 @@ import gtPlusPlus.xmod.gregtech.recipes.GregtechRecipeAdder; public class LoadedMods { - //Initialize Variables public static boolean Gregtech = false; public static boolean PlayerAPI = false; @@ -53,6 +52,7 @@ public class LoadedMods { public static boolean TiCon = false; public static boolean StevesCarts = false; public static boolean Witchery = false; + public static boolean Waila = false; @@ -185,6 +185,11 @@ public class LoadedMods { Logger.INFO("Components enabled for: Railcraft"); totalMods++; } + if (Loader.isModLoaded("Waila")){ + Waila = true; + Logger.INFO("Components enabled for: WAILA"); + totalMods++; + } if (Loader.isModLoaded("Mekanism")){ Mekanism = true; Logger.INFO("Components enabled for: Mekanism - This feature is not configurable and balances Mekanism to suit GT."); diff --git a/src/Java/gtPlusPlus/core/proxy/ClientProxy.java b/src/Java/gtPlusPlus/core/proxy/ClientProxy.java index 727a411e4f..c7374ca7d5 100644 --- a/src/Java/gtPlusPlus/core/proxy/ClientProxy.java +++ b/src/Java/gtPlusPlus/core/proxy/ClientProxy.java @@ -30,6 +30,7 @@ import gtPlusPlus.australia.entity.type.EntityDingo; import gtPlusPlus.australia.entity.type.EntityOctopus; import gtPlusPlus.core.client.model.ModelGiantChicken; import gtPlusPlus.core.client.renderer.CustomOreBlockRenderer; +import gtPlusPlus.core.client.renderer.RenderBatKing; import gtPlusPlus.core.client.renderer.RenderDecayChest; import gtPlusPlus.core.client.renderer.RenderGiantChicken; import gtPlusPlus.core.client.renderer.RenderMiningExplosivesPrimed; @@ -41,6 +42,7 @@ import gtPlusPlus.core.common.CommonProxy; import gtPlusPlus.core.common.compat.COMPAT_PlayerAPI; import gtPlusPlus.core.entity.EntityPrimedMiningExplosive; import gtPlusPlus.core.entity.EntityTeslaTowerLightning; +import gtPlusPlus.core.entity.monster.EntityBatKing; import gtPlusPlus.core.entity.monster.EntityGiantChickenBase; import gtPlusPlus.core.entity.monster.EntitySickBlaze; import gtPlusPlus.core.entity.monster.EntityStaballoyConstruct; @@ -55,7 +57,9 @@ import gtPlusPlus.core.tileentities.general.TileEntityDecayablesChest; import gtPlusPlus.core.tileentities.general.TileEntityFirepit; import gtPlusPlus.core.util.minecraft.particles.EntityParticleFXMysterious; import gtPlusPlus.xmod.gregtech.common.render.GTPP_CapeRenderer; +import gtPlusPlus.xmod.gregtech.common.render.GTPP_Render_MachineBlock; import net.minecraft.client.Minecraft; +import net.minecraft.client.model.ModelBat; import net.minecraft.client.particle.EntityFX; import net.minecraft.client.renderer.entity.RenderSnowball; import net.minecraft.entity.Entity; @@ -106,6 +110,7 @@ public class ClientProxy extends CommonProxy implements Runnable{ * Custom Block Renderers */ new CustomOreBlockRenderer(); + new GTPP_Render_MachineBlock(); super.init(e); } @@ -132,6 +137,7 @@ public class ClientProxy extends CommonProxy implements Runnable{ RenderingRegistry.registerEntityRenderingHandler(EntityHydrofluoricAcidPotion.class, new RenderSnowball(ModItems.itemHydrofluoricPotion)); RenderingRegistry.registerEntityRenderingHandler(EntityTeslaTowerLightning.class, new RenderPlasmaBolt()); RenderingRegistry.registerEntityRenderingHandler(EntityGiantChickenBase.class, new RenderGiantChicken(new ModelGiantChicken(), 1f)); + RenderingRegistry.registerEntityRenderingHandler(EntityBatKing.class, new RenderBatKing()); /** * Tiles diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java index 12195c2dc0..e2cfb3516e 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java @@ -209,6 +209,7 @@ public class RECIPES_Machines { initModItems(); controlCores(); energyCores(); + wirelessChargers(); } private static void initModItems(){ @@ -1281,53 +1282,6 @@ public class RECIPES_Machines { o_Fermenter, o_Distillery, o_Extractor, GregtechItemList.Industrial_MultiMachine.get(1)); } - - //Wireless Chargers - RecipeUtils.addShapedGregtechRecipe( - CI.emitter_LV, CI.circuitTier1, CI.emitter_LV, - CI.component_Plate[3], CI.machineHull_LV, CI.component_Plate[3], - CI.sensor_LV, CI.fieldGenerator_LV, CI.sensor_LV, - GregtechItemList.Charger_LV.get(1)); - RecipeUtils.addShapedGregtechRecipe( - CI.emitter_MV, CI.circuitTier2, CI.emitter_MV, - CI.component_Plate[4], CI.machineHull_MV, CI.component_Plate[4], - CI.sensor_MV, CI.fieldGenerator_MV, CI.sensor_MV, - GregtechItemList.Charger_MV.get(1)); - RecipeUtils.addShapedGregtechRecipe( - CI.emitter_HV, CI.circuitTier3, CI.emitter_HV, - CI.component_Plate[5], CI.machineHull_HV, CI.component_Plate[5], - CI.sensor_HV, CI.fieldGenerator_HV, CI.sensor_HV, - GregtechItemList.Charger_HV.get(1)); - RecipeUtils.addShapedGregtechRecipe( - CI.emitter_EV, CI.circuitTier4, CI.emitter_EV, - CI.component_Plate[6], CI.machineHull_EV, CI.component_Plate[6], - CI.sensor_EV, CI.fieldGenerator_EV, CI.sensor_EV, - GregtechItemList.Charger_EV.get(1)); - RecipeUtils.addShapedGregtechRecipe( - CI.emitter_IV, CI.circuitTier5, CI.emitter_IV, - CI.component_Plate[7], CI.machineHull_IV, CI.component_Plate[7], - CI.sensor_IV, CI.fieldGenerator_IV, CI.sensor_IV, - GregtechItemList.Charger_IV.get(1)); - RecipeUtils.addShapedGregtechRecipe( - CI.emitter_LuV, CI.circuitTier6, CI.emitter_LuV, - CI.component_Plate[8], CI.machineHull_LuV, CI.component_Plate[8], - CI.sensor_LuV, CI.fieldGenerator_LuV, CI.sensor_LuV, - GregtechItemList.Charger_LuV.get(1)); - RecipeUtils.addShapedGregtechRecipe( - CI.emitter_ZPM, CI.circuitTier7, CI.emitter_ZPM, - CI.component_Plate[9], CI.machineHull_ZPM, CI.component_Plate[9], - CI.sensor_ZPM, CI.fieldGenerator_ZPM, CI.sensor_ZPM, - GregtechItemList.Charger_ZPM.get(1)); - RecipeUtils.addShapedGregtechRecipe( - CI.emitter_UV, CI.circuitTier8, CI.emitter_UV, - CI.component_Plate[10], CI.machineHull_UV, CI.component_Plate[10], - CI.sensor_UV, CI.fieldGenerator_UV, CI.sensor_UV, - GregtechItemList.Charger_UV.get(1)); - RecipeUtils.addShapedGregtechRecipe( - CI.emitter_MAX, CI.circuitTier9, CI.emitter_MAX, - CI.component_Plate[11], CI.machineHull_MAX, CI.component_Plate[11], - CI.sensor_MAX, CI.fieldGenerator_MAX, CI.sensor_MAX, - GregtechItemList.Charger_MAX.get(1)); @@ -1819,4 +1773,44 @@ public class RECIPES_Machines { } + + private static void wirelessChargers() { + + ItemStack[] aChargers = new ItemStack[] { + null, + GregtechItemList.Charger_LV.get(1), + GregtechItemList.Charger_MV.get(1), + GregtechItemList.Charger_HV.get(1), + GregtechItemList.Charger_EV.get(1), + GregtechItemList.Charger_IV.get(1), + GregtechItemList.Charger_LuV.get(1), + GregtechItemList.Charger_ZPM.get(1), + GregtechItemList.Charger_UV.get(1), + GregtechItemList.Charger_MAX.get(1) + }; + + int aCostMultiplier = GTNH ? 2 : 1; + + for (int i = 0; i < 10; i++) { + if (i == 0) { + continue; + } + int aTier = (i + 1); + ItemStack[] aInputs = new ItemStack[] { + CI.getTieredMachineHull(i, 1 * aCostMultiplier), + CI.getEmitter(i, 2 * aCostMultiplier), + CI.getSensor(i, 2 * aCostMultiplier), + CI.getFieldGenerator(i, 1 * aCostMultiplier), + CI.getTieredComponent(OrePrefixes.plate, aTier, 4 * aCostMultiplier), + CI.getTieredComponent(OrePrefixes.circuit, aTier, 2 * aCostMultiplier), + }; + CORE.RA.addSixSlotAssemblingRecipe( + aInputs, + CI.getAlternativeTieredFluid(i, (144 * 2 * aTier)), //Input Fluid + aChargers[i], + 45 * 10 * 1 * (aTier), + MaterialUtils.getVoltageForTier(i)); + + } + } } diff --git a/src/Java/gtPlusPlus/core/recipe/common/CI.java b/src/Java/gtPlusPlus/core/recipe/common/CI.java index 5f334cdc71..13a30a510c 100644 --- a/src/Java/gtPlusPlus/core/recipe/common/CI.java +++ b/src/Java/gtPlusPlus/core/recipe/common/CI.java @@ -606,10 +606,22 @@ public class CI { public static FluidStack getTieredFluid(int aTier, int aAmount) { + return getTieredFluid(aTier, aAmount, 0); + } + + public static FluidStack getAlternativeTieredFluid(int aTier, int aAmount) { + return getTieredFluid(aTier, aAmount, 1); + } + + public static FluidStack getTertiaryTieredFluid(int aTier, int aAmount) { + return getTieredFluid(aTier, aAmount, 2); + } + + public static FluidStack getTieredFluid(int aTier, int aAmount, int aType) { ItemStack aCell = getTieredComponent(OrePrefixes.liquid, aTier, 1); FluidStack a = GT_Utility.getFluidForFilledItem(aCell, true); if (a == null) { - a = aMaster[0][aTier].getFluid(aAmount); + a = aMaster[aType][aTier].getFluid(aAmount); } a.amount = aAmount; return a; @@ -782,5 +794,358 @@ public class CI { } + + public static ItemStack getElectricMotor(int aTier, int aSize) { + ItemStack aType; + int aLazyTier = 0; + if (aTier == aLazyTier++) { + aType = CI.electricMotor_ULV; + } + else if (aTier == aLazyTier++) { + aType = CI.electricMotor_LV; + } + else if (aTier == aLazyTier++) { + aType = CI.electricMotor_MV; + } + else if (aTier == aLazyTier++) { + aType = CI.electricMotor_HV; + } + else if (aTier == aLazyTier++) { + aType = CI.electricMotor_EV; + } + else if (aTier == aLazyTier++) { + aType = CI.electricMotor_IV; + } + else if (aTier == aLazyTier++) { + aType = CI.electricMotor_LuV; + } + else if (aTier == aLazyTier++) { + aType = CI.electricMotor_ZPM; + } + else if (aTier == aLazyTier++) { + aType = CI.electricMotor_UV; + } + else if (aTier == aLazyTier++) { + aType = CI.electricMotor_MAX; + } + else { + aType = CI.electricMotor_LV; + } + return ItemUtils.getSimpleStack(aType, aSize); + } + + public static ItemStack getElectricPiston(int aTier, int aSize) { + ItemStack aType; + int aLazyTier = 0; + if (aTier == aLazyTier++) { + aType = CI.electricPiston_ULV; + } + else if (aTier == aLazyTier++) { + aType = CI.electricPiston_LV; + } + else if (aTier == aLazyTier++) { + aType = CI.electricPiston_MV; + } + else if (aTier == aLazyTier++) { + aType = CI.electricPiston_HV; + } + else if (aTier == aLazyTier++) { + aType = CI.electricPiston_EV; + } + else if (aTier == aLazyTier++) { + aType = CI.electricPiston_IV; + } + else if (aTier == aLazyTier++) { + aType = CI.electricPiston_LuV; + } + else if (aTier == aLazyTier++) { + aType = CI.electricPiston_ZPM; + } + else if (aTier == aLazyTier++) { + aType = CI.electricPiston_UV; + } + else if (aTier == aLazyTier++) { + aType = CI.electricPiston_MAX; + } + else { + aType = CI.electricPiston_LV; + } + return ItemUtils.getSimpleStack(aType, aSize); + } + + public static ItemStack getElectricPump(int aTier, int aSize) { + ItemStack aType; + int aLazyTier = 0; + if (aTier == aLazyTier++) { + aType = CI.electricPump_ULV; + } + else if (aTier == aLazyTier++) { + aType = CI.electricPump_LV; + } + else if (aTier == aLazyTier++) { + aType = CI.electricPump_MV; + } + else if (aTier == aLazyTier++) { + aType = CI.electricPump_HV; + } + else if (aTier == aLazyTier++) { + aType = CI.electricPump_EV; + } + else if (aTier == aLazyTier++) { + aType = CI.electricPump_IV; + } + else if (aTier == aLazyTier++) { + aType = CI.electricPump_LuV; + } + else if (aTier == aLazyTier++) { + aType = CI.electricPump_ZPM; + } + else if (aTier == aLazyTier++) { + aType = CI.electricPump_UV; + } + else if (aTier == aLazyTier++) { + aType = CI.electricPump_MAX; + } + else { + aType = CI.electricPump_LV; + } + return ItemUtils.getSimpleStack(aType, aSize); + } + + public static ItemStack getRobotArm(int aTier, int aSize) { + ItemStack aType; + int aLazyTier = 0; + if (aTier == aLazyTier++) { + aType = CI.robotArm_ULV; + } + else if (aTier == aLazyTier++) { + aType = CI.robotArm_LV; + } + else if (aTier == aLazyTier++) { + aType = CI.robotArm_MV; + } + else if (aTier == aLazyTier++) { + aType = CI.robotArm_HV; + } + else if (aTier == aLazyTier++) { + aType = CI.robotArm_EV; + } + else if (aTier == aLazyTier++) { + aType = CI.robotArm_IV; + } + else if (aTier == aLazyTier++) { + aType = CI.robotArm_LuV; + } + else if (aTier == aLazyTier++) { + aType = CI.robotArm_ZPM; + } + else if (aTier == aLazyTier++) { + aType = CI.robotArm_UV; + } + else if (aTier == aLazyTier++) { + aType = CI.robotArm_MAX; + } + else { + aType = CI.robotArm_LV; + } + return ItemUtils.getSimpleStack(aType, aSize); + } + + public static ItemStack getConveyor(int aTier, int aSize) { + ItemStack aType; + int aLazyTier = 0; + if (aTier == aLazyTier++) { + aType = CI.conveyorModule_ULV; + } + else if (aTier == aLazyTier++) { + aType = CI.conveyorModule_LV; + } + else if (aTier == aLazyTier++) { + aType = CI.conveyorModule_MV; + } + else if (aTier == aLazyTier++) { + aType = CI.conveyorModule_HV; + } + else if (aTier == aLazyTier++) { + aType = CI.conveyorModule_EV; + } + else if (aTier == aLazyTier++) { + aType = CI.conveyorModule_IV; + } + else if (aTier == aLazyTier++) { + aType = CI.conveyorModule_LuV; + } + else if (aTier == aLazyTier++) { + aType = CI.conveyorModule_ZPM; + } + else if (aTier == aLazyTier++) { + aType = CI.conveyorModule_UV; + } + else if (aTier == aLazyTier++) { + aType = CI.conveyorModule_MAX; + } + else { + aType = CI.conveyorModule_LV; + } + return ItemUtils.getSimpleStack(aType, aSize); + } + + public static ItemStack getEmitter(int aTier, int aSize) { + ItemStack aType; + int aLazyTier = 0; + if (aTier == aLazyTier++) { + aType = CI.emitter_ULV; + } + else if (aTier == aLazyTier++) { + aType = CI.emitter_LV; + } + else if (aTier == aLazyTier++) { + aType = CI.emitter_MV; + } + else if (aTier == aLazyTier++) { + aType = CI.emitter_HV; + } + else if (aTier == aLazyTier++) { + aType = CI.emitter_EV; + } + else if (aTier == aLazyTier++) { + aType = CI.emitter_IV; + } + else if (aTier == aLazyTier++) { + aType = CI.emitter_LuV; + } + else if (aTier == aLazyTier++) { + aType = CI.emitter_ZPM; + } + else if (aTier == aLazyTier++) { + aType = CI.emitter_UV; + } + else if (aTier == aLazyTier++) { + aType = CI.emitter_MAX; + } + else { + aType = CI.emitter_LV; + } + return ItemUtils.getSimpleStack(aType, aSize); + } + + public static ItemStack getSensor(int aTier, int aSize) { + ItemStack aType; + int aLazyTier = 0; + if (aTier == aLazyTier++) { + aType = CI.sensor_ULV; + } + else if (aTier == aLazyTier++) { + aType = CI.sensor_LV; + } + else if (aTier == aLazyTier++) { + aType = CI.sensor_MV; + } + else if (aTier == aLazyTier++) { + aType = CI.sensor_HV; + } + else if (aTier == aLazyTier++) { + aType = CI.sensor_EV; + } + else if (aTier == aLazyTier++) { + aType = CI.sensor_IV; + } + else if (aTier == aLazyTier++) { + aType = CI.sensor_LuV; + } + else if (aTier == aLazyTier++) { + aType = CI.sensor_ZPM; + } + else if (aTier == aLazyTier++) { + aType = CI.sensor_UV; + } + else if (aTier == aLazyTier++) { + aType = CI.sensor_MAX; + } + else { + aType = CI.sensor_LV; + } + return ItemUtils.getSimpleStack(aType, aSize); + } + + public static ItemStack getFieldGenerator(int aTier, int aSize) { + ItemStack aType; + int aLazyTier = 0; + if (aTier == aLazyTier++) { + aType = CI.fieldGenerator_ULV; + } + else if (aTier == aLazyTier++) { + aType = CI.fieldGenerator_LV; + } + else if (aTier == aLazyTier++) { + aType = CI.fieldGenerator_MV; + } + else if (aTier == aLazyTier++) { + aType = CI.fieldGenerator_HV; + } + else if (aTier == aLazyTier++) { + aType = CI.fieldGenerator_EV; + } + else if (aTier == aLazyTier++) { + aType = CI.fieldGenerator_IV; + } + else if (aTier == aLazyTier++) { + aType = CI.fieldGenerator_LuV; + } + else if (aTier == aLazyTier++) { + aType = CI.fieldGenerator_ZPM; + } + else if (aTier == aLazyTier++) { + aType = CI.fieldGenerator_UV; + } + else if (aTier == aLazyTier++) { + aType = CI.fieldGenerator_MAX; + } + else { + aType = CI.fieldGenerator_LV; + } + return ItemUtils.getSimpleStack(aType, aSize); + } + + + + public static ItemStack getTieredMachineHull(int aTier, int aSize) { + ItemStack aType; + int aLazyTier = 0; + if (aTier == aLazyTier++) { + aType = CI.machineHull_ULV; + } + else if (aTier == aLazyTier++) { + aType = CI.machineHull_LV; + } + else if (aTier == aLazyTier++) { + aType = CI.machineHull_MV; + } + else if (aTier == aLazyTier++) { + aType = CI.machineHull_HV; + } + else if (aTier == aLazyTier++) { + aType = CI.machineHull_EV; + } + else if (aTier == aLazyTier++) { + aType = CI.machineHull_IV; + } + else if (aTier == aLazyTier++) { + aType = CI.machineHull_LuV; + } + else if (aTier == aLazyTier++) { + aType = CI.machineHull_ZPM; + } + else if (aTier == aLazyTier++) { + aType = CI.machineHull_UV; + } + else if (aTier == aLazyTier++) { + aType = CI.machineHull_MAX; + } + else { + aType = CI.machineHull_LV; + } + return ItemUtils.getSimpleStack(aType, aSize); + } } diff --git a/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java b/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java index 771283d686..da018675f3 100644 --- a/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java +++ b/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java @@ -3,6 +3,8 @@ 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.*; @@ -25,7 +27,9 @@ public class ModTileEntities { GameRegistry.registerTileEntity(TileEntityGenericSpawner.class, "TileEntityGenericSpawner"); GameRegistry.registerTileEntity(TileEntityCircuitProgrammer.class, "TileCircuitProgrammer"); GameRegistry.registerTileEntity(TileEntityPlayerDoorBase.class, "TilePlayerDoorBase"); - GameRegistry.registerTileEntity(TileEntityDecayablesChest.class, "TileDecayablesChest"); + GameRegistry.registerTileEntity(TileEntityDecayablesChest.class, "TileDecayablesChest"); + GameRegistry.registerTileEntity(TileEntitySuperJukebox.class, "TileEntitySuperJukebox"); + GameRegistry.registerTileEntity(TileEntitySuperLight.class, "TileEntitySuperLight"); //Mod TEs diff --git a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java index 3f08715914..486cda42f9 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java @@ -608,25 +608,40 @@ public class ItemUtils { public static String getArrayStackNames(final ItemStack[] aStack) { String itemNames = "Item Array: "; - for (final ItemStack alph : aStack) { - + int aPos = 0; + for (final ItemStack alph : aStack) { + if (alph == null) { + continue; + } if (alph != null) { final String temp = itemNames; - itemNames = temp + ", " + alph.getDisplayName() + " x" + alph.stackSize; - } else { - final String temp = itemNames; - itemNames = temp + ", " + "null" + " x" + "0"; + itemNames = temp + (aPos > 0 ? ", " : "") + alph.getDisplayName() + " x" + alph.stackSize; + aPos++; } } return itemNames; } public static String[] getArrayStackNamesAsArray(final ItemStack[] aStack) { - final String[] itemNames = {}; + final String[] itemNames = aStack == null ? new String[] {} : new String[aStack.length]; + Logger.INFO(""+aStack.length); + + if (aStack == null || aStack.length < 1) { + return itemNames; + } + int arpos = 0; - for (final ItemStack alph : aStack) { + for (final ItemStack alph : aStack) { + if (alph == null) { + continue; + } + try { itemNames[arpos] = alph.getDisplayName(); arpos++; + } + catch (Throwable t) { + t.printStackTrace(); + } } return itemNames; diff --git a/src/Java/gtPlusPlus/core/util/minecraft/gregtech/recipehandlers/GregtechRecipe.java b/src/Java/gtPlusPlus/core/util/minecraft/gregtech/recipehandlers/GregtechRecipe.java index afba320fe7..635239bbfc 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/gregtech/recipehandlers/GregtechRecipe.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/gregtech/recipehandlers/GregtechRecipe.java @@ -1,76 +1,3 @@ package gtPlusPlus.core.util.minecraft.gregtech.recipehandlers; -import java.lang.reflect.Method; - -import net.minecraft.item.ItemStack; - -import gregtech.api.util.GT_ModHandler; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; - -public final class GregtechRecipe { - - public LibraryProxy ourProxy; - public GregtechRecipe(){ - Logger.INFO("Initializing a recipe handler for different versions of Gregtech 5."); - try { - if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ - this.ourProxy = new LibProxy1(); - Logger.INFO("Selecting GT 5.7/5.8 Recipe Set"); - } - if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ - this.ourProxy = new LibProxy2(); - Logger.INFO("Selecting GT 5.9 Recipe Set"); - } - } catch (final NoSuchMethodException e) { - this.ourProxy = null; - } - } - - public boolean addSmeltingAndAlloySmeltingRecipe(final ItemStack aInput, final ItemStack aOutput) { - Logger.WARNING("Adding a GT Furnace/Alloy Smelter Recipe"+"| Input:"+aInput.getDisplayName()+" | Output:"+aOutput.getDisplayName()+" |"); - return this.ourProxy.addSmeltingAndAlloySmeltingRecipe(aInput, aOutput); - } - -} - -abstract class LibraryProxy { // can also be interface unless you want to have common code here - abstract public boolean addSmeltingAndAlloySmeltingRecipe(ItemStack aInput, ItemStack aOutput); -} - -class LibProxy1 extends LibraryProxy { - final Method m1; - - public LibProxy1() throws NoSuchMethodException { - this.m1 = GT_ModHandler.class.getDeclaredMethod("addSmeltingAndAlloySmeltingRecipe", ItemStack.class, ItemStack.class); - } - - @Override - public boolean addSmeltingAndAlloySmeltingRecipe(final ItemStack aInput, final ItemStack aOutput) { - try { - //Logger.INFO("Trying with Gt 5.7/5.8 Method."); - return (boolean) this.m1.invoke(null, aInput, aOutput); - } catch (final Exception e) { - throw new RuntimeException(e); - } - } -} - -class LibProxy2 extends LibraryProxy { - final Method m2; - - public LibProxy2() throws NoSuchMethodException { - this.m2 = GT_ModHandler.class.getDeclaredMethod("addSmeltingAndAlloySmeltingRecipe", ItemStack.class, ItemStack.class, boolean.class); - } - - @Override - public boolean addSmeltingAndAlloySmeltingRecipe(final ItemStack aInput, final ItemStack aOutput) { - try { - //Logger.INFO("Trying with Gt 5.9 Method."); - return (boolean) this.m2.invoke(null, aInput, aOutput, true); - } catch (final Exception e) { - throw new RuntimeException(e); - } - } -}
\ No newline at end of file +public final class GregtechRecipe {}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/plugin/waila/Core_WailaPlugin.java b/src/Java/gtPlusPlus/plugin/waila/Core_WailaPlugin.java new file mode 100644 index 0000000000..e3af6d9681 --- /dev/null +++ b/src/Java/gtPlusPlus/plugin/waila/Core_WailaPlugin.java @@ -0,0 +1,49 @@ +package gtPlusPlus.plugin.waila; + +import gtPlusPlus.api.interfaces.IPlugin; +import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.plugin.manager.Core_Manager; + +public class Core_WailaPlugin implements IPlugin { + + final static Core_WailaPlugin mInstance; + static boolean mActive = false; + + static { + mInstance = new Core_WailaPlugin(); + mInstance.log("Preparing "+mInstance.getPluginName()+" for use."); + } + + Core_WailaPlugin() { + Core_Manager.registerPlugin(this); + } + + @Override + public boolean preInit() { + if (LoadedMods.Waila) { + mActive = true; + } + return mActive; + } + + @Override + public boolean init() { + return mActive; + } + + @Override + public boolean postInit() { + return mActive; + } + + @Override + public String getPluginName() { + return "GT++ WAILA module"; + } + + @Override + public String getPluginAbbreviation() { + return "Look"; + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java index 41bb0b0c26..068f47e0c4 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java @@ -335,6 +335,19 @@ public enum GregtechItemList implements GregtechItemContainer { Hatch_Muffler_Adv_EV, Hatch_Muffler_Adv_IV, Hatch_Muffler_Adv_LuV, Hatch_Muffler_Adv_ZPM, Hatch_Muffler_Adv_UV, Hatch_Muffler_Adv_MAX, + //Super Input Busses + Hatch_SuperBus_Input_ULV, Hatch_SuperBus_Input_LV, Hatch_SuperBus_Input_MV, + Hatch_SuperBus_Input_HV, Hatch_SuperBus_Input_EV, Hatch_SuperBus_Input_IV, + Hatch_SuperBus_Input_LuV, Hatch_SuperBus_Input_ZPM, Hatch_SuperBus_Input_UV, + Hatch_SuperBus_Input_MAX, + + //Super Output Busses + Hatch_SuperBus_Output_ULV, Hatch_SuperBus_Output_LV, Hatch_SuperBus_Output_MV, + Hatch_SuperBus_Output_HV, Hatch_SuperBus_Output_EV, Hatch_SuperBus_Output_IV, + Hatch_SuperBus_Output_LuV, Hatch_SuperBus_Output_ZPM, Hatch_SuperBus_Output_UV, + Hatch_SuperBus_Output_MAX, + + //---------------------------------------------------------------------------- @@ -432,6 +445,12 @@ public enum GregtechItemList implements GregtechItemContainer { Machine_ZPM_Component_Maker, Machine_UV_Component_Maker, + //Breakers + BreakerBox_ULV, BreakerBox_LV, BreakerBox_MV, + BreakerBox_HV, BreakerBox_EV, BreakerBox_IV, + BreakerBox_LuV, BreakerBox_ZPM, BreakerBox_UV, + BreakerBox_MAX, + //Solar Generators GT_Solar_ULV, GT_Solar_LV, GT_Solar_MV, diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/basic/CONTAINER_PollutionCleaner.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/basic/CONTAINER_PollutionCleaner.java index 788fff4031..e3365935aa 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/basic/CONTAINER_PollutionCleaner.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/basic/CONTAINER_PollutionCleaner.java @@ -14,6 +14,7 @@ import net.minecraft.item.ItemStack; import gregtech.api.gui.*; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaAtmosphericReconditioner; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! @@ -23,6 +24,7 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachin public class CONTAINER_PollutionCleaner extends GT_Container_BasicTank { public boolean mFluidTransfer = false, mItemTransfer = false, mStuttering = false; + public int mReduction = 0; public CONTAINER_PollutionCleaner(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { super(aInventoryPlayer, aTileEntity); @@ -37,72 +39,11 @@ public class CONTAINER_PollutionCleaner extends GT_Container_BasicTank { int tStartIndex = ((GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity()).getInputSlot(); switch (((GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity()).mInputSlotCount) { - case 0: - break; - case 1: //Chemical Mixer - //Add 3 Item Slots - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 17, 7)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 7)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 7)); - //Add 6 Fluid Slots - addSlotToContainer(new GT_Slot_Render(mTileEntity, tStartIndex++, 17, 25)); - addSlotToContainer(new GT_Slot_Render(mTileEntity, tStartIndex++, 35, 25)); - addSlotToContainer(new GT_Slot_Render(mTileEntity, tStartIndex++, 53, 25)); - addSlotToContainer(new GT_Slot_Render(mTileEntity, tStartIndex++, 17, 43)); - addSlotToContainer(new GT_Slot_Render(mTileEntity, tStartIndex++, 35, 43)); - addSlotToContainer(new GT_Slot_Render(mTileEntity, tStartIndex++, 53, 43)); - - break; case 2: //Pollution Scrubber //Add 2 Item Slots addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 25)); addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 107, 25)); - break; - case 3: - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 17, 25)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 25)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 25)); - break; - case 4: - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 16)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 16)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 34)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 34)); - break; - case 5: - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 17, 16)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 16)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 16)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 34)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 34)); - break; - case 6: - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 17, 16)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 16)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 16)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 17, 34)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 34)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 34)); - break; - case 7: - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 17, 7)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 7)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 7)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 17, 25)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 25)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 25)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 17, 43)); - break; - case 8: - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 17, 7)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 7)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 7)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 17, 25)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 25)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 53, 25)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 17, 43)); - addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 43)); - break; + break; default: addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 17, 7)); addSlotToContainer(new Slot(mTileEntity, tStartIndex++, 35, 7)); @@ -121,68 +62,7 @@ public class CONTAINER_PollutionCleaner extends GT_Container_BasicTank { switch (((GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity()).mOutputItems.length) { case 0: break; - case 1: - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 25)); - break; - case 2: - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 25)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 25)); - break; - case 3: - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 25)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 25)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 143, 25)); - break; - case 4: - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 16)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 16)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 34)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 34)); - break; - case 5: - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 16)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 16)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 143, 16)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 34)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 34)); - break; - case 6: - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 16)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 16)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 143, 16)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 34)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 34)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 143, 34)); - break; - case 7: - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 7)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 7)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 143, 7)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 25)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 25)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 143, 25)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 43)); - break; - case 8: - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 7)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 7)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 143, 7)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 25)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 25)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 143, 25)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 43)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 43)); - break; default: - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 7)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 7)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 143, 7)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 25)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 25)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 143, 25)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 107, 43)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 125, 43)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, tStartIndex++, 143, 43)); break; } @@ -215,6 +95,7 @@ public class CONTAINER_PollutionCleaner extends GT_Container_BasicTank { mFluidTransfer = ((GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity()).mFluidTransfer; mItemTransfer = ((GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity()).mItemTransfer; mStuttering = ((GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity()).mStuttering; + mReduction = ((GregtechMetaAtmosphericReconditioner) mTileEntity.getMetaTileEntity()).mPollutionReduction; Iterator var2 = this.crafters.iterator(); while (var2.hasNext()) { @@ -222,6 +103,7 @@ public class CONTAINER_PollutionCleaner extends GT_Container_BasicTank { var1.sendProgressBarUpdate(this, 102, mFluidTransfer ? 1 : 0); var1.sendProgressBarUpdate(this, 103, mItemTransfer ? 1 : 0); var1.sendProgressBarUpdate(this, 104, mStuttering ? 1 : 0); + var1.sendProgressBarUpdate(this, 105, mReduction); } } @@ -244,6 +126,9 @@ public class CONTAINER_PollutionCleaner extends GT_Container_BasicTank { case 104: mStuttering = (par2 != 0); break; + case 105: + mReduction = (par2); + break; } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/basic/GUI_PollutionCleaner.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/basic/GUI_PollutionCleaner.java index edc1ad4c8b..2c1601cee2 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/basic/GUI_PollutionCleaner.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/basic/GUI_PollutionCleaner.java @@ -6,15 +6,20 @@ import java.util.List; import net.minecraft.entity.player.InventoryPlayer; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; - +import gregtech.api.util.GT_Utility; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_ControlCore; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaAtmosphericReconditioner; public class GUI_PollutionCleaner extends GT_GUIContainerMetaTile_Machine { public final String mName; public final String mNEI; public final byte mProgressBarDirection; public final byte mProgressBarAmount; + public int mReduction; public GUI_PollutionCleaner(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final String aName, final String aTextureFile) { @@ -50,6 +55,12 @@ public class GUI_PollutionCleaner extends GT_GUIContainerMetaTile_Machine { if (x3 >= 25 && x3 <= 42) { list.add("Item Auto-Output"); } + if (x3 >= 77 && x3 <= 95) { + //Do Dumb shit + CONTAINER_PollutionCleaner aContainerCast = (CONTAINER_PollutionCleaner) this.mContainer; + mReduction = aContainerCast.mReduction; + list.add("Reduction: "+mReduction); + } } if (!list.isEmpty()) { this.drawHoveringText(list, x3, y3, this.fontRendererObj); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java index df71432663..ac2320afdb 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java @@ -179,4 +179,6 @@ public interface IGregtech_RecipeAdder { public boolean addBrewingRecipe(ItemStack aIngredient, FluidStack aInput, FluidStack aOutput, int aTime, int aEu, boolean aHidden); public boolean addBrewingRecipe(int aCircuit, FluidStack aInput, FluidStack aOutput, int aTime, int aEu, boolean aHidden); + + public boolean addSmeltingAndAlloySmeltingRecipe(ItemStack aDust, ItemStack aOutput); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/BaseCustomTileEntity.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/BaseCustomTileEntity.java new file mode 100644 index 0000000000..214fcc6a3f --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/BaseCustomTileEntity.java @@ -0,0 +1,479 @@ +package gtPlusPlus.xmod.gregtech.api.metatileentity; + +import java.util.ArrayList; +import java.util.Arrays; + +import gregtech.GT_Mod; +import gregtech.api.GregTech_API; +import gregtech.api.enums.GT_Values; +import gregtech.api.metatileentity.BaseMetaTileEntity; +import gregtech.api.util.GT_Log; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_Utility; +import gregtech.common.GT_Pollution; +import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; +import ic2.api.Direction; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; + +public class BaseCustomTileEntity extends BaseMetaTileEntity { + + protected boolean mHasEnoughEnergy; + + protected short mID; + protected long oOutput; + + protected long mAcceptedAmperes; + protected NBTTagCompound mRecipeStuff; + + + + protected boolean[] mActiveEUInputs; + protected boolean[] mActiveEUOutputs; + + public BaseCustomTileEntity() { + super(); + } + + public void writeToNBT(NBTTagCompound aNBT) { + try { + super.writeToNBT(aNBT); + } catch (Throwable arg7) { + GT_Log.err.println( + "Encountered CRITICAL ERROR while saving MetaTileEntity, the Chunk whould\'ve been corrupted by now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!"); + arg7.printStackTrace(GT_Log.err); + } + + try { + aNBT.setInteger("nbtVersion", GT_Mod.TOTAL_VERSION); + } catch (Throwable arg6) { + GT_Log.err.println( + "Encountered CRITICAL ERROR while saving MetaTileEntity, the Chunk whould\'ve been corrupted by now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!"); + arg6.printStackTrace(GT_Log.err); + } + + } + + public void readFromNBT(NBTTagCompound aNBT) { + super.readFromNBT(aNBT); + this.setInitialValuesAsNBT(aNBT, (short) 0); + } + + public void updateStatus() { + } + + public void chargeItem(ItemStack aStack) { + this.decreaseStoredEU( + (long) GT_ModHandler.chargeElectricItem(aStack, (int) Math.min(2147483647L, this.getStoredEU()), + (int) Math.min(2147483647L, this.mMetaTileEntity.getOutputTier()), false, false), + true); + } + + public void dischargeItem(ItemStack aStack) { + this.increaseStoredEnergyUnits((long) GT_ModHandler.dischargeElectricItem(aStack, + (int) Math.min(2147483647L, this.getEUCapacity() - this.getStoredEU()), + (int) Math.min(2147483647L, this.mMetaTileEntity.getInputTier()), false, false, false), true); + } + + public boolean decreaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooLessEnergy) { + return !this.canAccessData() ? false + : (this.mHasEnoughEnergy = this.decreaseStoredEU(aEnergy, aIgnoreTooLessEnergy) + || this.decreaseStoredSteam(aEnergy, false) + || aIgnoreTooLessEnergy && this.decreaseStoredSteam(aEnergy, true)); + } + + 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; + } + } + + public boolean inputEnergyFrom(byte aSide) { + return aSide == 6 ? true + : (!this.isServerSide() ? this.isEnergyInputSide(aSide) + : aSide >= 0 && aSide < 6 && this.mActiveEUInputs[aSide] && !this.mReleaseEnergy); + } + + public boolean outputsEnergyTo(byte aSide) { + return aSide == 6 ? true + : (!this.isServerSide() ? this.isEnergyOutputSide(aSide) + : aSide >= 0 && aSide < 6 && this.mActiveEUOutputs[aSide] || this.mReleaseEnergy); + } + + 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; + } + + public boolean increaseStoredSteam(long aEnergy, boolean aIgnoreTooMuchEnergy) { + if (!this.canAccessData()) { + return false; + } else if (this.mMetaTileEntity.getSteamVar() >= this.getSteamCapacity() && !aIgnoreTooMuchEnergy) { + return false; + } else { + this.setStoredSteam(this.mMetaTileEntity.getSteamVar() + aEnergy); + return true; + } + } + + public long getUniversalEnergyStored() { + return Math.max(this.getStoredEU(), this.getStoredSteam()); + } + + public long getUniversalEnergyCapacity() { + return Math.max(this.getEUCapacity(), this.getSteamCapacity()); + } + + public long getStoredEU() { + return this.canAccessData() ? Math.min(this.mMetaTileEntity.getEUVar(), this.getEUCapacity()) : 0L; + } + + public long getEUCapacity() { + return this.canAccessData() ? this.mMetaTileEntity.maxEUStore() : 0L; + } + + 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; + } + + public boolean setStoredEU(long aEnergy) { + if (!this.canAccessData()) { + return false; + } else { + if (aEnergy < 0L) { + aEnergy = 0L; + } + + this.mMetaTileEntity.setEUVar(aEnergy); + return true; + } + } + + public boolean decreaseStoredEU(long aEnergy, boolean aIgnoreTooLessEnergy) { + if (!this.canAccessData()) { + return false; + } else if (this.mMetaTileEntity.getEUVar() - aEnergy < 0L && !aIgnoreTooLessEnergy) { + return false; + } else { + this.setStoredEU(this.mMetaTileEntity.getEUVar() - aEnergy); + if (this.mMetaTileEntity.getEUVar() < 0L) { + this.setStoredEU(0L); + return false; + } else { + return true; + } + } + } + + public void doEnergyExplosion() { + if (this.getUniversalEnergyCapacity() > 0L + && this.getUniversalEnergyStored() >= this.getUniversalEnergyCapacity() / 5L) { + this.doExplosion( + this.oOutput * (long) (this.getUniversalEnergyStored() >= this.getUniversalEnergyCapacity() ? 4 + : (this.getUniversalEnergyStored() >= this.getUniversalEnergyCapacity() / 2L ? 2 : 1))); + GT_Mod arg9999 = GT_Mod.instance; + GT_Mod.achievements.issueAchievement(this.getWorldObj().getPlayerEntityByName(this.getOwnerName()), + "electricproblems"); + } + + } + + public void doExplosion(long aAmount) { + if (this.canAccessData()) { + if (GregTech_API.sMachineWireFire && this.mMetaTileEntity.isElectric()) { + try { + this.mReleaseEnergy = true; + Util.emitEnergyToNetwork(GT_Values.V[5], Math.max(1L, this.getStoredEU() / GT_Values.V[5]), this); + } catch (Exception arg4) { + ; + } + } + + this.mReleaseEnergy = false; + this.mMetaTileEntity.onExplosion(); + int i; + if (GT_Mod.gregtechproxy.mExplosionItemDrop) { + for (i = 0; i < this.getSizeInventory(); ++i) { + ItemStack tItem = this.getStackInSlot(i); + if (tItem != null && tItem.stackSize > 0 && this.isValidSlot(i)) { + this.dropItems(tItem); + this.setInventorySlotContents(i, (ItemStack) null); + } + } + } + + if (this.mRecipeStuff != null) { + for (i = 0; i < 9; ++i) { + if (this.getRandomNumber(100) < 50) { + this.dropItems(GT_Utility.loadItem(this.mRecipeStuff, "Ingredient." + i)); + } + } + } + + GT_Pollution.addPollution(this, 100000); + this.mMetaTileEntity.doExplosion(aAmount); + } + + } + + public ArrayList<ItemStack> getDrops() { + ItemStack rStack = new ItemStack(Meta_GT_Proxy.sBlockMachines, 1, this.mID); + NBTTagCompound aSuperNBT = super.getDrops().get(0).getTagCompound(); + NBTTagCompound tNBT = aSuperNBT; + if (this.hasValidMetaTileEntity()) { + this.mMetaTileEntity.setItemNBT(tNBT); + } + if (!tNBT.hasNoTags()) { + rStack.setTagCompound(tNBT); + } + + return new ArrayList<ItemStack>(Arrays.asList(new ItemStack[] { rStack })); + } + + public long getAverageElectricInput() { + int rEU = 0; + + for (int i = 0; i < this.mAverageEUInput.length; ++i) { + if (i != this.mAverageEUInputIndex) { + rEU += this.mAverageEUInput[i]; + } + } + + return (long) (rEU / (this.mAverageEUInput.length - 1)); + } + + public long getAverageElectricOutput() { + int rEU = 0; + + for (int i = 0; i < this.mAverageEUOutput.length; ++i) { + if (i != this.mAverageEUOutputIndex) { + rEU += this.mAverageEUOutput[i]; + } + } + + return (long) (rEU / (this.mAverageEUOutput.length - 1)); + } + + public long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage) { + if (this.canAccessData() && this.mMetaTileEntity.isElectric() && this.inputEnergyFrom(aSide) && aAmperage > 0L + && aVoltage > 0L && this.getStoredEU() < this.getEUCapacity() + && this.mMetaTileEntity.maxAmperesIn() > this.mAcceptedAmperes) { + if (aVoltage > this.getInputVoltage()) { + this.doExplosion(aVoltage); + return 0L; + } else if (this + .increaseStoredEnergyUnits( + aVoltage * (aAmperage = Math + .min(aAmperage, + Math.min(this.mMetaTileEntity.maxAmperesIn() - this.mAcceptedAmperes, + 1L + (this.getEUCapacity() - this.getStoredEU()) / aVoltage))), + true)) { + this.mAverageEUInput[this.mAverageEUInputIndex] = (int) ((long) this.mAverageEUInput[this.mAverageEUInputIndex] + + aVoltage * aAmperage); + this.mAcceptedAmperes += aAmperage; + return aAmperage; + } else { + return 0L; + } + } else { + return 0L; + } + } + + public boolean drainEnergyUnits(byte aSide, long aVoltage, long aAmperage) { + if (this.canAccessData() && this.mMetaTileEntity.isElectric() && this.outputsEnergyTo(aSide) + && this.getStoredEU() - aVoltage * aAmperage >= this.mMetaTileEntity.getMinimumStoredEU()) { + if (this.decreaseStoredEU(aVoltage * aAmperage, false)) { + this.mAverageEUOutput[this.mAverageEUOutputIndex] = (int) ((long) this.mAverageEUOutput[this.mAverageEUOutputIndex] + + aVoltage * aAmperage); + return true; + } else { + return false; + } + } else { + return false; + } + } + + public boolean acceptsRotationalEnergy(byte aSide) { + return this.canAccessData() && this.getCoverIDAtSide(aSide) == 0 + ? this.mMetaTileEntity.acceptsRotationalEnergy(aSide) + : false; + } + + public boolean injectRotationalEnergy(byte aSide, long aSpeed, long aEnergy) { + return this.canAccessData() && this.getCoverIDAtSide(aSide) == 0 + ? this.mMetaTileEntity.injectRotationalEnergy(aSide, aSpeed, aEnergy) + : false; + } + + public double getOutputEnergyUnitsPerTick() { + return (double) this.oOutput; + } + + public double demandedEnergyUnits() { + return !this.mReleaseEnergy && this.canAccessData() && this.mMetaTileEntity.isEnetInput() + ? (double) (this.getEUCapacity() - this.getStoredEU()) + : 0.0D; + } + + public double injectEnergyUnits(ForgeDirection aDirection, double aAmount) { + return this.injectEnergyUnits((byte) aDirection.ordinal(), (long) ((int) aAmount), 1L) > 0L ? 0.0D : aAmount; + } + + public boolean acceptsEnergyFrom(TileEntity aEmitter, ForgeDirection aDirection) { + return this.inputEnergyFrom((byte) aDirection.ordinal()); + } + + public boolean emitsEnergyTo(TileEntity aReceiver, ForgeDirection aDirection) { + return this.outputsEnergyTo((byte) aDirection.ordinal()); + } + + public double getOfferedEnergy() { + return this.canAccessData() && this.getStoredEU() - this.mMetaTileEntity.getMinimumStoredEU() >= this.oOutput + ? (double) Math.max(0L, this.oOutput) + : 0.0D; + } + + public void drawEnergy(double amount) { + this.mAverageEUOutput[this.mAverageEUOutputIndex] = (int) ((double) this.mAverageEUOutput[this.mAverageEUOutputIndex] + + amount); + this.decreaseStoredEU((long) ((int) amount), true); + } + + public int injectEnergy(ForgeDirection aForgeDirection, int aAmount) { + return this.injectEnergyUnits((byte) aForgeDirection.ordinal(), (long) aAmount, 1L) > 0L ? 0 : aAmount; + } + + public int addEnergy(int aEnergy) { + if (!this.canAccessData()) { + return 0; + } else { + if (aEnergy > 0) { + this.increaseStoredEnergyUnits((long) aEnergy, true); + } else { + this.decreaseStoredEU((long) (-aEnergy), true); + } + + return (int) Math.min(2147483647L, this.mMetaTileEntity.getEUVar()); + } + } + + public boolean isAddedToEnergyNet() { + return false; + } + + public int demandsEnergy() { + return !this.mReleaseEnergy && this.canAccessData() && this.mMetaTileEntity.isEnetInput() + ? this.getCapacity() - this.getStored() + : 0; + } + + public int getCapacity() { + return (int) Math.min(2147483647L, this.getEUCapacity()); + } + + public int getStored() { + return (int) Math.min(2147483647L, Math.min(this.getStoredEU(), (long) this.getCapacity())); + } + + public void setStored(int aEU) { + if (this.canAccessData()) { + this.setStoredEU((long) aEU); + } + + } + + public int getMaxSafeInput() { + return (int) Math.min(2147483647L, this.getInputVoltage()); + } + + public int getMaxEnergyOutput() { + return this.mReleaseEnergy ? Integer.MAX_VALUE : this.getOutput(); + } + + public int getOutput() { + return (int) Math.min(2147483647L, this.oOutput); + } + + public int injectEnergy(Direction aDirection, int aAmount) { + return this.injectEnergyUnits((byte) aDirection.toSideValue(), (long) aAmount, 1L) > 0L ? 0 : aAmount; + } + + public boolean isTeleporterCompatible(Direction aSide) { + return this.canAccessData() && this.mMetaTileEntity.isTeleporterCompatible(); + } + + public boolean acceptsEnergyFrom(TileEntity aReceiver, Direction aDirection) { + return this.inputEnergyFrom((byte) aDirection.toSideValue()); + } + + public boolean emitsEnergyTo(TileEntity aReceiver, Direction aDirection) { + return this.outputsEnergyTo((byte) aDirection.toSideValue()); + } + + public boolean isUniversalEnergyStored(long aEnergyAmount) { + if (this.getUniversalEnergyStored() >= aEnergyAmount) { + return true; + } else { + this.mHasEnoughEnergy = false; + return false; + } + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/BaseCustomPower_MTE.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/BaseCustomPower_MTE.java new file mode 100644 index 0000000000..e39c65b82f --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/BaseCustomPower_MTE.java @@ -0,0 +1,291 @@ +package gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power; + +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.xmod.gregtech.api.metatileentity.BaseCustomTileEntity; +import ic2.api.Direction; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; + +public class BaseCustomPower_MTE extends BaseCustomTileEntity { + + public long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage) { + //Logger.INFO("Injecting Energy Units"); + + if (mMetaTileEntity == null) { + Logger.INFO("Bad Tile"); + + } + + if (this.canAccessData() && this.mMetaTileEntity.isElectric() && this.inputEnergyFrom(aSide) && aAmperage > 0L + && aVoltage > 0L && this.getStoredEU() < this.getEUCapacity() + && this.mMetaTileEntity.maxAmperesIn() > this.mAcceptedAmperes) { + Logger.INFO("Injecting Energy Units"); + if (aVoltage > this.getInputVoltage()) { + this.doExplosion(aVoltage); + return 0L; + } else if (this + .increaseStoredEnergyUnits( + aVoltage * (aAmperage = Math + .min(aAmperage, + Math.min(this.mMetaTileEntity.maxAmperesIn() - this.mAcceptedAmperes, + 1L + (this.getEUCapacity() - this.getStoredEU()) / aVoltage))), + true)) { + Logger.INFO("Injecting Energy Units"); + this.mAverageEUInput[this.mAverageEUInputIndex] = (int) ((long) this.mAverageEUInput[this.mAverageEUInputIndex] + + aVoltage * aAmperage); + this.mAcceptedAmperes += aAmperage; + return aAmperage; + } else { + return 0L; + } + } else { + Logger.INFO("canAccessData(): "+canAccessData()); + Logger.INFO("isElectric(): "+this.mMetaTileEntity.isElectric()); + Logger.INFO("InputEnergyFromSide("+aSide+"): "+this.inputEnergyFrom(aSide)); + Logger.INFO("aAmperage: "+aAmperage); + Logger.INFO("aVoltage: "+aVoltage); + Logger.INFO("this.getStoredEU() < this.getEUCapacity(): "+(this.getStoredEU() < this.getEUCapacity())); + Logger.INFO("this.mMetaTileEntity.maxAmperesIn() > this.mAcceptedAmperes: "+(this.mMetaTileEntity.maxAmperesIn() > this.mAcceptedAmperes)); + return 0L; + } + } + + public boolean drainEnergyUnits(byte aSide, long aVoltage, long aAmperage) { + Logger.INFO("Draining Energy Units"); + if (this.canAccessData() && this.mMetaTileEntity.isElectric() && this.outputsEnergyTo(aSide) + && this.getStoredEU() - aVoltage * aAmperage >= this.mMetaTileEntity.getMinimumStoredEU()) { + if (this.decreaseStoredEU(aVoltage * aAmperage, false)) { + this.mAverageEUOutput[this.mAverageEUOutputIndex] = (int) ((long) this.mAverageEUOutput[this.mAverageEUOutputIndex] + + aVoltage * aAmperage); + return true; + } else { + return false; + } + } else { + return false; + } + } + + @Override + public boolean decreaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooLessEnergy) { + // TODO Auto-generated method stub + return super.decreaseStoredEnergyUnits(aEnergy, aIgnoreTooLessEnergy); + } + + @Override + public boolean increaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooMuchEnergy) { + // TODO Auto-generated method stub + return super.increaseStoredEnergyUnits(aEnergy, aIgnoreTooMuchEnergy); + } + + @Override + public boolean inputEnergyFrom(byte aSide) { + // TODO Auto-generated method stub + return super.inputEnergyFrom(aSide); + } + + @Override + public boolean outputsEnergyTo(byte aSide) { + // TODO Auto-generated method stub + return super.outputsEnergyTo(aSide); + } + + @Override + public long getOutputAmperage() { + // TODO Auto-generated method stub + return super.getOutputAmperage(); + } + + @Override + public long getOutputVoltage() { + // TODO Auto-generated method stub + return super.getOutputVoltage(); + } + + @Override + public long getInputAmperage() { + // TODO Auto-generated method stub + return super.getInputAmperage(); + } + + @Override + public long getInputVoltage() { + // TODO Auto-generated method stub + return super.getInputVoltage(); + } + + @Override + public long getUniversalEnergyStored() { + // TODO Auto-generated method stub + return super.getUniversalEnergyStored(); + } + + @Override + public long getUniversalEnergyCapacity() { + // TODO Auto-generated method stub + return super.getUniversalEnergyCapacity(); + } + + @Override + public long getStoredEU() { + // TODO Auto-generated method stub + return super.getStoredEU(); + } + + @Override + public long getEUCapacity() { + // TODO Auto-generated method stub + return super.getEUCapacity(); + } + + @Override + public boolean setStoredEU(long aEnergy) { + // TODO Auto-generated method stub + return super.setStoredEU(aEnergy); + } + + @Override + public boolean decreaseStoredEU(long aEnergy, boolean aIgnoreTooLessEnergy) { + // TODO Auto-generated method stub + return super.decreaseStoredEU(aEnergy, aIgnoreTooLessEnergy); + } + + @Override + public boolean decreaseStoredSteam(long aEnergy, boolean aIgnoreTooLessEnergy) { + // TODO Auto-generated method stub + return super.decreaseStoredSteam(aEnergy, aIgnoreTooLessEnergy); + } + + @Override + public void doEnergyExplosion() { + // TODO Auto-generated method stub + super.doEnergyExplosion(); + } + + @Override + public void doExplosion(long aAmount) { + // TODO Auto-generated method stub + super.doExplosion(aAmount); + } + + @Override + public byte getLightValue() { + // TODO Auto-generated method stub + return super.getLightValue(); + } + + @Override + public long getAverageElectricInput() { + // TODO Auto-generated method stub + return super.getAverageElectricInput(); + } + + @Override + public long getAverageElectricOutput() { + // TODO Auto-generated method stub + return super.getAverageElectricOutput(); + } + + @Override + public double getOutputEnergyUnitsPerTick() { + // TODO Auto-generated method stub + return super.getOutputEnergyUnitsPerTick(); + } + + @Override + public double demandedEnergyUnits() { + // TODO Auto-generated method stub + return super.demandedEnergyUnits(); + } + + @Override + public double injectEnergyUnits(ForgeDirection aDirection, double aAmount) { + // TODO Auto-generated method stub + return super.injectEnergyUnits(aDirection, aAmount); + } + + @Override + public boolean acceptsEnergyFrom(TileEntity aEmitter, ForgeDirection aDirection) { + // TODO Auto-generated method stub + return super.acceptsEnergyFrom(aEmitter, aDirection); + } + + @Override + public boolean emitsEnergyTo(TileEntity aReceiver, ForgeDirection aDirection) { + // TODO Auto-generated method stub + return super.emitsEnergyTo(aReceiver, aDirection); + } + + @Override + public double getOfferedEnergy() { + // TODO Auto-generated method stub + return super.getOfferedEnergy(); + } + + @Override + public void drawEnergy(double amount) { + // TODO Auto-generated method stub + super.drawEnergy(amount); + } + + @Override + public int injectEnergy(ForgeDirection aForgeDirection, int aAmount) { + // TODO Auto-generated method stub + return super.injectEnergy(aForgeDirection, aAmount); + } + + @Override + public int addEnergy(int aEnergy) { + // TODO Auto-generated method stub + return super.addEnergy(aEnergy); + } + + @Override + public boolean isAddedToEnergyNet() { + // TODO Auto-generated method stub + return super.isAddedToEnergyNet(); + } + + @Override + public int demandsEnergy() { + // TODO Auto-generated method stub + return super.demandsEnergy(); + } + + @Override + public int getMaxSafeInput() { + // TODO Auto-generated method stub + return super.getMaxSafeInput(); + } + + @Override + public int getMaxEnergyOutput() { + // TODO Auto-generated method stub + return super.getMaxEnergyOutput(); + } + + @Override + public int injectEnergy(Direction aDirection, int aAmount) { + // TODO Auto-generated method stub + return super.injectEnergy(aDirection, aAmount); + } + + @Override + public boolean acceptsEnergyFrom(TileEntity aReceiver, Direction aDirection) { + // TODO Auto-generated method stub + return super.acceptsEnergyFrom(aReceiver, aDirection); + } + + @Override + public boolean emitsEnergyTo(TileEntity aReceiver, Direction aDirection) { + // TODO Auto-generated method stub + return super.emitsEnergyTo(aReceiver, aDirection); + } + + @Override + public boolean isUniversalEnergyStored(long aEnergyAmount) { + // TODO Auto-generated method stub + return super.isUniversalEnergyStored(aEnergyAmount); + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicMachine.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicMachine.java new file mode 100644 index 0000000000..b0dc635aee --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicMachine.java @@ -0,0 +1,872 @@ +package gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power; + +import gregtech.GT_Mod; +import gregtech.api.GregTech_API; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Textures; +import gregtech.api.gui.GT_Container_BasicMachine; +import gregtech.api.gui.GT_GUIContainer_BasicMachine; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; +import gregtech.api.objects.GT_ItemStack; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.objects.XSTR; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gregtech.api.util.GT_Utility; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.DimensionManager; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.IFluidHandler; + +import java.util.Arrays; + +import static gregtech.api.enums.GT_Values.V; + +/** + * NEVER INCLUDE THIS FILE IN YOUR MOD!!! + * <p/> + * This is the main construct for my Basic Machines such as the Automatic Extractor + * Extend this class to make a simple Machine + */ +public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { + /** + * return values for checkRecipe() + */ + protected static final int + DID_NOT_FIND_RECIPE = 0, + FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS = 1, + FOUND_AND_SUCCESSFULLY_USED_RECIPE = 2; + public static final int OTHER_SLOT_COUNT = 4; + public final ItemStack[] mOutputItems; + public final int mInputSlotCount, mAmperage; + public boolean mAllowInputFromOutputSide = false, mFluidTransfer = false, mItemTransfer = false, mHasBeenUpdated = false, mStuttering = false, mCharge = false, mDecharge = false; + public int mMainFacing = -1, mProgresstime = 0, mMaxProgresstime = 0, mEUt = 0, mOutputBlocked = 0; + public FluidStack mOutputFluid; + public String mGUIName = "", mNEIName = ""; + public GT_MetaTileEntity_MultiBlockBase mCleanroom; + /** + * Contains the Recipe which has been previously used, or null if there was no previous Recipe, which could have been buffered + */ + protected GT_Recipe mLastRecipe = null; + private FluidStack mFluidOut; + + /** + * @param aOverlays 0 = SideFacingActive + * 1 = SideFacingInactive + * 2 = FrontFacingActive + * 3 = FrontFacingInactive + * 4 = TopFacingActive + * 5 = TopFacingInactive + * 6 = BottomFacingActive + * 7 = BottomFacingInactive + * ----- Not all Array Elements have to be initialised, you can also just use 8 Parameters for the Default Pipe Texture Overlays ----- + * 8 = BottomFacingPipeActive + * 9 = BottomFacingPipeInactive + * 10 = TopFacingPipeActive + * 11 = TopFacingPipeInactive + * 12 = SideFacingPipeActive + * 13 = SideFacingPipeInactive + */ + public GTPP_MTE_BasicMachine(int aID, String aName, String aNameRegional, int aTier, int aAmperage, String aDescription, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName, ITexture... aOverlays) { + super(aID, aName, aNameRegional, aTier, OTHER_SLOT_COUNT + aInputSlotCount + aOutputSlotCount + 1, aDescription, aOverlays); + mInputSlotCount = Math.max(0, aInputSlotCount); + mOutputItems = new ItemStack[Math.max(0, aOutputSlotCount)]; + mAmperage = aAmperage; + mGUIName = aGUIName; + mNEIName = aNEIName; + } + + public GTPP_MTE_BasicMachine(int aID, String aName, String aNameRegional, int aTier, int aAmperage, String[] aDescription, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName, ITexture... aOverlays) { + super(aID, aName, aNameRegional, aTier, OTHER_SLOT_COUNT + aInputSlotCount + aOutputSlotCount + 1, aDescription, aOverlays); + mInputSlotCount = Math.max(0, aInputSlotCount); + mOutputItems = new ItemStack[Math.max(0, aOutputSlotCount)]; + mAmperage = aAmperage; + mGUIName = aGUIName; + mNEIName = aNEIName; + } + + public GTPP_MTE_BasicMachine(String aName, int aTier, int aAmperage, String aDescription, ITexture[][][] aTextures, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName) { + super(aName, aTier, OTHER_SLOT_COUNT + aInputSlotCount + aOutputSlotCount + 1, aDescription, aTextures); + mInputSlotCount = Math.max(0, aInputSlotCount); + mOutputItems = new ItemStack[Math.max(0, aOutputSlotCount)]; + mAmperage = aAmperage; + mGUIName = aGUIName; + mNEIName = aNEIName; + } + + public GTPP_MTE_BasicMachine(String aName, int aTier, int aAmperage, String[] aDescription, ITexture[][][] aTextures, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName) { + super(aName, aTier, OTHER_SLOT_COUNT + aInputSlotCount + aOutputSlotCount + 1, aDescription, aTextures); + mInputSlotCount = Math.max(0, aInputSlotCount); + mOutputItems = new ItemStack[Math.max(0, aOutputSlotCount)]; + mAmperage = aAmperage; + mGUIName = aGUIName; + mNEIName = aNEIName; + } + + protected boolean isValidMainFacing(byte aSide) { + return aSide > 1; + } + + public boolean setMainFacing(byte aSide){ + if (!isValidMainFacing(aSide)) return false; + mMainFacing = aSide; + if(getBaseMetaTileEntity().getFrontFacing() == mMainFacing){ + getBaseMetaTileEntity().setFrontFacing(GT_Utility.getOppositeSide(aSide)); + } + onFacingChange(); + onMachineBlockUpdate(); + return true; + } + + @Override + public ITexture[][][] getTextureSet(ITexture[] aTextures) { + ITexture[][][] rTextures = new ITexture[14][17][]; + aTextures = Arrays.copyOf(aTextures, 14); + + for (int i = 0; i < aTextures.length; i++) + if (aTextures[i] != null) for (byte c = -1; c < 16; c++) { + if (rTextures[i][c + 1] == null) + rTextures[i][c + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][c + 1], aTextures[i]}; + } + + for (byte c = -1; c < 16; c++) { + if (rTextures[0][c + 1] == null) rTextures[0][c + 1] = getSideFacingActive(c); + if (rTextures[1][c + 1] == null) rTextures[1][c + 1] = getSideFacingInactive(c); + if (rTextures[2][c + 1] == null) rTextures[2][c + 1] = getFrontFacingActive(c); + if (rTextures[3][c + 1] == null) rTextures[3][c + 1] = getFrontFacingInactive(c); + if (rTextures[4][c + 1] == null) rTextures[4][c + 1] = getTopFacingActive(c); + if (rTextures[5][c + 1] == null) rTextures[5][c + 1] = getTopFacingInactive(c); + if (rTextures[6][c + 1] == null) rTextures[6][c + 1] = getBottomFacingActive(c); + if (rTextures[7][c + 1] == null) rTextures[7][c + 1] = getBottomFacingInactive(c); + if (rTextures[8][c + 1] == null) rTextures[8][c + 1] = getBottomFacingPipeActive(c); + if (rTextures[9][c + 1] == null) rTextures[9][c + 1] = getBottomFacingPipeInactive(c); + if (rTextures[10][c + 1] == null) rTextures[10][c + 1] = getTopFacingPipeActive(c); + if (rTextures[11][c + 1] == null) rTextures[11][c + 1] = getTopFacingPipeInactive(c); + if (rTextures[12][c + 1] == null) rTextures[12][c + 1] = getSideFacingPipeActive(c); + if (rTextures[13][c + 1] == null) rTextures[13][c + 1] = getSideFacingPipeInactive(c); + } + return rTextures; + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + return mTextures[mMainFacing < 2 ? aSide == aFacing ? aActive ? 2 : 3 : aSide == 0 ? aActive ? 6 : 7 : aSide == 1 ? aActive ? 4 : 5 : aActive ? 0 : 1 : aSide == mMainFacing ? aActive ? 2 : 3 : (showPipeFacing() && aSide == aFacing) ? aSide == 0 ? aActive ? 8 : 9 : aSide == 1 ? aActive ? 10 : 11 : aActive ? 12 : 13 : aSide == 0 ? aActive ? 6 : 7 : aSide == 1 ? aActive ? 4 : 5 : aActive ? 0 : 1][aColorIndex + 1]; + } + + @Override + public boolean isSimpleMachine() { + return false; + } + + @Override + public boolean isOverclockerUpgradable() { + return false; + } + + @Override + public boolean isTransformerUpgradable() { + return false; + } + + @Override + public boolean isElectric() { + return true; + } + + @Override + public boolean isValidSlot(int aIndex) { + return aIndex > 0 && super.isValidSlot(aIndex) && aIndex != OTHER_SLOT_COUNT + mInputSlotCount + mOutputItems.length; + } + + @Override + public boolean isFacingValid(byte aFacing) { + return mMainFacing > 1 || aFacing > 1; + } + + @Override + public boolean isEnetInput() { + return true; + } + + @Override + public boolean isInputFacing(byte aSide) { + return aSide != mMainFacing; + } + + @Override + public boolean isOutputFacing(byte aSide) { + return false; + } + + @Override + public boolean isTeleporterCompatible() { + return false; + } + + @Override + public boolean isLiquidInput(byte aSide) { + return aSide != mMainFacing && (mAllowInputFromOutputSide || aSide != getBaseMetaTileEntity().getFrontFacing()); + } + + @Override + public boolean isLiquidOutput(byte aSide) { + return aSide != mMainFacing; + } + + @Override + public long getMinimumStoredEU() { + return V[mTier] * 16; + } + + @Override + public long maxEUStore() { + return V[mTier] * 64; + } + + @Override + public long maxEUInput() { + return V[mTier]; + } + + @Override + public long maxSteamStore() { + return maxEUStore(); + } + + @Override + public long maxAmperesIn() { + return (mEUt * 2) / V[mTier] + 1; + } + + @Override + public int getInputSlot() { + return OTHER_SLOT_COUNT; + } + + @Override + public int getOutputSlot() { + return OTHER_SLOT_COUNT + mInputSlotCount; + } + + @Override + public int getStackDisplaySlot() { + return 2; + } + + @Override + public int rechargerSlotStartIndex() { + return 1; + } + + @Override + public int dechargerSlotStartIndex() { + return 1; + } + + @Override + public int rechargerSlotCount() { + return mCharge ? 1 : 0; + } + + @Override + public int dechargerSlotCount() { + return mDecharge ? 1 : 0; + } + + @Override + public boolean isAccessAllowed(EntityPlayer aPlayer) { + return true; + } + + @Override + public int getProgresstime() { + return mProgresstime; + } + + @Override + public int maxProgresstime() { + return mMaxProgresstime; + } + + @Override + public int increaseProgress(int aProgress) { + mProgresstime += aProgress; + return mMaxProgresstime - mProgresstime; + } + + @Override + public boolean isFluidInputAllowed(FluidStack aFluid) { + return getFillableStack() != null || (getRecipeList() != null && getRecipeList().containsInput(aFluid)); + } + + @Override + public boolean isFluidChangingAllowed() { + return true; + } + + @Override + public boolean doesFillContainers() { + return false; + } + + @Override + public boolean doesEmptyContainers() { + return false; + } + + @Override + public boolean canTankBeFilled() { + return true; + } + + @Override + public boolean canTankBeEmptied() { + return true; + } + + @Override + public boolean displaysItemStack() { + return true; + } + + @Override + public boolean displaysStackSize() { + return true; + } + + @Override + public FluidStack getDisplayedFluid() { + return displaysOutputFluid() ? getDrainableStack() : null; + } + + @Override + public FluidStack getDrainableStack() { + return mFluidOut; + } + + @Override + public FluidStack setDrainableStack(FluidStack aFluid) { + mFluidOut = aFluid; + return mFluidOut; + } + + @Override + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + if (aBaseMetaTileEntity.isClientSide()) return true; + if(!GT_Mod.gregtechproxy.mForceFreeFace) { + aBaseMetaTileEntity.openGUI(aPlayer); + return true; + } + for(byte i=0;i < 6; i++){ + if(aBaseMetaTileEntity.getAirAtSide(i)){ + aBaseMetaTileEntity.openGUI(aPlayer); + return true; + } + } + GT_Utility.sendChatToPlayer(aPlayer,"No free Side!"); + return true; + } + + @Override + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_Container_BasicMachine(aPlayerInventory, aBaseMetaTileEntity); + } + + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_BasicMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), mGUIName, GT_Utility.isStringValid(mNEIName) ? mNEIName : getRecipeList() != null ? getRecipeList().mUnlocalizedName : ""); + } + + @Override + public void initDefaultModes(NBTTagCompound aNBT) { + mMainFacing = -1; + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setBoolean("mFluidTransfer", mFluidTransfer); + aNBT.setBoolean("mItemTransfer", mItemTransfer); + aNBT.setBoolean("mHasBeenUpdated", mHasBeenUpdated); + aNBT.setBoolean("mAllowInputFromOutputSide", mAllowInputFromOutputSide); + aNBT.setInteger("mEUt", mEUt); + aNBT.setInteger("mMainFacing", mMainFacing); + aNBT.setInteger("mProgresstime", mProgresstime); + aNBT.setInteger("mMaxProgresstime", mMaxProgresstime); + if (mOutputFluid != null) aNBT.setTag("mOutputFluid", mOutputFluid.writeToNBT(new NBTTagCompound())); + if (mFluidOut != null) aNBT.setTag("mFluidOut", mFluidOut.writeToNBT(new NBTTagCompound())); + + for (int i = 0; i < mOutputItems.length; i++) + if (mOutputItems[i] != null) + aNBT.setTag("mOutputItem" + i, mOutputItems[i].writeToNBT(new NBTTagCompound())); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + mFluidTransfer = aNBT.getBoolean("mFluidTransfer"); + mItemTransfer = aNBT.getBoolean("mItemTransfer"); + mHasBeenUpdated = aNBT.getBoolean("mHasBeenUpdated"); + mAllowInputFromOutputSide = aNBT.getBoolean("mAllowInputFromOutputSide"); + mEUt = aNBT.getInteger("mEUt"); + mMainFacing = aNBT.getInteger("mMainFacing"); + mProgresstime = aNBT.getInteger("mProgresstime"); + mMaxProgresstime = aNBT.getInteger("mMaxProgresstime"); + mOutputFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mOutputFluid")); + mFluidOut = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluidOut")); + + for (int i = 0; i < mOutputItems.length; i++) mOutputItems[i] = GT_Utility.loadItem(aNBT, "mOutputItem" + i); + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPostTick(aBaseMetaTileEntity, aTick); + + if (aBaseMetaTileEntity.isServerSide()) { + mCharge = aBaseMetaTileEntity.getStoredEU() / 2 > aBaseMetaTileEntity.getEUCapacity() / 3; + mDecharge = aBaseMetaTileEntity.getStoredEU() < aBaseMetaTileEntity.getEUCapacity() / 3; + + doDisplayThings(); + + boolean tSucceeded = false; + + if (mMaxProgresstime > 0 && (mProgresstime >= 0 || aBaseMetaTileEntity.isAllowedToWork())) { + aBaseMetaTileEntity.setActive(true); + if (mProgresstime < 0 || drainEnergyForProcess(mEUt)) { + if (++mProgresstime >= mMaxProgresstime) { + for (int i = 0; i < mOutputItems.length; i++) + for (int j = 0; j < mOutputItems.length; j++) + if (aBaseMetaTileEntity.addStackToSlot(getOutputSlot() + ((j + i) % mOutputItems.length), mOutputItems[i])) + break; + if (mOutputFluid != null) + if (getDrainableStack() == null) setDrainableStack(mOutputFluid.copy()); + else if (mOutputFluid.isFluidEqual(getDrainableStack())) + getDrainableStack().amount += mOutputFluid.amount; + for (int i = 0; i < mOutputItems.length; i++) mOutputItems[i] = null; + mOutputFluid = null; + mEUt = 0; + mProgresstime = 0; + mMaxProgresstime = 0; + mStuttering = false; + tSucceeded = true; + endProcess(); + } + if (mProgresstime > 5) mStuttering = false; + XSTR aXSTR = new XSTR(); + if(GT_Mod.gregtechproxy.mAprilFool && aXSTR.nextInt(5000)==0)GT_Utility.sendSoundToPlayers(aBaseMetaTileEntity.getWorld(), GregTech_API.sSoundList.get(5), 10.0F, -1.0F, aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(),aBaseMetaTileEntity.getZCoord()); + } else { + if (!mStuttering) { + stutterProcess(); + if (canHaveInsufficientEnergy()) mProgresstime = -100; + mStuttering = true; + } + } + } else { + aBaseMetaTileEntity.setActive(false); + } + + boolean tRemovedOutputFluid = false; + + if (doesAutoOutputFluids() && getDrainableStack() != null && aBaseMetaTileEntity.getFrontFacing() != mMainFacing && (tSucceeded || aTick % 20 == 0)) { + IFluidHandler tTank = aBaseMetaTileEntity.getITankContainerAtSide(aBaseMetaTileEntity.getFrontFacing()); + if (tTank != null) { + FluidStack tDrained = drain(1000, false); + if (tDrained != null) { + int tFilledAmount = tTank.fill(ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), tDrained, false); + if (tFilledAmount > 0) + tTank.fill(ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), drain(tFilledAmount, true), true); + } + } + if (getDrainableStack() == null) tRemovedOutputFluid = true; + } + + if (doesAutoOutput() && !isOutputEmpty() && aBaseMetaTileEntity.getFrontFacing() != mMainFacing && (tSucceeded || mOutputBlocked % 300 == 1 || aBaseMetaTileEntity.hasInventoryBeenModified() || aTick % 600 == 0)) { + TileEntity tTileEntity2 = aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getFrontFacing()); + for (int i = 0, tCosts = 1; i < mOutputItems.length && tCosts > 0 && aBaseMetaTileEntity.isUniversalEnergyStored(128); i++) { + tCosts = GT_Utility.moveOneItemStack(aBaseMetaTileEntity, tTileEntity2, aBaseMetaTileEntity.getFrontFacing(), aBaseMetaTileEntity.getBackFacing(), null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1); + if (tCosts > 0) aBaseMetaTileEntity.decreaseStoredEnergyUnits(tCosts, true); + } + } + + if (mOutputBlocked != 0) if (isOutputEmpty()) mOutputBlocked = 0; + else mOutputBlocked++; + + if (allowToCheckRecipe()) { + if (mMaxProgresstime <= 0 && aBaseMetaTileEntity.isAllowedToWork() && (tRemovedOutputFluid || tSucceeded || aBaseMetaTileEntity.hasInventoryBeenModified() || aTick % 600 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled()) && hasEnoughEnergyToCheckRecipe()) { + if (checkRecipe() == 2) { + if (mInventory[3] != null && mInventory[3].stackSize <= 0) mInventory[3] = null; + for (int i = getInputSlot(), j = i + mInputSlotCount; i < j; i++) + if (mInventory[i] != null && mInventory[i].stackSize <= 0) mInventory[i] = null; + for (int i = 0; i < mOutputItems.length; i++) { + mOutputItems[i] = GT_Utility.copy(mOutputItems[i]); + if (mOutputItems[i] != null && mOutputItems[i].stackSize > 64) + mOutputItems[i].stackSize = 64; + mOutputItems[i] = GT_OreDictUnificator.get(true, mOutputItems[i]); + } + if (mFluid != null && mFluid.amount <= 0) mFluid = null; + mMaxProgresstime = Math.max(1, mMaxProgresstime); + if (GT_Utility.isDebugItem(mInventory[dechargerSlotStartIndex()])) { + mEUt = mMaxProgresstime = 1; + } + startProcess(); + } else { + mMaxProgresstime = 0; + for (int i = 0; i < mOutputItems.length; i++) mOutputItems[i] = null; + mOutputFluid = null; + } + } + } else { + if (!mStuttering) { + stutterProcess(); + mStuttering = true; + } + } + } + } + + protected void doDisplayThings() { + if (mMainFacing < 2 && getBaseMetaTileEntity().getFrontFacing() > 1) { + mMainFacing = getBaseMetaTileEntity().getFrontFacing(); + } + if (mMainFacing >= 2 && !mHasBeenUpdated) { + mHasBeenUpdated = true; + getBaseMetaTileEntity().setFrontFacing(getBaseMetaTileEntity().getBackFacing()); + } + + if (displaysInputFluid()) { + int tDisplayStackSlot = OTHER_SLOT_COUNT + mInputSlotCount + mOutputItems.length; + if (getFillableStack() == null) { + if (ItemList.Display_Fluid.isStackEqual(mInventory[tDisplayStackSlot], true, true)) + mInventory[tDisplayStackSlot] = null; + } else { + mInventory[tDisplayStackSlot] = GT_Utility.getFluidDisplayStack(getFillableStack(), displaysStackSize()); + } + } + } + + protected boolean hasEnoughEnergyToCheckRecipe() { + return getBaseMetaTileEntity().isUniversalEnergyStored(getMinimumStoredEU() / 2); + } + + protected boolean drainEnergyForProcess(long aEUt) { + return getBaseMetaTileEntity().decreaseStoredEnergyUnits(aEUt, false); + } + + protected void calculateOverclockedNess(GT_Recipe aRecipe) { + calculateOverclockedNess(aRecipe.mEUt, aRecipe.mDuration); + } + + protected void calculateOverclockedNess(int aEUt, int aDuration) { + if (aEUt <= 16) { + mEUt = aEUt * (1 << (mTier - 1)) * (1 << (mTier - 1)); + mMaxProgresstime = aDuration / (1 << (mTier - 1)); + } else { + mEUt = aEUt; + mMaxProgresstime = aDuration; + while (mEUt <= V[mTier - 1] * mAmperage) { + mEUt *= 4; + mMaxProgresstime /= 2; + } + } + } + + protected ItemStack getSpecialSlot() { + return mInventory[3]; + } + + protected ItemStack getOutputAt(int aIndex) { + return mInventory[getOutputSlot() + aIndex]; + } + + protected ItemStack[] getAllOutputs() { + ItemStack[] rOutputs = new ItemStack[mOutputItems.length]; + for (int i = 0; i < mOutputItems.length; i++) rOutputs[i] = getOutputAt(i); + return rOutputs; + } + + protected boolean canOutput(GT_Recipe aRecipe) { + return aRecipe != null && (aRecipe.mNeedsEmptyOutput ? isOutputEmpty() && getDrainableStack() == null : canOutput(aRecipe.getFluidOutput(0)) && canOutput(aRecipe.mOutputs)); + } + + protected boolean canOutput(ItemStack... aOutputs) { + if (aOutputs == null) return true; + ItemStack[] tOutputSlots = getAllOutputs(); + for (int i = 0; i < tOutputSlots.length && i < aOutputs.length; i++) + if (tOutputSlots[i] != null && aOutputs[i] != null && (!GT_Utility.areStacksEqual(tOutputSlots[i], aOutputs[i], false) || tOutputSlots[i].stackSize + aOutputs[i].stackSize > tOutputSlots[i].getMaxStackSize())) { + mOutputBlocked++; + return false; + } + return true; + } + + protected boolean canOutput(FluidStack aOutput) { + return getDrainableStack() == null || aOutput == null || (getDrainableStack().isFluidEqual(aOutput) && (getDrainableStack().amount <= 0 || getDrainableStack().amount + aOutput.amount <= getCapacity())); + } + + protected ItemStack getInputAt(int aIndex) { + return mInventory[getInputSlot() + aIndex]; + } + + protected ItemStack[] getAllInputs() { + ItemStack[] rInputs = new ItemStack[mInputSlotCount]; + for (int i = 0; i < mInputSlotCount; i++) rInputs[i] = getInputAt(i); + return rInputs; + } + + protected boolean isOutputEmpty() { + boolean rIsEmpty = true; + for (ItemStack tOutputSlotContent : getAllOutputs()) if (tOutputSlotContent != null) rIsEmpty = false; + return rIsEmpty; + } + + protected boolean displaysInputFluid() { + return true; + } + + protected boolean displaysOutputFluid() { + return true; + } + + @Override + public void onValueUpdate(byte aValue) { + mMainFacing = aValue; + } + + @Override + public byte getUpdateData() { + return (byte) mMainFacing; + } + + @Override + public void doSound(byte aIndex, double aX, double aY, double aZ) { + super.doSound(aIndex, aX, aY, aZ); + if (aIndex == 8) GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(210), 100, 1.0F, aX, aY, aZ); + } + + public boolean doesAutoOutput() { + return mItemTransfer; + } + + public boolean doesAutoOutputFluids() { + return mFluidTransfer; + } + + public boolean allowToCheckRecipe() { + return true; + } + + public boolean showPipeFacing() { + return true; + } + + /** + * Called whenever the Machine successfully started a Process, useful for Sound Effects + */ + public void startProcess() { + // + } + + /** + * Called whenever the Machine successfully finished a Process, useful for Sound Effects + */ + public void endProcess() { + // + } + + /** + * Called whenever the Machine aborted a Process, useful for Sound Effects + */ + public void abortProcess() { + // + } + + /** + * Called whenever the Machine aborted a Process but still works on it, useful for Sound Effects + */ + public void stutterProcess() { + if (useStandardStutterSound()) sendSound((byte) 8); + } + + /** + * If this Machine can have the Insufficient Energy Line Problem + */ + public boolean canHaveInsufficientEnergy() { + return true; + } + + public boolean useStandardStutterSound() { + return true; + } + + @Override + public String[] getInfoData() { + return new String[]{ + mNEIName, + "Progress:", (mProgresstime / 20) + " secs", + (mMaxProgresstime / 20) + " secs", + "Stored Energy:", + getBaseMetaTileEntity().getStoredEU() + "EU", + getBaseMetaTileEntity().getEUCapacity() + "EU"}; + } + + @Override + public boolean isGivingInformation() { + return true; + } + + @Override + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + if (aSide == getBaseMetaTileEntity().getFrontFacing() || aSide == mMainFacing) { + mAllowInputFromOutputSide = !mAllowInputFromOutputSide; + GT_Utility.sendChatToPlayer(aPlayer, mAllowInputFromOutputSide ? trans("095","Input from Output Side allowed") : trans("096","Input from Output Side forbidden")); + } + } + + @Override + public boolean allowCoverOnSide(byte aSide, GT_ItemStack aCoverID) { + return (aSide != mMainFacing || GregTech_API.getCoverBehavior(aCoverID.toStack()).isGUIClickable(aSide, GT_Utility.stackToInt(aCoverID.toStack()), 0, getBaseMetaTileEntity())); + } + + @Override + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return aSide != mMainFacing && aIndex >= getOutputSlot() && aIndex < getOutputSlot() + mOutputItems.length; + } + + @Override + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + if (aSide == mMainFacing || aIndex < getInputSlot() || aIndex >= getInputSlot() + mInputSlotCount || (!mAllowInputFromOutputSide && aSide == aBaseMetaTileEntity.getFrontFacing())) + return false; + for (int i = getInputSlot(), j = i + mInputSlotCount; i < j; i++) + if (GT_Utility.areStacksEqual(GT_OreDictUnificator.get(aStack), mInventory[i])) return i == aIndex; + return true; + } + + /** + * @return the Recipe List which is used for this Machine, this is a useful Default Handler + */ + public GT_Recipe_Map getRecipeList() { + return null; + } + + /** + * Override this to check the Recipes yourself, super calls to this could be useful if you just want to add a special case + * <p/> + * I thought about Enum too, but Enum doesn't add support for people adding other return Systems. + * <p/> + * Funny how Eclipse marks the word Enum as not correctly spelled. + * + * @return see constants above + */ + public int checkRecipe() { + return checkRecipe(false); + } + + public static boolean isValidForLowGravity(GT_Recipe tRecipe, int dimId){ + return //TODO check or get a better solution + DimensionManager.getProvider(dimId).getClass().getName().contains("Orbit") || + DimensionManager.getProvider(dimId).getClass().getName().endsWith("Space") || + DimensionManager.getProvider(dimId).getClass().getName().endsWith("Asteroids") || + DimensionManager.getProvider(dimId).getClass().getName().endsWith("SS") || + DimensionManager.getProvider(dimId).getClass().getName().contains("SpaceStation"); + } + + + /** + * + * @param skipOC disables OverclockedNess calculation and check - if you do you must implement your own method... + * @return + */ + public int checkRecipe(boolean skipOC){ + GT_Recipe_Map tMap = getRecipeList(); + if (tMap == null) return DID_NOT_FIND_RECIPE; + GT_Recipe tRecipe = tMap.findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, V[mTier], new FluidStack[]{getFillableStack()}, getSpecialSlot(), getAllInputs()); + if (tRecipe == null) return DID_NOT_FIND_RECIPE; + + if (GT_Mod.gregtechproxy.mLowGravProcessing && tRecipe.mSpecialValue == -100 && + !isValidForLowGravity(tRecipe,getBaseMetaTileEntity().getWorld().provider.dimensionId)) + return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; + if (tRecipe.mCanBeBuffered) mLastRecipe = tRecipe; + if (!canOutput(tRecipe)) { + mOutputBlocked++; + return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; + } + if (tRecipe.mSpecialValue == -200 && (mCleanroom == null || mCleanroom.mEfficiency == 0)) + return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; + if (!tRecipe.isRecipeInputEqual(true, new FluidStack[]{getFillableStack()}, getAllInputs())) + return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; + for (int i = 0; i < mOutputItems.length; i++) + if (getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(i)) + mOutputItems[i] = tRecipe.getOutput(i); + if (tRecipe.mSpecialValue == -200) + for (int i = 0; i < mOutputItems.length; i++) + if (mOutputItems[i] != null && getBaseMetaTileEntity().getRandomNumber(10000) > mCleanroom.mEfficiency) + mOutputItems[i] = null; + mOutputFluid = tRecipe.getFluidOutput(0); + calculateOverclockedNess(tRecipe); + return FOUND_AND_SUCCESSFULLY_USED_RECIPE; + } + + public ITexture[] getSideFacingActive(byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + } + + public ITexture[] getSideFacingInactive(byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + } + + public ITexture[] getFrontFacingActive(byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + } + + public ITexture[] getFrontFacingInactive(byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + } + + public ITexture[] getTopFacingActive(byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + } + + public ITexture[] getTopFacingInactive(byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + } + + public ITexture[] getBottomFacingActive(byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + } + + public ITexture[] getBottomFacingInactive(byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + } + + public ITexture[] getBottomFacingPipeActive(byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; + } + + public ITexture[] getBottomFacingPipeInactive(byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; + } + + public ITexture[] getTopFacingPipeActive(byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; + } + + public ITexture[] getTopFacingPipeInactive(byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; + } + + public ITexture[] getSideFacingPipeActive(byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; + } + + public ITexture[] getSideFacingPipeInactive(byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicTank.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicTank.java new file mode 100644 index 0000000000..03c8fadad4 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicTank.java @@ -0,0 +1,264 @@ +package gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power; + +import gregtech.api.enums.ItemList; +import gregtech.api.gui.GT_Container_BasicTank; +import gregtech.api.gui.GT_GUIContainer_BasicTank; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_Utility; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.fluids.FluidStack; + +/** + * NEVER INCLUDE THIS FILE IN YOUR MOD!!! + * <p/> + * This is the main construct for my generic Tanks. Filling and emptying behavior have to be implemented manually + */ +public abstract class GTPP_MTE_BasicTank extends GTPP_MTE_TieredMachineBlock { + + public FluidStack mFluid; + + /** + * @param aInvSlotCount should be 3 + */ + public GTPP_MTE_BasicTank(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription, ITexture... aTextures) { + super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures); + } + + public GTPP_MTE_BasicTank(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String[] aDescription, ITexture... aTextures) { + super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures); + } + + public GTPP_MTE_BasicTank(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, aInvSlotCount, aDescription, aTextures); + } + + public GTPP_MTE_BasicTank(String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) { + super(aName, aTier, aInvSlotCount, aDescription, aTextures); + } + + @Override + public boolean isSimpleMachine() { + return false; + } + + @Override + public boolean isValidSlot(int aIndex) { + return aIndex != getStackDisplaySlot(); + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + if (mFluid != null) aNBT.setTag("mFluid", mFluid.writeToNBT(new NBTTagCompound())); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + mFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid")); + } + + public abstract boolean doesFillContainers(); + + public abstract boolean doesEmptyContainers(); + + public abstract boolean canTankBeFilled(); + + public abstract boolean canTankBeEmptied(); + + public abstract boolean displaysItemStack(); + + public abstract boolean displaysStackSize(); + + public int getInputSlot() { + return 0; + } + + public int getOutputSlot() { + return 1; + } + + public int getStackDisplaySlot() { + return 2; + } + + public boolean isFluidInputAllowed(FluidStack aFluid) { + return true; + } + + public boolean isFluidChangingAllowed() { + return true; + } + + public FluidStack getFillableStack() { + return mFluid; + } + + public FluidStack setFillableStack(FluidStack aFluid) { + mFluid = aFluid; + return mFluid; + } + + public FluidStack getDrainableStack() { + return mFluid; + } + + public FluidStack setDrainableStack(FluidStack aFluid) { + mFluid = aFluid; + return mFluid; + } + + public FluidStack getDisplayedFluid() { + return getDrainableStack(); + } + + @Override + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_Container_BasicTank(aPlayerInventory, aBaseMetaTileEntity); + } + + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_BasicTank(aPlayerInventory, aBaseMetaTileEntity, getLocalName()); + } + + @Override + public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + if (aBaseMetaTileEntity.isServerSide()) { + if (isFluidChangingAllowed() && getFillableStack() != null && getFillableStack().amount <= 0) + setFillableStack(null); + + if (displaysItemStack() && getStackDisplaySlot() >= 0 && getStackDisplaySlot() < mInventory.length) { + if (getDisplayedFluid() == null) { + if (ItemList.Display_Fluid.isStackEqual(mInventory[getStackDisplaySlot()], true, true)) + mInventory[getStackDisplaySlot()] = null; + } else { + mInventory[getStackDisplaySlot()] = GT_Utility.getFluidDisplayStack(getDisplayedFluid(), displaysStackSize()); + } + } + + if (doesEmptyContainers()) { + FluidStack tFluid = GT_Utility.getFluidForFilledItem(mInventory[getInputSlot()], true); + if (tFluid != null && isFluidInputAllowed(tFluid)) { + if (getFillableStack() == null) { + if (isFluidInputAllowed(tFluid) && tFluid.amount <= getCapacity()) { + if (aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), GT_Utility.getContainerItem(mInventory[getInputSlot()], true), 1)) { + setFillableStack(tFluid.copy()); + this.onEmptyingContainerWhenEmpty(); + aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1); + } + } + } else { + if (tFluid.isFluidEqual(getFillableStack()) && tFluid.amount + getFillableStack().amount <= getCapacity()) { + if (aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), GT_Utility.getContainerItem(mInventory[getInputSlot()], true), 1)) { + getFillableStack().amount += tFluid.amount; + aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1); + } + } + } + } + } + + if (doesFillContainers()) { + ItemStack tOutput = GT_Utility.fillFluidContainer(getDrainableStack(), mInventory[getInputSlot()], false, true); + if (tOutput != null && aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), tOutput, 1)) { + FluidStack tFluid = GT_Utility.getFluidForFilledItem(tOutput, true); + aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1); + if (tFluid != null) getDrainableStack().amount -= tFluid.amount; + if (getDrainableStack().amount <= 0 && isFluidChangingAllowed()) setDrainableStack(null); + } + } + } + } + + @Override + public FluidStack getFluid() { + return getDrainableStack(); + } + + @Override + public int getFluidAmount() { + return getDrainableStack() != null ? getDrainableStack().amount : 0; + } + + @Override + public int fill(FluidStack aFluid, boolean doFill) { + if (aFluid == null || aFluid.getFluid().getID() <= 0 || aFluid.amount <= 0 || !canTankBeFilled() || !isFluidInputAllowed(aFluid)) + return 0; + + if (getFillableStack() == null || getFillableStack().getFluid().getID() <= 0) { + if (aFluid.amount <= getCapacity()) { + if (doFill) { + setFillableStack(aFluid.copy()); + getBaseMetaTileEntity().markDirty(); + } + return aFluid.amount; + } + if (doFill) { + setFillableStack(aFluid.copy()); + getFillableStack().amount = getCapacity(); + getBaseMetaTileEntity().markDirty(); + } + return getCapacity(); + } + + if (!getFillableStack().isFluidEqual(aFluid)) + return 0; + + int space = getCapacity() - getFillableStack().amount; + if (aFluid.amount <= space) { + if (doFill) { + getFillableStack().amount += aFluid.amount; + getBaseMetaTileEntity().markDirty(); + } + return aFluid.amount; + } + if (doFill) + getFillableStack().amount = getCapacity(); + return space; + } + + @Override + public FluidStack drain(int maxDrain, boolean doDrain) { + if (getDrainableStack() == null || !canTankBeEmptied()) return null; + if (getDrainableStack().amount <= 0 && isFluidChangingAllowed()) { + setDrainableStack(null); + getBaseMetaTileEntity().markDirty(); + return null; + } + + int used = maxDrain; + if (getDrainableStack().amount < used) + used = getDrainableStack().amount; + + if (doDrain) { + getDrainableStack().amount -= used; + getBaseMetaTileEntity().markDirty(); + } + + FluidStack drained = getDrainableStack().copy(); + drained.amount = used; + + if (getDrainableStack().amount <= 0 && isFluidChangingAllowed()) { + setDrainableStack(null); + getBaseMetaTileEntity().markDirty(); + } + + return drained; + } + + @Override + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return aIndex == getOutputSlot(); + } + + @Override + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return aIndex == getInputSlot(); + } + + protected void onEmptyingContainerWhenEmpty(){ + //Do nothing + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_TieredMachineBlock.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_TieredMachineBlock.java new file mode 100644 index 0000000000..e3ab7915d2 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_TieredMachineBlock.java @@ -0,0 +1,105 @@ +package gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power; + +import static gregtech.api.enums.GT_Values.GT; + +import org.apache.commons.lang3.ArrayUtils; + +import gregtech.api.enums.GT_Values; +import gregtech.api.interfaces.ITexture; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.core.lib.CORE; + +public abstract class GTPP_MTE_TieredMachineBlock extends MetaTileEntityCustomPower { + /** + * Value between [0 - 9] to describe the Tier of this Machine. + */ + public final byte mTier; + + @Deprecated + public final String mDescription; + + /** + * A simple Description. + */ + public final String[] mDescriptionArray; + + /** + * Contains all Textures used by this Block. + */ + public final ITexture[][][] mTextures; + + public GTPP_MTE_TieredMachineBlock(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription, ITexture... aTextures) { + super(aID, aName, aNameRegional, aInvSlotCount); + mTier = (byte) Math.max(0, Math.min(aTier, 9)); + mDescriptionArray = aDescription == null ? new String[0] : new String[]{aDescription}; + mDescription = mDescriptionArray.length > 0 ? mDescriptionArray[0] : ""; + // must always be the last call! + if (GT.isClientSide()) mTextures = getTextureSet(aTextures); + else mTextures = null; + } + + public GTPP_MTE_TieredMachineBlock(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String[] aDescription, ITexture... aTextures) { + super(aID, aName, aNameRegional, aInvSlotCount); + mTier = (byte) Math.max(0, Math.min(aTier, 9)); + mDescriptionArray = aDescription == null ? new String[0] : aDescription; + mDescription = mDescriptionArray.length > 0 ? mDescriptionArray[0] : ""; + + // must always be the last call! + if (GT.isClientSide()) mTextures = getTextureSet(aTextures); + else mTextures = null; + } + + public GTPP_MTE_TieredMachineBlock(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { + super(aName, aInvSlotCount); + mTier = (byte) aTier; + mDescriptionArray = aDescription == null ? new String[0] : new String[]{aDescription}; + mDescription = mDescriptionArray.length > 0 ? mDescriptionArray[0] : ""; + mTextures = aTextures; + } + + public GTPP_MTE_TieredMachineBlock(String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) { + super(aName, aInvSlotCount); + mTier = (byte) aTier; + mDescriptionArray = aDescription == null ? new String[0] : aDescription; + mDescription = mDescriptionArray.length > 0 ? mDescriptionArray[0] : ""; + mTextures = aTextures; + } + + @Override + public byte getTileEntityBaseType() { + return (byte) (Math.min(3, mTier <= 0 ? 0 : 1 + ((mTier - 1) / 4))); + } + + @Override + public long getInputTier() { + return mTier; + } + + @Override + public long getOutputTier() { + return mTier; + } + + @Override + public String[] getDescription() { + + AutoMap<String> aTooltip = new AutoMap<String>(); + String []s1 = null; + aTooltip.put("Special GT++ Machine"); + aTooltip.put(CORE.GT_Tooltip); + s1 = new String[aTooltip.size()]; + int u = 0; + for (String s : aTooltip) { + s1[u] = s; + } + return s1; + } + + /** + * Used Client Side to get a Texture Set for this Block. + * Called after setting the Tier and the Description so that those two are accessible. + * + * @param aTextures is the optional Array you can give to the Constructor. + */ + public abstract ITexture[][][] getTextureSet(ITexture[] aTextures); +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/MetaTileEntityCustomPower.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/MetaTileEntityCustomPower.java new file mode 100644 index 0000000000..3824206d24 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/MetaTileEntityCustomPower.java @@ -0,0 +1,76 @@ +package gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power; + +import gregtech.api.GregTech_API; +import gregtech.api.enums.GT_Values; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.CustomMetaTileBase; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; + +public abstract class MetaTileEntityCustomPower extends CustomMetaTileBase { + + public MetaTileEntityCustomPower(int aID, String aBasicName, String aRegionalName, int aInvSlotCount) { + super(aID, aBasicName, aRegionalName, aInvSlotCount); + } + + public MetaTileEntityCustomPower(String aStack, int aInvSlotCount) { + super(aStack, aInvSlotCount); + } + + public long getMinimumStoredEU() { + return 0L; + } + + public void doExplosion(long aExplosionPower) { + float tStrength = aExplosionPower < GT_Values.V[0] + ? 1.0F + : (aExplosionPower < GT_Values.V[1] + ? 2.0F + : (aExplosionPower < GT_Values.V[2] + ? 3.0F + : (aExplosionPower < GT_Values.V[3] + ? 4.0F + : (aExplosionPower < GT_Values.V[4] + ? 5.0F + : (aExplosionPower < GT_Values.V[4] * 2L + ? 6.0F + : (aExplosionPower < GT_Values.V[5] + ? 7.0F + : (aExplosionPower < GT_Values.V[6] + ? 8.0F + : (aExplosionPower < GT_Values.V[7] + ? 9.0F + : 10.0F)))))))); + int tX = this.getBaseMetaTileEntity().getXCoord(); + short tY = this.getBaseMetaTileEntity().getYCoord(); + int tZ = this.getBaseMetaTileEntity().getZCoord(); + World tWorld = this.getBaseMetaTileEntity().getWorld(); + GT_Utility.sendSoundToPlayers(tWorld, (String) GregTech_API.sSoundList.get(Integer.valueOf(209)), 1.0F, -1.0F, + tX, tY, tZ); + tWorld.setBlock(tX, tY, tZ, Blocks.air); + if (GregTech_API.sMachineExplosions) { + tWorld.createExplosion((Entity) null, (double) tX + 0.5D, (double) tY + 0.5D, (double) tZ + 0.5D, tStrength, + true); + } + + } + + @Override + public void onExplosion() { + // TODO Auto-generated method stub + super.onExplosion(); + } + + @Override + public boolean isElectric() { + return true; + } + + @Override + public long getEUVar() { + // TODO Auto-generated method stub + return super.getEUVar(); + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBreaker.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBreaker.java new file mode 100644 index 0000000000..251deba6d4 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBreaker.java @@ -0,0 +1,288 @@ +package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; + +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.Textures.BlockIcons; +import gregtech.api.gui.GT_Container_4by4; +import gregtech.api.gui.GT_GUIContainer_4by4; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.items.GT_MetaBase_Item; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power.GTPP_MTE_TieredMachineBlock; +import ic2.api.item.ElectricItem; +import ic2.api.item.IElectricItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +public class GT_MetaTileEntity_BasicBreaker extends GTPP_MTE_TieredMachineBlock { + + public boolean mCharge = false; + public boolean mDecharge = false; + public int mBatteryCount = 0; + public int mChargeableCount = 0; + private long count = 0L; + private long mStored = 0L; + private long mMax = 0L; + + public GT_MetaTileEntity_BasicBreaker(int aID, String aName, String aNameRegional, int aTier, + String aDescription, int aSlotCount) { + super(aID, aName, aNameRegional, aTier, aSlotCount, aDescription, new ITexture[0]); + } + + public GT_MetaTileEntity_BasicBreaker(String aName, int aTier, String aDescription, ITexture[][][] aTextures, + int aSlotCount) { + super(aName, aTier, aSlotCount, aDescription, aTextures); + } + + public GT_MetaTileEntity_BasicBreaker(String aName, int aTier, String[] aDescription, + ITexture[][][] aTextures, int aSlotCount) { + super(aName, aTier, aSlotCount, aDescription, aTextures); + } + + public String[] getDescription() { + String []s1 = super.getDescription(); + s1 = new String[0]; + return s1; + } + + public ITexture[][][] getTextureSet(ITexture[] aTextures) { + ITexture[][][] rTextures = new ITexture[2][17][]; + + for (byte i = -1; i < 16; ++i) { + rTextures[0][i + 1] = new ITexture[]{BlockIcons.MACHINE_CASINGS[this.mTier][i + 1]}; + rTextures[1][i + 1] = new ITexture[]{BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], + this.mInventory.length > 4 + ? BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier] + : BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier]}; + } + + return rTextures; + } + + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, + boolean aActive, boolean aRedstone) { + return this.mTextures[aSide == aFacing ? 1 : 0][aColorIndex + 1]; + } + + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_BasicBreaker(this.mName, this.mTier, this.mDescriptionArray, this.mTextures, + this.mInventory.length); + } + + public boolean isSimpleMachine() { + return false; + } + + public boolean isElectric() { + return true; + } + + public boolean isValidSlot(int aIndex) { + return true; + } + + public boolean isFacingValid(byte aFacing) { + return true; + } + + public boolean isEnetInput() { + return true; + } + + public boolean isEnetOutput() { + return true; + } + + public boolean isInputFacing(byte aSide) { + return aSide != this.getBaseMetaTileEntity().getFrontFacing(); + } + + public boolean isOutputFacing(byte aSide) { + return aSide == this.getBaseMetaTileEntity().getFrontFacing(); + } + + public boolean isTeleporterCompatible() { + return false; + } + + public long getMinimumStoredEU() { + return GT_Values.V[this.mTier] * 16L * 16; + } + + public long maxEUStore() { + return GT_Values.V[this.mTier] * 64L * 16; + } + + public long maxEUInput() { + return GT_Values.V[this.mTier] * 16; + } + + public long maxEUOutput() { + return GT_Values.V[this.mTier]; + } + + public long maxAmperesIn() { + return (long) (1); + } + + public long maxAmperesOut() { + return (long) 16; + } + + public int rechargerSlotStartIndex() { + return 0; + } + + public int dechargerSlotStartIndex() { + return 0; + } + + public int rechargerSlotCount() { + return 0; + } + + public int dechargerSlotCount() { + return 0; + } + + public int getProgresstime() { + return (int) this.getBaseMetaTileEntity().getUniversalEnergyStored(); + } + + public int maxProgresstime() { + return (int) this.getBaseMetaTileEntity().getUniversalEnergyCapacity(); + } + + public boolean isAccessAllowed(EntityPlayer aPlayer) { + return true; + } + + public void saveNBTData(NBTTagCompound aNBT) { + } + + public void loadNBTData(NBTTagCompound aNBT) { + } + + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + if (aBaseMetaTileEntity.isClientSide()) { + return true; + } else { + aBaseMetaTileEntity.openGUI(aPlayer); + return true; + } + } + + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_Container_4by4(aPlayerInventory, aBaseMetaTileEntity); + } + + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_4by4(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName()); + } + + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + if (aBaseMetaTileEntity.isServerSide()) { + /*this.mCharge = aBaseMetaTileEntity.getStoredEU() / 2L > aBaseMetaTileEntity.getEUCapacity() / 3L; + this.mDecharge = aBaseMetaTileEntity.getStoredEU() < aBaseMetaTileEntity.getEUCapacity() / 3L; + this.mBatteryCount = 0; + this.mChargeableCount = 0; + ItemStack[] arg3 = this.mInventory; + int arg4 = arg3.length; + + for (int arg5 = 0; arg5 < arg4; ++arg5) { + ItemStack tStack = arg3[arg5]; + if (GT_ModHandler.isElectricItem(tStack, this.mTier)) { + if (GT_ModHandler.isChargerItem(tStack)) { + ++this.mBatteryCount; + } + + ++this.mChargeableCount; + } + }*/ + } + + } + + 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 true; + } + + public int getInventoryStackLimit() { + return 1; + } + + public long[] getStoredEnergy() { + boolean scaleOverflow = false; + boolean storedOverflow = false; + long tScale = this.getBaseMetaTileEntity().getEUCapacity(); + long tStored = this.getBaseMetaTileEntity().getStoredEU(); + long tStep = 0L; + if (this.mInventory != null) { + ItemStack[] arg8 = this.mInventory; + int arg9 = arg8.length; + + for (int arg10 = 0; arg10 < arg9; ++arg10) { + ItemStack aStack = arg8[arg10]; + if (GT_ModHandler.isElectricItem(aStack)) { + if (aStack.getItem() instanceof GT_MetaBase_Item) { + Long[] stats = ((GT_MetaBase_Item) aStack.getItem()).getElectricStats(aStack); + if (stats != null) { + if (stats[0].longValue() > 4611686018427387903L) { + scaleOverflow = true; + } + + tScale += stats[0].longValue(); + tStep = ((GT_MetaBase_Item) aStack.getItem()).getRealCharge(aStack); + if (tStep > 4611686018427387903L) { + storedOverflow = true; + } + + tStored += tStep; + } + } else if (aStack.getItem() instanceof IElectricItem) { + tStored += (long) ElectricItem.manager.getCharge(aStack); + tScale += (long) ((IElectricItem) aStack.getItem()).getMaxCharge(aStack); + } + } + } + } + + if (scaleOverflow) { + tScale = Long.MAX_VALUE; + } + + if (storedOverflow) { + tStored = Long.MAX_VALUE; + } + + return new long[]{tStored, tScale}; + } + + public String[] getInfoData() { + ++this.count; + if (this.mMax == 0L || this.count % 20L == 0L) { + long[] tmp = this.getStoredEnergy(); + this.mStored = tmp[0]; + this.mMax = tmp[1]; + } + + return new String[]{this.getLocalName(), "Stored Items:", GT_Utility.formatNumbers(this.mStored) + " EU /", + GT_Utility.formatNumbers(this.mMax) + " EU", "Average input:", + this.getBaseMetaTileEntity().getAverageElectricInput() + "", "Average output:", + this.getBaseMetaTileEntity().getAverageElectricOutput() + ""}; + } + + public boolean isGivingInformation() { + return true; + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java new file mode 100644 index 0000000000..833c1bfcc0 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java @@ -0,0 +1,216 @@ +package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; + +import gregtech.api.enums.Textures.BlockIcons; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.PlayerUtils; +import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +public class GT_MetaTileEntity_SuperBus_Input extends GT_MetaTileEntity_Hatch_InputBus { + public GT_Recipe_Map mRecipeMap = null; + + public GT_MetaTileEntity_SuperBus_Input(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier); + } + + public GT_MetaTileEntity_SuperBus_Input(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures); + } + + public GT_MetaTileEntity_SuperBus_Input(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures); + } + + /** + * Returns a factor of 16 based on tier. + * @param aTier The tier of this bus. + * @return (1+ aTier) * 16 + */ + public static int getSlots(int aTier) { + return (1+ aTier) * 16; + } + + public ITexture[] getTexturesActive(ITexture aBaseTexture) { + return new ITexture[]{aBaseTexture, new GT_RenderedTexture(BlockIcons.OVERLAY_PIPE_IN)}; + } + + public ITexture[] getTexturesInactive(ITexture aBaseTexture) { + return new ITexture[]{aBaseTexture, new GT_RenderedTexture(BlockIcons.OVERLAY_PIPE_IN)}; + } + + public boolean isSimpleMachine() { + return true; + } + + public boolean isFacingValid(byte aFacing) { + return true; + } + + public boolean isAccessAllowed(EntityPlayer aPlayer) { + return true; + } + + public boolean isValidSlot(int aIndex) { + return true; + } + + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_SuperBus_Input(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); + } + + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return null; + } + + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return null; + } + + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { + if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.hasInventoryBeenModified()) { + this.fillStacksIntoFirstSlots(); + } + + } + + public void updateSlots() { + for (int i = 0; i < this.mInventory.length; ++i) { + if (this.mInventory[i] != null && this.mInventory[i].stackSize <= 0) { + this.mInventory[i] = null; + } + } + + this.fillStacksIntoFirstSlots(); + } + + protected void fillStacksIntoFirstSlots() { + for (int i = 0; i < this.mInventory.length; ++i) { + for (int j = i + 1; j < this.mInventory.length; ++j) { + if (this.mInventory[j] != null && (this.mInventory[i] == null + || GT_Utility.areStacksEqual(this.mInventory[i], this.mInventory[j]))) { + GT_Utility.moveStackFromSlotAToSlotB((IInventory) this.getBaseMetaTileEntity(), (IInventory) this.getBaseMetaTileEntity(), j, i, (byte) 64, (byte) 1, (byte) 64, (byte) 1); + } + } + } + + } + + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return aSide == this.getBaseMetaTileEntity().getFrontFacing(); + } + + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return aSide == this.getBaseMetaTileEntity().getFrontFacing() + && (this.mRecipeMap == null || this.mRecipeMap.containsInput(aStack)); + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + } + + @Override + public String[] getDescription() { + String[] aDesc = new String[] { + "Item Input for Multiblocks", + "This bus has no GUI, but can have items extracted", + ""+this.getSlots(this.mTier)+" Slots", + }; + return aDesc; + } + + @Override + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, + float aY, float aZ) { + return super.onRightclick(aBaseMetaTileEntity, aPlayer, aSide, aX, aY, aZ); + } + + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + if (aBaseMetaTileEntity.isClientSide()) { + return true; + } else { + //Logger.INFO("Trying to display Super Input Bus contents."); + displayBusContents(aPlayer); + return true; + } + } + + public void displayBusContents(EntityPlayer aPlayer) { + String STRIP = "Item Array: "; + String aNameString = ItemUtils.getArrayStackNames(getRealInventory()); + aNameString = aNameString.replace(STRIP, ""); + + String[] aNames; + if (aNameString.length() < 1) { + aNames = null; + } + else { + aNames = aNameString.split(","); + } + + if (aNames == null || aNames.length <= 0) { + PlayerUtils.messagePlayer(aPlayer, "This Super Bus (I) is Empty. Total Slots: "+this.getSlots(this.mTier)); + return; + } + + PlayerUtils.messagePlayer(aPlayer, "This Super Bus (I) contains:"); + for (String s : aNames) { + if (s.startsWith(" ")) { + s = s.substring(1); + } + //Logger.INFO("Trying to display Super Input Bus contents. "+s); + PlayerUtils.messagePlayer(aPlayer, s); + } + } + + @Override + public int getMaxItemCount() { + // TODO Auto-generated method stub + return super.getMaxItemCount(); + } + + @Override + public int getSizeInventory() { + // TODO Auto-generated method stub + return super.getSizeInventory(); + } + + @Override + public ItemStack getStackInSlot(int aIndex) { + // TODO Auto-generated method stub + return super.getStackInSlot(aIndex); + } + + @Override + public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) { + // TODO Auto-generated method stub + return super.canInsertItem(aIndex, aStack, aSide); + } + + @Override + public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) { + // TODO Auto-generated method stub + return super.canExtractItem(aIndex, aStack, aSide); + } + + @Override + public ItemStack[] getRealInventory() { + // TODO Auto-generated method stub + return super.getRealInventory(); + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output.java new file mode 100644 index 0000000000..d09b71ee35 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output.java @@ -0,0 +1,182 @@ +package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; + +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.PlayerUtils; +import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +public class GT_MetaTileEntity_SuperBus_Output extends GT_MetaTileEntity_Hatch_OutputBus { + public GT_Recipe_Map mRecipeMap = null; + + public GT_MetaTileEntity_SuperBus_Output(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier); + } + + public GT_MetaTileEntity_SuperBus_Output(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures); + } + + public GT_MetaTileEntity_SuperBus_Output(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures); + } + + /** + * Returns a factor of 16 based on tier. + * @param aTier The tier of this bus. + * @return (1+ aTier) * 16 + */ + public static int getSlots(int aTier) { + return (1+ aTier) * 16; + } + + public boolean isValidSlot(int aIndex) { + return true; + } + + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_SuperBus_Output(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); + } + + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return null; + } + + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return null; + } + + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { + if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.hasInventoryBeenModified()) { + this.fillStacksIntoFirstSlots(); + } + + } + + public void updateSlots() { + for (int i = 0; i < this.mInventory.length; ++i) { + if (this.mInventory[i] != null && this.mInventory[i].stackSize <= 0) { + this.mInventory[i] = null; + } + } + this.fillStacksIntoFirstSlots(); + } + + protected void fillStacksIntoFirstSlots() { + for (int i = 0; i < this.mInventory.length; ++i) { + for (int j = i + 1; j < this.mInventory.length; ++j) { + if (this.mInventory[j] != null && (this.mInventory[i] == null + || GT_Utility.areStacksEqual(this.mInventory[i], this.mInventory[j]))) { + GT_Utility.moveStackFromSlotAToSlotB((IInventory) this.getBaseMetaTileEntity(), (IInventory) this.getBaseMetaTileEntity(), j, i, (byte) 64, (byte) 1, (byte) 64, (byte) 1); + } + } + } + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + } + + @Override + public String[] getDescription() { + String[] aDesc = new String[] { + "Item Output for Multiblocks", + "This bus has no GUI", + ""+this.getSlots(this.mTier)+" Slots", + }; + return aDesc; + } + + @Override + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, + float aY, float aZ) { + return super.onRightclick(aBaseMetaTileEntity, aPlayer, aSide, aX, aY, aZ); + } + + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + if (aBaseMetaTileEntity.isClientSide()) { + return true; + } else { + displayBusContents(aPlayer); + return true; + } + } + + public void displayBusContents(EntityPlayer aPlayer) { + String STRIP = "Item Array: "; + String aNameString = ItemUtils.getArrayStackNames(getRealInventory()); + aNameString = aNameString.replace(STRIP, ""); + + String[] aNames; + if (aNameString.length() < 1) { + aNames = null; + } + else { + aNames = aNameString.split(","); + } + + if (aNames == null || aNames.length <= 0) { + PlayerUtils.messagePlayer(aPlayer, "This Super Bus (O) is Empty. Total Slots: "+this.getSlots(this.mTier)); + return; + } + + PlayerUtils.messagePlayer(aPlayer, "This Super Bus (O) contains:"); + for (String s : aNames) { + if (s.startsWith(" ")) { + s = s.substring(1); + } + //Logger.INFO("Trying to display Super Output Bus contents. "+s); + PlayerUtils.messagePlayer(aPlayer, s); + } + } + + @Override + public int getMaxItemCount() { + // TODO Auto-generated method stub + return super.getMaxItemCount(); + } + + @Override + public int getSizeInventory() { + // TODO Auto-generated method stub + return super.getSizeInventory(); + } + + @Override + public ItemStack getStackInSlot(int aIndex) { + // TODO Auto-generated method stub + return super.getStackInSlot(aIndex); + } + + @Override + public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) { + // TODO Auto-generated method stub + return super.canInsertItem(aIndex, aStack, aSide); + } + + @Override + public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) { + // TODO Auto-generated method stub + return super.canExtractItem(aIndex, aStack, aSide); + } + + @Override + public ItemStack[] getRealInventory() { + // TODO Auto-generated method stub + return super.getRealInventory(); + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/CustomMetaTileBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/CustomMetaTileBase.java new file mode 100644 index 0000000000..1920b4a282 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/CustomMetaTileBase.java @@ -0,0 +1,30 @@ +package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base; + +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.util.GT_LanguageManager; +import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; +import net.minecraft.item.ItemStack; + +public abstract class CustomMetaTileBase extends MetaTileEntity { + private IGregTechTileEntity mBaseMetaTileEntity; + + public CustomMetaTileBase(int aID, String aBasicName, String aRegionalName, int aInvSlotCount) { + super(aID, aBasicName, aRegionalName, aInvSlotCount); + this.setBaseMetaTileEntity(Meta_GT_Proxy.constructBaseMetaTileEntity()); + this.getBaseMetaTileEntity().setMetaTileID((short) aID); + } + + public CustomMetaTileBase(String aName, int aInvSlotCount) { + super(aName, aInvSlotCount); + } + + public ItemStack getStackForm(long aAmount) { + return new ItemStack(Meta_GT_Proxy.sBlockMachines, (int) aAmount, this.getBaseMetaTileEntity().getMetaTileID()); + } + + public String getLocalName() { + return GT_LanguageManager.getTranslation("gt.blockmachines." + this.mName + ".name"); + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java index 25997e5d35..2bea7473cc 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java @@ -2,6 +2,8 @@ package gtPlusPlus.xmod.gregtech.common; import static gtPlusPlus.xmod.gregtech.common.covers.GTPP_Cover_Overflow.mOverflowCache; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; @@ -10,9 +12,10 @@ import java.util.Map; import java.util.Timer; import java.util.TimerTask; +import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; - +import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -22,11 +25,15 @@ import net.minecraftforge.fluids.FluidStack; import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.BaseMetaTileEntity; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Utility; import gregtech.common.GT_Proxy; +import gregtech.common.blocks.GT_Block_Machines; +import gregtech.common.render.GT_Renderer_Block; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.api.objects.data.ObjMap; @@ -34,25 +41,143 @@ import gtPlusPlus.api.objects.minecraft.FormattedTooltipString; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.reflect.ProxyFinder; import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.xmod.gregtech.api.metatileentity.BaseCustomTileEntity; +import gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power.BaseCustomPower_MTE; +import gtPlusPlus.xmod.gregtech.common.blocks.GTPP_Block_Machines; +import gtPlusPlus.xmod.gregtech.common.render.GTPP_Render_MachineBlock; public class Meta_GT_Proxy { + static { + instance = new Meta_GT_Proxy(); + } + + public static final Meta_GT_Proxy instance; + public static List<Runnable> GT_BlockIconload = new ArrayList<>(); public static List<Runnable> GT_ItemIconload = new ArrayList<>(); public static AutoMap<Integer> GT_ValidHeatingCoilMetas = new AutoMap<Integer>(); + + private static Class sBaseMetaTileEntityClass; + private static Class sBaseMetaTileEntityClass2; public static final Map<String, FormattedTooltipString> mCustomGregtechMetaTooltips = new LinkedHashMap<String, FormattedTooltipString>(); + @SideOnly(Side.CLIENT) public static IIconRegister sBlockIcons, sItemIcons; public Meta_GT_Proxy() { Logger.INFO("GT_PROXY - initialized."); + } + + public static Block sBlockMachines; + + public void preInit() { + + //New GT++ Block, yay! (Progress) + sBlockMachines = new GTPP_Block_Machines(); + + GT_Log.out.println("GT++ Mod: Register TileEntities."); + BaseMetaTileEntity tBaseMetaTileEntity = constructBaseMetaTileEntity(); + BaseMetaTileEntity tBaseMetaTileEntity2 = constructBaseMetaTileEntityCustomPower(); + + GT_Log.out.println("GT++ Mod: Testing BaseMetaTileEntity."); + if (tBaseMetaTileEntity == null || tBaseMetaTileEntity2 == null) { + GT_Log.out.println("GT++ Mod: Fatal Error ocurred while initializing TileEntities, crashing Minecraft."); + throw new RuntimeException(""); + } + + GT_Log.out.println("GT++ Mod: Registering the BaseMetaTileEntity."); + GameRegistry.registerTileEntity(tBaseMetaTileEntity.getClass(), "BaseMetaTileEntity_GTPP"); + GameRegistry.registerTileEntity(tBaseMetaTileEntity2.getClass(), "BaseMetaTileEntity_GTPP2"); + } + + public void init() { scheduleCoverMapCleaner(); - setValidHeatingCoilMetas(); + setValidHeatingCoilMetas(); } + public void postInit() { + + } + + public static BaseCustomTileEntity constructBaseMetaTileEntity() { + if (sBaseMetaTileEntityClass == null) { + try { + sBaseMetaTileEntityClass = BaseCustomTileEntity.class; + return (BaseCustomTileEntity) BaseCustomTileEntity.class.newInstance(); + } catch (Throwable arg1) { + try { + Constructor<?> g = BaseCustomTileEntity.class.getConstructors()[0]; + g.setAccessible(true); + return (BaseCustomTileEntity) g.newInstance(); + } catch (InstantiationException | IllegalAccessException | IllegalArgumentException + | InvocationTargetException | SecurityException e) { + } + } + } + try { + return (BaseCustomTileEntity) ((BaseCustomTileEntity) sBaseMetaTileEntityClass.newInstance()); + } catch (Throwable arg0) { + arg0.printStackTrace(GT_Log.err); + try { + Constructor<?> g = BaseCustomTileEntity.class.getConstructors()[0]; + g.setAccessible(true); + return (BaseCustomTileEntity) g.newInstance(); + } catch (InstantiationException | IllegalAccessException | IllegalArgumentException + | InvocationTargetException | SecurityException e) { + GT_Log.err + .println("GT++ Mod: Fatal Error ocurred while initializing TileEntities, crashing Minecraft."); + e.printStackTrace(GT_Log.err); + throw new RuntimeException(e); + } + } + } + + public static BaseCustomPower_MTE constructBaseMetaTileEntityCustomPower() { + if (sBaseMetaTileEntityClass2 == null) { + try { + sBaseMetaTileEntityClass2 = BaseCustomPower_MTE.class; + return (BaseCustomPower_MTE) BaseCustomPower_MTE.class.newInstance(); + } catch (Throwable arg1) { + try { + Constructor<?> g = BaseCustomPower_MTE.class.getConstructors()[0]; + g.setAccessible(true); + return (BaseCustomPower_MTE) g.newInstance(); + } catch (InstantiationException | IllegalAccessException | IllegalArgumentException + | InvocationTargetException | SecurityException e) { + // e.printStackTrace(); + } + } + } + + try { + return (BaseCustomPower_MTE) ((BaseCustomPower_MTE) sBaseMetaTileEntityClass2.newInstance()); + } catch (Throwable arg0) { + arg0.printStackTrace(GT_Log.err); + try { + Constructor<?> g = BaseCustomPower_MTE.class.getConstructors()[0]; + g.setAccessible(true); + return (BaseCustomPower_MTE) g.newInstance(); + } catch (InstantiationException | IllegalAccessException | IllegalArgumentException + | InvocationTargetException | SecurityException e) { + GT_Log.err + .println("GT++ Mod: Fatal Error ocurred while initializing TileEntities, crashing Minecraft."); + e.printStackTrace(GT_Log.err); + throw new RuntimeException(e); + } + } + } + + + + + + + + public void setValidHeatingCoilMetas() { for (int i = 0; i <= 6; i++ ) { GT_ValidHeatingCoilMetas.put(i); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java b/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java index 4313ca53f6..c1db39b132 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java @@ -17,9 +17,13 @@ import gregtech.api.enums.Textures.BlockIcons; import gregtech.api.interfaces.ITexture; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; +import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.reflect.ReflectionUtils; import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; public class StaticFields59 { @@ -31,6 +35,7 @@ public class StaticFields59 { public static final Field mCasingTexturePages; public static final Method mCalculatePollutionReduction; + public static final Method mAddFurnaceRecipe; private static final Map<String, Materials> mMaterialCache = new LinkedHashMap<String, Materials>(); @@ -46,6 +51,20 @@ public class StaticFields59 { mCasingTexturePages = getField(BlockIcons.class, "casingTexturePages"); mCalculatePollutionReduction = getMethod(GT_MetaTileEntity_Hatch_Muffler.class, "calculatePollutionReduction", int.class); + + Logger.INFO("Initializing a recipe handler for different versions of Gregtech 5."); + //Yep... + if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { + Logger.INFO("Selecting GT 5.7/5.8 Recipe Set"); + mAddFurnaceRecipe = getMethod(GT_ModHandler.class, "addSmeltingAndAlloySmeltingRecipe", ItemStack.class, ItemStack.class); + } + else { + Logger.INFO("Selecting GT 5.9 Recipe Set"); + mAddFurnaceRecipe = getMethod(GT_ModHandler.class, "addSmeltingAndAlloySmeltingRecipe", ItemStack.class, ItemStack.class, boolean.class); + } + + + } public static synchronized final Block getBlockCasings5() { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Block_Machines.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Block_Machines.java new file mode 100644 index 0000000000..9fe89bfabc --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Block_Machines.java @@ -0,0 +1,515 @@ +package gtPlusPlus.xmod.gregtech.common.blocks; + +import java.util.ArrayList; +import java.util.List; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.GregTech_API; +import gregtech.api.enums.Textures.BlockIcons; +import gregtech.api.interfaces.IDebugableBlock; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.ICoverable; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.items.GT_Generic_Block; +import gregtech.api.metatileentity.BaseMetaPipeEntity; +import gregtech.api.metatileentity.BaseMetaTileEntity; +import gregtech.api.metatileentity.BaseTileEntity; +import gregtech.api.objects.XSTR; +import gregtech.api.util.GT_Log; +import gregtech.api.util.GT_Utility; +import gregtech.common.blocks.GT_Item_Machines; +import gregtech.common.blocks.GT_Material_Machines; +import gregtech.common.render.GT_Renderer_Block; +import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; +import gtPlusPlus.xmod.gregtech.common.render.GTPP_Render_MachineBlock; +import net.minecraft.block.Block; +import net.minecraft.block.ITileEntityProvider; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.EnumCreatureType; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; +import net.minecraft.util.StatCollector; +import net.minecraft.world.Explosion; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +public class GTPP_Block_Machines extends GT_Generic_Block implements IDebugableBlock, ITileEntityProvider { + public static ThreadLocal<IGregTechTileEntity> mTemporaryTileEntity = new ThreadLocal<IGregTechTileEntity>(); + + public GTPP_Block_Machines() { + super(GTPP_Item_Machines.class, "gtpp.blockmachines", new GT_Material_Machines()); + GregTech_API.registerMachineBlock(this, -1); + this.setHardness(1.0F); + this.setResistance(10.0F); + this.setStepSound(soundTypeMetal); + this.setCreativeTab(GregTech_API.TAB_GREGTECH); + this.isBlockContainer = true; + } + + public String getHarvestTool(int aMeta) { + switch (aMeta / 4) { + case 0 : + return "wrench"; + case 1 : + return "wrench"; + case 2 : + return "cutter"; + case 3 : + return "axe"; + default : + return "wrench"; + } + } + + public int getHarvestLevel(int aMeta) { + return aMeta % 4; + } + + protected boolean canSilkHarvest() { + return false; + } + + public void onNeighborChange(IBlockAccess aWorld, int aX, int aY, int aZ, int aTileX, int aTileY, int aTileZ) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if (tTileEntity instanceof BaseTileEntity) { + ((BaseTileEntity) tTileEntity).onAdjacentBlockChange(aTileX, aTileY, aTileZ); + } + + } + + public void onBlockAdded(World aWorld, int aX, int aY, int aZ) { + super.onBlockAdded(aWorld, aX, aY, aZ); + if (GregTech_API.isMachineBlock(this, aWorld.getBlockMetadata(aX, aY, aZ))) { + GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); + } + + } + + public String getUnlocalizedName() { + return "gtpp.blockmachines"; + } + + public String getLocalizedName() { + return StatCollector.translateToLocal("gtpp.blockmachines" + ".name"); + } + + public int getFlammability(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection face) { + return 0; + } + + public int getFireSpreadSpeed(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection face) { + return GregTech_API.sMachineFlammable && aWorld.getBlockMetadata(aX, aY, aZ) == 0 ? 100 : 0; + } + + public int getRenderType() { + return GTPP_Render_MachineBlock.INSTANCE == null ? super.getRenderType() : GTPP_Render_MachineBlock.INSTANCE.mRenderID; + } + + public boolean isFireSource(World aWorld, int aX, int aY, int aZ, ForgeDirection side) { + return GregTech_API.sMachineFlammable && aWorld.getBlockMetadata(aX, aY, aZ) == 0; + } + + public boolean isFlammable(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection face) { + return GregTech_API.sMachineFlammable && aWorld.getBlockMetadata(aX, aY, aZ) == 0; + } + + public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess aWorld, int aX, int aY, int aZ) { + return false; + } + + public boolean canConnectRedstone(IBlockAccess var1, int var2, int var3, int var4, int var5) { + return true; + } + + public boolean canBeReplacedByLeaves(IBlockAccess aWorld, int aX, int aY, int aZ) { + return false; + } + + public boolean isNormalCube(IBlockAccess aWorld, int aX, int aY, int aZ) { + return false; + } + + public boolean hasTileEntity(int aMeta) { + return true; + } + + public boolean hasComparatorInputOverride() { + return true; + } + + public boolean renderAsNormalBlock() { + return false; + } + + public boolean canProvidePower() { + return true; + } + + public boolean isOpaqueCube() { + return false; + } + + public TileEntity createNewTileEntity(World aWorld, int aMeta) { + return this.createTileEntity(aWorld, aMeta); + } + + public IIcon getIcon(IBlockAccess aIBlockAccess, int aX, int aY, int aZ, int aSide) { + return BlockIcons.MACHINE_LV_SIDE.getIcon(); + } + + public IIcon getIcon(int aSide, int aMeta) { + return BlockIcons.MACHINE_LV_SIDE.getIcon(); + } + + public boolean onBlockEventReceived(World aWorld, int aX, int aY, int aZ, int aData1, int aData2) { + super.onBlockEventReceived(aWorld, aX, aY, aZ, aData1, aData2); + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + return tTileEntity != null ? tTileEntity.receiveClientEvent(aData1, aData2) : false; + } + + public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List outputAABB, + Entity collider) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if (tTileEntity instanceof IGregTechTileEntity + && ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null) { + ((IGregTechTileEntity) tTileEntity).addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, + collider); + } else { + super.addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider); + } + } + + public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + return tTileEntity instanceof IGregTechTileEntity + && ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null + ? ((IGregTechTileEntity) tTileEntity).getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ) + : super.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); + } + + @SideOnly(Side.CLIENT) + public AxisAlignedBB getSelectedBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + return tTileEntity instanceof IGregTechTileEntity + && ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null + ? ((IGregTechTileEntity) tTileEntity).getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ) + : super.getSelectedBoundingBoxFromPool(aWorld, aX, aY, aZ); + } + + public void setBlockBoundsBasedOnState(IBlockAccess blockAccess, int aX, int aY, int aZ) { + TileEntity tTileEntity = blockAccess.getTileEntity(aX, aY, aZ); + if (tTileEntity instanceof IGregTechTileEntity + && ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null) { + AxisAlignedBB bbb = ((IGregTechTileEntity) tTileEntity) + .getCollisionBoundingBoxFromPool(((IGregTechTileEntity) tTileEntity).getWorld(), 0, 0, 0); + this.minX = bbb.minX; + this.minY = bbb.minY; + this.minZ = bbb.minZ; + this.maxX = bbb.maxX; + this.maxY = bbb.maxY; + this.maxZ = bbb.maxZ; + } else { + super.setBlockBoundsBasedOnState(blockAccess, aX, aY, aZ); + } + } + + public void setBlockBoundsForItemRender() { + super.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity collider) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if (tTileEntity instanceof IGregTechTileEntity + && ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null) { + ((IGregTechTileEntity) tTileEntity).onEntityCollidedWithBlock(aWorld, aX, aY, aZ, collider); + } else { + super.onEntityCollidedWithBlock(aWorld, aX, aY, aZ, collider); + } + } + + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister aIconRegister) { + + } + + public float getBlockHardness(World aWorld, int aX, int aY, int aZ) { + return super.getBlockHardness(aWorld, aX, aY, aZ); + } + + public float getPlayerRelativeBlockHardness(EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + return tTileEntity instanceof BaseMetaTileEntity && ((BaseMetaTileEntity) tTileEntity).privateAccess() + && !((BaseMetaTileEntity) tTileEntity).playerOwnsThis(aPlayer, true) + ? -1.0F + : super.getPlayerRelativeBlockHardness(aPlayer, aWorld, aX, aY, aZ); + } + + public boolean onBlockActivated(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer, int aSide, float par1, + float par2, float par3) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if (tTileEntity == null) { + return false; + } else { + if (aPlayer.isSneaking()) { + ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem(); + if (tCurrentItem == null) { + return false; + } + + if (!GT_Utility.isStackInList(tCurrentItem, GregTech_API.sScrewdriverList) + && !GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWrenchList)) { + return false; + } + } + + return tTileEntity instanceof IGregTechTileEntity + ? (((IGregTechTileEntity) tTileEntity).getTimer() < 50L + ? false + : (!aWorld.isRemote && !((IGregTechTileEntity) tTileEntity).isUseableByPlayer(aPlayer) + ? true + : ((IGregTechTileEntity) tTileEntity).onRightclick(aPlayer, (byte) aSide, par1, + par2, par3))) + : false; + } + } + + public void onBlockClicked(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if (tTileEntity instanceof IGregTechTileEntity) { + ((IGregTechTileEntity) tTileEntity).onLeftclick(aPlayer); + } + + } + + public int getDamageValue(World aWorld, int aX, int aY, int aZ) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + return tTileEntity instanceof IGregTechTileEntity ? ((IGregTechTileEntity) tTileEntity).getMetaTileID() : 0; + } + + public void onBlockExploded(World aWorld, int aX, int aY, int aZ, Explosion aExplosion) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if (tTileEntity instanceof BaseMetaTileEntity) { + ((BaseMetaTileEntity) tTileEntity).doEnergyExplosion(); + } + + super.onBlockExploded(aWorld, aX, aY, aZ, aExplosion); + } + + public void breakBlock(World aWorld, int aX, int aY, int aZ, Block par5, int par6) { + GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if (tTileEntity instanceof IGregTechTileEntity) { + IGregTechTileEntity tGregTechTileEntity = (IGregTechTileEntity) tTileEntity; + XSTR tRandom = new XSTR(); + mTemporaryTileEntity.set(tGregTechTileEntity); + + for (int i = 0; i < tGregTechTileEntity.getSizeInventory(); ++i) { + ItemStack tItem = tGregTechTileEntity.getStackInSlot(i); + if (tItem != null && tItem.stackSize > 0 && tGregTechTileEntity.isValidSlot(i)) { + EntityItem tItemEntity = new EntityItem(aWorld, + (double) ((float) aX + tRandom.nextFloat() * 0.8F + 0.1F), + (double) ((float) aY + tRandom.nextFloat() * 0.8F + 0.1F), + (double) ((float) aZ + tRandom.nextFloat() * 0.8F + 0.1F), + new ItemStack(tItem.getItem(), tItem.stackSize, tItem.getItemDamage())); + if (tItem.hasTagCompound()) { + tItemEntity.getEntityItem().setTagCompound((NBTTagCompound) tItem.getTagCompound().copy()); + } + + tItemEntity.motionX = tRandom.nextGaussian() * 0.0500000007450581D; + tItemEntity.motionY = tRandom.nextGaussian() * 0.0500000007450581D + 0.2000000029802322D; + tItemEntity.motionZ = tRandom.nextGaussian() * 0.0500000007450581D; + aWorld.spawnEntityInWorld(tItemEntity); + tItem.stackSize = 0; + tGregTechTileEntity.setInventorySlotContents(i, (ItemStack) null); + } + } + } + + super.breakBlock(aWorld, aX, aY, aZ, par5, par6); + aWorld.removeTileEntity(aX, aY, aZ); + } + + public ArrayList<ItemStack> getDrops(World aWorld, int aX, int aY, int aZ, int aMeta, int aFortune) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + return tTileEntity instanceof IGregTechTileEntity + ? ((IGregTechTileEntity) tTileEntity).getDrops() + : (mTemporaryTileEntity.get() == null + ? new ArrayList() + : ((IGregTechTileEntity) mTemporaryTileEntity.get()).getDrops()); + } + + public int getComparatorInputOverride(World aWorld, int aX, int aY, int aZ, int aSide) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + return tTileEntity instanceof IGregTechTileEntity + ? ((IGregTechTileEntity) tTileEntity).getComparatorValue((byte) aSide) + : 0; + } + + public int isProvidingWeakPower(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) { + if (aSide >= 0 && aSide <= 5) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + return tTileEntity instanceof IGregTechTileEntity + ? ((IGregTechTileEntity) tTileEntity).getOutputRedstoneSignal(GT_Utility.getOppositeSide(aSide)) + : 0; + } else { + return 0; + } + } + + public int isProvidingStrongPower(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) { + if (aSide >= 0 && aSide <= 5) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + return tTileEntity instanceof IGregTechTileEntity + ? ((IGregTechTileEntity) tTileEntity) + .getStrongOutputRedstoneSignal(GT_Utility.getOppositeSide(aSide)) + : 0; + } else { + return 0; + } + } + + public void dropBlockAsItemWithChance(World aWorld, int aX, int aY, int aZ, int par5, float chance, int par7) { + if (!aWorld.isRemote) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if (tTileEntity != null && chance < 1.0F) { + if (tTileEntity instanceof BaseMetaTileEntity && GregTech_API.sMachineNonWrenchExplosions) { + ((BaseMetaTileEntity) tTileEntity).doEnergyExplosion(); + } + } else { + super.dropBlockAsItemWithChance(aWorld, aX, aY, aZ, par5, chance, par7); + } + } + + } + + public boolean isSideSolid(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection aSide) { + if (aWorld.getBlockMetadata(aX, aY, aZ) == 0) { + return true; + } else { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if (tTileEntity != null) { + if (tTileEntity instanceof BaseMetaTileEntity) { + return true; + } + + if (tTileEntity instanceof BaseMetaPipeEntity + && (((BaseMetaPipeEntity) tTileEntity).mConnections & -64) != 0) { + return true; + } + + if (tTileEntity instanceof ICoverable + && ((ICoverable) tTileEntity).getCoverIDAtSide((byte) aSide.ordinal()) != 0) { + return true; + } + } + + return false; + } + } + + public int getLightOpacity(IBlockAccess aWorld, int aX, int aY, int aZ) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + return tTileEntity == null + ? 0 + : (tTileEntity instanceof IGregTechTileEntity + ? ((IGregTechTileEntity) tTileEntity).getLightOpacity() + : (aWorld.getBlockMetadata(aX, aY, aZ) == 0 ? 255 : 0)); + } + + public int getLightValue(IBlockAccess aWorld, int aX, int aY, int aZ) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + return tTileEntity instanceof BaseMetaTileEntity ? ((BaseMetaTileEntity) tTileEntity).getLightValue() : 0; + } + + public TileEntity createTileEntity(World aWorld, int aMeta) { + return (TileEntity) (aMeta >= 4 ? Meta_GT_Proxy.constructBaseMetaTileEntity() : Meta_GT_Proxy.constructBaseMetaTileEntityCustomPower()); + } + + public float getExplosionResistance(Entity par1Entity, World aWorld, int aX, int aY, int aZ, double explosionX, + double explosionY, double explosionZ) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + return tTileEntity instanceof IGregTechTileEntity + ? ((IGregTechTileEntity) tTileEntity).getBlastResistance((byte) 6) + : 10.0F; + } + + @SideOnly(Side.CLIENT) + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { + for (int i = 0; i < 100; ++i) { + if (GregTech_API.METATILEENTITIES[(30400 + i)] != null) { + par3List.add(new ItemStack(par1, 1, i)); + } + } + + } + + public void onBlockPlacedBy(World aWorld, int aX, int aY, int aZ, EntityLivingBase aPlayer, ItemStack aStack) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if (tTileEntity != null) { + if (tTileEntity instanceof IGregTechTileEntity) { + IGregTechTileEntity var6 = (IGregTechTileEntity) tTileEntity; + if (aPlayer == null) { + var6.setFrontFacing((byte) 1); + } else { + int var7 = MathHelper.floor_double((double) (aPlayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + int var8 = Math.round(aPlayer.rotationPitch); + if (var8 >= 65 && var6.isValidFacing((byte) 1)) { + var6.setFrontFacing((byte) 1); + } else if (var8 <= -65 && var6.isValidFacing((byte) 0)) { + var6.setFrontFacing((byte) 0); + } else { + switch (var7) { + case 0 : + var6.setFrontFacing((byte) 2); + break; + case 1 : + var6.setFrontFacing((byte) 5); + break; + case 2 : + var6.setFrontFacing((byte) 3); + break; + case 3 : + var6.setFrontFacing((byte) 4); + } + } + } + } + + } + } + + public ArrayList<String> getDebugInfo(EntityPlayer aPlayer, int aX, int aY, int aZ, int aLogLevel) { + TileEntity tTileEntity = aPlayer.worldObj.getTileEntity(aX, aY, aZ); + return tTileEntity instanceof BaseMetaTileEntity + ? ((BaseMetaTileEntity) tTileEntity).getDebugInfo(aPlayer, aLogLevel) + : (tTileEntity instanceof BaseMetaPipeEntity + ? ((BaseMetaPipeEntity) tTileEntity).getDebugInfo(aPlayer, aLogLevel) + : null); + } + + public boolean recolourBlock(World aWorld, int aX, int aY, int aZ, ForgeDirection aSide, int aColor) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if (tTileEntity instanceof IGregTechTileEntity) { + if (((IGregTechTileEntity) tTileEntity).getColorization() == (byte) (~aColor & 15)) { + return false; + } else { + ((IGregTechTileEntity) tTileEntity).setColorization((byte) (~aColor & 15)); + return true; + } + } else { + return false; + } + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Item_Machines.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Item_Machines.java new file mode 100644 index 0000000000..a9645184cf --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Item_Machines.java @@ -0,0 +1,219 @@ +package gtPlusPlus.xmod.gregtech.common.blocks; + +import gregtech.api.GregTech_API; +import gregtech.api.enums.GT_Values; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_ItsNotMyFaultException; +import gregtech.api.util.GT_LanguageManager; +import gregtech.api.util.GT_Log; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.core.lib.CORE; + +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.World; + +public class GTPP_Item_Machines extends ItemBlock { + public GTPP_Item_Machines(Block par1) { + super(par1); + this.setMaxDamage(0); + this.setHasSubtypes(true); + this.setCreativeTab(GregTech_API.TAB_GREGTECH); + } + + @SuppressWarnings("unchecked") + public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean par4) { + try { + int e = this.getDamage(aStack) + 30400; //Add Offset + if (e <= 0 || e >= GregTech_API.METATILEENTITIES.length) { + return; + } + + if (GregTech_API.METATILEENTITIES[e] != null) { + + IGregTechTileEntity aNBT = GregTech_API.METATILEENTITIES[e].getBaseMetaTileEntity(); + + final long tVoltage = aNBT.getInputVoltage(); + byte tTier = (byte) ((byte) Math.max(1, GT_Utility.getTier(tVoltage))); + + /*if (aNBT.getDescription() != null) { + int tAmount = 0; + String[] arg7 = aNBT.getDescription(); + int arg8 = arg7.length-1; + + if (arg7 != null && arg7.length > 0) { + for (String t : arg7) { + aList.add(t); + } + + } + else { + aList.add("ERROR"); + } + + for (int y = 0; y < arg8; y++) { + String tDescription = arg7[y]; + + if (tDescription != null) { + aList.add(tDescription+"|"+arg8); + continue; + } + else { + continue; + } + } + }*/ + + if (aNBT.getEUCapacity() > 0L) { + + //Custom handling + if ((e - 30400) <= 100) { + + + if ((e - 30400) <= 10) { + tTier -= 2; + aList.add(EnumChatFormatting.BOLD+"16"+" Fuse Slots"+EnumChatFormatting.GRAY); + aList.add("One will blow per each A of eu extra passed into it"); + aList.add("Can receive an additional "+EnumChatFormatting.YELLOW+GT_Values.V[tTier]+EnumChatFormatting.GRAY+" EU/t per Fuse"); + aList.add("This machine can accept upto a single amp of "+GT_Values.VN[Math.min(tTier+2, 12)]); + aList.add(GT_LanguageManager.addStringLocalization("TileEntity_Breaker_Loss", "Breaker Loss: "+EnumChatFormatting.RED+""+(GT_Values.V[Math.max(tTier-1, 0)]/10)+EnumChatFormatting.GRAY+" EU/t", !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY); + } + + + aList.add(GT_LanguageManager.addStringLocalization("TileEntity_Special_Power_1", EnumChatFormatting.RED+"Special Power Handling, please read manual", !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY); + //aList.add(GT_LanguageManager.addStringLocalization("TileEntity_BreakerBox_2", EnumChatFormatting.RED+"Special Power Handling, please read manual", !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY); + //aList.add(GT_LanguageManager.addStringLocalization("TileEntity_BreakerBox_3", EnumChatFormatting.RED+"Special Power Handling, please read manual", !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY); + } + + + if (aNBT.getInputVoltage() > 0L) { + aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_IN", "Voltage IN: ", + !GregTech_API.sPostloadFinished) + EnumChatFormatting.GREEN + aNBT.getInputVoltage() + + " (" + GT_Values.VN[GT_Utility.getTier(aNBT.getInputVoltage())] + ")" + + EnumChatFormatting.GRAY); + } + + if (aNBT.getOutputVoltage() > 0L) { + aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_OUT", "Voltage OUT: ", + !GregTech_API.sPostloadFinished) + EnumChatFormatting.GREEN + aNBT.getOutputVoltage() + + " (" + GT_Values.VN[GT_Utility.getTier(aNBT.getOutputVoltage())] + ")" + + EnumChatFormatting.GRAY); + } + + aList.add(GT_LanguageManager.addStringLocalization("TileEntity_Lossess_EU", "Transmission Loss: "+EnumChatFormatting.DARK_BLUE+"0", !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY); + + + if (aNBT.getOutputAmperage() > 1L) { + aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_AMOUNT", "Amperage: ", + !GregTech_API.sPostloadFinished) + EnumChatFormatting.YELLOW + aNBT.getOutputAmperage() + + EnumChatFormatting.GRAY); + } + + aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_STORE", "Capacity: ", + !GregTech_API.sPostloadFinished) + EnumChatFormatting.BLUE + aNBT.getEUCapacity() + + EnumChatFormatting.GRAY); + } + } + + NBTTagCompound arg16 = aStack.getTagCompound(); + if (arg16 != null) { + if (arg16.getBoolean("mMuffler")) { + aList.add(GT_LanguageManager.addStringLocalization("GT_TileEntity_MUFFLER", "has Muffler Upgrade", + !GregTech_API.sPostloadFinished)); + } + + if (arg16.getBoolean("mSteamConverter")) { + aList.add(GT_LanguageManager.addStringLocalization("GT_TileEntity_STEAMCONVERTER", + "has Steam Upgrade", !GregTech_API.sPostloadFinished)); + } + + boolean arg17 = false; + byte arg18; + if ((arg18 = arg16.getByte("mSteamTanks")) > 0) { + aList.add(arg18 + " " + GT_LanguageManager.addStringLocalization("GT_TileEntity_STEAMTANKS", + "Steam Tank Upgrades", !GregTech_API.sPostloadFinished)); + } + } + + + aList.add(EnumChatFormatting.UNDERLINE+"Special GT++ Machine"); + + } catch (Throwable arg15) { + arg15.printStackTrace(GT_Log.err); + } + + } + + public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, + float hitX, float hitY, float hitZ) { + return false; + } + + public String getUnlocalizedName(ItemStack aStack) { + short tDamage = (short) (this.getDamage(aStack) + 30400); //Add Offset; + return tDamage >= 0 && tDamage < GregTech_API.METATILEENTITIES.length + ? (GregTech_API.METATILEENTITIES[tDamage] != null + ? "gt.blockmachines" + "." + GregTech_API.METATILEENTITIES[tDamage].getMetaName() + : "") + : ""; + } + + public void onCreated(ItemStack aStack, World aWorld, EntityPlayer aPlayer) { + super.onCreated(aStack, aWorld, aPlayer); + short tDamage = (short) ((short) this.getDamage(aStack) + 30400); //Add Offset; + if (tDamage < 0 + || tDamage >= GregTech_API.METATILEENTITIES.length && GregTech_API.METATILEENTITIES[tDamage] != null) { + GregTech_API.METATILEENTITIES[tDamage].onCreated(aStack, aWorld, aPlayer); + } + + } + + public boolean placeBlockAt(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int side, + float hitX, float hitY, float hitZ, int aMeta) { + short tDamage = (short) ((short) this.getDamage(aStack) + 30400); //Add Offset; + if (tDamage > 0) { + if (GregTech_API.METATILEENTITIES[tDamage] == null) { + return false; + } + + byte tMetaData = GregTech_API.METATILEENTITIES[tDamage].getTileEntityBaseType(); + if (!aWorld.setBlock(aX, aY, aZ, this.field_150939_a, tMetaData, 3)) { + return false; + } + + if (aWorld.getBlock(aX, aY, aZ) != this.field_150939_a) { + throw new GT_ItsNotMyFaultException( + "Failed to place Block even though World.setBlock returned true. It COULD be MCPC/Bukkit causing that. In case you really have that installed, don\'t report this Bug to me, I don\'t know how to fix it."); + } + + if (aWorld.getBlockMetadata(aX, aY, aZ) != tMetaData) { + throw new GT_ItsNotMyFaultException( + "Failed to set the MetaValue of the Block even though World.setBlock returned true. It COULD be MCPC/Bukkit causing that. In case you really have that installed, don\'t report this Bug to me, I don\'t know how to fix it."); + } + + IGregTechTileEntity tTileEntity = (IGregTechTileEntity) aWorld.getTileEntity(aX, aY, aZ); + if (tTileEntity != null) { + tTileEntity.setInitialValuesAsNBT(tTileEntity.isServerSide() ? aStack.getTagCompound() : null, tDamage); + if (aPlayer != null) { + tTileEntity.setOwnerName(aPlayer.getDisplayName()); + } + + tTileEntity.getMetaTileEntity().initDefaultModes(aStack.getTagCompound()); + } + } else if (!aWorld.setBlock(aX, aY, aZ, this.field_150939_a, tDamage, 3)) { + return false; + } + + if (aWorld.getBlock(aX, aY, aZ) == this.field_150939_a) { + this.field_150939_a.onBlockPlacedBy(aWorld, aX, aY, aZ, aPlayer, aStack); + this.field_150939_a.onPostBlockPlaced(aWorld, aX, aY, aZ, tDamage); + } + + return true; + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_Render_MachineBlock.java b/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_Render_MachineBlock.java new file mode 100644 index 0000000000..c884114b79 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_Render_MachineBlock.java @@ -0,0 +1,659 @@ +package gtPlusPlus.xmod.gregtech.common.render; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.client.registry.RenderingRegistry; +import gregtech.api.GregTech_API; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.interfaces.tileentity.IPipeRenderedTileEntity; +import gregtech.api.interfaces.tileentity.ITexturedTileEntity; +import gregtech.common.blocks.GT_Block_Machines; +import gregtech.common.blocks.GT_Block_Ores_Abstract; +import gregtech.common.blocks.GT_TileEntity_Ores; +import gregtech.common.render.GT_Renderer_Block; +import gtPlusPlus.xmod.gregtech.common.blocks.GTPP_Block_Machines; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.IBlockAccess; + +public class GTPP_Render_MachineBlock extends GT_Renderer_Block { + + public static GTPP_Render_MachineBlock INSTANCE; + public final int mRenderID = RenderingRegistry.getNextAvailableRenderId(); + + public GTPP_Render_MachineBlock() { + INSTANCE = this; + RenderingRegistry.registerBlockHandler(this); + } + + private static ITexture[] getTexture(IMetaTileEntity arg0, int arg1, int arg2, int arg3, boolean arg4, boolean arg5) { + IGregTechTileEntity arg0b = arg0.getBaseMetaTileEntity(); + return arg0.getTexture(arg0b, (byte) arg1, (byte) arg2, (byte) arg3, arg4, arg5); + } + + private static void renderNormalInventoryMetaTileEntity(Block aBlock, int aMeta, RenderBlocks aRenderer) { + if (aMeta > 0 && aMeta < GregTech_API.METATILEENTITIES.length) { + IMetaTileEntity tMetaTileEntity = GregTech_API.METATILEENTITIES[aMeta]; + if (tMetaTileEntity != null) { + aBlock.setBlockBoundsForItemRender(); + aRenderer.setRenderBoundsFromBlock(aBlock); + GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + if (tMetaTileEntity.getBaseMetaTileEntity() instanceof IPipeRenderedTileEntity) { + float tThickness = ((IPipeRenderedTileEntity) tMetaTileEntity.getBaseMetaTileEntity()) + .getThickNess(); + float sp = (1.0F - tThickness) / 2.0F; + aBlock.setBlockBounds(0.0F, sp, sp, 1.0F, sp + tThickness, sp + tThickness); + aRenderer.setRenderBoundsFromBlock(aBlock); + Tessellator.instance.startDrawingQuads(); + Tessellator.instance.setNormal(0.0F, -1.0F, 0.0F); + renderNegativeYFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0, + getTexture(tMetaTileEntity, 0, 9, -1, false, false), + true); + Tessellator.instance.draw(); + Tessellator.instance.startDrawingQuads(); + Tessellator.instance.setNormal(0.0F, 1.0F, 0.0F); + renderPositiveYFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0, + getTexture(tMetaTileEntity, 1, 9, -1, false, false), + true); + Tessellator.instance.draw(); + Tessellator.instance.startDrawingQuads(); + Tessellator.instance.setNormal(0.0F, 0.0F, -1.0F); + renderNegativeZFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0, + getTexture(tMetaTileEntity, 2, 9, -1, false, false), + true); + Tessellator.instance.draw(); + Tessellator.instance.startDrawingQuads(); + Tessellator.instance.setNormal(0.0F, 0.0F, 1.0F); + renderPositiveZFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0, + getTexture(tMetaTileEntity, 3, 9, -1, false, false), + true); + Tessellator.instance.draw(); + Tessellator.instance.startDrawingQuads(); + Tessellator.instance.setNormal(-1.0F, 0.0F, 0.0F); + renderNegativeXFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0, + getTexture(tMetaTileEntity, 4, 9, -1, true, false), + true); + Tessellator.instance.draw(); + Tessellator.instance.startDrawingQuads(); + Tessellator.instance.setNormal(1.0F, 0.0F, 0.0F); + renderPositiveXFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0, + getTexture(tMetaTileEntity, 5, 9, -1, true, false), + true); + Tessellator.instance.draw(); + } else { + Tessellator.instance.startDrawingQuads(); + Tessellator.instance.setNormal(0.0F, -1.0F, 0.0F); + renderNegativeYFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0, + getTexture(tMetaTileEntity, 0, 4, -1, true, false), + true); + Tessellator.instance.draw(); + Tessellator.instance.startDrawingQuads(); + Tessellator.instance.setNormal(0.0F, 1.0F, 0.0F); + renderPositiveYFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0, + getTexture(tMetaTileEntity, 1, 4, -1, true, false), + true); + Tessellator.instance.draw(); + Tessellator.instance.startDrawingQuads(); + Tessellator.instance.setNormal(0.0F, 0.0F, -1.0F); + renderNegativeZFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0, + getTexture(tMetaTileEntity, 2, 4, -1, true, false), + true); + Tessellator.instance.draw(); + Tessellator.instance.startDrawingQuads(); + Tessellator.instance.setNormal(0.0F, 0.0F, 1.0F); + renderPositiveZFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0, + getTexture(tMetaTileEntity, 3, 4, -1, true, false), + true); + Tessellator.instance.draw(); + Tessellator.instance.startDrawingQuads(); + Tessellator.instance.setNormal(-1.0F, 0.0F, 0.0F); + renderNegativeXFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0, + getTexture(tMetaTileEntity, 4, 4, -1, true, false), + true); + Tessellator.instance.draw(); + Tessellator.instance.startDrawingQuads(); + Tessellator.instance.setNormal(1.0F, 0.0F, 0.0F); + renderPositiveXFacing((IBlockAccess) null, aRenderer, aBlock, 0, 0, 0, + getTexture(tMetaTileEntity, 5, 4, -1, true, false), + true); + Tessellator.instance.draw(); + } + + aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + aRenderer.setRenderBoundsFromBlock(aBlock); + GL11.glTranslatef(0.5F, 0.5F, 0.5F); + } + } + } + + public static boolean renderStandardBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, + RenderBlocks aRenderer) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + return tTileEntity instanceof ITexturedTileEntity + ? renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer, + new ITexture[][]{((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 0), + ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 1), + ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 2), + ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 3), + ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 4), + ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 5)}) + : false; + } + + public static boolean renderStandardBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, + RenderBlocks aRenderer, ITexture[][] aTextures) { + aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + aRenderer.setRenderBoundsFromBlock(aBlock); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[0], true); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[1], true); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[2], true); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[3], true); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[4], true); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[5], true); + return true; + } + + public static boolean renderPipeBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, + IPipeRenderedTileEntity aTileEntity, RenderBlocks aRenderer) { + byte aConnections = aTileEntity.getConnections(); + if ((aConnections & 192) != 0) { + return renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer); + } else { + float tThickness = aTileEntity.getThickNess(); + if (tThickness >= 0.99F) { + return renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer); + } else { + float sp = (1.0F - tThickness) / 2.0F; + byte tConnections = 0; + + for (byte tIsCovered = 0; tIsCovered < 6; ++tIsCovered) { + if ((aConnections & 1 << tIsCovered) != 0) { + tConnections = (byte) (tConnections | 1 << (tIsCovered + 2) % 6); + } + } + + boolean[] arg14 = new boolean[6]; + + for (byte tIcons = 0; tIcons < 6; ++tIcons) { + arg14[tIcons] = aTileEntity.getCoverIDAtSide(tIcons) != 0; + } + + if (arg14[0] && arg14[1] && arg14[2] && arg14[3] && arg14[4] && arg14[5]) { + return renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer); + } else { + ITexture[][] arg15 = new ITexture[6][]; + ITexture[][] tCovers = new ITexture[6][]; + + for (byte i = 0; i < 6; ++i) { + tCovers[i] = aTileEntity.getTexture(aBlock, i); + arg15[i] = aTileEntity.getTextureUncovered(i); + } + + if (tConnections == 0) { + aBlock.setBlockBounds(sp, sp, sp, sp + tThickness, sp + tThickness, sp + tThickness); + aRenderer.setRenderBoundsFromBlock(aBlock); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[0], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[1], false); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[2], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[3], false); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[4], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[5], false); + } else if (tConnections == 3) { + aBlock.setBlockBounds(0.0F, sp, sp, 1.0F, sp + tThickness, sp + tThickness); + aRenderer.setRenderBoundsFromBlock(aBlock); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[0], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[1], false); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[2], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[3], false); + if (!arg14[4]) { + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[4], false); + } + + if (!arg14[5]) { + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[5], false); + } + } else if (tConnections == 12) { + aBlock.setBlockBounds(sp, 0.0F, sp, sp + tThickness, 1.0F, sp + tThickness); + aRenderer.setRenderBoundsFromBlock(aBlock); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[2], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[3], false); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[4], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[5], false); + if (!arg14[0]) { + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[0], false); + } + + if (!arg14[1]) { + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[1], false); + } + } else if (tConnections == 48) { + aBlock.setBlockBounds(sp, sp, 0.0F, sp + tThickness, sp + tThickness, 1.0F); + aRenderer.setRenderBoundsFromBlock(aBlock); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[0], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[1], false); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[4], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[5], false); + if (!arg14[2]) { + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[2], false); + } + + if (!arg14[3]) { + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[3], false); + } + } else { + if ((tConnections & 1) == 0) { + aBlock.setBlockBounds(sp, sp, sp, sp + tThickness, sp + tThickness, sp + tThickness); + aRenderer.setRenderBoundsFromBlock(aBlock); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[4], false); + } else { + aBlock.setBlockBounds(0.0F, sp, sp, sp, sp + tThickness, sp + tThickness); + aRenderer.setRenderBoundsFromBlock(aBlock); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[0], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[1], false); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[2], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[3], false); + if (!arg14[4]) { + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[4], false); + } + } + + if ((tConnections & 2) == 0) { + aBlock.setBlockBounds(sp, sp, sp, sp + tThickness, sp + tThickness, sp + tThickness); + aRenderer.setRenderBoundsFromBlock(aBlock); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[5], false); + } else { + aBlock.setBlockBounds(sp + tThickness, sp, sp, 1.0F, sp + tThickness, sp + tThickness); + aRenderer.setRenderBoundsFromBlock(aBlock); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[0], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[1], false); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[2], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[3], false); + if (!arg14[5]) { + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[5], false); + } + } + + if ((tConnections & 4) == 0) { + aBlock.setBlockBounds(sp, sp, sp, sp + tThickness, sp + tThickness, sp + tThickness); + aRenderer.setRenderBoundsFromBlock(aBlock); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[0], false); + } else { + aBlock.setBlockBounds(sp, 0.0F, sp, sp + tThickness, sp, sp + tThickness); + aRenderer.setRenderBoundsFromBlock(aBlock); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[2], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[3], false); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[4], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[5], false); + if (!arg14[0]) { + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[0], false); + } + } + + if ((tConnections & 8) == 0) { + aBlock.setBlockBounds(sp, sp, sp, sp + tThickness, sp + tThickness, sp + tThickness); + aRenderer.setRenderBoundsFromBlock(aBlock); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[1], false); + } else { + aBlock.setBlockBounds(sp, sp + tThickness, sp, sp + tThickness, 1.0F, sp + tThickness); + aRenderer.setRenderBoundsFromBlock(aBlock); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[2], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[3], false); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[4], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[5], false); + if (!arg14[1]) { + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[1], false); + } + } + + if ((tConnections & 16) == 0) { + aBlock.setBlockBounds(sp, sp, sp, sp + tThickness, sp + tThickness, sp + tThickness); + aRenderer.setRenderBoundsFromBlock(aBlock); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[2], false); + } else { + aBlock.setBlockBounds(sp, sp, 0.0F, sp + tThickness, sp + tThickness, sp); + aRenderer.setRenderBoundsFromBlock(aBlock); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[0], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[1], false); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[4], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[5], false); + if (!arg14[2]) { + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[2], false); + } + } + + if ((tConnections & 32) == 0) { + aBlock.setBlockBounds(sp, sp, sp, sp + tThickness, sp + tThickness, sp + tThickness); + aRenderer.setRenderBoundsFromBlock(aBlock); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[3], false); + } else { + aBlock.setBlockBounds(sp, sp, sp + tThickness, sp + tThickness, sp + tThickness, 1.0F); + aRenderer.setRenderBoundsFromBlock(aBlock); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[0], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[1], false); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[4], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[5], false); + if (!arg14[3]) { + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, arg15[3], false); + } + } + } + + if (arg14[0]) { + aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F); + aRenderer.setRenderBoundsFromBlock(aBlock); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[0], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[0], false); + if (!arg14[2]) { + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[0], false); + } + + if (!arg14[3]) { + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[0], false); + } + + if (!arg14[4]) { + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[0], false); + } + + if (!arg14[5]) { + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[0], false); + } + } + + if (arg14[1]) { + aBlock.setBlockBounds(0.0F, 0.875F, 0.0F, 1.0F, 1.0F, 1.0F); + aRenderer.setRenderBoundsFromBlock(aBlock); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[1], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[1], false); + if (!arg14[2]) { + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[1], false); + } + + if (!arg14[3]) { + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[1], false); + } + + if (!arg14[4]) { + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[1], false); + } + + if (!arg14[5]) { + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[1], false); + } + } + + if (arg14[2]) { + aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.125F); + aRenderer.setRenderBoundsFromBlock(aBlock); + if (!arg14[0]) { + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[2], false); + } + + if (!arg14[1]) { + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[2], false); + } + + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[2], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[2], false); + if (!arg14[4]) { + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[2], false); + } + + if (!arg14[5]) { + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[2], false); + } + } + + if (arg14[3]) { + aBlock.setBlockBounds(0.0F, 0.0F, 0.875F, 1.0F, 1.0F, 1.0F); + aRenderer.setRenderBoundsFromBlock(aBlock); + if (!arg14[0]) { + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[3], false); + } + + if (!arg14[1]) { + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[3], false); + } + + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[3], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[3], false); + if (!arg14[4]) { + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[3], false); + } + + if (!arg14[5]) { + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[3], false); + } + } + + if (arg14[4]) { + aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 0.125F, 1.0F, 1.0F); + aRenderer.setRenderBoundsFromBlock(aBlock); + if (!arg14[0]) { + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[4], false); + } + + if (!arg14[1]) { + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[4], false); + } + + if (!arg14[2]) { + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[4], false); + } + + if (!arg14[3]) { + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[4], false); + } + + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[4], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[4], false); + } + + if (arg14[5]) { + aBlock.setBlockBounds(0.875F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + aRenderer.setRenderBoundsFromBlock(aBlock); + if (!arg14[0]) { + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[5], false); + } + + if (!arg14[1]) { + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[5], false); + } + + if (!arg14[2]) { + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[5], false); + } + + if (!arg14[3]) { + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[5], false); + } + + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[5], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[5], false); + } + + aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + aRenderer.setRenderBoundsFromBlock(aBlock); + return true; + } + } + } + } + + public static void renderNegativeYFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, + int aZ, ITexture[] aIcon, boolean aFullBlock) { + if (aWorld != null) { + if (aFullBlock && !aBlock.shouldSideBeRendered(aWorld, aX, aY - 1, aZ, 0)) { + return; + } + + Tessellator.instance + .setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aFullBlock ? aY - 1 : aY, aZ)); + } + + if (aIcon != null) { + for (int i = 0; i < aIcon.length; ++i) { + if (aIcon[i] != null) { + aIcon[i].renderYNeg(aRenderer, aBlock, aX, aY, aZ); + } + } + } + + aRenderer.flipTexture = false; + } + + public static void renderPositiveYFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, + int aZ, ITexture[] aIcon, boolean aFullBlock) { + if (aWorld != null) { + if (aFullBlock && !aBlock.shouldSideBeRendered(aWorld, aX, aY + 1, aZ, 1)) { + return; + } + + Tessellator.instance + .setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aFullBlock ? aY + 1 : aY, aZ)); + } + + if (aIcon != null) { + for (int i = 0; i < aIcon.length; ++i) { + if (aIcon[i] != null) { + aIcon[i].renderYPos(aRenderer, aBlock, aX, aY, aZ); + } + } + } + + aRenderer.flipTexture = false; + } + + public static void renderNegativeZFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, + int aZ, ITexture[] aIcon, boolean aFullBlock) { + if (aWorld != null) { + if (aFullBlock && !aBlock.shouldSideBeRendered(aWorld, aX, aY, aZ - 1, 2)) { + return; + } + + Tessellator.instance + .setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aY, aFullBlock ? aZ - 1 : aZ)); + } + + aRenderer.flipTexture = !aFullBlock; + if (aIcon != null) { + for (int i = 0; i < aIcon.length; ++i) { + if (aIcon[i] != null) { + aIcon[i].renderZNeg(aRenderer, aBlock, aX, aY, aZ); + } + } + } + + aRenderer.flipTexture = false; + } + + public static void renderPositiveZFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, + int aZ, ITexture[] aIcon, boolean aFullBlock) { + if (aWorld != null) { + if (aFullBlock && !aBlock.shouldSideBeRendered(aWorld, aX, aY, aZ + 1, 3)) { + return; + } + + Tessellator.instance + .setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aY, aFullBlock ? aZ + 1 : aZ)); + } + + if (aIcon != null) { + for (int i = 0; i < aIcon.length; ++i) { + if (aIcon[i] != null) { + aIcon[i].renderZPos(aRenderer, aBlock, aX, aY, aZ); + } + } + } + + aRenderer.flipTexture = false; + } + + public static void renderNegativeXFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, + int aZ, ITexture[] aIcon, boolean aFullBlock) { + if (aWorld != null) { + if (aFullBlock && !aBlock.shouldSideBeRendered(aWorld, aX - 1, aY, aZ, 4)) { + return; + } + + Tessellator.instance + .setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aFullBlock ? aX - 1 : aX, aY, aZ)); + } + + if (aIcon != null) { + for (int i = 0; i < aIcon.length; ++i) { + if (aIcon[i] != null) { + aIcon[i].renderXNeg(aRenderer, aBlock, aX, aY, aZ); + } + } + } + + aRenderer.flipTexture = false; + } + + public static void renderPositiveXFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, + int aZ, ITexture[] aIcon, boolean aFullBlock) { + if (aWorld != null) { + if (aFullBlock && !aBlock.shouldSideBeRendered(aWorld, aX + 1, aY, aZ, 5)) { + return; + } + + Tessellator.instance + .setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aFullBlock ? aX + 1 : aX, aY, aZ)); + } + + aRenderer.flipTexture = !aFullBlock; + if (aIcon != null) { + for (int i = 0; i < aIcon.length; ++i) { + if (aIcon[i] != null) { + aIcon[i].renderXPos(aRenderer, aBlock, aX, aY, aZ); + } + } + } + + aRenderer.flipTexture = false; + } + + public void renderInventoryBlock(Block aBlock, int aMeta, int aModelID, RenderBlocks aRenderer) { + aMeta += 30400; + if (aBlock instanceof GT_Block_Machines || aBlock instanceof GTPP_Block_Machines) { + if (aMeta > 0 && aMeta < GregTech_API.METATILEENTITIES.length + && GregTech_API.METATILEENTITIES[aMeta] != null + && !GregTech_API.METATILEENTITIES[aMeta].renderInInventory(aBlock, aMeta, aRenderer)) { + renderNormalInventoryMetaTileEntity(aBlock, aMeta, aRenderer); + } + } + aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + aRenderer.setRenderBoundsFromBlock(aBlock); + GL11.glTranslatef(0.5F, 0.5F, 0.5F); + } + + public boolean renderWorldBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, int aModelID, + RenderBlocks aRenderer) { + TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); + return aTileEntity == null + ? false + : (aTileEntity instanceof IGregTechTileEntity + && ((IGregTechTileEntity) aTileEntity).getMetaTileEntity() != null + && ((IGregTechTileEntity) aTileEntity).getMetaTileEntity().renderInWorld(aWorld, aX, aY, aZ, + aBlock, aRenderer) + ? true + : (aTileEntity instanceof IPipeRenderedTileEntity + ? renderPipeBlock(aWorld, aX, aY, aZ, aBlock, + (IPipeRenderedTileEntity) aTileEntity, aRenderer) + : renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer))); + } + + public boolean shouldRender3DInInventory(int aModel) { + return true; + } + + public int getRenderId() { + return this.mRenderID; + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java index a55876ac35..9c66e1e05c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java @@ -2,17 +2,21 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic; import static gregtech.api.enums.GT_Values.V; +import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.items.GT_MetaGenerated_Tool; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; +import gregtech.api.objects.GT_ItemStack; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; import gregtech.common.items.GT_MetaGenerated_Tool_01; import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.core.item.general.ItemAirFilter; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; @@ -29,7 +33,7 @@ import net.minecraft.nbt.NBTTagCompound; public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_BasicMachine { - protected int mPollutionReduction = 0; + public int mPollutionReduction = 0; protected int mBaseEff = 2500; protected int mOptimalAirFlow = 0; protected boolean mHasPollution = false; @@ -74,7 +78,7 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi this.mDescription, "Requires a turbine rotor and an Air Filter [T1/T2] to run.", "The turbine rotor must be manually inserted/replaced", - "Can be configured with a screwdriver to change modes", + "Can be configured with a soldering iron to change modes", "Low Efficiency: Removes half pollution, Turbine takes 50% dmg", "High Efficiency: Removes full pollution, Turbine takes 100% dmg", "Turbine Rotor will not break in LE mode", @@ -97,7 +101,7 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi @Override public long maxAmperesIn() { - return 4; + return 2; } @Override @@ -129,42 +133,56 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi //Get Current Pollution Amount. int mCurrentPollution = getCurrentChunkPollution(); + boolean isIdle = true; //Get Inventory Item ItemStack stackRotor = this.mInventory[SLOT_ROTOR]; - ItemStack stackFilter = this.mInventory[SLOT_FILTER]; - - //Enable machine animation/graphic - if (this.mHasPollution && mCurrentPollution > 0 && hasRotor(stackRotor) && hasAirFilter(stackFilter)){ - aBaseMetaTileEntity.setActive(true); - } - else if (!this.mHasPollution || mCurrentPollution <= 0 || stackRotor == null || stackFilter == null || hasRotor(stackRotor) || !hasAirFilter(stackFilter)){ - aBaseMetaTileEntity.setActive(false); - } + ItemStack stackFilter = this.mInventory[SLOT_FILTER]; //Power Drain - long drainEU = V[mTier]; + long drainEU = maxEUInput() * maxAmperesIn(); if (aBaseMetaTileEntity.isActive() && aBaseMetaTileEntity.getStoredEU() >= drainEU){ if(aBaseMetaTileEntity.decreaseStoredEnergyUnits(drainEU, false)){ - //Utils.LOG_WARNING("Draining "+drainEU+" EU"); + isIdle = false; + } + else { + aBaseMetaTileEntity.setActive(false); + this.sendSound((byte) -122); } } else if (!aBaseMetaTileEntity.isActive() && aBaseMetaTileEntity.getStoredEU() >= drainEU/4){ if(aBaseMetaTileEntity.decreaseStoredEnergyUnits((drainEU/4), false)){ - //Utils.LOG_WARNING("Draining "+(drainEU/4)+" EU"); + isIdle = false; + } + else { + aBaseMetaTileEntity.setActive(false); + this.sendSound((byte) -122); } } else { aBaseMetaTileEntity.setActive(false); - } - - + this.sendSound((byte) -122); + } + //Only try once/sec. - if (aTick % 20L == 0L){ - + if (!isIdle && aTick % 20L == 0L){ + //Check if machine can work. if ((aBaseMetaTileEntity.isAllowedToWork())){ + //Enable machine animation/graphic + if (hasRotor(stackRotor) && hasAirFilter(stackFilter) && this.mHasPollution){ + if (!this.getBaseMetaTileEntity().isActive()) { + aBaseMetaTileEntity.setActive(true); + } + } + else if (!this.mHasPollution || mCurrentPollution <= 0 || stackRotor == null || stackFilter == null || !hasRotor(stackRotor) || !hasAirFilter(stackFilter)){ + if (!this.getBaseMetaTileEntity().isActive()) { + aBaseMetaTileEntity.setActive(false); + this.sendSound((byte) -122); + } + } + //If Active. if (aBaseMetaTileEntity.isActive()){ @@ -187,31 +205,35 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi Logger.WARNING("mOptimalAirFlow[1]:"+mOptimalAirFlow); //Calculate The Voltage we are running - long tVoltage = maxEUInput(); + long tVoltage = drainEU; byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); //Check Sides for Air, //More air means more pollution processing. int mAirSides = getFreeSpaces(); + int reduction = 0; + //If no sides are free, how will you process the atmosphere? if (mAirSides > 0){ - mPollutionReduction += (((mTier*2)*100)*mAirSides); //Was originally *100 - Logger.WARNING("mPollutionReduction[1]:"+mPollutionReduction); + reduction += (((Math.max((tTier-2), 1)*2)*50)*mAirSides); //Was originally *100 + Logger.WARNING("mPollutionReduction[1]:"+reduction); //I stole this code - mPollutionReduction = (MathUtils.safeInt((long)mPollutionReduction*this.mBaseEff)/100000)*mAirSides*tTier; - //Utils.LOG_WARNING("mPollutionReduction[2]:"+mPollutionReduction); - //mPollutionReduction = GT_Utility.safeInt((long)mPollutionReduction*this.mOptimalAirFlow/10000); - //Utils.LOG_WARNING("mPollutionReduction[3]:"+mPollutionReduction); + reduction = (MathUtils.safeInt((long)reduction*this.mBaseEff)/100000)*mAirSides*Math.max((tTier-2), 1); + Logger.WARNING("reduction[2]:"+reduction); + reduction = GT_Utility.safeInt(((long)reduction/100)*this.mOptimalAirFlow); + Logger.WARNING("reduction[3]:"+reduction); + mPollutionReduction = reduction; + //Set a temp to remove variable to aleviate duplicate code. int toRemove = 0; Logger.WARNING("mCurrentPollution[4]:"+mCurrentPollution); - if (mPollutionReduction <= mCurrentPollution){ + if (reduction <= mCurrentPollution){ //Clean some Air. - toRemove = mPollutionReduction; + toRemove = reduction; } else { //Makes sure we don't get negative pollution. @@ -236,12 +258,31 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi //Utils.LOG_WARNING("Wrong Tool metaitem Found."); } } - } + } + else if (!aBaseMetaTileEntity.isActive()) { + return; + } } //End of can work block. else { //Disable Machine. //aBaseMetaTileEntity.setActive(false); } } //End of 1/sec action block. + else { + + if (hasRotor(stackRotor) && hasAirFilter(stackFilter) && this.mHasPollution && !isIdle && aBaseMetaTileEntity.isAllowedToWork()){ + aBaseMetaTileEntity.setActive(true); + } + else if (isIdle || !this.mHasPollution || mCurrentPollution <= 0 || stackRotor == null || stackFilter == null || !hasRotor(stackRotor) || !hasAirFilter(stackFilter)){ + aBaseMetaTileEntity.setActive(false); + } + + } + if (this.getBaseMetaTileEntity().isActive()) { + if (MathUtils.randInt(0, 5) <= 2) { + this.sendSound((byte) -120); + } + } + } //End of is serverside block. } @@ -272,6 +313,22 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi public boolean damageTurbineRotor(){ try{ + + boolean creativeRotor = false; + ItemStack rotorStack = this.mInventory[SLOT_ROTOR]; + if (rotorStack == null) { + return false; + } + else { + if(rotorStack.getItem() instanceof GT_MetaGenerated_Tool_01) { + Materials t1 = GT_MetaGenerated_Tool.getPrimaryMaterial(rotorStack); + Materials t2 = GT_MetaGenerated_Tool.getSecondaryMaterial(rotorStack); + if (t1 == Materials._NULL && t2 == Materials._NULL){ + creativeRotor = true; + } + } + } + if(mInventory[SLOT_ROTOR].getItem() instanceof GT_MetaGenerated_Tool_01 && ((GT_MetaGenerated_Tool) mInventory[SLOT_ROTOR].getItem()).getToolStats(mInventory[SLOT_ROTOR]).getSpeedMultiplier()>0 && GT_MetaGenerated_Tool.getPrimaryMaterial(mInventory[SLOT_ROTOR]).mToolSpeed>0 ) { @@ -280,16 +337,16 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi double fDam = Math.floor(Math.abs(MathUtils.randFloat(1f, 2f) - MathUtils.randFloat(1f, 2f)) * (1f + 2f - 1f) + 1f); damageValue -= fDam; - //Logger.INFO("Trying to do "+damageValue+" damage to the rotor. ["+fDam+"]"); + //Logger.WARNING("Trying to do "+damageValue+" damage to the rotor. ["+fDam+"]"); /*Materials M1 = GT_MetaGenerated_Tool.getPrimaryMaterial(this.mInventory[this.SLOT_ROTOR]); Materials M2 = GT_MetaGenerated_Tool.getSecondaryMaterial(this.mInventory[this.SLOT_ROTOR]); - Logger.INFO("Trying to do "+damageValue+" damage to the rotor. [2]");*/ + Logger.WARNING("Trying to do "+damageValue+" damage to the rotor. [2]");*/ //Damage Rotor //int rotorDurability = this.mInventory[this.SLOT_ROTOR].getItemDamage(); - long rotorDamage = GT_MetaGenerated_Tool.getToolDamage(this.mInventory[this.SLOT_ROTOR]); - long rotorDurabilityMax = GT_MetaGenerated_Tool.getToolMaxDamage(this.mInventory[this.SLOT_ROTOR]); + long rotorDamage = creativeRotor ? 0 : GT_MetaGenerated_Tool.getToolDamage(this.mInventory[this.SLOT_ROTOR]); + long rotorDurabilityMax = creativeRotor ? Integer.MAX_VALUE : GT_MetaGenerated_Tool.getToolMaxDamage(this.mInventory[this.SLOT_ROTOR]); long rotorDurability = (rotorDurabilityMax - rotorDamage); Logger.WARNING("Rotor Damage: "+rotorDamage + " | Max Durability: "+rotorDurabilityMax+" | "+" Remaining Durability: "+rotorDurability); if (rotorDurability >= damageValue){ @@ -297,6 +354,8 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi if (!mSaveRotor){ Logger.WARNING("Damaging Rotor."); + + if (!creativeRotor) GT_ModHandler.damageOrDechargeItem(this.mInventory[this.SLOT_ROTOR], (int) damageValue, 0, null); long tempDur = GT_MetaGenerated_Tool.getToolDamage(this.mInventory[this.SLOT_ROTOR]); @@ -310,6 +369,7 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi else { Logger.WARNING("Damaging Rotor."); if (rotorDurability > 1000){ + if (!creativeRotor) GT_ModHandler.damageOrDechargeItem(this.mInventory[this.SLOT_ROTOR], (int) damageValue/2, 0, null); long tempDur = GT_MetaGenerated_Tool.getToolDamage(this.mInventory[this.SLOT_ROTOR]); if (tempDur < rotorDurabilityMax){ @@ -324,7 +384,7 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi } - if (rotorDurability <= 0 && !mSaveRotor) { + if (rotorDurability <= 0 && !mSaveRotor && !creativeRotor) { Logger.WARNING("Destroying Rotor."); this.mInventory[this.SLOT_ROTOR] = null; return false; @@ -388,6 +448,29 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi public boolean damageAirFilter(){ ItemStack filter = this.mInventory[this.SLOT_FILTER]; + + boolean creativeRotor = false; + ItemStack rotorStack = this.mInventory[SLOT_ROTOR]; + if (rotorStack == null) { + return false; + } + else { + if(rotorStack.getItem() instanceof GT_MetaGenerated_Tool_01) { + Materials t1 = GT_MetaGenerated_Tool.getPrimaryMaterial(rotorStack); + Materials t2 = GT_MetaGenerated_Tool.getSecondaryMaterial(rotorStack); + if (t1 == Materials._NULL && t2 == Materials._NULL){ + creativeRotor = true; + } + } + } + + if (creativeRotor) { + return true; + } + if (filter == null) { + return false; + } + if (filter.getItem() instanceof ItemAirFilter){ @@ -398,7 +481,7 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi this.mInventory[this.SLOT_FILTER] = null; return false; } - else if (filter.getItemDamage() == 1 && currentUse >= 150-1){ + else if (filter.getItemDamage() == 1 && currentUse >= 2500-1){ this.mInventory[this.SLOT_FILTER] = null; return false; } @@ -432,7 +515,13 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi } @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); + } + + @Override + public boolean onSolderingToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, + float aZ) { this.mSaveRotor = Utils.invertBoolean(mSaveRotor); if (mSaveRotor){ PlayerUtils.messagePlayer(aPlayer, "Running in low efficiency mode, rotors will not break."); @@ -440,8 +529,71 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi else { PlayerUtils.messagePlayer(aPlayer, "Running in high efficiency mode, rotors will break."); } + return true; + } + + @Override + public void doSound(byte aIndex, double aX, double aY, double aZ) { + if (aIndex == -120) { + GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(Integer.valueOf(103)), MathUtils.randInt(5, 50), 0.05F, aX, aY, aZ); + } else if (aIndex == -121 || aIndex == -122) { + //GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(Integer.valueOf(108)), 0, 0.5F, aX, aY, aZ); + } /*else if (aIndex == -122) { + GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(Integer.valueOf(6)), 100, 1.0F, aX, aY, aZ); + }*/ else { + super.doSound((byte) 0, aX, aY, aZ); + } + } + + @Override + public boolean canHaveInsufficientEnergy() { + // TODO Auto-generated method stub + return super.canHaveInsufficientEnergy(); + } + + @Override + public String[] getInfoData() { + AutoMap<String> aTooltipSuper = new AutoMap<String>(); + for (String s : super.getInfoData()) { + aTooltipSuper.put(s); + } + int mAirSides = getFreeSpaces(); + int reduction = 0; - super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); + long tVoltage = maxEUInput(); + byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + reduction += (((Math.max((tTier-2), 1)*2)*50)*mAirSides); + reduction = (MathUtils.safeInt((long)reduction*this.mBaseEff)/100000)*mAirSides*Math.max((tTier-2), 1); + reduction = GT_Utility.safeInt(((long)reduction/100)*this.mOptimalAirFlow); + + aTooltipSuper.put("Maximum pollution removed per second: "+reduction); + aTooltipSuper.put("Air Sides: "+mAirSides); + return aTooltipSuper.toArray(); + } + + @Override + public boolean isGivingInformation() { + return true; + } + + @Override + public boolean allowCoverOnSide(byte aSide, GT_ItemStack aCoverID) { + if (aSide <= 1) { + return false; + } + return super.allowCoverOnSide(aSide, aCoverID); + } + + @Override + public ITexture[] getTopFacingInactive(byte aColor) { + return super.getTopFacingInactive(aColor); + } + + @Override + public void setItemNBT(NBTTagCompound aNBT) { + aNBT.setInteger("mOptimalAirFlow", this.mOptimalAirFlow); + aNBT.setBoolean("mSaveRotor", mSaveRotor); + super.setItemNBT(aNBT); } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java index eb2339cbea..1623e7cb54 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java @@ -27,6 +27,7 @@ import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.item.chemistry.IonParticles; import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_Cyclotron; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; @@ -530,6 +531,8 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas } } } + PollutionUtils.addPollution(getBaseMetaTileEntity(), this.getPollutionPerTick(aStack)); + return true; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java index ebf5aecd99..1932f30969 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java @@ -394,7 +394,7 @@ public class RecipeGen_DustGeneration extends RecipeGen_Base { else { aOutput = aMatInfo.getIngot(1); if (ItemUtils.checkForInvalidItems(aOutput)) { - if (CORE.GT_Recipe.addSmeltingAndAlloySmeltingRecipe(aDust, aOutput)){ + if (CORE.RA.addSmeltingAndAlloySmeltingRecipe(aDust, aOutput)){ Logger.MATERIALS("Successfully added a furnace recipe for "+aMatInfo.getLocalizedName()); } else { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java index 05fb2a5471..50e9f8c3d6 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java @@ -6,8 +6,6 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.List; -import net.minecraft.item.ItemStack; - import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; @@ -16,7 +14,6 @@ import gregtech.api.util.CustomRecipeMap; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import gregtech.api.util.Recipe_GT; - import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; @@ -25,7 +22,9 @@ import gtPlusPlus.core.util.data.ArrayUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.xmod.gregtech.api.interfaces.internal.IGregtech_RecipeAdder; +import gtPlusPlus.xmod.gregtech.common.StaticFields59; import gtPlusPlus.xmod.gregtech.recipes.machines.RECIPEHANDLER_MatterFabricator; +import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; @@ -910,6 +909,29 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { } + /** + * Lets me add recipes for GT 5.08 & 5.09, since someone broke the method headers. + */ + @Override + public boolean addSmeltingAndAlloySmeltingRecipe(ItemStack aDust, ItemStack aOutput) { + Method m = StaticFields59.mAddFurnaceRecipe; + if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { + try { + return (boolean) m.invoke(null, aDust, aOutput); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + return false; + } + } + else { + try { + return (boolean) m.invoke(null, aDust, aOutput, true); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + return false; + } + } + } + + diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java index d0b9d9287f..9a12acaaf1 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java @@ -1,5 +1,8 @@ package gtPlusPlus.xmod.gregtech.registration.gregtech; +import gregtech.api.enums.ItemList; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.FluidUtils; @@ -7,6 +10,8 @@ import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_ControlCore; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler_Adv; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Naquadah; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_SuperBus_Input; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_SuperBus_Output; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GT_MetaTileEntity_Hatch_CustomFluidBase; public class GregtechCustomHatches { @@ -15,79 +20,158 @@ public class GregtechCustomHatches { if (gtPlusPlus.core.lib.LoadedMods.Gregtech) { Logger.INFO("Gregtech5u Content | Registering Custom Fluid Hatches."); run1(); - + //No pollution in 5.08 - if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) - run2(); + if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { + run2(); + } + + run3(); } } private static void run1() { GregtechItemList.Hatch_Input_Cryotheum - .set(new GT_MetaTileEntity_Hatch_CustomFluidBase(FluidUtils.getFluidStack("cryotheum", 1).getFluid(), // Fluid - // to - // resitrct - // hatch - // to - 128000, // Capacity - 967, // ID - "hatch.cryotheum.input.tier.00", // unlocal name - "Cryotheum Cooling Hatch" // Local name - ).getStackForm(1L)); + .set(new GT_MetaTileEntity_Hatch_CustomFluidBase(FluidUtils.getFluidStack("cryotheum", 1).getFluid(), // Fluid + // to + // resitrct + // hatch + // to + 128000, // Capacity + 967, // ID + "hatch.cryotheum.input.tier.00", // unlocal name + "Cryotheum Cooling Hatch" // Local name + ).getStackForm(1L)); GregtechItemList.Hatch_Input_Pyrotheum - .set(new GT_MetaTileEntity_Hatch_CustomFluidBase(FluidUtils.getFluidStack("pyrotheum", 1).getFluid(), // Fluid - // to - // resitrct - // hatch - // to - 128000, // Capacity - 968, // ID - "hatch.pyrotheum.input.tier.00", // unlocal name - "Pyrotheum Heating Vent" // Local name - ).getStackForm(1L)); + .set(new GT_MetaTileEntity_Hatch_CustomFluidBase(FluidUtils.getFluidStack("pyrotheum", 1).getFluid(), // Fluid + // to + // resitrct + // hatch + // to + 128000, // Capacity + 968, // ID + "hatch.pyrotheum.input.tier.00", // unlocal name + "Pyrotheum Heating Vent" // Local name + ).getStackForm(1L)); GregtechItemList.Hatch_Input_Naquadah.set(new GT_MetaTileEntity_Hatch_Naquadah(969, // ID "hatch.naquadah.input.tier.00", // unlocal name "Naquadah Reactor Input hatch" // Local name - ).getStackForm(1L)); + ).getStackForm(1L)); } private static void run2() { GregtechItemList.Hatch_Muffler_Adv_LV - .set((new GT_MetaTileEntity_Hatch_Muffler_Adv(30001, "hatch.muffler.adv.tier.01", "Advanced Muffler Hatch (LV)", 1)) - .getStackForm(1L)); + .set((new GT_MetaTileEntity_Hatch_Muffler_Adv(30001, "hatch.muffler.adv.tier.01", "Advanced Muffler Hatch (LV)", 1)) + .getStackForm(1L)); GregtechItemList.Hatch_Muffler_Adv_MV - .set((new GT_MetaTileEntity_Hatch_Muffler_Adv(30002, "hatch.muffler.adv.tier.02", "Advanced Muffler Hatch (MV)", 2)) - .getStackForm(1L)); + .set((new GT_MetaTileEntity_Hatch_Muffler_Adv(30002, "hatch.muffler.adv.tier.02", "Advanced Muffler Hatch (MV)", 2)) + .getStackForm(1L)); GregtechItemList.Hatch_Muffler_Adv_HV - .set((new GT_MetaTileEntity_Hatch_Muffler_Adv(30003, "hatch.muffler.adv.tier.03", "Advanced Muffler Hatch (HV)", 3)) - .getStackForm(1L)); + .set((new GT_MetaTileEntity_Hatch_Muffler_Adv(30003, "hatch.muffler.adv.tier.03", "Advanced Muffler Hatch (HV)", 3)) + .getStackForm(1L)); GregtechItemList.Hatch_Muffler_Adv_EV - .set((new GT_MetaTileEntity_Hatch_Muffler_Adv(30004, "hatch.muffler.adv.tier.04", "Advanced Muffler Hatch (EV)", 4)) - .getStackForm(1L)); + .set((new GT_MetaTileEntity_Hatch_Muffler_Adv(30004, "hatch.muffler.adv.tier.04", "Advanced Muffler Hatch (EV)", 4)) + .getStackForm(1L)); GregtechItemList.Hatch_Muffler_Adv_IV - .set((new GT_MetaTileEntity_Hatch_Muffler_Adv(30005, "hatch.muffler.adv.tier.05", "Advanced Muffler Hatch (IV)", 5)) - .getStackForm(1L)); + .set((new GT_MetaTileEntity_Hatch_Muffler_Adv(30005, "hatch.muffler.adv.tier.05", "Advanced Muffler Hatch (IV)", 5)) + .getStackForm(1L)); GregtechItemList.Hatch_Muffler_Adv_LuV - .set((new GT_MetaTileEntity_Hatch_Muffler_Adv(30006, "hatch.muffler.adv.tier.06", "Advanced Muffler Hatch (LuV)", 6)) - .getStackForm(1L)); + .set((new GT_MetaTileEntity_Hatch_Muffler_Adv(30006, "hatch.muffler.adv.tier.06", "Advanced Muffler Hatch (LuV)", 6)) + .getStackForm(1L)); GregtechItemList.Hatch_Muffler_Adv_ZPM - .set((new GT_MetaTileEntity_Hatch_Muffler_Adv(30007, "hatch.muffler.adv.tier.07", "Advanced Muffler Hatch (ZPM)", 7)) - .getStackForm(1L)); + .set((new GT_MetaTileEntity_Hatch_Muffler_Adv(30007, "hatch.muffler.adv.tier.07", "Advanced Muffler Hatch (ZPM)", 7)) + .getStackForm(1L)); GregtechItemList.Hatch_Muffler_Adv_UV - .set((new GT_MetaTileEntity_Hatch_Muffler_Adv(30008, "hatch.muffler.adv.tier.08", "Advanced Muffler Hatch (UV)", 8)) - .getStackForm(1L)); + .set((new GT_MetaTileEntity_Hatch_Muffler_Adv(30008, "hatch.muffler.adv.tier.08", "Advanced Muffler Hatch (UV)", 8)) + .getStackForm(1L)); GregtechItemList.Hatch_Muffler_Adv_MAX - .set((new GT_MetaTileEntity_Hatch_Muffler_Adv(30009, "hatch.muffler.adv.tier.09", "Advanced Muffler Hatch (MAX)", 9)) - .getStackForm(1L)); - + .set((new GT_MetaTileEntity_Hatch_Muffler_Adv(30009, "hatch.muffler.adv.tier.09", "Advanced Muffler Hatch (MAX)", 9)) + .getStackForm(1L)); + //GT++ multiblock Control Core Bus GregtechItemList.Hatch_Control_Core .set((new GT_MetaTileEntity_Hatch_ControlCore(30020, "hatch.control.adv", "Control Core Module", 1)) .getStackForm(1L)); } + private static void run3() { + + /* + * Super Input Busses + */ + + int aStartID = 30021; + + GregtechItemList.Hatch_SuperBus_Input_ULV + .set((new GT_MetaTileEntity_SuperBus_Input(aStartID++, "hatch.superbus.input.tier.00", "Super Bus (I) (ULV)", 0)) + .getStackForm(1L)); + GregtechItemList.Hatch_SuperBus_Input_LV + .set((new GT_MetaTileEntity_SuperBus_Input(aStartID++, "hatch.superbus.input.tier.01", "Super Bus (I) (LV)", 1)) + .getStackForm(1L)); + GregtechItemList.Hatch_SuperBus_Input_MV + .set((new GT_MetaTileEntity_SuperBus_Input(aStartID++, "hatch.superbus.input.tier.02", "Super Bus (I) (MV)", 2)) + .getStackForm(1L)); + GregtechItemList.Hatch_SuperBus_Input_HV + .set((new GT_MetaTileEntity_SuperBus_Input(aStartID++, "hatch.superbus.input.tier.03", "Super Bus (I) (HV)", 3)) + .getStackForm(1L)); + GregtechItemList.Hatch_SuperBus_Input_EV + .set((new GT_MetaTileEntity_SuperBus_Input(aStartID++, "hatch.superbus.input.tier.04", "Super Bus (I) (EV)", 4)) + .getStackForm(1L)); + GregtechItemList.Hatch_SuperBus_Input_IV + .set((new GT_MetaTileEntity_SuperBus_Input(aStartID++, "hatch.superbus.input.tier.05", "Super Bus (I) (IV)", 5)) + .getStackForm(1L)); + GregtechItemList.Hatch_SuperBus_Input_LuV + .set((new GT_MetaTileEntity_SuperBus_Input(aStartID++, "hatch.superbus.input.tier.06", "Super Bus (I) (LuV)", 6)) + .getStackForm(1L)); + GregtechItemList.Hatch_SuperBus_Input_ZPM + .set((new GT_MetaTileEntity_SuperBus_Input(aStartID++, "hatch.superbus.input.tier.07", "Super Bus (I) (ZPM)", 7)) + .getStackForm(1L)); + GregtechItemList.Hatch_SuperBus_Input_UV + .set((new GT_MetaTileEntity_SuperBus_Input(aStartID++, "hatch.superbus.input.tier.08", "Super Bus (I) (UV)", 8)) + .getStackForm(1L)); + GregtechItemList.Hatch_SuperBus_Input_MAX + .set((new GT_MetaTileEntity_SuperBus_Input(aStartID++, "hatch.superbus.input.tier.09", "Super Bus (I) (MAX)", 9)) + .getStackForm(1L)); + + /* + * Super Output Busses + */ + + GregtechItemList.Hatch_SuperBus_Output_ULV + .set((new GT_MetaTileEntity_SuperBus_Output(aStartID++, "hatch.superbus.output.tier.00", "Super Bus (O) (ULV)", 0)) + .getStackForm(1L)); + GregtechItemList.Hatch_SuperBus_Output_LV + .set((new GT_MetaTileEntity_SuperBus_Output(aStartID++, "hatch.superbus.output.tier.01", "Super Bus (O) (LV)", 1)) + .getStackForm(1L)); + GregtechItemList.Hatch_SuperBus_Output_MV + .set((new GT_MetaTileEntity_SuperBus_Output(aStartID++, "hatch.superbus.output.tier.02", "Super Bus (O) (MV)", 2)) + .getStackForm(1L)); + GregtechItemList.Hatch_SuperBus_Output_HV + .set((new GT_MetaTileEntity_SuperBus_Output(aStartID++, "hatch.superbus.output.tier.03", "Super Bus (O) (HV)", 3)) + .getStackForm(1L)); + GregtechItemList.Hatch_SuperBus_Output_EV + .set((new GT_MetaTileEntity_SuperBus_Output(aStartID++, "hatch.superbus.output.tier.04", "Super Bus (O) (EV)", 4)) + .getStackForm(1L)); + GregtechItemList.Hatch_SuperBus_Output_IV + .set((new GT_MetaTileEntity_SuperBus_Output(aStartID++, "hatch.superbus.output.tier.05", "Super Bus (O) (IV)", 5)) + .getStackForm(1L)); + GregtechItemList.Hatch_SuperBus_Output_LuV + .set((new GT_MetaTileEntity_SuperBus_Output(aStartID++, "hatch.superbus.output.tier.06", "Super Bus (O) (LuV)", 6)) + .getStackForm(1L)); + GregtechItemList.Hatch_SuperBus_Output_ZPM + .set((new GT_MetaTileEntity_SuperBus_Output(aStartID++, "hatch.superbus.output.tier.07", "Super Bus (O) (ZPM)", 7)) + .getStackForm(1L)); + GregtechItemList.Hatch_SuperBus_Output_UV + .set((new GT_MetaTileEntity_SuperBus_Output(aStartID++, "hatch.superbus.output.tier.08", "Super Bus (O) (UV)", 8)) + .getStackForm(1L)); + GregtechItemList.Hatch_SuperBus_Output_MAX + .set((new GT_MetaTileEntity_SuperBus_Output(aStartID++, "hatch.superbus.output.tier.09", "Super Bus (O) (MAX)", 9)) + .getStackForm(1L)); + + } + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechPowerBreakers.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechPowerBreakers.java new file mode 100644 index 0000000000..3e9582b80a --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechPowerBreakers.java @@ -0,0 +1,42 @@ +package gtPlusPlus.xmod.gregtech.registration.gregtech; + +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicBreaker; + +public class GregtechPowerBreakers { + + public static void run() { + if (gtPlusPlus.core.lib.LoadedMods.Gregtech) { + Logger.INFO("Gregtech5u Content | Registering Power Breakers."); + run1(); + } + + } + + private static void run1() { + //30200 + int aStartID = 30400; + GregtechItemList.BreakerBox_ULV.set((new GT_MetaTileEntity_BasicBreaker(aStartID++, "breaker.tier.00", + "Ultra Low Voltage Breaker Box", 0, "", 16)).getStackForm(1L)); + GregtechItemList.BreakerBox_LV.set((new GT_MetaTileEntity_BasicBreaker(aStartID++, "breaker.tier.01", + "Low Voltage Breaker Box", 1, "", 16)).getStackForm(1L)); + GregtechItemList.BreakerBox_MV.set((new GT_MetaTileEntity_BasicBreaker(aStartID++, "breaker.tier.02", + "Medium Voltage Breaker Box", 2, "", 16)).getStackForm(1L)); + GregtechItemList.BreakerBox_HV.set((new GT_MetaTileEntity_BasicBreaker(aStartID++, "breaker.tier.03", + "High Voltage Breaker Box", 3, "", 16)).getStackForm(1L)); + GregtechItemList.BreakerBox_EV.set((new GT_MetaTileEntity_BasicBreaker(aStartID++, "breaker.tier.04", + "Extreme Voltage Breaker Box", 16, "", 16)).getStackForm(1L)); + GregtechItemList.BreakerBox_IV.set((new GT_MetaTileEntity_BasicBreaker(aStartID++, "breaker.tier.05", + "Insane Voltage Breaker Box", 5, "", 16)).getStackForm(1L)); + GregtechItemList.BreakerBox_LuV.set((new GT_MetaTileEntity_BasicBreaker(aStartID++, "breaker.tier.06", + "Ludicrous Voltage Breaker Box", 6, "", 16)).getStackForm(1L)); + GregtechItemList.BreakerBox_ZPM.set((new GT_MetaTileEntity_BasicBreaker(aStartID++, "breaker.tier.07", + "ZPM Voltage Breaker Box", 7, "", 16)).getStackForm(1L)); + GregtechItemList.BreakerBox_UV.set((new GT_MetaTileEntity_BasicBreaker(aStartID++, "breaker.tier.08", + "Ultimate Voltage Breaker Box", 8, "", 16)).getStackForm(1L)); + GregtechItemList.BreakerBox_MAX.set((new GT_MetaTileEntity_BasicBreaker(aStartID++, "breaker.tier.09", + "MAX Voltage Breaker Box", 9, "", 16)).getStackForm(1L)); + + } +}
\ No newline at end of file |