diff options
| author | Draknyte1 <Draknyte1@hotmail.com> | 2017-01-20 02:07:40 +1000 |
|---|---|---|
| committer | Draknyte1 <Draknyte1@hotmail.com> | 2017-01-20 02:07:40 +1000 |
| commit | a6bb1b33da251f4a2ec7a6d6facb4864e9905341 (patch) | |
| tree | 84d47440794cadd5c64598355903b123e18e0662 /src/Java | |
| parent | 142fe00070526484862f15f3a125400a22a2fe96 (diff) | |
| download | GT5-Unofficial-a6bb1b33da251f4a2ec7a6d6facb4864e9905341.tar.gz GT5-Unofficial-a6bb1b33da251f4a2ec7a6d6facb4864e9905341.tar.bz2 GT5-Unofficial-a6bb1b33da251f4a2ec7a6d6facb4864e9905341.zip | |
+ Added a power cost of 32eu/action for the Tree Farmer. (Will eventually get a config option).
% Moved the internal power buffer variable out of the cut method into the class.
% Massive project tidy up, lots of old unused code removed or tidied up.
$ Fixed lots of String comparisons that used == instead of .equals().
$ Fixed Double/Triple/Quad null checks in certain places.
$ Fixed returns that set values at the same time.
$ Swapped 3.14 and 1.57 to Math.PI and Math.PI/2.
$ Fixed possible cases where a NPE may be thrown, by calling logging outside of null checks.
+ Added PI to CORE.java, since it's a double and MC uses it as a float in each instance.
- Stripped 95% of the useless code out of Meta_GT_Proxy.java
Diffstat (limited to 'src/Java')
51 files changed, 243 insertions, 2551 deletions
diff --git a/src/Java/gregtech/api/util/Recipe_GT.java b/src/Java/gregtech/api/util/Recipe_GT.java index f0b80f084a..af421610b1 100644 --- a/src/Java/gregtech/api/util/Recipe_GT.java +++ b/src/Java/gregtech/api/util/Recipe_GT.java @@ -25,45 +25,7 @@ import net.minecraftforge.fluids.FluidStack; */ public class Recipe_GT extends GT_Recipe{ - public static volatile int VERSION = 508; - /** - * If you want to change the Output, feel free to modify or even replace the whole ItemStack Array, for Inputs, please add a new Recipe, because of the HashMaps. - */ - public ItemStack[] mInputs, mOutputs; - /** - * If you want to change the Output, feel free to modify or even replace the whole ItemStack Array, for Inputs, please add a new Recipe, because of the HashMaps. - */ - public FluidStack[] mFluidInputs, mFluidOutputs; - /** - * If you changed the amount of Array-Items inside the Output Array then the length of this Array must be larger or equal to the Output Array. A chance of 10000 equals 100% - */ - public int[] mChances; - /** - * An Item that needs to be inside the Special Slot, like for example the Copy Slot inside the Printer. This is only useful for Fake Recipes in NEI, since findRecipe() and containsInput() don't give a shit about this Field. Lists are also possible. - */ - public Object mSpecialItems; - public int mDuration, mEUt, mSpecialValue; - /** - * Use this to just disable a specific Recipe, but the Configuration enables that already for every single Recipe. - */ - public boolean mEnabled = true; - /** - * If this Recipe is hidden from NEI - */ - public boolean mHidden = false; - /** - * If this Recipe is Fake and therefore doesn't get found by the findRecipe Function (It is still in the HashMaps, so that containsInput does return T on those fake Inputs) - */ - public boolean mFakeRecipe = false; - /** - * If this Recipe can be stored inside a Machine in order to make Recipe searching more Efficient by trying the previously used Recipe first. In case you have a Recipe Map overriding things and returning one time use Recipes, you have to set this to F. - */ - public boolean mCanBeBuffered = true; - /** - * If this Recipe needs the Output Slots to be completely empty. Needed in case you have randomised Outputs - */ - public boolean mNeedsEmptyOutput = false; - + public static volatile int VERSION = 508; protected Recipe_GT(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, int[] aChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { super(aOptimize, aInputs, aOutputs, aSpecialItems, aChances, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue); @@ -181,11 +143,6 @@ public class Recipe_GT extends GT_Recipe{ } @Override - public GT_Recipe copy() { - return this.copy(); - } - - @Override public boolean isRecipeInputEqual(boolean aDecreaseStacksizeBySuccess, FluidStack[] aFluidInputs, ItemStack... aInputs) { return isRecipeInputEqual(aDecreaseStacksizeBySuccess, false, aFluidInputs, aInputs); } diff --git a/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java b/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java index 9e71370197..d694557f55 100644 --- a/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java +++ b/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java @@ -45,15 +45,15 @@ public class BlockBaseModular extends BasicBlock{ //Utils.LOG_INFO("=========================================="); } - if (thisBlockType == BlockTypes.STANDARD.name().toUpperCase()){ + if (thisBlockType.equals(BlockTypes.STANDARD.name().toUpperCase())){ LanguageRegistry.addName(this, "Block of "+blockMaterial); //Utils.LOG_INFO("Registered Block in Language Registry as: "+"Block of "+blockMaterial); } - else if (thisBlockType == BlockTypes.FRAME.name().toUpperCase()){ + else if (thisBlockType.equals(BlockTypes.FRAME.name().toUpperCase())){ LanguageRegistry.addName(this, blockMaterial+ " Frame Box"); //Utils.LOG_INFO("Registered Block in Language Registry as: "+blockMaterial+ " Frame Box"); } - else if (thisBlockType == BlockTypes.ORE.name().toUpperCase()){ + else if (thisBlockType.equals(BlockTypes.ORE.name().toUpperCase())){ LanguageRegistry.addName(this, blockMaterial+ " Ore"); //Utils.LOG_INFO("Registered Block in Language Registry as: "+blockMaterial+ " Frame Box"); } @@ -63,15 +63,15 @@ public class BlockBaseModular extends BasicBlock{ } //setOreDict(unlocalizedName, blockType); - if (thisBlockType == BlockTypes.STANDARD.name().toUpperCase()){ + if (thisBlockType.equals(BlockTypes.STANDARD.name().toUpperCase())){ GameRegistry.registerBlock(this, ItemBlockGtBlock.class, Utils.sanitizeString(blockType.getTexture()+unlocalizedName)); //Utils.LOG_INFO("Registered Block in Block Registry as: "+"Block of "+blockMaterial); } - else if (thisBlockType == BlockTypes.FRAME.name().toUpperCase()){ + else if (thisBlockType.equals(BlockTypes.FRAME.name().toUpperCase())){ GameRegistry.registerBlock(this, ItemBlockGtFrameBox.class, Utils.sanitizeString(blockType.getTexture()+unlocalizedName)); //Utils.LOG_INFO("Registered Block in Block Registry as: "+blockMaterial+" Frame Box"); } - else if (thisBlockType == BlockTypes.ORE.name().toUpperCase()){ + else if (thisBlockType.equals(BlockTypes.ORE.name().toUpperCase())){ GameRegistry.registerBlock(this, ItemBlockGtBlock.class, Utils.sanitizeString(blockType.getTexture()+unlocalizedName)); //Utils.LOG_INFO("Registered Block in Block Registry as: "+blockMaterial+" Frame Box"); } diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_Charger.java b/src/Java/gtPlusPlus/core/block/machine/Machine_Charger.java deleted file mode 100644 index 4f426b99c9..0000000000 --- a/src/Java/gtPlusPlus/core/block/machine/Machine_Charger.java +++ /dev/null @@ -1,83 +0,0 @@ -package gtPlusPlus.core.block.machine; - -import gtPlusPlus.GTplusplus; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.tileentities.machines.TileEntityCharger; - -import java.util.ArrayList; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import scala.util.Random; - -public class Machine_Charger extends BlockContainer -{ - private static final String name = "Charging Machine"; - - private final Random rand = new Random(); - - public Machine_Charger(String unlocalizedName) - { - super(Material.iron); - //GameRegistry.registerBlock(this, unlocalizedName); - this.setBlockName(unlocalizedName); - this.setBlockTextureName(CORE.MODID + ":" + unlocalizedName); - this.setCreativeTab(AddToCreativeTab.tabMachines); - } - - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float lx, float ly, float lz) - { - if (world.isRemote) return true; - - TileEntity te = world.getTileEntity(x, y, z); - if (te != null && te instanceof TileEntityCharger) - { - player.openGui(GTplusplus.instance, 1, world, x, y, z); - return true; - } - return false; - } - - @Override - public void breakBlock(World world, int x, int y, int z, Block block, int par6) - { - if (world.isRemote) return; - - ArrayList drops = new ArrayList(); - - TileEntity teRaw = world.getTileEntity(x, y, z); - - if (teRaw != null && teRaw instanceof TileEntityCharger) - { - TileEntityCharger te = (TileEntityCharger) teRaw; - - for (int i = 0; i < te.getSizeInventory(); i++) - { - ItemStack stack = te.getStackInSlot(i); - - if (stack != null) drops.add(stack.copy()); - } - } - - for (int i = 0;i < drops.size();i++) - { - EntityItem item = new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, (ItemStack) drops.get(i)); - item.setVelocity((rand.nextDouble() - 0.5) * 0.25, rand.nextDouble() * 0.5 * 0.25, (rand.nextDouble() - 0.5) * 0.25); - world.spawnEntityInWorld(item); - } - } - - @Override - public TileEntity createNewTileEntity(World world, int par2) - { - return new TileEntityCharger(); - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_NHG.java b/src/Java/gtPlusPlus/core/block/machine/Machine_NHG.java deleted file mode 100644 index 011e293000..0000000000 --- a/src/Java/gtPlusPlus/core/block/machine/Machine_NHG.java +++ /dev/null @@ -1,83 +0,0 @@ -package gtPlusPlus.core.block.machine; - -import gtPlusPlus.GTplusplus; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.tileentities.machines.TileEntityNHG; - -import java.util.ArrayList; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import scala.util.Random; - -public class Machine_NHG extends BlockContainer -{ - private static final String name = "Nuclear Fueled Helium Generator"; - - private final Random rand = new Random(); - - public Machine_NHG(String unlocalizedName) - { - super(Material.iron); - //GameRegistry.registerBlock(this, unlocalizedName); - this.setBlockName(unlocalizedName); - this.setBlockTextureName(CORE.MODID + ":" + unlocalizedName); - this.setCreativeTab(AddToCreativeTab.tabMachines); - } - - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float lx, float ly, float lz) - { - if (world.isRemote) return true; - - TileEntity te = world.getTileEntity(x, y, z); - if (te != null && te instanceof TileEntityNHG) - { - player.openGui(GTplusplus.instance, 0, world, x, y, z); - return true; - } - return false; - } - - @Override - public void breakBlock(World world, int x, int y, int z, Block block, int par6) - { - if (world.isRemote) return; - - ArrayList drops = new ArrayList(); - - TileEntity teRaw = world.getTileEntity(x, y, z); - - if (teRaw != null && teRaw instanceof TileEntityNHG) - { - TileEntityNHG te = (TileEntityNHG) teRaw; - - for (int i = 0; i < te.getSizeInventory(); i++) - { - ItemStack stack = te.getStackInSlot(i); - - if (stack != null) drops.add(stack.copy()); - } - } - - for (int i = 0;i < drops.size();i++) - { - EntityItem item = new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, (ItemStack) drops.get(i)); - item.setVelocity((rand.nextDouble() - 0.5) * 0.25, rand.nextDouble() * 0.5 * 0.25, (rand.nextDouble() - 0.5) * 0.25); - world.spawnEntityInWorld(item); - } - } - - @Override - public TileEntity createNewTileEntity(World world, int par2) - { - return new TileEntityNHG(); - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/machine/heliumgen/tileentity/TileEntityHeliumGenerator.java b/src/Java/gtPlusPlus/core/block/machine/heliumgen/tileentity/TileEntityHeliumGenerator.java index 343f37527e..ffc4745059 100644 --- a/src/Java/gtPlusPlus/core/block/machine/heliumgen/tileentity/TileEntityHeliumGenerator.java +++ b/src/Java/gtPlusPlus/core/block/machine/heliumgen/tileentity/TileEntityHeliumGenerator.java @@ -249,7 +249,6 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II private boolean redstone = false; private boolean fluidcoolreactor = false; private boolean active = true; - public boolean prevActive = false; public short getReactorSize() @@ -273,6 +272,7 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II return cols; } + @Override protected void updateEntityServer() { Utils.LOG_WARNING("updateEntityServer"); diff --git a/src/Java/gtPlusPlus/core/common/CommonProxy.java b/src/Java/gtPlusPlus/core/common/CommonProxy.java index f16beb625f..d5a126ff39 100644 --- a/src/Java/gtPlusPlus/core/common/CommonProxy.java +++ b/src/Java/gtPlusPlus/core/common/CommonProxy.java @@ -15,18 +15,15 @@ import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.debug.DEBUG_INIT; import gtPlusPlus.core.util.player.PlayerCache; import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; - -import java.util.Iterator; - import net.minecraft.entity.Entity; -import net.minecraft.item.ItemStack; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.oredict.OreDictionary; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.event.*; public class CommonProxy { + public static Meta_GT_Proxy GtProxy; + public CommonProxy(){ //Should Register Gregtech Materials I've Made MinecraftForge.EVENT_BUS.register(this); @@ -38,19 +35,11 @@ public class CommonProxy { else { Utils.LOG_INFO("We're using Gregtech 5.08 or an equivalent fork."); } - handleGtIntegrationInit(); + Utils.LOG_INFO("Setting up our own GT_Proxy."); + GtProxy = new Meta_GT_Proxy(); } - } - private static void handleGtIntegrationInit(){ - Utils.LOG_INFO("Setting up our own GT_Proxy."); - Meta_GT_Proxy GtProxy = new Meta_GT_Proxy(); - for (String tOreName : OreDictionary.getOreNames()) { - ItemStack tOreStack; - Utils.LOG_INFO("Iterating list of GT materials for custom tool parts."); - for (Iterator i$ = OreDictionary.getOres(tOreName).iterator(); i$.hasNext(); GtProxy.registerOre(new OreDictionary.OreRegisterEvent(tOreName, tOreStack))) { - Utils.LOG_INFO("Iterating Material"); - tOreStack = (ItemStack) i$.next(); - } + else { + GtProxy = null; } } @@ -122,12 +111,11 @@ public class CommonProxy { } - @SuppressWarnings("static-method") public int addArmor(String armor) { return 0; } - - public void generateMysteriousParticles(Entity theEntity) { } + public void generateMysteriousParticles(Entity entity) { + } } diff --git a/src/Java/gtPlusPlus/core/container/Container_Charger.java b/src/Java/gtPlusPlus/core/container/Container_Charger.java deleted file mode 100644 index 4b6c43ada6..0000000000 --- a/src/Java/gtPlusPlus/core/container/Container_Charger.java +++ /dev/null @@ -1,81 +0,0 @@ -package gtPlusPlus.core.container; - -import gtPlusPlus.core.tileentities.machines.TileEntityCharger; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public class Container_Charger extends Container -{ - private TileEntityCharger te; - - public static final int INPUT_1 = 0; - - private int slotID = 0; - - public Container_Charger(TileEntityCharger te, EntityPlayer player) - { - this.te = te; - - //Fuel Slot A - addSlotToContainer(new Slot(te, slotID++, 80, 53)); - - - - //Inventory - for (int i = 0; i < 3; i++) - { - for (int j = 0; j < 9; j++) - { - addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); - } - } - // Hotbar - for (int i = 0; i < 9; i++) - { - addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142)); - } - } - - @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slotRaw) - { - ItemStack stack = null; - Slot slot = (Slot)inventorySlots.get(slotRaw); - - if (slot != null && slot.getHasStack()) - { - ItemStack stackInSlot = slot.getStack(); - stack = stackInSlot.copy(); - - if (slotRaw < 3 * 9) - { - if (!mergeItemStack(stackInSlot, 3 * 9, inventorySlots.size(), true)) - { - return null; - } - } - else if (!mergeItemStack(stackInSlot, 0, 3 * 9, false)) - { - return null; - } - - if (stackInSlot.stackSize == 0) - { - slot.putStack((ItemStack)null); - } - else - { - slot.onSlotChanged(); - } - } - return stack; - } - - @Override - public boolean canInteractWith(EntityPlayer player) - { - return te.isUseableByPlayer(player); - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/container/Container_NHG.java b/src/Java/gtPlusPlus/core/container/Container_NHG.java deleted file mode 100644 index 5fd19489c0..0000000000 --- a/src/Java/gtPlusPlus/core/container/Container_NHG.java +++ /dev/null @@ -1,102 +0,0 @@ -package gtPlusPlus.core.container; - -import gtPlusPlus.core.tileentities.machines.TileEntityNHG; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.*; -import net.minecraft.item.ItemStack; - -public class Container_NHG extends Container -{ - private TileEntityNHG te; - - public static final int INPUT_1 = 0, INPUT_2 = 1, INPUT_3 = 2, - INPUT_4 = 3, INPUT_5 = 4, INPUT_6 = 5, - INPUT_7 = 6, INPUT_8 = 7, INPUT_9 = 8, - INPUT_10 = 9, INPUT_11 = 10, INPUT_12 = 11, - INPUT_13 = 12, INPUT_14 = 13, INPUT_15 = 14, - INPUT_16 = 15, INPUT_17 = 16, INPUT_18 = 17, - OUTPUT = 18; - - private int slotID = 0; - - public Container_NHG(TileEntityNHG te, EntityPlayer player) - { - this.te = te; - - - //Fuel Rods A - for (int i = 0; i < 3; i++) - { - for (int j = 0; j < 3; j++) - { - addSlotToContainer(new Slot(te, slotID++, 8 + j * 18, 17 + i * 18)); - } - } - //Fuel Rods B - for (int i = 0; i < 3; i++) - { - for (int j = 0; j < 3; j++) - { - addSlotToContainer(new Slot(te, slotID++, 116 + j * 18, 17 + i * 18)); - } - } - - //Output - addSlotToContainer(new SlotFurnace(player, te, OUTPUT, 80, 53)); - - //Inventory - for (int i = 0; i < 3; i++) - { - for (int j = 0; j < 9; j++) - { - addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); - } - } - // Hotbar - for (int i = 0; i < 9; i++) - { - addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142)); - } - } - - @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slotRaw) - { - ItemStack stack = null; - Slot slot = (Slot)inventorySlots.get(slotRaw); - - if (slot != null && slot.getHasStack()) - { - ItemStack stackInSlot = slot.getStack(); - stack = stackInSlot.copy(); - - if (slotRaw < 3 * 9) - { - if (!mergeItemStack(stackInSlot, 3 * 9, inventorySlots.size(), true)) - { |
