diff options
author | huajijam <strhuaji@gmail.com> | 2019-01-30 19:01:07 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-30 19:01:07 +0800 |
commit | d0e3b95db387194a5da4ff71d743a3ede6b42f5e (patch) | |
tree | da5c64c420de4242ab1e23cbb74d8294843228b0 /src/Java/gtPlusPlus/core | |
parent | f32773a4c5664c48b3ea832e22da9dda68120c38 (diff) | |
parent | 241df1134f16c6c9c54b198db97279d697de8c77 (diff) | |
download | GT5-Unofficial-d0e3b95db387194a5da4ff71d743a3ede6b42f5e.tar.gz GT5-Unofficial-d0e3b95db387194a5da4ff71d743a3ede6b42f5e.tar.bz2 GT5-Unofficial-d0e3b95db387194a5da4ff71d743a3ede6b42f5e.zip |
update
update
Diffstat (limited to 'src/Java/gtPlusPlus/core')
33 files changed, 2624 insertions, 562 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/FishTrap.java b/src/Java/gtPlusPlus/core/block/machine/FishTrap.java index 8e5f8a33f5..b5e78f23ef 100644 --- a/src/Java/gtPlusPlus/core/block/machine/FishTrap.java +++ b/src/Java/gtPlusPlus/core/block/machine/FishTrap.java @@ -50,6 +50,7 @@ public class FishTrap extends BlockContainer implements ITileTooltip { super(Material.iron); this.setBlockName("blockFishTrap"); + this.setHardness(5f); this.setCreativeTab(AddToCreativeTab.tabMachines); GameRegistry.registerBlock(this, ItemBlockBasicTile.class, "blockFishTrap"); LanguageRegistry.addName(this, "Fish Catcher"); 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..9176dcc720 100644 --- a/src/Java/gtPlusPlus/core/common/CommonProxy.java +++ b/src/Java/gtPlusPlus/core/common/CommonProxy.java @@ -2,13 +2,13 @@ package gtPlusPlus.core.common; import static gtPlusPlus.core.lib.CORE.DEBUG; -import cpw.mods.fml.common.event.*; +import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.event.FMLLoadCompleteEvent; +import cpw.mods.fml.common.event.FMLPostInitializationEvent; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import cpw.mods.fml.common.event.FMLServerStartingEvent; import cpw.mods.fml.common.registry.GameRegistry; - -import net.minecraft.entity.Entity; - import gregtech.api.enums.ItemList; - import gtPlusPlus.GTplusplus; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.minecraft.ChunkManager; @@ -18,8 +18,15 @@ import gtPlusPlus.core.entity.InternalEntityRegistry; import gtPlusPlus.core.entity.monster.EntityGiantChickenBase; import gtPlusPlus.core.entity.monster.EntitySickBlaze; import gtPlusPlus.core.entity.monster.EntityStaballoyConstruct; -import gtPlusPlus.core.handler.*; -import gtPlusPlus.core.handler.events.*; +import gtPlusPlus.core.handler.BookHandler; +import gtPlusPlus.core.handler.BurnableFuelHandler; +import gtPlusPlus.core.handler.COMPAT_HANDLER; +import gtPlusPlus.core.handler.COMPAT_IntermodStaging; +import gtPlusPlus.core.handler.GuiHandler; +import gtPlusPlus.core.handler.events.BlockEventHandler; +import gtPlusPlus.core.handler.events.GeneralTooltipEventHandler; +import gtPlusPlus.core.handler.events.PickaxeBlockBreakEventHandler; +import gtPlusPlus.core.handler.events.ZombieBackupSpawnEventHandler; import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.CORE.ConfigSwitches; @@ -33,30 +40,20 @@ import gtPlusPlus.core.util.player.PlayerCache; import gtPlusPlus.plugin.villagers.block.BlockGenericSpawner; import gtPlusPlus.xmod.eio.handler.HandlerTooltip_EIO; import gtPlusPlus.xmod.galacticraft.handler.HandlerTooltip_GC; -import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; +import net.minecraft.entity.Entity; import net.minecraftforge.common.ForgeChunkManager; 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()); } } @@ -65,38 +62,33 @@ public class CommonProxy { LoadedMods.checkLoaded(); Logger.INFO("Making sure we're ready to party!"); - - if (!DEBUG){ + if (!DEBUG) { Logger.WARNING("Development mode not enabled."); - } - else if (DEBUG){ + } else if (DEBUG) { Logger.INFO("Development mode enabled."); - } - else { + } else { Logger.WARNING("Development mode not set."); } AddToCreativeTab.initialiseTabs(); - - //Moved from Init after Debug Loading. - //29/01/18 - Alkalus - //Moved earlier into PreInit, so that Items exist before they're called upon in recipes. - //20/03/18 - Alkalus + + // Moved from Init after Debug Loading. + // 29/01/18 - Alkalus + // Moved earlier into PreInit, so that Items exist before they're called upon in + // recipes. + // 20/03/18 - Alkalus ModItems.init(); ModBlocks.init(); CI.preInit(); - - - + COMPAT_IntermodStaging.preInit(); BookHandler.run(); - //Registration of entities and renderers + // Registration of entities and renderers Logger.INFO("[Proxy] Calling Entity registrator."); registerEntities(); Logger.INFO("[Proxy] Calling Tile Entity registrator."); registerTileEntities(); - - + Logger.INFO("[Proxy] Calling Render registrator."); registerRenderThings(); @@ -104,25 +96,21 @@ public class CommonProxy { Material.generateQueuedFluids(); mFluidsGenerated = true; } - - //Must be done in pre-init. - generateMobSpawners(); - + } public void init(final FMLInitializationEvent e) { - //Debug Loading - if (CORE.DEBUG){ + // Debug Loading + if (CORE.DEBUG) { DEBUG_INIT.registerHandlers(); - } + } ModBlocks.blockCustomMobSpawner = new BlockGenericSpawner(); - + if (!mFluidsGenerated && ItemList.valueOf("Cell_Empty").hasBeenSet()) { Material.generateQueuedFluids(); mFluidsGenerated = true; - } - else { + } else { Logger.INFO("[ERROR] Did not generate fluids at all."); Logger.WARNING("[ERROR] Did not generate fluids at all."); Logger.ERROR("[ERROR] Did not generate fluids at all."); @@ -133,22 +121,22 @@ public class CommonProxy { * Register the Event Handlers. */ - //Prevents my Safes being destroyed. + // Prevents my Safes being destroyed. Utils.registerEvent(new PickaxeBlockBreakEventHandler()); - //Block Handler for all events. + // Block Handler for all events. Utils.registerEvent(new BlockEventHandler()); Utils.registerEvent(new GeneralTooltipEventHandler()); - //Handles Custom tooltips for EIO. + // Handles Custom tooltips for EIO. Utils.registerEvent(new HandlerTooltip_EIO()); - //Handles Custom Tooltips for GC + // Handles Custom Tooltips for GC Utils.registerEvent(new HandlerTooltip_GC()); - - //Register Chunkloader + + // Register Chunkloader ForgeChunkManager.setForcedChunkLoadingCallback(GTplusplus.instance, ChunkManager.getInstance()); Utils.registerEvent(ChunkManager.getInstance()); - if (ConfigSwitches.disableZombieReinforcement){ - //Make Zombie reinforcements fuck off. + if (ConfigSwitches.disableZombieReinforcement) { + // Make Zombie reinforcements fuck off. Utils.registerEvent(new ZombieBackupSpawnEventHandler()); } @@ -156,7 +144,7 @@ public class CommonProxy { * End of Subscribe Event registration. */ - //Compat Handling + // Compat Handling COMPAT_HANDLER.registerMyModsOreDictEntries(); COMPAT_HANDLER.intermodOreDictionarySupport(); COMPAT_IntermodStaging.init(); @@ -166,14 +154,14 @@ public class CommonProxy { Logger.INFO("Cleaning up, doing postInit."); PlayerCache.initCache(); - //Make Burnables burnable - if (!CORE.burnables.isEmpty()){ + // Make Burnables burnable + if (!CORE.burnables.isEmpty()) { BurnableFuelHandler fuelHandler = new BurnableFuelHandler(); GameRegistry.registerFuelHandler(fuelHandler); - Logger.INFO("[Fuel Handler] Registering "+fuelHandler.getClass().getName()); + Logger.INFO("[Fuel Handler] Registering " + fuelHandler.getClass().getName()); } - //Compat Handling + // Compat Handling COMPAT_HANDLER.RemoveRecipesFromOtherMods(); COMPAT_HANDLER.InitialiseHandlerThenAddRecipes(); COMPAT_HANDLER.startLoadingGregAPIBasedRecipes(); @@ -181,25 +169,23 @@ public class CommonProxy { COMPAT_HANDLER.runQueuedRecipes(); } - - public void serverStarting(final FMLServerStartingEvent e) - { + public void serverStarting(final FMLServerStartingEvent e) { COMPAT_HANDLER.InitialiseLateHandlerThenAddRecipes(); } - + public void onLoadComplete(FMLLoadCompleteEvent event) { COMPAT_IntermodStaging.onLoadComplete(event); } - public void registerNetworkStuff(){ + public void registerNetworkStuff() { GuiHandler.init(); } - public void registerEntities(){ + public void registerEntities() { InternalEntityRegistry.registerEntities(); } - public void registerTileEntities(){ + public void registerTileEntities() { ModTileEntities.init(); } @@ -212,11 +198,11 @@ public class CommonProxy { } public void generateMysteriousParticles(final Entity entity) { - + } - + public void generateMobSpawners() { - //Try register some test spawners + // Try register some test spawners Utils.createNewMobSpawner(0, EntityGiantChickenBase.class); Utils.createNewMobSpawner(1, EntitySickBlaze.class); Utils.createNewMobSpawner(2, EntityStaballoyConstruct.class); 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/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java index 2fd23ec88d..a14073e569 100644 --- a/src/Java/gtPlusPlus/core/item/ModItems.java +++ b/src/Java/gtPlusPlus/core/item/ModItems.java @@ -292,11 +292,12 @@ public final class ModItems { public static Item boxFood; public static Item boxMagic; - private static DustDecayable dustMolybdenum99; + public static DustDecayable dustMolybdenum99; + public static DustDecayable dustTechnetium99; + public static DustDecayable dustTechnetium99M; - private static DustDecayable dustTechnetium99; - - private static DustDecayable dustTechnetium99M; + public static IonParticles itemIonParticleBase; + public static StandardBaseParticles itemStandarParticleBase; static { Logger.INFO("Items!"); @@ -580,7 +581,7 @@ public final class ModItems { MaterialGenerator.generate(ALLOY.ABYSSAL); - MaterialGenerator.generate(ALLOY.TITANSTEEL, false); + MaterialGenerator.generate(ALLOY.TITANSTEEL); MaterialGenerator.generate(ALLOY.ARCANITE); MaterialGenerator.generate(ALLOY.OCTIRON); @@ -630,7 +631,7 @@ public final class ModItems { dustLithiumPeroxide = ItemUtils.generateSpecialUseDusts("LithiumPeroxide", "Lithium Peroxide", "Li2O2", Utils.rgbtoHexValue(250, 250, 250))[0]; //https://en.wikipedia.org/wiki/Lithium_peroxide dustLithiumHydroxide = ItemUtils.generateSpecialUseDusts("LithiumHydroxide", "Lithium Hydroxide", "LiOH", Utils.rgbtoHexValue(250, 250, 250))[0]; //https://en.wikipedia.org/wiki/Lithium_hydroxide - if ((ItemUtils.getItemStackOfAmountFromOreDict("dustQuicklime", 1).getItem() == ModItems.AAA_Broken) || !LoadedMods.IHL){ + if (!ItemUtils.checkForInvalidItems(ItemUtils.getItemStackOfAmountFromOreDict("dustQuicklime", 1)) && !LoadedMods.IHL){ dustQuicklime = ItemUtils.generateSpecialUseDusts("Quicklime", "Quicklime", "CaO", Utils.rgbtoHexValue(255, 255, 175))[0]; //https://en.wikipedia.org/wiki/Calcium_oxide } dustCalciumHydroxide = ItemUtils.generateSpecialUseDusts("CalciumHydroxide", "Hydrated Lime", "Ca(OH)2", Utils.rgbtoHexValue(255, 255, 255))[0]; //https://en.wikipedia.org/wiki/Calcium_hydroxide @@ -814,8 +815,8 @@ public final class ModItems { dustTechnetium99M = new DustDecayable("dustTechnetium99M", ELEMENT.getInstance().TECHNETIUM.getRgbAsHex(), 8570, new String[] {""+StringUtils.superscript("99ᵐTc"), "Result: Technicium 99 ("+StringUtils.superscript("99Tc")+")"}, dustTechnetium99, 4); dustMolybdenum99 = new DustDecayable("dustMolybdenum99", ELEMENT.getInstance().MOLYBDENUM.getRgbAsHex(), 16450, new String[] {""+StringUtils.superscript("99Mo"), "Result: Technicium 99ᵐ ("+StringUtils.superscript("99ᵐTc")+")"}, dustTechnetium99M, 4); - new IonParticles(); - new StandardBaseParticles(); + itemIonParticleBase = new IonParticles(); + itemStandarParticleBase = new StandardBaseParticles(); diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockDoor.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockDoor.java index a41a44c113..2aba494d6e 100644 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockDoor.java +++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockDoor.java @@ -1,5 +1,7 @@ package gtPlusPlus.core.item.base.itemblock; +import java.util.List; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; @@ -89,4 +91,10 @@ public class ItemBlockDoor extends ItemBlock { } } } + + @Override + public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List p_77624_3_, boolean p_77624_4_) { + p_77624_3_.add("This is a block, you can place it by right clicking"); + super.addInformation(p_77624_1_, p_77624_2_, p_77624_3_, p_77624_4_); + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/base/misc/BaseItemParticle.java b/src/Java/gtPlusPlus/core/item/base/misc/BaseItemParticle.java index 89cd1e55ae..b7bbc84757 100644 --- a/src/Java/gtPlusPlus/core/item/base/misc/BaseItemParticle.java +++ b/src/Java/gtPlusPlus/core/item/base/misc/BaseItemParticle.java @@ -30,7 +30,10 @@ public abstract class BaseItemParticle extends CoreItem { public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { return aColourMap.get(stack.getItemDamage()); } - + + public int getColorFromParentClass(ItemStack stack, int aaa) { + return super.getColorFromItemStack(stack, aaa); + } @SuppressWarnings({ "unchecked", "rawtypes" }) @Override diff --git a/src/Java/gtPlusPlus/core/item/chemistry/IonParticles.java b/src/Java/gtPlusPlus/core/item/chemistry/IonParticles.java index ff5f67d2da..517a698e80 100644 --- a/src/Java/gtPlusPlus/core/item/chemistry/IonParticles.java +++ b/src/Java/gtPlusPlus/core/item/chemistry/IonParticles.java @@ -1,23 +1,42 @@ package gtPlusPlus.core.item.chemistry; +import java.util.HashMap; +import java.util.List; + import gregtech.api.enums.Materials; import gtPlusPlus.core.item.base.misc.BaseItemParticle; +import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IIcon; public class IonParticles extends BaseItemParticle { + public static HashMap<String, Integer> NameToMetaMap = new HashMap<String, Integer>(); + public static HashMap<Integer, String> MetaToNameMap = new HashMap<Integer, String>(); + + public IonParticles() { super("Ion", aElements.length, EnumRarity.rare); } private static final String[] aElements = new String[]{"Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine", "Neon", "Sodium", "Magnesium", "Aluminum", "Silicon", "Phosphorus", "Sulfur", "Chlorine", "Argon", "Potassium", "Calcium", "Scandium", "Titanium", "Vanadium", "Chromium", "Manganese", "Iron", "Cobalt", "Nickel", "Copper", "Zinc", "Gallium", "Germanium", "Arsenic", "Selenium", "Bromine", "Krypton", "Rubidium", "Strontium", "Yttrium", "Zirconium", "Niobium", "Molybdenum", "Technetium", "Ruthenium", "Rhodium", "Palladium", "Silver", "Cadmium", "Indium", "Tin", "Antimony", "Tellurium", "Iodine", "Xenon", "Cesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium", "Promethium", "Samarium", "Europium", "Gadolinium", "Terbium", "Dysprosium", "Holmium", "Erbium", "Thulium", "Ytterbium", "Lutetium", "Hafnium", "Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinum", "Gold", "Mercury", "Thallium", "Lead", "Bismuth", "Polonium", "Astatine", "Radon", "Francium", "Radium", "Actinium", "Thorium", "Protactinium", "Uranium", "Neptunium", "Plutonium", "Americium", "Curium", "Berkelium", "Californium", "Einsteinium", "Fermium", "Mendelevium", "Nobelium", "Lawrencium", "Rutherfordium", "Dubnium", "Seaborgium", "Bohrium", "Hassium", "Meitnerium", "Darmstadtium", "Roentgenium", "Copernicium", "Nihonium", "Flerovium", "Moscovium", "Livermorium", "Tennessine", "Oganesson"}; + + public static IIcon[] overlays = new IIcon[aElements.length]; + public static IIcon baseTexture; static { //Generate Ions int key = 0; for (String s : aElements) { + //Map names to Meta + NameToMetaMap.put(Utils.sanitizeString(s.toLowerCase()), key); + MetaToNameMap.put(key, Utils.sanitizeString(s.toLowerCase())); Materials m = Materials.get(s); int aColour = 0; if (m == null) { @@ -45,5 +64,103 @@ public class IonParticles extends BaseItemParticle { public String getUnlocalizedName(final ItemStack itemStack) { return "item.particle.ion" + "." + aElements[itemStack.getItemDamage()]; } + + private static boolean createNBT(ItemStack rStack){ + final NBTTagCompound tagMain = new NBTTagCompound(); + final NBTTagCompound tagNBT = new NBTTagCompound(); + tagNBT.setLong("Charge", 0); + tagMain.setTag("Ion", tagNBT); + rStack.setTagCompound(tagMain); + return true; + } + + public static final long getChargeState(final ItemStack aStack) { + NBTTagCompound aNBT = aStack.getTagCompound(); + if (aNBT != null) { + aNBT = aNBT.getCompoundTag("Ion"); + if (aNBT != null) { + return aNBT.getLong("Charge"); + } + } + else { + createNBT(aStack); + } + return 0L; + } + + public static final boolean setChargeState(final ItemStack aStack, final long aCharge) { + NBTTagCompound aNBT = aStack.getTagCompound(); + if (aNBT != null) { + aNBT = aNBT.getCompoundTag("Ion"); + if (aNBT != null) { + aNBT.setLong("Charge", aCharge); + return true; + } + } + return false; + } + + @Override + public double getDurabilityForDisplay(ItemStack stack) { + if (stack.getTagCompound() == null){ + createNBT(stack); + } + double chargeState = getChargeState(stack); + return chargeState; + } + + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) { + long aCharge = getChargeState(stack); + String aState = EnumChatFormatting.YELLOW+"Unknown"+EnumChatFormatting.GRAY; + //State not set + if (aCharge == 0) { + list.add(EnumChatFormatting.GRAY+"A "+MetaToNameMap.get(stack.getItemDamage())+" Ion with an "+aState+" charge state"); + } + else { + if (aCharge > 0) { + aState = EnumChatFormatting.GREEN+"Positive"+EnumChatFormatting.GRAY; + } + else { + aState = EnumChatFormatting.RED+"Negative"+EnumChatFormatting.GRAY; + } + + list.add(EnumChatFormatting.GRAY+"A "+MetaToNameMap.get(stack.getItemDamage())+" Ion with a "+aState+" charge state of "+aCharge+""); + } + super.addInformation(stack, player, list, bool); + } + + @Override + public void registerIcons(IIconRegister reg) { + for (int i = 0; i < IonParticles.overlays.length; i++) { + IonParticles.overlays[i] = reg.registerIcon(CORE.MODID + ":" + "ion/"+i); + } + IonParticles.baseTexture = reg.registerIcon(CORE.MODID + ":" + "ion/IonBase"); + } + + @Override + public IIcon getIconFromDamage(int meta) { + return IonParticles.overlays[meta]; + } + + @Override + public boolean requiresMultipleRenderPasses() { + return true; + } + + @Override + public IIcon getIconFromDamageForRenderPass(int aMeta, int aPass) { + if (aPass == 0) { + return IonParticles.baseTexture; + } + else { + return IonParticles.overlays[aMeta]; + } + } + + @Override + public int getRenderPasses(int metadata) { + return 2; + } } diff --git a/src/Java/gtPlusPlus/core/item/chemistry/RocketFuels.java b/src/Java/gtPlusPlus/core/item/chemistry/RocketFuels.java index 9bd8a521ab..a516cb0639 100644 --- a/src/Java/gtPlusPlus/core/item/chemistry/RocketFuels.java +++ b/src/Java/gtPlusPlus/core/item/chemistry/RocketFuels.java @@ -404,7 +404,7 @@ public class RocketFuels { 480); ItemStack aCell11dimethylhydrazine = ItemUtils.getItemStackOfAmountFromOreDict("cell1,1Dimethylhydrazine", 2); - if (aCell11dimethylhydrazine != null && aCell11dimethylhydrazine.getItem() != ModItems.AAA_Broken) { + if (ItemUtils.checkForInvalidItems(aCell11dimethylhydrazine)) { GT_Values.RA.addCentrifugeRecipe( CI.getNumberedCircuit(23), aCell11dimethylhydrazine, diff --git a/src/Java/gtPlusPlus/core/item/chemistry/StandardBaseParticles.java b/src/Java/gtPlusPlus/core/item/chemistry/StandardBaseParticles.java index dd07d41b3d..1e833a7b00 100644 --- a/src/Java/gtPlusPlus/core/item/chemistry/StandardBaseParticles.java +++ b/src/Java/gtPlusPlus/core/item/chemistry/StandardBaseParticles.java @@ -1,15 +1,26 @@ package gtPlusPlus.core.item.chemistry; -import gregtech.api.enums.Materials; +import java.util.HashMap; +import java.util.List; + +import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.core.item.base.misc.BaseItemParticle; +import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.Particle; import gtPlusPlus.core.material.Particle.ElementaryGroup; import gtPlusPlus.core.util.Utils; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IIcon; public class StandardBaseParticles extends BaseItemParticle { + public static HashMap<String, Integer> NameToMetaMap = new HashMap<String, Integer>(); + public static HashMap<Integer, String> MetaToNameMap = new HashMap<Integer, String>(); + public StandardBaseParticles() { super("Base", aTypes.length, EnumRarity.rare); } @@ -17,13 +28,19 @@ public class StandardBaseParticles extends BaseItemParticle { private static final String[] aTypes = new String[] { "Graviton", "Up", "Down", "Charm", "Strange", "Top", "Bottom", "Electron", "Electron Neutrino", "Muon", "Muon Neutrino", "Tau", "Tau Neutrino", "Gluon", "Photon", "Z Boson", "W Boson", "Higgs Boson", "Proton", "Neutron", "Lambda", "Omega", "Pion", - "ETA Meson", }; + "ETA Meson", "Unknown" }; + + public IIcon[] icons = new IIcon[aTypes.length]; static { //Generate Ions int key = 0; + + for (String s : aTypes) { - Particle p; + //Map names to Meta + NameToMetaMap.put(Utils.sanitizeString(s.toLowerCase()), key); + MetaToNameMap.put(key, Utils.sanitizeString(s.toLowerCase())); for (Particle o : Particle.aMap) { int aColour = 0; if (o.mParticleName.toLowerCase().equals(s.toLowerCase())) { @@ -73,5 +90,72 @@ public class StandardBaseParticles extends BaseItemParticle { public String getUnlocalizedName(final ItemStack itemStack) { return "item.particle.base" + "." + aTypes[itemStack.getItemDamage()]; } + + public static Particle getParticle(ItemStack aStack) { + AutoMap<Particle> g = Particle.aMap; + for (Particle p : g) { + String aPartName = Utils.sanitizeString(p.mParticleName.toLowerCase()); + String expectedPart = Utils.sanitizeString(aTypes[aStack.getItemDamage()].toLowerCase()); + if (aPartName.equals(expectedPart)) { + return p; + } + } + return Particle.UNKNOWN; + } + + @Override + public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { + //return Utils.rgbtoHexValue(200, 200, 200); + return super.getColorFromParentClass(stack, HEX_OxFFFFFF); + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) { + Particle aCharge = getParticle(stack); + EnumChatFormatting aColour = EnumChatFormatting.GRAY; + String aState = aColour+"Unknown"+EnumChatFormatting.RESET; + if (aCharge != null) { + String aGroup = aCharge.mParticleType.name().toLowerCase(); + if (aGroup.toLowerCase().contains("quark")) { + aColour = EnumChatFormatting.LIGHT_PURPLE; + } + else if (aGroup.toLowerCase().contains("lepton")) { + aColour = EnumChatFormatting.GREEN; + } + else if (aCharge == Particle.HIGGS_BOSON) { + aColour = EnumChatFormatting.YELLOW; + } + else if (aGroup.toLowerCase().contains("boson")) { + aColour = EnumChatFormatting.RED; + } + else if (aGroup.toLowerCase().contains("baryon")) { + aColour = EnumChatFormatting.BLUE; + } + else if (aGroup.toLowerCase().contains("meson")) { + aColour = EnumChatFormatting.WHITE; + } + else { + aColour = EnumChatFormatting.GRAY; + } + String aFirstLet = aGroup.substring(0, 1).toUpperCase(); + aGroup = aGroup.replaceFirst(aGroup.substring(0, 1), aFirstLet); + aState = aColour+aGroup+EnumChatFormatting.RESET; + list.add(EnumChatFormatting.GRAY + "Type: "+aState); + } + super.addInformation(stack, player, list, bool); + } + + @Override + public void registerIcons(IIconRegister reg) { + for (int i = 0; i < this.icons.length; i++) { + this.icons[i] = reg.registerIcon(CORE.MODID + ":" + "particle/"+i); + } + } + + @Override + public IIcon getIconFromDamage(int meta) { + return this.icons[meta]; + } } diff --git a/src/Java/gtPlusPlus/core/item/general/BufferCore.java b/src/Java/gtPlusPlus/core/item/general/BufferCore.java index d3c7d5112f..9b00d3d034 100644 --- a/src/Java/gtPlusPlus/core/item/general/BufferCore.java +++ b/src/Java/gtPlusPlus/core/item/general/BufferCore.java @@ -4,7 +4,7 @@ import java.util.List; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; - +import gregtech.api.enums.GT_Values; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; @@ -21,7 +21,7 @@ public class BufferCore extends BaseItemWithDamageValue{ public BufferCore(final String unlocalizedName, final int i) { super(unlocalizedName+i); this.setTextureName(CORE.MODID + ":" + unlocalizedName); - this.setMaxStackSize(2); + this.setMaxStackSize(32); this.coreTier = i; } @@ -40,7 +40,7 @@ public class BufferCore extends BaseItemWithDamageValue{ @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - list.add(EnumChatFormatting.GRAY+"A key crafting component for making energy buffers."); + list.add(EnumChatFormatting.GRAY+"A key crafting component for "+GT_Values.VN[this.coreTier-1]+" Applicances"); } public final int getCoreTier() { @@ -48,51 +48,25 @@ public class BufferCore extends BaseItemWithDamageValue{ } @Override - public int getColorFromItemStack(final ItemStack stack, int HEX_OxFFFFFF) { - //Figure Out Damage - final String s = String.format("%X", HEX_OxFFFFFF); - //Utils.LOG_INFO(s); - //String rgb = Utils.hex2Rgb(s); - //Utils.LOG_INFO(rgb); - if (this.coreTier == 1){ - HEX_OxFFFFFF = 0x4d4d4d; - } - else if (this.coreTier == 2){ - HEX_OxFFFFFF = 0x666666; - } - else if (this.coreTier == 3){ - HEX_OxFFFFFF = 0x8c8c8c; - } - else if (this.coreTier == 4){ - HEX_OxFFFFFF = 0xa6a6a6; - } - else if (this.coreTier == 5){ - HEX_OxFFFFFF = 0xcccccc; - } - else if (this.coreTier == 6){ - HEX_OxFFFFFF = 0xe6e6e6; - } - else if (this.coreTier == 7){ - HEX_OxFFFFFF = 0xffffcc; - } - else if (this.coreTier == 8){ - HEX_OxFFFFFF = 0xace600; - } - else if (this.coreTier == 9){ - HEX_OxFFFFFF = 0xffff00; - } - /*else if (coreTier == 10){ - HEX_OxFFFFFF = 0xff0000; - }*/ - else if (this.coreTier == 10){ - HEX_OxFFFFFF = Utils.rgbtoHexValue(MathUtils.randInt(220, 250), MathUtils.randInt(221, 251), MathUtils.randInt(220, 250)); - } - else { - HEX_OxFFFFFF = 0xffffff; - } + public int getColorFromItemStack(final ItemStack stack, int HEX_OxFFFFFF) { + int[] mTierTypes = new int[] { + Utils.rgbtoHexValue(200, 180, 180), + Utils.rgbtoHexValue(142, 153, 161), + Utils.rgbtoHexValue(230, 121, 75), + Utils.rgbtoHexValue(215, 156, 70), + Utils.rgbtoHexValue(97, 97, 96), //EV + Utils.rgbtoHexValue(202, 202, 201), + Utils.rgbtoHexValue(247, 159, 157), + Utils.rgbtoHexValue(181, 223, 223), + Utils.rgbtoHexValue(187, 219, 185), + }; + + if (this.coreTier == 10){ + return Utils.rgbtoHexValue(MathUtils.randInt(220, 250), MathUtils.randInt(221, 251), MathUtils.randInt(220, 250)); + } - return HEX_OxFFFFFF; + return mTierTypes[this.coreTier-1]; } } diff --git a/src/Java/gtPlusPlus/core/item/general/ItemControlCore.java b/src/Java/gtPlusPlus/core/item/general/ItemControlCore.java index 8ad87c0ea8..eb22f8fa07 100644 --- a/src/Java/gtPlusPlus/core/item/general/ItemControlCore.java +++ b/src/Java/gtPlusPlus/core/item/general/ItemControlCore.java @@ -4,10 +4,13 @@ import java.util.List; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.GregTech_API; +import gregtech.api.enums.GT_Values; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IIcon; import gtPlusPlus.core.lib.CORE; @@ -57,6 +60,14 @@ public class ItemControlCore extends Item { public String getUnlocalizedName(ItemStack stack) { return this.getUnlocalizedName() + "_" + stack.getItemDamage(); } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + list.add(EnumChatFormatting.GRAY+"Allows a Multiblock to function upto "+GT_Values.VN[stack.getItemDamage()]+""); + list.add(EnumChatFormatting.GRAY+"Required Tier is determined by the sum of the eu/t of all Energy Inputs"); + list.add(EnumChatFormatting.GRAY+"Lower tiers may be used to underclock, which is useful in some situations"); + } @Override public String getItemStackDisplayName(final ItemStack tItem) { 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/material/Material.java b/src/Java/gtPlusPlus/core/material/Material.java index 1ee02a2654..03e50aa7dd 100644 --- a/src/Java/gtPlusPlus/core/material/Material.java +++ b/src/Java/gtPlusPlus/core/material/Material.java @@ -753,7 +753,7 @@ public class Material { } } //Logger.MATERIALS("Unabled to find \"" + aKey + this.unlocalizedName + "\""); - return ItemUtils.getErrorStack(stacksize); + return ItemUtils.getErrorStack(stacksize, (aKey + this.unlocalizedName+" x"+stacksize)); } } diff --git a/src/Java/gtPlusPlus/core/material/Particle.java b/src/Java/gtPlusPlus/core/material/Particle.java index 6cc0f878d6..e93129ec58 100644 --- a/src/Java/gtPlusPlus/core/material/Particle.java +++ b/src/Java/gtPlusPlus/core/material/Particle.java @@ -1,6 +1,11 @@ package gtPlusPlus.core.material; import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.core.item.ModItems; +import gtPlusPlus.core.item.chemistry.IonParticles; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import net.minecraft.item.ItemStack; public class Particle { @@ -34,6 +39,8 @@ public class Particle { public static final Particle PION; public static final Particle ETA_MESON; + public static final Particle UNKNOWN; + public static final AutoMap<Particle> aMap = new AutoMap<Particle>(); static { @@ -80,7 +87,11 @@ public class Particle { //Mesons PION = new Particle(ElementaryGroup.MESON, "Pion", new Particle[] {MUON, MUON_NEUTRINO}); - ETA_MESON = new Particle(ElementaryGroup.MESON, "ETA Meson", new Particle[] {PION, PION, PION}); + ETA_MESON = new Particle(ElementaryGroup.MESON, "ETA Meson", new Particle[] {PION, PION, PION}); + + + //Wildcard + UNKNOWN = new Particle(ElementaryGroup.UNKNOWN, "Unknown"); } @@ -89,7 +100,8 @@ public class Particle { LEPTON, BOSON, BARYON, - MESON; + MESON, + UNKNOWN; } public final ElementaryGroup mParticleType; @@ -107,4 +119,35 @@ public class Particle { aMap.put(this); } + + public static ItemStack getIon(String aElementName, int aCharge) { + for (String g : gtPlusPlus.core.item.chemistry.IonParticles.NameToMetaMap.keySet()) { + if (g.toLowerCase().equals(Utils.sanitizeString(aElementName.toLowerCase()))){ + Integer meta = gtPlusPlus.core.item.chemistry.IonParticles.NameToMetaMap.get(Utils.sanitizeString(aElementName.toLowerCase())); + if (meta == null) { + meta = 0; + } + ItemStack aIon = ItemUtils.simpleMetaStack(ModItems.itemIonParticleBase, meta, 1); + if (aCharge != 0) { + IonParticles.setChargeState(aIon, aCharge); + } + return aIon; + } + } + return null; + } + + public static ItemStack getBaseParticle(Particle aParticle) { + String aPartName = Utils.sanitizeString(aParticle.mParticleName.toLowerCase()); + for (String g : gtPlusPlus.core.item.chemistry.StandardBaseParticles.NameToMetaMap.keySet()) { + if (g.toLowerCase().equals(aPartName)){ + Integer meta = gtPlusPlus.core.item.chemistry.StandardBaseParticles.NameToMetaMap.get(aPartName); + if (meta == null) { + meta = 0; + } + return ItemUtils.simpleMetaStack(ModItems.itemStandarParticleBase, meta, 1); + } + } + return null; + } } 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_GREGTECH.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java index e2c69277f6..456b535606 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java @@ -1,22 +1,27 @@ package gtPlusPlus.core.recipe; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; - -import static gtPlusPlus.core.util.minecraft.ItemUtils.getSimpleStack; +import static gtPlusPlus.core.lib.CORE.GTNH; import gregtech.api.GregTech_API; -import gregtech.api.enums.*; -import gregtech.api.util.*; - +import gregtech.api.enums.ConfigCategories; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Utility; +import gregtech.api.util.HotFuel; +import gregtech.api.util.ThermalFuel; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.item.ModItems; +import gtPlusPlus.core.item.chemistry.IonParticles; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.ALLOY; import gtPlusPlus.core.material.ELEMENT; +import gtPlusPlus.core.material.Particle; import gtPlusPlus.core.material.nuclear.FLUORIDES; import gtPlusPlus.core.material.nuclear.NUCLIDE; import gtPlusPlus.core.recipe.common.CI; @@ -25,10 +30,12 @@ import gtPlusPlus.core.util.minecraft.EnchantingUtils; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.MaterialUtils; -import gtPlusPlus.core.util.minecraft.RecipeUtils; import gtPlusPlus.core.util.reflect.AddGregtechRecipe; import gtPlusPlus.everglades.dimension.Dimension_Everglades; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; public class RECIPES_GREGTECH { @@ -70,9 +77,76 @@ public class RECIPES_GREGTECH { extruderRecipes(); cuttingSawRecipes(); breweryRecipes(); + laserEngraverRecipes(); + assemblyLineRecipes(); addFuels(); } + private static void assemblyLineRecipes() { + + CORE.RA.addAssemblylineRecipe( + ItemList.Field_Generator_IV.get(1), + 20 * 60 * 30, + new ItemStack[] { + ItemList.Field_Generator_IV.get(GTNH ? 32 : 16), + ItemList.Electric_Motor_EV.get(GTNH ? 64 : 32), + ItemList.Energy_LapotronicOrb.get(GTNH ? 32 : 16), + CI.getTieredComponent(OrePrefixes.cableGt12, 7, GTNH ? 32 : 16), + CI.getTieredComponent(OrePrefixes.wireGt16, 6, GTNH ? 64 : 32), + ItemUtils.getOrePrefixStack(OrePrefixes.plate, Materials.Naquadria, GTNH ? 64 : 16), + ELEMENT.getInstance().GADOLINIUM.getDust(GTNH ? 32 : 8), + ELEMENT.getInstance().SAMARIUM.getDust(GTNH ? 16 : 4), + ALLOY.ARCANITE.getGear(GTNH ? 8 : 2), + CI.getTieredComponent(OrePrefixes.circuit, 5, GTNH ? 64 : 32), + CI.getTieredComponent(OrePrefixes.circuit, 6, GTNH ? 32 : 16), + CI.getTieredComponent(OrePrefixes.circuit, 7, GTNH ? 16 : 8), + GregtechItemList.Laser_Lens_Special.get(1) + }, + new FluidStack[] { + ALLOY.NITINOL_60.getFluid(144 * 9 * (GTNH ? 4 : 2)), + ALLOY.ENERGYCRYSTAL.getFluid(144 * 9 * (GTNH ? 8 : 4)), + ALLOY.TUMBAGA.getFluid(144 * 9 * (GTNH ? 32 : 8)), + ALLOY.NICHROME.getFluid(144 * 1 * (GTNH ? 16 : 4)), + + }, + ItemUtils.getSimpleStack(ModBlocks.blockCasings3Misc, 15, 32), + 20 * 60 * 10 * (GTNH ? 2 : 1), + (int) GT_Values.V[6]); + + } + + private static void laserEngraverRecipes() { + + GT_Values.RA.addLaserEngraverRecipe( + GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Tungsten, 6L), + GregtechItemList.Laser_Lens_Special.get(0), + ELEMENT.STANDALONE.CELESTIAL_TUNGSTEN.getDust(1), + 20 * 60 * 3, + MaterialUtils.getVoltageForTier(ELEMENT.STANDALONE.CELESTIAL_TUNGSTEN.vTier)); + + GT_Values.RA.addLaserEngraverRecipe( + GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Titanium, 8L), + GregtechItemList.Laser_Lens_Special.get(0), + ELEMENT.STANDALONE.ASTRAL_TITANIUM.getDust(1), + 20 * 60 * 2, + MaterialUtils.getVoltageForTier(ELEMENT.STANDALONE.ASTRAL_TITANIUM.vTier)); + + GT_Values.RA.addLaserEngraverRecipe( + ALLOY.NITINOL_60.getBlock(2), + GregtechItemList.Laser_Lens_Special.get(0), + ELEMENT.STANDALONE.ADVANCED_NITINOL.getBlock(1), + 20 * 60 * 1, + MaterialUtils.getVoltageForTier(ELEMENT.STANDALONE.ADVANCED_NITINOL.vTier)); + + GT_Values.RA.addLaserEngraverRecipe( + GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Glass, 64L), + GregtechItemList.Laser_Lens_Special.get(0), + ELEMENT.STANDALONE.CHRONOMATIC_GLASS.getDust(1), + 20 * 60 * 5, + MaterialUtils.getVoltageForTier(ELEMENT.STANDALONE.CHRONOMATIC_GLASS.vTier)); + + } + private static void breweryRecipes() { CORE.RA.addBrewingRecipe(14, EnchantingUtils.getMobEssence(100), EnchantingUtils.getLiquidXP(1332), 100, 120, false); CORE.RA.addBrewingRecipe(14, EnchantingUtils.getLiquidXP(1332), EnchantingUtils.getMobEssence(100), 100, 120, false); @@ -92,7 +166,7 @@ public class RECIPES_GREGTECH { ItemUtils.getSimpleStack(ModItems.dustDecayedRadium226, 1), null, null, - FluidUtils.getFluidStack("radon", !CORE.GTNH ? 500 : 144), + FluidUtils.getFluidStack("radon", !GTNH ? 500 : 144), null, null, null, @@ -118,7 +192,7 @@ public class RECIPES_GREGTECH { private static void blastSmelterRecipes() { - if (!CORE.GTNH) { + if (!GTNH) { // Trinium CORE.RA.addBlastSmelterRecipe( new ItemStack[] { @@ -481,10 +555,9 @@ public class RECIPES_GREGTECH { } // Calcium Hydroxide - if ((ItemUtils.getItemStackOfAmountFromOreDict("dustQuicklime", 1).getItem() != ModItems.AAA_Broken) - || LoadedMods.IHL) { + if ((ItemUtils.checkForInvalidItems(ItemUtils.getItemStackOfAmountFromOreDict("dustQuicklime", 1))) || LoadedMods.IHL) { try { - + CORE.RA.addDehydratorRecipe( new ItemStack[] { ItemUtils.getItemStackOfAmountFromOreDict("dustQuicklime", 10) }, // Item FluidUtils.getFluidStack("water", 10000), // Fluid input @@ -908,13 +981,6 @@ public class RECIPES_GREGTECH { } - private static boolean addAR(final ItemStack inputA, final ItemStack inputB, final ItemStack outputA, - final int seconds, final int voltage) { - // return GT_Values.RA.addAssemblerRecipe(inputA, inputB, outputA, - // seconds*20, voltage); - return addAR(inputA, inputB, null, outputA, seconds * 20, voltage); - } - private static boolean addAR(final ItemStack inputA, final ItemStack inputB, final FluidStack inputFluidA, final ItemStack outputA, final int seconds, final int voltage) { // return GT_Values.RA.addAssemblerRecipe(inputA, inputB, outputA, @@ -953,7 +1019,7 @@ public class RECIPES_GREGTECH { private static void addFuels() { Logger.INFO("Registering New Fuels."); - if (!CORE.GTNH) { + if (!GTNH) { GT_Values.RA.addFuel(ItemUtils.simpleMetaStack("EnderIO:bucketFire_water", 0, 1), null, 120, 0); GT_Values.RA.addFuel(ItemUtils.simpleMetaStack("EnderIO:bucketRocket_fuel", 0, 1), null, 112, 0); GT_Values.RA.addFuel(ItemUtils.simpleMetaStack("EnderIO:bucketHootch", 0, 1), null, 36, 0); @@ -1116,7 +1182,7 @@ public class RECIPES_GREGTECH { CI.emptyCells(1), 300 * 20); // LFTR Fuel Related Compounds - if (CORE.GTNH) { + if (GTNH) { // Hydroxide AddGregtechRecipe.addChemicalRecipeForBasicMachineOnly( ItemUtils.getItemStackOfAmountFromOreDict("cellOxygen", 1), @@ -1140,7 +1206,7 @@ public class RECIPES_GREGTECH { CI.emptyCells(2), GT_Values.NI, 20 * 20, 30); } - if (!CORE.GTNH) { + if (!GTNH) { // Hydroxide GT_Values.RA.addChemicalRecipe(ItemUtils.getItemStackOfAmountFromOreDict("cellOxygen", 1), ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogen", 1), GT_Values.NF, @@ -1261,40 +1327,202 @@ public class RECIPES_GREGTECH { //Polonium CORE.RA.addCyclotronRecipe(CI.getNumberedCircuit(0), FluidUtils.getFluidStack("molten.bismuth", 1), - new ItemStack[] { GregtechItemList.Pellet_RTG_PO210.get(1) }, null, new int[] { 100 }, 20 * 300, 2040, + new ItemStack[] { GregtechItemList.Pellet_RTG_PO210.get(1) }, null, new int[] { 100 }, 20 * 300 * 100, 2040, 500 * 20); //Americium CORE.RA.addCyclotronRecipe(CI.getNumberedCircuit(0), FluidUtils.getFluidStack("molten.americium", 1), - new ItemStack[] { GregtechItemList.Pellet_RTG_AM241.get(4) }, null, new int[] { 2500 }, 20 * 300, 1020, + new ItemStack[] { GregtechItemList.Pellet_RTG_AM241.get(4) }, null, new int[] { 2500 }, 20 * 300 * 100, 1020, 500 * 20); //PO Special Value //Strontium u235 CORE.RA.addCyclotronRecipe(CI.getNumberedCircuit(0), FluidUtils.getFluidStack("molten.uranium235", 10), - new ItemStack[] { GregtechItemList.Pellet_RTG_SR90.get(1) }, null, new int[] { 570 }, 20 * 300, 1020, + new ItemStack[] { GregtechItemList.Pellet_RTG_SR90.get(1) }, null, new int[] { 570 }, 20 * 300 * 100, 1020, 500 * 20); //PO Special Value //Strontium u233 CORE.RA.addCyclotronRecipe(CI.getNumberedCircuit(0), FluidUtils.getFluidStack("molten.uranium233", 10), - new ItemStack[] { GregtechItemList.Pellet_RTG_SR90.get(1) }, null, new int[] { 660 }, 20 * 300, 1020, + new ItemStack[] { GregtechItemList.Pellet_RTG_SR90.get(1) }, null, new int[] { 660 }, 20 * 300 * 100, 1020, 500 * 20); //PO Special Value //Strontium pu239 CORE.RA.addCyclotronRecipe(CI.getNumberedCircuit(0), FluidUtils.getFluidStack("molten.plutonium239", 10), - new ItemStack[] { GregtechItemList.Pellet_RTG_SR90.get(1) }, null, new int[] { 220 }, 20 * 300, 1020, + new ItemStack[] { GregtechItemList.Pellet_RTG_SR90.get(1) }, null, new int[] { 220 }, 20 * 300 * 100, 1020, 500 * 20); //PO Special Value //Plutonium CORE.RA.addCyclotronRecipe(CI.getNumberedCircuit(0), FluidUtils.getFluidStack("molten.plutonium238", 1), - new ItemStack[] { GregtechItemList.Pellet_RTG_PU238.get(2) }, null, new int[] { 780 }, 20 * 300, 1020, + new ItemStack[] { GregtechItemList.Pellet_RTG_PU238.get(2) }, null, new int[] { 780 }, 20 * 300 * 100, 1020, 500 * 20); //PO Special Value - //Neptunium CORE.RA.addCyclotronRecipe(new ItemStack[] {ELEMENT.getInstance().URANIUM238.getDust(1) }, FluidUtils.getFluidStack("deuterium", 400), - ItemUtils.getSimpleStack(ModItems.dustNeptunium238), null, new int[] { 500 }, 20 * 5, 500, + new ItemStack[] {ItemUtils.getSimpleStack(ModItems.dustNeptunium238)}, null, new int[] { 500 }, 20 * 5, 500, 500 * 20); //PO Special Value + + + /** + * Particle Science + */ + + // Quark Smash + CORE.RA.addCyclotronRecipe( + CI.getNumberedCircuit(3), + FluidUtils.getFluidStack("plasma.hydrogen", 1000), + new ItemStack[] { + Particle.getBaseParticle(Particle.UP), + Particle.getBaseParticle(Particle.DOWN), + Particle.getBaseParticle(Particle.CHARM), + Particle.getBaseParticle(Particle.STRANGE), + Particle.getBaseParticle(Particle.TOP), + Particle.getBaseParticle(Particle.BOTTOM), + }, + null, + new int[] { 50, 50, 50, 50, 50, 50 }, + 20 * 300 * 38, + (int) GT_Values.V[7], + 750 * 20); + + // Lepton Smash + CORE.RA.addCyclotronRecipe( + CI.getNumberedCircuit(6), + FluidUtils.getFluidStack("plasma.helium", 1500), + new ItemStack[] { + Particle.getBaseParticle(Particle.ELECTRON), + Particle.getBaseParticle(Particle.MUON), + Particle.getBaseParticle(Particle.TAU), + Particle.getBaseParticle(Particle.ELECTRON_NEUTRINO), + Particle.getBaseParticle(Particle.MUON_NEUTRINO), + Particle.getBaseParticle(Particle.TAU_NEUTRINO), + }, + null, + new int[] { 60, 40, 20, 15, 10, 5 }, + 20 * 300 * 38, + (int) GT_Values.V[7], + 750 * 20); + + //Boson Smash + CORE.RA.addCyclotronRecipe( + CI.getNumberedCircuit(9), + FluidUtils.getFluidStack("plasma.helium", 1500), + new ItemStack[] { + Particle.getBaseParticle(Particle.GLUON), + Particle.getBaseParticle(Particle.PHOTON), + Particle.getBaseParticle(Particle.Z_BOSON), + Particle.getBaseParticle(Particle.W_BOSON), + Particle.getBaseParticle(Particle.HIGGS_BOSON), + }, + null, + new int[] { 60, 60, 50, 50, 1 }, + 20 * 300 * 38, + (int) GT_Values.V[7], + 750 * 20); + + + // Mixed Smash 1 + CORE.RA.addCyclotronRecipe( + CI.getNumberedCircuit(12), + FluidUtils.getFluidStack("plasma.beryllium", 2500), + new ItemStack[] { + Particle.getBaseParticle(Particle.GRAVITON), + Particle.getBaseParticle(Particle.ETA_MESON), + Particle.getBaseParticle(Particle.PION), + Particle.getBaseParticle(Particle.PROTON), + Particle.getBaseParticle(Particle.NEUTRON), + Particle.getBaseParticle(Particle.LAMBDA), + Particle.getBaseParticle(Particle.OMEGA), + Particle.getBaseParticle(Particle.HIGGS_BOSON), + }, + null, + new int[] { 10, 20, 20, 10, 10, 5, 5, 2 }, + 17 * 247 * 134, + (int) GT_Values.V[8], + 750 * 20); + + //Graviton Smash + CORE.RA.addCyclotronRecipe( + CI.getNumberedCircuit(15), + FluidUtils.getFluidStack("plasma.hydrogen", GTNH ? 50 : 10), + new ItemStack[] { + Particle.getBaseParticle(Particle.GRAVITON), + Particle.getBaseParticle(Particle.UNKNOWN) + }, + null, + new int[] {15, 100}, + 20 * (GTNH ? 90 : 30), + (int) GT_Values.V[6], + 1000 * 20); + + FluidStack aPlasma = Materials.Duranium.getMolten(GTNH ? 40 : 10); + FluidStack aPlasma_NULL = Materials._NULL.getPlasma(1); + + if (aPlasma == null || aPlasma.isFluidEqual(aPlasma_NULL)) { + aPlasma = Materials.Americium.getMolten(GTNH ? 20 : 5); + } + + //Quantum Anomaly + CORE.RA.addCyclotronRecipe( + new ItemStack[] { + CI.getNumberedCircuit(24), + Particle.getBaseParticle(Particle.UNKNOWN), + }, + aPlasma, + new ItemStack[] { + GregtechItemList.Laser_Lens_Special.get(1) + }, + null, + new int[] {100}, + 20 * (GTNH ? 300 : 60), + (int) GT_Values.V[6], + 1000 * 20); + + /* + * Ions + */ + + int IonCount = 2; + int tenCountA = (GTNH ? 2 : 1); + int tenCountB = 0; + for (String y : IonParticles.MetaToNameMap.values()) { + FluidStack aPlasma2 = FluidUtils.getFluidStack("plasma."+y.toLowerCase(), 2); + Materials aTestMat = MaterialUtils.getMaterial(y); + FluidStack aPlasma3 = aTestMat != null ? aTestMat.getPlasma(2) : aPlasma2; + + // Ionize Plasma + if ((aPlasma2 != null && !aPlasma2.isFluidEqual(aPlasma_NULL)) || (aPlasma3 != null && !aPlasma3.isFluidEqual(aPlasma_NULL))) { + CORE.RA.addCyclotronRecipe( + CI.getNumberedCircuit(1+(tenCountA-1)), + aPlasma2 != null ? aPlasma2 : aPlasma3, + new ItemStack[] { + Particle.getIon(y, 1), + Particle.getIon(y, 2), + Particle.getIon(y, 3), + Particle.getIon(y, -1), + Particle.getIon(y, -2), + Particle.getIon(y, -3), + Particle.getIon(y, 1), + Particle.getIon(y, 2), + Particle.getIon(y, -1), + }, + null, + new int[] { 75, 50, 25, 75, 50, 25, 75, 50, 75}, + 20 * 20 * (IonCount++) * tenCountA, + (int) GT_Values.V[7], + 1500 * 20 * tenCountA); + } + else { + Logger.INFO("Plasma for "+y+" does not exist, please report this to Alkalus."); + } + + if (tenCountB == 12) { + tenCountB = 0; + tenCountA++; + } + else { + tenCountB++; + } + } } diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java index 0040edfa99..e2cfb3516e 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java @@ -208,6 +208,8 @@ public class RECIPES_Machines { private static void run(){ initModItems(); controlCores(); + energyCores(); + wirelessChargers(); } private static void initModItems(){ @@ -338,109 +340,7 @@ public class RECIPES_Machines { 8000); - //Buffer Core - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[1], cableTier1, CI.component_Plate[1], - "circuitPrimitive", "plateStaballoy", "circuitPrimitive", - CI.component_Plate[1], cableTier1, CI.component_Plate[1], - RECIPE_BufferCore_ULV); - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[2], cableTier2, CI.component_Plate[2], - RECIPE_BufferCore_ULV, CI.machineHull_HV, RECIPE_BufferCore_ULV, - CI.component_Plate[2], cableTier2, CI.component_Plate[2], - RECIPE_BufferCore_LV); - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[3], cableTier3, CI.component_Plate[3], - RECIPE_BufferCore_LV, CI.circuitTier2, RECIPE_BufferCore_LV, - CI.component_Plate[3], cableTier3, CI.component_Plate[3], - RECIPE_BufferCore_MV); - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[4], cableTier4, CI.component_Plate[4], - RECIPE_BufferCore_MV, CI.circuitTier3, RECIPE_BufferCore_MV, - CI.component_Plate[4], cableTier4, CI.component_Plate[4], - RECIPE_BufferCore_HV); - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[5], cableTier5, CI.component_Plate[5], - RECIPE_BufferCore_HV, CI.circuitTier4, RECIPE_BufferCore_HV, - CI.component_Plate[5], cableTier5, CI.component_Plate[5], - RECIPE_BufferCore_EV); - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[6], cableTier6, CI.component_Plate[6], - RECIPE_BufferCore_EV, CI.circuitTier5, RECIPE_BufferCore_EV, - CI.component_Plate[6], cableTier6, CI.component_Plate[6], - RECIPE_BufferCore_IV); - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[7], cableTier7, CI.component_Plate[7], - RECIPE_BufferCore_IV, CI.circuitTier6, RECIPE_BufferCore_IV, - CI.component_Plate[7], cableTier7, CI.component_Plate[7], - RECIPE_BufferCore_LuV); - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[8], cableTier8, CI.component_Plate[8], - RECIPE_BufferCore_LuV, CI.circuitTier7, RECIPE_BufferCore_LuV, - CI.component_Plate[8], cableTier8, CI.component_Plate[8], - RECIPE_BufferCore_ZPM); - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[9], cableTier9, CI.component_Plate[9], - RECIPE_BufferCore_ZPM, CI.circuitTier8, RECIPE_BufferCore_ZPM, - CI.component_Plate[9], cableTier9, CI.component_Plate[9], - RECIPE_BufferCore_UV); - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[10], cableTier10, CI.component_Plate[10], - RECIPE_BufferCore_UV, CI.circuitTier9, RECIPE_BufferCore_UV, - CI.component_Plate[10], cableTier10, CI.component_Plate[10], - RECIPE_BufferCore_MAX); - - - RecipeUtils.addShapedGregtechRecipe( - wireTier1, RECIPE_BufferCore_ULV, wireTier1, - wireTier1, CI.machineCasing_ULV, wireTier1, - CI.circuitPrimitive, CI.circuitTier1, CI.circuitPrimitive, - RECIPE_Buffer_ULV); - RecipeUtils.addShapedGregtechRecipe( - wireTier2, RECIPE_BufferCore_LV, wireTier2, - wireTier2, CI.machineCasing_LV, wireTier2, - CI.circuitTier1, RECIPE_BufferCore_LV, CI.circuitTier1, - RECIPE_Buffer_LV); - RecipeUtils.addShapedGregtechRecipe( - wireTier3, RECIPE_BufferCore_MV, wireTier3, - wireTier3, CI.machineCasing_MV, wireTier3, - CI.circuitTier2, RECIPE_BufferCore_MV, CI.circuitTier2, - RECIPE_Buffer_MV); - RecipeUtils.addShapedGregtechRecipe( - wireTier4, RECIPE_BufferCore_HV, wireTier4, - wireTier4, CI.machineCasing_HV, wireTier4, - CI.circuitTier3, RECIPE_BufferCore_HV, CI.circuitTier3, - RECIPE_Buffer_HV); - RecipeUtils.addShapedGregtechRecipe( - wireTier5, RECIPE_BufferCore_EV, wireTier5, - wireTier5, CI.machineCasing_EV, wireTier5, - CI.circuitTier4, RECIPE_BufferCore_EV, CI.circuitTier4, - RECIPE_Buffer_EV); - RecipeUtils.addShapedGregtechRecipe( - wireTier6, RECIPE_BufferCore_IV, wireTier6, - wireTier6, CI.machineCasing_IV, wireTier6, - CI.circuitTier5, RECIPE_BufferCore_IV, CI.circuitTier5, - RECIPE_Buffer_IV); - RecipeUtils.addShapedGregtechRecipe( - wireTier7, RECIPE_BufferCore_LuV, wireTier7, - wireTier7, CI.machineCasing_LuV, wireTier7, - CI.circuitTier6, RECIPE_BufferCore_LuV, CI.circuitTier6, - RECIPE_Buffer_LuV); - RecipeUtils.addShapedGregtechRecipe( - wireTier8, RECIPE_BufferCore_ZPM, wireTier8, - wireTier8, CI.machineCasing_ZPM, wireTier8, - CI.circuitTier7, RECIPE_BufferCore_ZPM, CI.circuitTier7, - RECIPE_Buffer_ZPM); - RecipeUtils.addShapedGregtechRecipe( - wireTier9, RECIPE_BufferCore_UV, wireTier9, - wireTier9, CI.machineCasing_UV, wireTier9, - CI.circuitTier8, RECIPE_BufferCore_UV, CI.circuitTier8, - RECIPE_Buffer_UV); - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[11], RECIPE_BufferCore_MAX, CI.component_Plate[11], - wireTier10, CI.machineCasing_MAX, wireTier10, - CI.circuitTier9, RECIPE_BufferCore_MAX, CI.circuitTier9, - RECIPE_Buffer_MAX); + //Steam Condenser if (CORE.ConfigSwitches.enableMachine_SteamConverter ){ @@ -1382,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)); @@ -1576,17 +1429,60 @@ public class RECIPES_Machines { } - + int aCostMultiplier = GTNH ? 2 : 1; //Mystic Frame - Logger.RECIPE("[Inspection] Portal Frame"); - if (RecipeUtils.addShapedGregtechRecipe( - "circuitMaster", ItemList.Field_Generator_MV.get(1, CI.circuitTier7), "circuitElite", - CI.craftingToolScrewdriver, GregtechItemList.Casing_Multi_Use.get(1), CI.craftingToolWrench, - ItemList.Sensor_HV.get(1, CI.circuitTier7), ItemList.Field_Generator_HV.get(1, CI.circuitTier7), ItemList.Emitter_HV.get(1, CI.circuitTier7), - ItemUtils.getSimpleStack(Dimension_Everglades.blockPortalFrame, 2))){ - Logger.INFO("Added a recipe for the Toxic Everglades Portal frame"); + CORE.RA.addSixSlotAssemblingRecipe( + new ItemStack[] { + GregtechItemList.Casing_Multi_Use.get(1), + ItemList.Field_Generator_MV.get(1, CI.circuitTier7), + ItemList.Field_Generator_HV.get(1, CI.circuitTier7), + ItemList.Emitter_HV.get(1, CI.circuitTier7), + ItemList.Sensor_HV.get(1, CI.circuitTier7), + CI.getTieredComponent(OrePrefixes.plate, 7, 8 * aCostMultiplier), + CI.getTieredComponent(OrePrefixes.wireGt08, 8, 4 * aCostMultiplier), + }, + CI.getTieredFluid(6, (144 * 8)), //Input Fluid + ItemUtils.getSimpleStack(Dimension_Everglades.blockPortalFrame, 2), + 45 * 20 * 1 * (6), + MaterialUtils.getVoltageForTier(6)); + + + //Player Doors + ItemStack[] aDoorInputs = new ItemStack[] { + ItemUtils.getSimpleStack(Blocks.log2), + ItemUtils.getSimpleStack(Blocks.iron_block), + ItemUtils.getSimpleStack(Blocks.glass), + ItemUtils.getSimpleStack(Blocks.packed_ice), + ItemUtils.getSimpleStack(Blocks.cactus), + }; + ItemStack[] aDoorOutputs = new ItemStack[] { + ItemUtils.getSimpleStack(ModBlocks.blockPlayerDoorWooden), + ItemUtils.getSimpleStack(ModBlocks.blockPlayerDoorIron), + ItemUtils.getSimpleStack(ModBlocks.blockPlayerDoorCustom_Glass), + ItemUtils.getSimpleStack(ModBlocks.blockPlayerDoorCustom_Ice), + ItemUtils.getSimpleStack(ModBlocks.blockPlayerDoorCustom_Cactus), + }; + + for (int y = 0; y < aDoorInputs.length; y++) { + CORE.RA.addSixSlotAssemblingRecipe( + new ItemStack[] { + ItemUtils.getSimpleStack(Items.iron_door), + aDoorInputs[y], + ItemList.Sensor_LV.get(1, CI.circuitTier7), + CI.getTieredComponent(OrePrefixes.plate, 1, 2 * aCostMultiplier), + CI.getTieredComponent(OrePrefixes.wireGt02, 1, 2 * aCostMultiplier), + ItemUtils.getSimpleStack(Items.redstone, 16) + }, + CI.getTieredFluid(1, (144 * 2)), //Input Fluid + aDoorOutputs[y], + 100, + MaterialUtils.getVoltageForTier(1)); } + + + + Logger.INFO("Done loading recipes for the Various machine blocks."); @@ -1622,7 +1518,7 @@ public class RECIPES_Machines { Item aBaseCore = ModItems.itemControlCore; ItemStack[] aInputPrevTier = new ItemStack[] { - ItemUtils.getItemStack("miscutils:item.itemBufferCore5", 1), + GTNH ? ItemUtils.getItemStack("miscutils:item.itemBufferCore3", 1) : ItemUtils.getItemStack("miscutils:item.itemBufferCore2", 1), ItemUtils.simpleMetaStack(aBaseCore, 0, 1), ItemUtils.simpleMetaStack(aBaseCore, 1, 1), ItemUtils.simpleMetaStack(aBaseCore, 2, 1), @@ -1653,7 +1549,7 @@ public class RECIPES_Machines { aOutput[2], aMat_A[3].getGear(GTNH ? 4 : 2), aMat_B[5].getPlateDouble(GTNH ? 16 : 8), - ItemUtils.getItemStack("miscutils:item.itemBufferCore"+(GTNH ? "5" : "4"), GTNH ? 4 : 2), + ItemUtils.getItemStack("miscutils:item.itemBufferCore"+(GTNH ? "4" : "3"), GTNH ? 4 : 2), ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(GTNH ? 4 : 3), GTNH ? 10 : 5) }, aMat_B[4].getFluid(144 * 16), //Input Fluid @@ -1702,10 +1598,219 @@ public class RECIPES_Machines { aOutput[i], 60 * 20 * 1 * (i+1), MaterialUtils.getVoltageForTier(i)); + } + } + + private static void energyCores() { + + //Simpler Recipes for normal Players, Force assembly crafting in GTNH + if (!GTNH) { + //Buffer Core + /*RecipeUtils.addShapedGregtechRecipe( + CI.component_Plate[1], cableTier1, CI.component_Plate[1], + "circuitPrimitive", "plateStaballoy", "circuitPrimitive", + CI.component_Plate[1], cableTier1, CI.component_Plate[1], + RECIPE_BufferCore_ULV); + RecipeUtils.addShapedGregtechRecipe( + CI.component_Plate[2], cableTier2, CI.component_Plate[2], + RECIPE_BufferCore_ULV, CI.machineHull_HV, RECIPE_BufferCore_ULV, + CI.component_Plate[2], cableTier2, CI.component_Plate[2], + RECIPE_BufferCore_LV); + RecipeUtils.addShapedGregtechRecipe( + CI.component_Plate[3], cableTier3, CI.component_Plate[3], + RECIPE_BufferCore_LV, CI.circuitTier2, RECIPE_BufferCore_LV, + CI.component_Plate[3], cableTier3, CI.component_Plate[3], + RECIPE_BufferCore_MV); + RecipeUtils.addShapedGregtechRecipe( + CI.component_Plate[4], cableTier4, CI.component_Plate[4], + RECIPE_BufferCore_MV, CI.circuitTier3, RECIPE_BufferCore_MV, + CI.component_Plate[4], cableTier4, CI.component_Plate[4], + RECIPE_BufferCore_HV); + RecipeUtils.addShapedGregtechRecipe( + CI.component_Plate[5], cableTier5, CI.component_Plate[5], + RECIPE_BufferCore_HV, CI.circuitTier4, RECIPE_BufferCore_HV, + CI.component_Plate[5], cableTier5, CI.component_Plate[5], + RECIPE_BufferCore_EV); + RecipeUtils.addShapedGregtechRecipe( + CI.component_Plate[6], cableTier6, CI.component_Plate[6], + RECIPE_BufferCore_EV, CI.circuitTier5, RECIPE_BufferCore_EV, + CI.component_Plate[6], cableTier6, CI.component_Plate[6], + RECIPE_BufferCore_IV); + RecipeUtils.addShapedGregtechRecipe( + CI.component_Plate[7], cableTier7, CI.component_Plate[7], + RECIPE_BufferCore_IV, CI.circuitTier6, RECIPE_BufferCore_IV, + CI.component_Plate[7], cableTier7, CI.component_Plate[7], + RECIPE_BufferCore_LuV); + RecipeUtils.addShapedGregtechRecipe( + CI.component_Plate[8], cableTier8, CI.component_Plate[8], + RECIPE_BufferCore_LuV, CI.circuitTier7, RECIPE_BufferCore_LuV, + CI.component_Plate[8], cableTier8, CI.component_Plate[8], + RECIPE_BufferCore_ZPM); + RecipeUtils.addShapedGregtechRecipe( + CI.component_Plate[9], cableTier9, CI.component_Plate[9], + RECIPE_BufferCore_ZPM, CI.circuitTier8, RECIPE_BufferCore_ZPM, + CI.component_Plate[9], cableTier9, CI.component_Plate[9], + RECIPE_BufferCore_UV); + RecipeUtils.addShapedGregtechRecipe( + CI.component_Plate[10], cableTier10, CI.component_Plate[10], + RECIPE_BufferCore_UV, CI.circuitTier9, RECIPE_BufferCore_UV, + CI.component_Plate[10], cableTier10, CI.component_Plate[10], + RECIPE_BufferCore_MAX);*/ + + + /*RecipeUtils.addShapedGregtechRecipe( + wireTier1, RECIPE_BufferCore_ULV, wireTier1, + wireTier1, CI.machineCasing_ULV, wireTier1, + CI.circuitPrimitive, CI.circuitTier1, CI.circuitPrimitive, + RECIPE_Buffer_ULV); + RecipeUtils.addShapedGregtechRecipe( + wireTier2, RECIPE_BufferCore_LV, wireTier2, + wireTier2, CI.machineCasing_LV, wireTier2, + CI.circuitTier1, RECIPE_BufferCore_LV, CI.circuitTier1, + RECIPE_Buffer_LV); + RecipeUtils.addShapedGregtechRecipe( + wireTier3, RECIPE_BufferCore_MV, wireTier3, + wireTier3, CI.machineCasing_MV, wireTier3, + CI.circuitTier2, RECIPE_BufferCore_MV, CI.circuitTier2, + RECIPE_Buffer_MV); + RecipeUtils.addShapedGregtechRecipe( + wireTier4, RECIPE_BufferCore_HV, wireTier4, + wireTier4, CI.machineCasing_HV, wireTier4, + CI.circuitTier3, RECIPE_BufferCore_HV, CI.circuitTier3, + RECIPE_Buffer_HV); + RecipeUtils.addShapedGregtechRecipe( + wireTier5, RECIPE_BufferCore_EV, wireTier5, + wireTier5, CI.machineCasing_EV, wireTier5, + CI.circuitTier4, RECIPE_BufferCore_EV, CI.circuitTier4, + RECIPE_Buffer_EV); + RecipeUtils.addShapedGregtechRecipe( + wireTier6, RECIPE_BufferCore_IV, wireTier6, + wireTier6, CI.machineCasing_IV, wireTier6, + CI.circuitTier5, RECIPE_BufferCore_IV, CI.circuitTier5, + RECIPE_Buffer_IV); + RecipeUtils.addShapedGregtechRecipe( + wireTier7, RECIPE_BufferCore_LuV, wireTier7, + wireTier7, CI.machineCasing_LuV, wireTier7, + CI.circuitTier6, RECIPE_BufferCore_LuV, CI.circuitTier6, + RECIPE_Buffer_LuV); + RecipeUtils.addShapedGregtechRecipe( + wireTier8, RECIPE_BufferCore_ZPM, wireTier8, + wireTier8, CI.machineCasing_ZPM, wireTier8, + CI.circuitTier7, RECIPE_BufferCore_ZPM, CI.circuitTier7, + RECIPE_Buffer_ZPM); + RecipeUtils.addShapedGregtechRecipe( + wireTier9, RECIPE_BufferCore_UV, wireTier9, + wireTier9, CI.machineCasing_UV, wireTier9, + CI.circuitTier8, RECIPE_BufferCore_UV, CI.circuitTier8, + RECIPE_Buffer_UV); + RecipeUtils.addShapedGregtechRecipe( + CI.component_Plate[11], RECIPE_BufferCore_MAX, CI.component_Plate[11], + wireTier10, CI.machineCasing_MAX, wireTier10, + CI.circuitTier9, RECIPE_BufferCore_MAX, CI.circuitTier9, + RECIPE_Buffer_MAX);*/ + } + + + ItemStack[] aBufferOutput = new ItemStack[] { + RECIPE_Buffer_ULV, RECIPE_Buffer_LV, RECIPE_Buffer_MV, + RECIPE_Buffer_HV, RECIPE_Buffer_EV, RECIPE_Buffer_IV, + RECIPE_Buffer_LuV, RECIPE_Buffer_ZPM, RECIPE_Buffer_UV, RECIPE_Buffer_MAX }; + + + + ItemStack[] aOutput = new ItemStack[] { + ItemUtils.getItemStack("miscutils:item.itemBufferCore"+"1", 1), + ItemUtils.getItemStack("miscutils:item.itemBufferCore"+"2", 1), + ItemUtils.getItemStack("miscutils:item.itemBufferCore"+"3", 1), + ItemUtils.getItemStack("miscutils:item.itemBufferCore"+"4", 1), + ItemUtils.getItemStack("miscutils:item.itemBufferCore"+"5", 1), + ItemUtils.getItemStack("miscutils:item.itemBufferCore"+"6", 1), + ItemUtils.getItemStack("miscutils:item.itemBufferCore"+"7", 1), + ItemUtils.getItemStack("miscutils:item.itemBufferCore"+"8", 1), + ItemUtils.getItemStack("miscutils:item.itemBufferCore"+"9", 1), + ItemUtils.getItemStack("miscutils:item.itemBufferCore"+"10", 1) + }; + + int aCostMultiplier = GTNH ? 4 : 1; + + for (int i = 0; i < 10; i++) { + + ItemStack aPrevTier = (i == 0 ? CI.getTieredMachineHull(GTNH ? 2 : 1) : aOutput[i-1]); + aPrevTier.stackSize = GTNH ? 2 : 1; + int aTier = (i + 1); + CORE.RA.addSixSlotAssemblingRecipe( + new ItemStack[] { + aPrevTier, + CI.getTieredComponent(OrePrefixes.plate, aTier, 4 * aCostMultiplier), + CI.getTieredComponent(OrePrefixes.cableGt04, i, 2 * aCostMultiplier), + CI.getTieredComponent(OrePrefixes.circuit, aTier, 2 * aCostMultiplier), + CI.getTieredComponent(OrePrefixes.screw, aTier, 6 * aCostMultiplier), + CI.getTieredComponent(OrePrefixes.bolt, i, 12 * (GTNH ? 2 : 1)), + }, + CI.getTieredFluid(i, (144 * 4 * aTier)), //Input Fluid + aOutput[i], + 45 * 10 * 1 * (aTier), + MaterialUtils.getVoltageForTier(i)); + + //Energy Buffer + CORE.RA.addSixSlotAssemblingRecipe( + new ItemStack[] { + ItemUtils.getSimpleStack(aOutput[i], 4), + CI.getTieredComponent(OrePrefixes.plate, aTier, 8 * aCostMultiplier), + CI.getTieredComponent(OrePrefixes.wireGt08, i, 4 * aCostMultiplier), + CI.getTieredComponent(OrePrefixes.circuit, i, 4 * aCostMultiplier), + CI.getTieredComponent(OrePrefixes.stickLong, aTier, 4 * aCostMultiplier), + CI.getTieredComponent(OrePrefixes.gearGt, i, 5 * (GTNH ? 2 : 1)), + }, + CI.getTieredFluid(aTier, (144 * 16 * aTier)), //Input Fluid + aBufferOutput[i], + 45 * 20 * 1 * (aTier), + MaterialUtils.getVoltageForTier(i)); + } } + + 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 dc156c6f91..13a30a510c 100644 --- a/src/Java/gtPlusPlus/core/recipe/common/CI.java +++ b/src/Java/gtPlusPlus/core/recipe/common/CI.java @@ -1,29 +1,31 @@ package gtPlusPlus.core.recipe.common; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; - import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.util.GT_ModHandler; - +import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.ALLOY; +import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.recipe.LOADER_Machine_Components; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.xmod.eio.material.MaterialEIO; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import ic2.core.Ic2Items; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; public class CI { //null - public static ItemStack _NULL = ItemUtils.getSimpleStack(ModItems.AAA_Broken); + public static ItemStack _NULL = ItemUtils.getErrorStack(1); //bits public static long bits = GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE @@ -520,5 +522,630 @@ public class CI { public static ItemStack emptyCells(int i) { return ItemUtils.getEmptyCell(i); } + + + + /* + * + */ + + private static final Material[] aMaterial_Main = new Material[] { + MaterialEIO.REDSTONE_ALLOY, + ALLOY.POTIN, + ALLOY.ZIRCONIUM_CARBIDE, + ALLOY.EGLIN_STEEL, + ALLOY.INCONEL_792, + ALLOY.TUNGSTEN_TITANIUM_CARBIDE, + ALLOY.NITINOL_60, + ALLOY.ZERON_100, + ALLOY.PIKYONIUM, + ELEMENT.STANDALONE.ADVANCED_NITINOL, + ALLOY.ABYSSAL, + ALLOY.QUANTUM + }; + + private static final Material[] aMaterial_Secondary = new Material[] { + ELEMENT.getInstance().LEAD, + ALLOY.TUMBAGA, + ALLOY.SILICON_CARBIDE, + ALLOY.TUNGSTEN_CARBIDE, + ALLOY.INCONEL_690, + ALLOY.STELLITE, + ALLOY.ARCANITE, + ALLOY.LAFIUM, + ALLOY.CINOBITE, + ALLOY.TITANSTEEL, + ALLOY.OCTIRON, + ELEMENT.STANDALONE.CELESTIAL_TUNGSTEN + }; + + private static final Material[] aMaterial_Tertiary = new Material[] { + ELEMENT.getInstance().IRON, + ALLOY.STEEL, + ELEMENT.getInstance().ALUMINIUM, + ALLOY.STAINLESSSTEEL, + ELEMENT.getInstance().TUNGSTEN, + ALLOY.HASTELLOY_N, + ALLOY.ENERGYCRYSTAL, + ALLOY.TRINIUM_NAQUADAH_CARBON, + ALLOY.TRINIUM_REINFORCED_STEEL, //Arceus + ALLOY.TITANSTEEL, + ELEMENT.STANDALONE.ASTRAL_TITANIUM, + ELEMENT.STANDALONE.CELESTIAL_TUNGSTEN + }; + + private static final Materials[] aMaterial_Cables = new Materials[] { + (CORE.ConfigSwitches.enableCustom_Cables && LoadedMods.EnderIO) ? Materials.RedstoneAlloy : CORE.GTNH ? Materials.Lead : Materials.Tin, + Materials.Cobalt, + Materials.AnnealedCopper, + Materials.Gold, + Materials.Titanium, + Materials.Nichrome, + Materials.Platinum, + Materials.YttriumBariumCuprate, + Materials.Naquadah, + Materials.Duranium, + Materials.Superconductor, + }; + + private static final Materials[] aMaterial_Circuits = new Materials[] { + Materials.Primitive, + Materials.Basic, + Materials.Good, + Materials.Advanced, + Materials.Data, + Materials.Data, + Materials.Elite, + Materials.Master, + Materials.Ultimate, + Materials.Superconductor, + Materials.Infinite, + }; + + private static final Material[][] aMaster = new Material[][] {aMaterial_Main, aMaterial_Secondary, aMaterial_Tertiary}; + + + 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[aType][aTier].getFluid(aAmount); + } + a.amount = aAmount; + return a; + } + + public static ItemStack getTieredComponent(OrePrefixes aPrefix, int aTier, int aAmount) { + aTier = Math.max(0, aTier); + + Material m = null; + + + + + + + if (aPrefix == OrePrefixes.liquid) { + int aMatID = (aTier == 0 || aTier == 2 || aTier == 5 || aTier == 8 ? 0 : (aTier == 1 || aTier == 3 || aTier == 6 || aTier == 9 ? 1 : 2)); + ItemStack aCell = aMaster[aMatID][aTier].getCell(aAmount); + return aCell; + } + + if (aPrefix == OrePrefixes.circuit) { + if (aTier == 4) { + return ItemUtils.getSimpleStack(CI.getDataStick(), aAmount); + } + else if (aTier == 5) { + return ItemUtils.getSimpleStack(CI.getDataOrb(), aAmount); + } + return ItemUtils.getOrePrefixStack(OrePrefixes.circuit, aMaterial_Circuits[aTier], aAmount); + } + + //Check for Cables first, catch SuperConductor case and swap to wire. + if (aPrefix == OrePrefixes.cableGt01 || aPrefix == OrePrefixes.cableGt02 || aPrefix == OrePrefixes.cableGt04 || aPrefix == OrePrefixes.cableGt08 || aPrefix == OrePrefixes.cableGt12) { + //Special Handler + if (aTier == 10) { + if (aPrefix == OrePrefixes.cableGt01) { + aPrefix = OrePrefixes.wireGt02; + } + else if (aPrefix == OrePrefixes.cableGt02) { + aPrefix = OrePrefixes.wireGt04; + } + else if (aPrefix == OrePrefixes.cableGt04) { + aPrefix = OrePrefixes.wireGt08; + } + else if (aPrefix == OrePrefixes.cableGt08) { + aPrefix = OrePrefixes.wireGt12; + } + else if (aPrefix == OrePrefixes.cableGt12) { + aPrefix = OrePrefixes.wireGt16; + } + } + else { + return ItemUtils.getOrePrefixStack(aPrefix, aMaterial_Cables[aTier], aAmount); + } + + + } + if (aPrefix == OrePrefixes.wireGt01 || aPrefix == OrePrefixes.wireGt02 || aPrefix == OrePrefixes.wireGt04 || aPrefix == OrePrefixes.wireGt08 || aPrefix == OrePrefixes.wireGt12 || aPrefix == OrePrefixes.wireGt16) { + return ItemUtils.getOrePrefixStack(aPrefix, aMaterial_Cables[aTier], aAmount); + } + + if (aPrefix == OrePrefixes.pipeTiny || aPrefix == OrePrefixes.pipeSmall || aPrefix == OrePrefixes.pipe || aPrefix == OrePrefixes.pipeMedium || aPrefix == OrePrefixes.pipeLarge || aPrefix == OrePrefixes.pipeHuge) { + if (aTier == 0) { + return ItemUtils.getOrePrefixStack(aPrefix, Materials.Lead, aAmount); + } + else if (aTier == 1) { + return ItemUtils.getOrePrefixStack(aPrefix, Materials.Steel, aAmount); + } + else if (aTier == 2) { + return ItemUtils.getOrePrefixStack(aPrefix, Materials.StainlessSteel, aAmount); + } + else if (aTier == 3) { + return ItemUtils.getOrePrefixStack(aPrefix, Materials.Tungsten, aAmount); + } + else if (aTier == 4) { + return ItemUtils.getOrePrefixStack(aPrefix, Materials.TungstenSteel, aAmount); + } + else if (aTier == 5) { + return ItemUtils.getOrePrefixStack(aPrefix, ALLOY.MARAGING350, aAmount); + } + else if (aTier == 6) { + return ItemUtils.getOrePrefixStack(aPrefix, ALLOY.STABALLOY, aAmount); + } + else if (aTier == 7) { + return ItemUtils.getOrePrefixStack(aPrefix, ALLOY.HASTELLOY_X, aAmount); + } + else if (aTier == 8) { + return ItemUtils.getOrePrefixStack(aPrefix, Materials.Ultimate, aAmount); + } + else if (aTier == 9) { + return ItemUtils.getOrePrefixStack(OrePrefixes.pipeMedium, Materials.Superconductor, aAmount); + } + else if (aTier == 10) { + return ItemUtils.getOrePrefixStack(aPrefix, Materials.Europium, aAmount); + } + else { + return ItemUtils.getOrePrefixStack(aPrefix, Materials.Titanium, aAmount); + } + } + + ItemStack aTempStack = null; + + if (aPrefix == OrePrefixes.gear || aPrefix == OrePrefixes.gearGt) { + m = aMaster[0][aTier]; + } + else if (aPrefix == OrePrefixes.rod || aPrefix == OrePrefixes.stick) { + m = aMaster[0][aTier]; + } + else if (aPrefix == OrePrefixes.stickLong) { + m = aMaster[1][aTier]; + } + else if (aPrefix == OrePrefixes.bolt) { + m = aMaster[2][aTier]; + } + else if (aPrefix == OrePrefixes.screw) { + m = aMaster[0][aTier]; + } + else if (aPrefix == OrePrefixes.rotor) { + m = aMaster[1][aTier]; + } + else if (aPrefix == OrePrefixes.frame || aPrefix == OrePrefixes.frameGt) { + m = aMaster[2][aTier]; + } + else if (aPrefix == OrePrefixes.ingot) { + m = aMaster[1][aTier]; + } + else if (aPrefix == OrePrefixes.plate) { + m = aMaster[0][aTier]; + } + else if (aPrefix == OrePrefixes.plateDouble) { + m = aMaster[0][aTier]; + } + else if (aPrefix == OrePrefixes.ring) { + m = aMaster[2][aTier]; + } + else if (aPrefix == OrePrefixes.cell) { + m = aMaster[1][aTier]; + } + else { + m = aMaterial_Main[aTier]; + } + + ItemStack aReturn = ItemUtils.getOrePrefixStack(aPrefix, m, aAmount); + + //If Invalid, Try First Material + if (!ItemUtils.checkForInvalidItems(aReturn)) { + m = aMaster[0][aTier]; + aReturn = ItemUtils.getOrePrefixStack(aPrefix, m, aAmount); + + //If Invalid, Try Second Material + if (!ItemUtils.checkForInvalidItems(aReturn)) { + m = aMaster[1][aTier]; + aReturn = ItemUtils.getOrePrefixStack(aPrefix, m, aAmount); + + //If Invalid, Try Third Material + if (!ItemUtils.checkForInvalidItems(aReturn)) { + m = aMaster[2][aTier]; + aReturn = ItemUtils.getOrePrefixStack(aPrefix, m, aAmount); + + //All Invalid? Ok, shit. + //Let's add a special error ingot. + if (!ItemUtils.checkForInvalidItems(aReturn)) { + aReturn = ItemUtils.getErrorStack(1, (aPrefix.toString()+m.getLocalizedName()+" x"+aAmount)); + } + } + } + } + + return aReturn; + + + } + + 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/Utils.java b/src/Java/gtPlusPlus/core/util/Utils.java index e2220f74f8..968de2f55a 100644 --- a/src/Java/gtPlusPlus/core/util/Utils.java +++ b/src/Java/gtPlusPlus/core/util/Utils.java @@ -485,7 +485,10 @@ public class Utils { return true; } - public static File getMcDir() { + public static File getMcDir() { + if (Minecraft.getMinecraft() == null) { + return new File("testdir"); + } if ((MinecraftServer.getServer() != null) && MinecraftServer.getServer().isDedicatedServer()) { return new File("."); } diff --git a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java index 425606dd8e..486cda42f9 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java @@ -1,26 +1,18 @@ package gtPlusPlus.core.util.minecraft; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier; - -import net.minecraft.block.Block; -import net.minecraft.init.Items; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.Item; -import net.minecraft.item.Item.ToolMaterial; -import net.minecraft.item.ItemStack; -import net.minecraft.util.StatCollector; - import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; -import gtPlusPlus.GTplusplus; -import gtPlusPlus.api.objects.GregtechException; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.Pair; import gtPlusPlus.api.objects.minecraft.BlockPos; @@ -38,6 +30,14 @@ import gtPlusPlus.core.material.Material; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_DustGeneration; +import net.minecraft.block.Block; +import net.minecraft.init.Items; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.Item; +import net.minecraft.item.Item.ToolMaterial; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; @@ -50,9 +50,18 @@ public class ItemUtils { public static ItemStack getSimpleStack(final Block x) { return simpleMetaStack(Item.getItemFromBlock(x), 0, 1); } + - public static ItemStack getSimpleStack(final Block x, int meta) { - return simpleMetaStack(Item.getItemFromBlock(x), meta, 1); + public static ItemStack getSimpleStack(final Block x, int i) { + if (i == 0) { + return getSimpleStack(x, i, 1); + } + + return getSimpleStack(x, 0, i); + } + + public static ItemStack getSimpleStack(final Block x, int meta, int i) { + return simpleMetaStack(Item.getItemFromBlock(x), meta, i); } public static ItemStack getSimpleStack(final Item x, final int i) { @@ -315,7 +324,7 @@ public class ItemUtils { return returnValue; } Logger.INFO("Failed to find `" + oredictName + "` in OD."); - return getErrorStack(amount); + return getErrorStack(amount, oredictName+" x"+amount); //return getItemStackOfAmountFromOreDictNoBroken(mTemp, amount); } @@ -366,8 +375,7 @@ public class ItemUtils { public static ItemStack getGregtechDust(final Materials material, final int amount) { final ItemStack returnValue = GT_OreDictUnificator.get(OrePrefixes.dust, material, 1L); if (returnValue != null) { - if ((returnValue.getItem().getClass() != ModItems.AAA_Broken.getClass()) - || (returnValue.getItem() != ModItems.AAA_Broken)) { + if (ItemUtils.checkForInvalidItems(returnValue)) { return returnValue.copy(); } } @@ -600,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; @@ -762,23 +785,23 @@ public class ItemUtils { if (aGtStack == null) { Logger.INFO( "Failed to find `" + mPrefix + MaterialUtils.getMaterialName(mMat) + "` in OD. [Prefix Search]"); - return getErrorStack(mAmount); + return getErrorStack(mAmount, (mPrefix.toString()+MaterialUtils.getMaterialName(mMat)+" x"+mAmount)); } else { return aGtStack; } } - public static ItemStack getErrorStack(int mAmount) { - //System.exit(1); - try { - //new GregtechException("Logging - [Issue #999]"); - } - catch (Throwable t) { - t.printStackTrace(); - } + public static ItemStack getErrorStack(int mAmount) { + return getErrorStack(mAmount, null); + } - return getSimpleStack(ModItems.AAA_Broken, mAmount); - //return null; + public static ItemStack getErrorStack(int mAmount, String aName) { + ItemStack g = getSimpleStack(ModItems.AAA_Broken, 1); + NBTUtils.setString(g, "Lore", EnumChatFormatting.RED+aName); + if (aName != null) { + NBTUtils.setBookTitle(g, EnumChatFormatting.YELLOW+"Maybe Alkalus should know about this"); + } + return g; } public static ItemStack[] getStackOfAllOreDictGroup(String oredictname) { diff --git a/src/Java/gtPlusPlus/core/util/minecraft/gregtech/PollutionUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/gregtech/PollutionUtils.java index d4f217bbfd..dde785cee6 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/gregtech/PollutionUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/gregtech/PollutionUtils.java @@ -10,18 +10,22 @@ import gregtech.api.interfaces.tileentity.IHasWorldObjectAndCoords; import gregtech.common.GT_Proxy; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.reflect.ReflectionUtils; -import net.minecraft.tileentity.TileEntity; import net.minecraft.world.chunk.Chunk; public class PollutionUtils { private static boolean mIsPollutionEnabled = true; + private static Method mAddPollution; + private static Method mAddPollution2; + + private static Method mGetPollution; + private static Method mGetPollution2; + static { if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK || CORE.GTNH) { mIsPollutionEnabled = mPollution(); - } - else { + } else { mIsPollutionEnabled = false; } } @@ -42,65 +46,123 @@ public class PollutionUtils { public static boolean addPollution(IGregTechTileEntity te, int pollutionValue) { if (mIsPollutionEnabled) - try { - Class<?> GT_Pollution = Class.forName("gregtech.common.GT_Pollution"); - if (GT_Pollution != null) { - Method addPollution = GT_Pollution.getMethod("addPollution", IGregTechTileEntity.class, int.class); - if (addPollution != null) { - addPollution.invoke(null, te, pollutionValue); - return true; + try { + if (te == null) { + return false; } + if (mAddPollution != null) { + mAddPollution.invoke(null, te, pollutionValue); + } + Class<?> GT_Pollution = Class.forName("gregtech.common.GT_Pollution"); + if (GT_Pollution != null) { + Method addPollution = GT_Pollution.getMethod("addPollution", IGregTechTileEntity.class, int.class); + if (addPollution != null) { + mAddPollution = addPollution; + addPollution.invoke(null, te, pollutionValue); + return true; + } + } + } catch (ClassNotFoundException | SecurityException | NoSuchMethodException | IllegalAccessException + | IllegalArgumentException | InvocationTargetException e) { } - } catch (ClassNotFoundException | SecurityException | NoSuchMethodException | IllegalAccessException - | IllegalArgumentException | InvocationTargetException e) { - } return false; } - public static int getPollution(IGregTechTileEntity te) { + public static boolean addPollution(IHasWorldObjectAndCoords aTileOfSomeSort, int pollutionValue) { if (mIsPollutionEnabled) - try { - Class<?> GT_Pollution = Class.forName("gregtech.common.GT_Pollution"); - if (GT_Pollution != null) { - Method addPollution = GT_Pollution.getMethod("getPollution", IGregTechTileEntity.class); - if (addPollution != null) { - return (int) addPollution.invoke(null, te); + try { + if (aTileOfSomeSort == null) { + return false; } + IHasWorldObjectAndCoords j = (IHasWorldObjectAndCoords) aTileOfSomeSort; + Chunk c = j.getWorld().getChunkFromBlockCoords(j.getXCoord(), j.getZCoord()); + return addPollution(c, pollutionValue); + } catch (SecurityException | IllegalArgumentException e) { } - } catch (ClassNotFoundException | SecurityException | NoSuchMethodException | IllegalAccessException - | IllegalArgumentException | InvocationTargetException e) { - } - return 0; + return false; } - public static boolean addPollution(Object aTileOfSomeSort, int pollutionValue) { + public static boolean addPollution(Chunk aChunk, int pollutionValue) { if (mIsPollutionEnabled) - try { - Class<?> GT_Pollution = Class.forName("gregtech.common.GT_Pollution"); - if (GT_Pollution != null) { - Method addPollution = GT_Pollution.getMethod("addPollution", Chunk.class, int.class); - if (addPollution != null) { - IHasWorldObjectAndCoords j = (IHasWorldObjectAndCoords) aTileOfSomeSort; - if (j != null) { - Chunk c = j.getWorld().getChunkFromBlockCoords(j.getXCoord(), j.getZCoord()); - addPollution.invoke(null, c, pollutionValue); + try { + if (aChunk == null) { + return false; + } + if (mAddPollution2 != null) { + mAddPollution2.invoke(null, aChunk, pollutionValue); + return true; + } + Class<?> GT_Pollution = Class.forName("gregtech.common.GT_Pollution"); + if (GT_Pollution != null) { + Method addPollution = GT_Pollution.getMethod("addPollution", Chunk.class, int.class); + if (addPollution != null) { + mAddPollution2 = addPollution; + mAddPollution2.invoke(null, aChunk, pollutionValue); return true; - } else { - TileEntity t = (TileEntity) aTileOfSomeSort; - if (t != null) { - Chunk c = t.getWorldObj().getChunkFromBlockCoords(t.xCoord, t.zCoord); - addPollution.invoke(null, c, pollutionValue); - return true; - } } - } + } catch (ClassNotFoundException | SecurityException | NoSuchMethodException | IllegalAccessException + | IllegalArgumentException | InvocationTargetException e) { } - } catch (ClassNotFoundException | SecurityException | NoSuchMethodException | IllegalAccessException - | IllegalArgumentException | InvocationTargetException e) { - } return false; + } + + public static boolean removePollution(IGregTechTileEntity te, int pollutionValue) { + return addPollution(te, -pollutionValue); + } + + public static boolean removePollution(IHasWorldObjectAndCoords aTileOfSomeSort, int pollutionValue) { + return addPollution(aTileOfSomeSort, -pollutionValue); + } + + public static boolean removePollution(Chunk aChunk, int pollutionValue) { + return addPollution(aChunk, -pollutionValue); + } + + public static int getPollution(IGregTechTileEntity te) { + if (mIsPollutionEnabled) + try { + if (te == null) { + return 0; + } + if (mGetPollution != null) { + mGetPollution.invoke(null, te); + } + Class<?> GT_Pollution = Class.forName("gregtech.common.GT_Pollution"); + if (GT_Pollution != null) { + Method addPollution = GT_Pollution.getMethod("getPollution", IGregTechTileEntity.class); + if (addPollution != null) { + mGetPollution = addPollution; + return (int) addPollution.invoke(null, te); + } + } + } catch (ClassNotFoundException | SecurityException | NoSuchMethodException | IllegalAccessException + | IllegalArgumentException | InvocationTargetException e) { + } + return 0; + } + public static int getPollution(Chunk te) { + if (mIsPollutionEnabled) + try { + if (te == null) { + return 0; + } + if (mGetPollution2 != null) { + mGetPollution2.invoke(null, te); + } + Class<?> GT_Pollution = Class.forName("gregtech.common.GT_Pollution"); + if (GT_Pollution != null) { + Method addPollution = GT_Pollution.getMethod("getPollution", Chunk.class); + if (addPollution != null) { + mGetPollution2 = addPollution; + return (int) addPollution.invoke(null, te); + } + } + } catch (ClassNotFoundException | SecurityException | NoSuchMethodException | IllegalAccessException + | IllegalArgumentException | InvocationTargetException e) { + } + return 0; } } 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 |