diff options
Diffstat (limited to 'src')
27 files changed, 1429 insertions, 228 deletions
diff --git a/src/Java/gtPlusPlus/GTplusplus.java b/src/Java/gtPlusPlus/GTplusplus.java index 91efec62fb..bd79aeb764 100644 --- a/src/Java/gtPlusPlus/GTplusplus.java +++ b/src/Java/gtPlusPlus/GTplusplus.java @@ -20,6 +20,7 @@ import cpw.mods.fml.relauncher.IFMLLoadingPlugin.MCVersion; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.GT_Values; +import gregtech.api.enums.Materials; import gregtech.api.util.EmptyRecipeMap; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; @@ -30,6 +31,7 @@ import gtPlusPlus.core.handler.Recipes.RegistrationHandler; import gtPlusPlus.core.handler.events.LoginEventHandler; import gtPlusPlus.core.item.general.RF2EU_Battery; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.material.gregtech.CustomGTMaterials; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; @@ -206,6 +208,11 @@ public class GTplusplus implements ActionListener { FMLCommonHandler.instance().bus().register(new LoginEventHandler()); Utils.LOG_INFO("Login Handler Initialized"); + //Early load materials + try { + CustomGTMaterials.run(); + } catch (Throwable t){} + if (CORE.configSwitches.enableOldGTcircuits && CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ removeCircuitRecipeMap(); //Bye shitty recipes. } @@ -243,6 +250,10 @@ public class GTplusplus implements ActionListener { this.dumpGtRecipeMap(Gregtech_Recipe_Map.sMatterFab2Recipes); this.dumpGtRecipeMap(Gregtech_Recipe_Map.sAlloyBlastSmelterRecipes); } + + for (Materials s : gtPlusPlus.core.material.gregtech.CustomGTMaterials.Custom_GT_Materials){ + Utils.LOG_INFO("Verification for New Material: "+s.mName); + } // ~ //ReflectionUtils.becauseIWorkHard(); diff --git a/src/Java/gtPlusPlus/GTplusplus_Secondary.java b/src/Java/gtPlusPlus/GTplusplus_Secondary.java index 057810955f..b71d770c0c 100644 --- a/src/Java/gtPlusPlus/GTplusplus_Secondary.java +++ b/src/Java/gtPlusPlus/GTplusplus_Secondary.java @@ -1,5 +1,6 @@ package gtPlusPlus; +import java.io.File; import java.util.Random; import org.apache.logging.log4j.Level; @@ -16,9 +17,12 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.world.darkworld.Dimension_DarkWorld; import gtPlusPlus.core.world.darkworld.biome.Biome_DarkWorld; +import gtPlusPlus.xmod.gregtech.HANDLER_GT; +import gtPlusPlus.xmod.gregtech.api.util.GTPP_Config; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; +import net.minecraftforge.common.config.Configuration; @MCVersion(value = "1.7.10") @ChildMod(parent = CORE.MODID, mod = @Mod(modid = "GT++DarkWorld", @@ -64,6 +68,10 @@ public class GTplusplus_Secondary implements IFuelHandler, IWorldGenerator{ DarkWorld_Dimension.instance = GTplusplus.instance; DarkWorld_Biome.preInit(event); DarkWorld_Dimension.preInit(event); + + //Load/Set Custom Ore Gen + HANDLER_GT.sCustomWorldgenFile = new GTPP_Config(new Configuration(new File(new File(event.getModConfigurationDirectory(), "GTplusplus"), "WorldGeneration.cfg"))); + } @EventHandler diff --git a/src/Java/gtPlusPlus/core/container/Container_FishTrap.java b/src/Java/gtPlusPlus/core/container/Container_FishTrap.java index 46b9a0c523..34cfdf9bf3 100644 --- a/src/Java/gtPlusPlus/core/container/Container_FishTrap.java +++ b/src/Java/gtPlusPlus/core/container/Container_FishTrap.java @@ -21,14 +21,15 @@ public class Container_FishTrap extends Container { private final int posY; private final int posZ; - - public static int StorageSlotNumber = 15; //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 static int StorageSlotNumber = 15; // Number of slots in storage area + public static int InventorySlotNumber = 36; // Inventory Slots (Inventory + // and Hotbar) + public static int FullSlotNumber = InventorySlotNumber + StorageSlotNumber; // All + // slots private final int[] slotStorage = new int[15]; - public Container_FishTrap(final InventoryPlayer inventory, final TileEntityFishTrap te){ + public Container_FishTrap(final InventoryPlayer inventory, final TileEntityFishTrap te) { this.tile_entity = te; this.inventoryChest = te.getInventory(); @@ -39,120 +40,87 @@ public class Container_FishTrap extends Container { this.posY = te.yCoord; this.posZ = te.zCoord; - int o=0; + int o = 0; - //Storage Side - for (var6 = 0; var6 < 3; ++var6) - { - for (var7 = 0; var7 < 5; ++var7) - { - //Utils.LOG_WARNING("Adding slots at var:"+(var7 + var6 * 4)+" x:"+(8 + var7 * 18)+" y:"+(7 + var6 * 18)); - this.addSlotToContainer(new SlotNoInput(this.inventoryChest, var7 + (var6 * 4), 36+ 8 + (var7 * 18), 8 + 7 + (var6 * 18))); + // Storage Side + for (var6 = 0; var6 < 3; var6++) { + for (var7 = 0; var7 < 5; var7++) { this.slotStorage[o] = o; - o++; + this.addSlotToContainer(new SlotNoInput(this.inventoryChest, o++, 44 + (var7 * 18), 15 + (var6 * 18))); } } - o=0; - - //Player Inventory - for (var6 = 0; var6 < 3; ++var6) - { - for (var7 = 0; var7 < 9; ++var7) - { + // 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) - { + // Player Hotbar + for (var6 = 0; var6 < 9; ++var6) { this.addSlotToContainer(new Slot(inventory, var6, 8 + (var6 * 18), 142)); } } @Override - public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, final EntityPlayer aPlayer){ + 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); + 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){ + 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.blockFishTrap){ + public boolean canInteractWith(final EntityPlayer par1EntityPlayer) { + if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockFishTrap) { 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) - { + public ItemStack transferStackInSlot(final EntityPlayer par1EntityPlayer, final int par2) { ItemStack var3 = null; - final Slot var4 = (Slot)this.inventorySlots.get(par2); + final Slot var4 = (Slot) this.inventorySlots.get(par2); - if ((var4 != null) && var4.getHasStack()) - { + 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 - { + /* + * 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) - { + if (var5.stackSize == var3.stackSize) { return null; } @@ -162,11 +130,10 @@ public class Container_FishTrap extends Container { return var3; } - //Can merge Slot + // 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/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java index 3a242ea10b..ec32b0bb9f 100644 --- a/src/Java/gtPlusPlus/core/item/ModItems.java +++ b/src/Java/gtPlusPlus/core/item/ModItems.java @@ -217,6 +217,8 @@ public final class ModItems { public static Item itemCoalCoke; + public static CoreItem itemCircuitLFTR; + @@ -480,6 +482,10 @@ public final class ModItems { dustLi2BeF4 = ItemUtils.generateSpecialUseDusts("Li2BeF4", "Li2BeF4 Fuel Compound", Utils.rgbtoHexValue(255, 255, 255))[0]; //https://en.wikipedia.org/wiki/FLiBe fluidFLiBeSalt = FluidUtils.generateFluid("Li2BeF4", "Li2BeF4", 7430, new short[]{255, 255, 255, 100}); + //LFTR Control Circuit + itemCircuitLFTR = new CoreItem("itemCircuitLFTR", ""+EnumChatFormatting.GREEN+"Thorium Reactor Control Circuit", AddToCreativeTab.tabMisc, 1, 0, "Helps your LFTR not explode", EnumRarity.epic, EnumChatFormatting.DARK_GREEN, false, null); + + //Zirconium //Cinter Pellet. itemZirconiumChlorideCinterPellet = new CoreItem("itemZirconiumPellet", "Zirconium Pellet ["+StringUtils.subscript("ZrCl4")+"]", tabMisc).setTextureName(CORE.MODID + ":itemShard"); diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java index 4731581d83..35f1942040 100644 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java +++ b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java @@ -187,7 +187,11 @@ public class BaseItemComponent extends Item{ @Override public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { if (this.componentMaterial != null){ - EntityUtils.applyRadiationDamageToEntity(this.componentMaterial.vRadiationLevel, world, entityHolding); + if (entityHolding instanceof EntityPlayer){ + if (!((EntityPlayer) entityHolding).capabilities.isCreativeMode){ + EntityUtils.applyRadiationDamageToEntity(this.componentMaterial.vRadiationLevel, world, entityHolding); + } + } } } diff --git a/src/Java/gtPlusPlus/core/item/base/CoreItem.java b/src/Java/gtPlusPlus/core/item/base/CoreItem.java index 62fc5c0160..951d2050f5 100644 --- a/src/Java/gtPlusPlus/core/item/base/CoreItem.java +++ b/src/Java/gtPlusPlus/core/item/base/CoreItem.java @@ -132,6 +132,26 @@ public class CoreItem extends Item GameRegistry.registerItem(this, unlocalizedName); } + //6 + /* + * Name, Tab, Stack, Dmg, Description, Rarity, Text Colour, Effect + */ + public CoreItem(final String unlocalizedName, final String displayName, final CreativeTabs creativeTab, final int stackSize, final int maxDmg, final String description, final EnumRarity regRarity, final EnumChatFormatting colour, final boolean Effect, final ItemStack OverrideItem) + { + this.setUnlocalizedName(unlocalizedName); + this.itemName = displayName; + this.setTextureName(CORE.MODID + ":" + unlocalizedName); + this.setCreativeTab(creativeTab); + this.setMaxStackSize(stackSize); + this.setMaxDamage(maxDmg); + this.rarity = regRarity; + this.itemDescription = description; + this.descColour = colour; + this.hasEffect = Effect; + this.turnsInto = OverrideItem; + GameRegistry.registerItem(this, unlocalizedName); + } + @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { diff --git a/src/Java/gtPlusPlus/core/material/Material.java b/src/Java/gtPlusPlus/core/material/Material.java index c7d50c55b2..d4d306d5af 100644 --- a/src/Java/gtPlusPlus/core/material/Material.java +++ b/src/Java/gtPlusPlus/core/material/Material.java @@ -228,11 +228,11 @@ public class Material { this.vChemicalFormula = this.getToolTip(chemicalSymbol, OrePrefixes.dust.mMaterialAmount / M, true); } else if (!this.vChemicalSymbol.equals("")){ - Utils.LOG_MACHINE_INFO("materialInput is null, using a valid chemical symbol."); + Utils.LOG_WARNING("materialInput is null, using a valid chemical symbol."); this.vChemicalFormula = this.vChemicalSymbol; } else{ - Utils.LOG_MACHINE_INFO("MaterialInput == null && chemicalSymbol probably equals nothing"); + Utils.LOG_WARNING("MaterialInput == null && chemicalSymbol probably equals nothing"); this.vChemicalFormula = "??"; } @@ -268,13 +268,13 @@ public class Material { } } - Utils.LOG_MACHINE_INFO("Creating a Material instance for "+materialName); - Utils.LOG_MACHINE_INFO("Formula: "+this.vChemicalFormula + " Smallest Stack: "+this.smallestStackSizeWhenProcessing+" Smallest Ratio:"+ratio); - Utils.LOG_MACHINE_INFO("Protons: "+this.vProtons); - Utils.LOG_MACHINE_INFO("Neutrons: "+this.vNeutrons); - Utils.LOG_MACHINE_INFO("Mass: "+this.vMass+"/units"); - Utils.LOG_MACHINE_INFO("Melting Point: "+this.meltingPointC+"C."); - Utils.LOG_MACHINE_INFO("Boiling Point: "+this.boilingPointC+"C."); + Utils.LOG_WARNING("Creating a Material instance for "+materialName); + Utils.LOG_WARNING("Formula: "+this.vChemicalFormula + " Smallest Stack: "+this.smallestStackSizeWhenProcessing+" Smallest Ratio:"+ratio); + Utils.LOG_WARNING("Protons: "+this.vProtons); + Utils.LOG_WARNING("Neutrons: "+this.vNeutrons); + Utils.LOG_WARNING("Mass: "+this.vMass+"/units"); + Utils.LOG_WARNING("Melting Point: "+this.meltingPointC+"C."); + Utils.LOG_WARNING("Boiling Point: "+this.boilingPointC+"C."); } public final String getLocalizedName(){ @@ -428,21 +428,21 @@ public class Material { if (!this.vMaterialInput.isEmpty()){ final ItemStack[] temp = new ItemStack[this.vMaterialInput.size()]; for (int i=0;i<this.vMaterialInput.size();i++){ - //Utils.LOG_MACHINE_INFO("i:"+i); + //Utils.LOG_WARNING("i:"+i); ItemStack testNull = null; try { testNull = this.vMaterialInput.get(i).getValidStack(); } catch (final Throwable r){ - Utils.LOG_MACHINE_INFO("Failed gathering material stack for "+this.localizedName+"."); - Utils.LOG_MACHINE_INFO("What Failed: Length:"+this.vMaterialInput.size()+" current:"+i); + Utils.LOG_WARNING("Failed gathering material stack for "+this.localizedName+"."); + Utils.LOG_WARNING("What Failed: Length:"+this.vMaterialInput.size()+" current:"+i); } try { if (testNull != null){ - //Utils.LOG_MACHINE_INFO("not null"); + //Utils.LOG_WARNING("not null"); temp[i] = this.vMaterialInput.get(i).getValidStack(); } } catch (final Throwable r){ - Utils.LOG_MACHINE_INFO("Failed setting slot "+i+", using "+this.localizedName); + Utils.LOG_WARNING("Failed setting slot "+i+", using "+this.localizedName); } } return temp; @@ -490,9 +490,9 @@ public class Material { public final long[] getSmallestRatio(final ArrayList<MaterialStack> tempInput){ if (tempInput != null){ if (!tempInput.isEmpty()){ - Utils.LOG_MACHINE_INFO("length: "+tempInput.size()); - Utils.LOG_MACHINE_INFO("(inputs != null): "+(tempInput != null)); - //Utils.LOG_MACHINE_INFO("length: "+inputs.length); + Utils.LOG_WARNING("length: "+tempInput.size()); + Utils.LOG_WARNING("(inputs != null): "+(tempInput != null)); + //Utils.LOG_WARNING("length: "+inputs.length); final long[] tempRatio = new long[tempInput.size()]; for (int x=0;x<tempInput.size();x++){ //tempPercentage = tempPercentage+inputs[x].percentageToUse; @@ -509,7 +509,7 @@ public class Material { for (int r=0;r<tempRatio.length;r++){ tempRatioStringThing1 = tempRatioStringThing1 + tempRatio[r] +" : "; } - Utils.LOG_MACHINE_INFO("Default Ratio: "+tempRatioStringThing1); + Utils.LOG_WARNING("Default Ratio: "+tempRatioStringThing1); String tempRatioStringThing = ""; int tempSmallestCraftingUseSize = 0; @@ -518,7 +518,7 @@ public class Material { tempSmallestCraftingUseSize = (int) (tempSmallestCraftingUseSize + smallestRatio[r]); } //this.smallestStackSizeWhenProcessing = tempSmallestCraftingUseSize; - Utils.LOG_MACHINE_INFO("Smallest Ratio: "+tempRatioStringThing); + Utils.LOG_WARNING("Smallest Ratio: "+tempRatioStringThing); return smallestRatio; } } @@ -530,7 +530,7 @@ public class Material { if (!aShowQuestionMarks && (this.vChemicalFormula.equals("?")||this.vChemicalFormula.equals("??"))) { return ""; } - Utils.LOG_MACHINE_INFO("===============| Calculating Atomic Formula for "+this.localizedName+" |==============="); + Utils.LOG_WARNING("===============| Calculating Atomic Formula for "+this.localizedName+" |==============="); if (!chemSymbol.equals("")) { return chemSymbol; } @@ -573,13 +573,13 @@ public class Material { return StringUtils.subscript(dummyFormula); //return dummyFormula; } - Utils.LOG_MACHINE_INFO("dummyFormulaArray <= 0"); + Utils.LOG_WARNING("dummyFormulaArray <= 0"); } - Utils.LOG_MACHINE_INFO("dummyFormulaArray == null"); + Utils.LOG_WARNING("dummyFormulaArray == null"); } - Utils.LOG_MACHINE_INFO("tempInput.length <= 0"); + Utils.LOG_WARNING("tempInput.length <= 0"); } - Utils.LOG_MACHINE_INFO("tempInput == null"); + Utils.LOG_WARNING("tempInput == null"); return "??"; } @@ -593,7 +593,7 @@ public class Material { } catch (final Throwable e){} if (Materials.get(this.localizedName).mFluid == null){ - Utils.LOG_MACHINE_INFO("Generating our own fluid."); + Utils.LOG_WARNING("Generating our own fluid."); //Generate a Cell if we need to if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+this.getUnlocalizedName(), 1) == null){ @@ -639,7 +639,7 @@ public class Material { return this.generatePlasma(); } } - Utils.LOG_MACHINE_INFO("Getting the fluid from a GT material instead."); + Utils.LOG_WARNING("Getting the fluid from a GT material instead."); return Materials.get(this.localizedName).mFluid; } @@ -648,11 +648,11 @@ public class Material { if ((isValid != Materials._NULL) && (isValid != null) && (isValid != Materials.Clay) && (isValid != Materials.Clay) && (isValid != Materials.Phosphorus) && (isValid != Materials.Steel) && (isValid != Materials.Bronze)){ if (isValid.mPlasma != null){ - Utils.LOG_MACHINE_INFO("Using a pre-defined Plasma from GT."); + Utils.LOG_WARNING("Using a pre-defined Plasma from GT."); return isValid.mPlasma; } } - Utils.LOG_MACHINE_INFO("Generating our own Plasma."); + Utils.LOG_WARNING("Generating our own Plasma."); return FluidUtils.addGTPlasma(this); //return null; } @@ -660,9 +660,9 @@ public class Material { final public FluidStack getFluid(final int fluidAmount) { - Utils.LOG_MACHINE_INFO("Attempting to get "+fluidAmount+"L of "+this.vMoltenFluid.getName()); + //Utils.LOG_WARNING("Attempting to get "+fluidAmount+"L of "+this.vMoltenFluid.getName()); final FluidStack moltenFluid = new FluidStack(this.vMoltenFluid, fluidAmount); - Utils.LOG_MACHINE_INFO("Info: "+moltenFluid.getFluid().getName()+" Info: "+moltenFluid.amount+" Info: "+moltenFluid.getFluidID()); + //Utils.LOG_WARNING("Info: "+moltenFluid.getFluid().getName()+" Info: "+moltenFluid.amount+" Info: "+moltenFluid.getFluidID()); return moltenFluid; } @@ -672,10 +672,10 @@ public class Material { for (MaterialStack part : this.vMaterialInput){ int incrementor = part.getStackMaterial().getMeltingPointC(); meltingPoint += incrementor; - Utils.LOG_MACHINE_INFO("Melting Point for "+this.getLocalizedName()+" increased to "+ incrementor); + Utils.LOG_WARNING("Melting Point for "+this.getLocalizedName()+" increased to "+ incrementor); } int divisor = (this.vMaterialInput.size()>0 ? this.vMaterialInput.size() : 1); - Utils.LOG_MACHINE_INFO("Dividing "+meltingPoint+" / "+divisor+" to get average melting point."); + Utils.LOG_WARNING("Dividing "+meltingPoint+" / "+divisor+" to get average melting point."); meltingPoint = (meltingPoint/divisor); return meltingPoint; } diff --git a/src/Java/gtPlusPlus/core/material/gregtech/CustomGTMaterials.java b/src/Java/gtPlusPlus/core/material/gregtech/CustomGTMaterials.java new file mode 100644 index 0000000000..96a4b34d98 --- /dev/null +++ b/src/Java/gtPlusPlus/core/material/gregtech/CustomGTMaterials.java @@ -0,0 +1,95 @@ +package gtPlusPlus.core.material.gregtech; + +import static gregtech.api.enums.Materials.*; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import gregtech.api.enums.Dyes; +import gregtech.api.enums.Element; +import gregtech.api.enums.Materials; +import gregtech.api.enums.TC_Aspects; +import gregtech.api.enums.TC_Aspects.TC_AspectStack; +import gregtech.api.enums.TextureSet; +import gregtech.api.interfaces.IMaterialHandler; +import gregtech.api.objects.MaterialStack; +import gtPlusPlus.core.util.Utils; + +public class CustomGTMaterials { + + //public static Materials Fireclay = new MaterialBuilder(626, TextureSet.SET_ROUGH, "Fireclay").addDustItems().setRGB(173, 160, 155).setColor(Dyes.dyeBrown).setMaterialList(new MaterialStack(Brick, 1)).constructMaterial(); + + /**int aMetaItemSubID, + * TextureSet aIconSet, + * float aToolSpeed, + * int aDurability, + * int aToolQuality, + * boolean aUnificatable, + * String aName, String aDefaultLocalName, + * String aConfigSection, + * boolean aCustomOre, + * String aCustomID) { + + **/ + + public static List<Materials> Custom_GT_Materials = new ArrayList<Materials>(); + + public static Materials Zirconium = materialBuilder_Element(1232, TextureSet.SET_METALLIC, 6.0F, 256, 2, 1|2|8|32|64|128, 200, 200, 200, 0, "Zirconium", "Zirconium", 0, 0, 1811, 0, false, false, 3, 1, 1, Dyes.dyeLightGray, Element.Zr, Arrays.asList(new TC_Aspects.TC_AspectStack(TC_Aspects.METALLUM, 3))); + public static Materials Geikielite = materialBuilder(1234, TextureSet.SET_SHINY, new int[]{1,2,3}, "Geikielite", Dyes.dyeBlack, Arrays.asList(new MaterialStack(Titanium, 1), new MaterialStack(Magnesium, 1), new MaterialStack(Oxygen, 3))); + public static Materials Zirconolite = materialBuilder(1235, TextureSet.SET_METALLIC, new int[]{1,2,3}, "Zirconolite", Dyes.dyeBlack, Arrays.asList(new MaterialStack(Calcium, 1), new MaterialStack(Zirconium, 1), new MaterialStack(Titanium, 2), new MaterialStack(Oxygen, 7))); + + public static final void run(){ + Utils.LOG_INFO("[Custom] Trying to initialise custom materials."); + } + + private final static boolean registerMaterial(Materials r){ + Custom_GT_Materials.add(r); + Utils.LOG_INFO("[Custom] Registered new Gregtech material - "+r.mName); + return true; + } + + public final static Materials materialBuilder(int ID, TextureSet texture, int[] rgb, String materialName, Dyes dyeColour, List<MaterialStack> composition){ + Materials newMat = new Materials( + ID, + texture, + 1.0F, + 0, + 2, + 1 |8 , + rgb[0], rgb[1], rgb[2], 0, + materialName, materialName, + 0, 0, -1, 0, false, false, 3, 1, 1, + dyeColour, + 1, + composition + ); + registerMaterial(newMat); + return newMat; + } + + public final static Materials materialBuilder_Element( + int ID, TextureSet texture, + float a, int b, int c, + int d, int r2, int g2, int b2, int a2, + String materialName, String e, + int f, int g, int h, int i, + boolean j, boolean k, + int l, int m, int n, + Dyes dyeColour, Element o, + List<TC_AspectStack> aspects){ + Materials newMat = new Materials( + ID, texture, + a, b, c, + d, r2, g2, b2, a2, + materialName, e, + f, g, h, i, j, k, l, m, n, + dyeColour, o, + aspects + ); + registerMaterial(newMat); + return newMat; + } + + +} diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_MachineComponents.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_MachineComponents.java index c6d03b345b..fb3aa64564 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_MachineComponents.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_MachineComponents.java @@ -93,10 +93,6 @@ public class RECIPES_MachineComponents { public static String smallGearTier9 = "gearGtSmallOsmium"; public static String smallGearTier10 = "gearGtSmallNeutronium"; - //Crafting Tools - public static String craftingToolWrench = "craftingToolWrench"; - public static String craftingToolScrewdriver = "craftingToolScrewdriver"; - public static final void RECIPES_LOAD(){ Utils.LOG_INFO("Loading Recipes for the Various Circuits and Machine components."); if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ @@ -135,22 +131,22 @@ public class RECIPES_MachineComponents { //Electric Pump RecipeUtils.addShapedGregtechRecipe( cableTier7, rotorTier7, itemRubberRing, - craftingToolScrewdriver, pipeTier7, craftingToolWrench, + CI.craftingToolScrewdriver, pipeTier7, CI.craftingToolWrench, itemRubberRing, CI.electricMotor_LuV, cableTier7, CI.electricPump_LuV); RecipeUtils.addShapedGregtechRecipe( cableTier8, rotorTier8, itemRubberRing, - craftingToolScrewdriver, pipeTier8, craftingToolWrench, + CI.craftingToolScrewdriver, pipeTier8, CI.craftingToolWrench, itemRubberRing, CI.electricMotor_ZPM, cableTier8, CI.electricPump_ZPM); RecipeUtils.addShapedGregtechRecipe( cableTier9, rotorTier9, itemRubberRing, - craftingToolScrewdriver, pipeTier9, craftingToolWrench, + CI.craftingToolScrewdriver, pipeTier9, CI.craftingToolWrench, itemRubberRing, CI.electricMotor_UV, cableTier9, CI.electricPump_UV); RecipeUtils.addShapedGregtechRecipe( cableTier10, rotorTier10, itemRubberRing, - craftingToolScrewdriver, pipeTier10, craftingToolWrench, + CI.craftingToolScrewdriver, pipeTier10, CI.craftingToolWrench, itemRubberRing, CI.electricMotor_MAX, cableTier10, CI.electricPump_MAX); @@ -301,7 +297,7 @@ public class RECIPES_MachineComponents { RecipeUtils.addShapedGregtechRecipe( cableTier0, rotorTier0, itemRubberRing, - craftingToolScrewdriver, pipeTier0, craftingToolWrench, + CI.craftingToolScrewdriver, pipeTier0, CI.craftingToolWrench, itemRubberRing, CI.electricMotor_ULV, cableTier0, CI.electricPump_ULV); @@ -350,7 +346,7 @@ public class RECIPES_MachineComponents { CI.electricMotor_MAX); RecipeUtils.addShapedGregtechRecipe( cableTier10, rotorTier10, itemRubberRing, - craftingToolScrewdriver, pipeTier10, craftingToolWrench, + CI.craftingToolScrewdriver, pipeTier10, CI.craftingToolWrench, itemRubberRing, CI.electricMotor_MAX, cableTier10, CI.electricPump_MAX); RecipeUtils.addShapedGregtechRecipe( diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java index effff15171..eb58ba3928 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java @@ -74,8 +74,13 @@ public class RECIPES_Machines { //Thermal Boiler public static ItemStack RECIPE_ThermalBoilerController; public static ItemStack RECIPE_ThermalBoilerCasing; - - + + //Thorium Reactor + public static ItemStack RECIPE_LFTRController; + public static ItemStack RECIPE_LFTROuterCasing; + public static ItemStack RECIPE_LFTRInnerCasing; + + //Buffer Cores public static ItemStack RECIPE_BufferCore_ULV = ItemUtils.getItemStack("miscutils:item.itemBufferCore1", 1); public static ItemStack RECIPE_BufferCore_LV = ItemUtils.getItemStack("miscutils:item.itemBufferCore2", 1); @@ -222,7 +227,7 @@ public class RECIPES_Machines { private static void runModRecipes(){ if (LoadedMods.Gregtech){ - + //Computer Cube RecipeUtils.addShapedGregtechRecipe( CI.getDataOrb(),ItemList.Cover_Screen.get(1),"circuitMaster", @@ -756,7 +761,7 @@ public class RECIPES_Machines { "plateTitanium",CI.machineHull_EV,"plateTitanium", RECIPE_TesseractTerminal); } - + if (CORE.configSwitches.enableMachine_SimpleWasher){ ItemStack plateWrought = ItemUtils.getItemStackOfAmountFromOreDict("plateWroughtIron", 1); ItemStack washerPipe; @@ -773,47 +778,145 @@ public class RECIPES_Machines { plateWrought, CI.machineCasing_ULV, plateWrought, GregtechItemList.SimpleDustWasher.get(1)); } - + if (CORE.configSwitches.enableMachine_Pollution){ RecipeUtils.addShapedGregtechRecipe( "plateCarbon", "plateCarbon", "plateCarbon", "dustCarbon", "dustCarbon", "dustCarbon", "plateCarbon", "plateCarbon", "plateCarbon", ItemUtils.simpleMetaStack(ModItems.itemAirFilter, 0, 1)); + + //Pollution Detector + RecipeUtils.addShapedGregtechRecipe( + CI.component_Plate[1], CI.sensor_MV, CI.component_Plate[1], + CI.component_Plate[2], CI.electricMotor_ULV, CI.component_Plate[2], + CI.getTieredCircuit(1), CI.machineHull_LV, CI.getTieredCircuit(0), + GregtechItemList.Pollution_Detector.get(1)); + + //ULV + RecipeUtils.addShapedGregtechRecipe( + CI.component_Plate[0], ItemUtils.simpleMetaStack(ModItems.itemAirFilter, 0, 1), CI.component_Plate[0], + CI.component_Plate[0], CI.electricMotor_ULV, CI.component_Plate[0], + CI.getTieredCircuit(0), CI.machineHull_ULV, CI.getTieredCircuit(0), + GregtechItemList.Pollution_Cleaner_ULV.get(1)); + //LV + RecipeUtils.addShapedGregtechRecipe( + CI.component_Plate[1], ItemUtils.simpleMetaStack(ModItems.itemAirFilter, 0, 1), CI.component_Plate[1], + CI.component_Plate[1], CI.electricMotor_LV, CI.component_Plate[1], + CI.getTieredCircuit(1), CI.machineHull_LV, CI.getTieredCircuit(1), + GregtechItemList.Pollution_Cleaner_LV.get(1)); + //MV + RecipeUtils.addShapedGregtechRecipe( + CI.component_Plate[2], ItemUtils.simpleMetaStack(ModItems.itemAirFilter, 0, 1), CI.component_Plate[2], + CI.component_Plate[2], CI.electricMotor_MV, CI.component_Plate[2], + CI.getTieredCircuit(2), CI.machineHull_MV, CI.getTieredCircuit(2), + GregtechItemList.Pollution_Cleaner_MV.get(1)); + //HV + RecipeUtils.addShapedGregtechRecipe( + CI.component_Plate[3], ItemUtils.simpleMetaStack(ModItems.itemAirFilter, 0, 1), CI.component_Plate[3], + CI.component_Plate[3], CI.electricMotor_HV, CI.component_Plate[3], + CI.getTieredCircuit(3), CI.machineHull_HV, CI.getTieredCircuit(3), + GregtechItemList.Pollution_Cleaner_HV.get(1)); + //EV + RecipeUtils.addShapedGregtechRecipe( + CI.component_Plate[4], ItemUtils.simpleMetaStack(ModItems.itemAirFilter, 0, 1), CI.component_Plate[4], + CI.component_Plate[4], CI.electricMotor_EV, CI.component_Plate[4], + CI.getTieredCircuit(4), CI.machineHull_EV, CI.getTieredCircuit(4), + GregtechItemList.Pollution_Cleaner_EV.get(1)); + //IV + RecipeUtils.addShapedGregtechRecipe( + CI.component_Plate[5], ItemUtils.simpleMetaStack(ModItems.itemAirFilter, 1, 1), CI.component_Plate[5], + CI.component_Plate[5], CI.electricMotor_IV, CI.component_Plate[5], + CI.getTieredCircuit(5), CI.machineHull_IV, CI.getTieredCircuit(5), + GregtechItemList.Pollution_Cleaner_IV.get(1)); + //LuV + RecipeUtils.addShapedGregtechRecipe( + CI.component_Plate[6], ItemUtils.simpleMetaStack(ModItems.itemAirFilter, 1, 1), CI.component_Plate[6], + CI.component_Plate[6], CI.electricMotor_LuV, CI.component_Plate[6], + CI.getTieredCircuit(6), CI.machineHull_LuV, CI.getTieredCircuit(6), + GregtechItemList.Pollution_Cleaner_LuV.get(1)); + //ZPM + RecipeUtils.addShapedGregtechRecipe( + CI.component_Plate[7], ItemUtils.simpleMetaStack(ModItems.itemAirFilter, 1, 1), CI.component_Plate[7], + CI.component_Plate[7], CI.electricMotor_ZPM, CI.component_Plate[7], + CI.getTieredCircuit(7), CI.machineHull_ZPM, CI.getTieredCircuit(7), + GregtechItemList.Pollution_Cleaner_ZPM.get(1)); + //UV + RecipeUtils.addShapedGregtechRecipe( + CI.component_Plate[8], ItemUtils.simpleMetaStack(ModItems.itemAirFilter, 1, 1), CI.component_Plate[8], + CI.component_Plate[8], CI.electricMotor_UV, CI.component_Plate[8], + CI.getTieredCircuit(8), CI.machineHull_UV, CI.getTieredCircuit(8), + GregtechItemList.Pollution_Cleaner_UV.get(1)); + //MAX + RecipeUtils.addShapedGregtechRecipe( + CI.component_Plate[9], ItemUtils.simpleMetaStack(ModItems.itemAirFilter, 1, 1), CI.component_Plate[9], + CI.component_Plate[9], CI.electricMotor_MAX, CI.component_Plate[9], + CI.getTieredCircuit(9), CI.machineHull_MAX, CI.getTieredCircuit(9), + GregtechItemList.Pollution_Cleaner_MAX.get(1)); + + } - + if (CORE.configSwitches.enableMachine_ThermalBoiler){ RECIPE_ThermalBoilerController = GregtechItemList.GT4_Thermal_Boiler.get(1); RECIPE_ThermalBoilerCasing = GregtechItemList.Casing_ThermalContainment.get(4); ItemStack centrifugeHV = ItemList.Machine_HV_Centrifuge.get(1); - + RecipeUtils.addShapedGregtechRecipe( "craftingGeothermalGenerator", centrifugeHV, "craftingGeothermalGenerator", "gearTitanium", "circuitElite", "gearTitanium", "craftingGeothermalGenerator", centrifugeHV, "craftingGeothermalGenerator", RECIPE_ThermalBoilerController); - + RecipeUtils.addShapedGregtechRecipe( "craftingGeothermalGenerator", centrifugeHV, "craftingGeothermalGenerator", "gearTungstenSteel", "circuitElite", "gearTungstenSteel", "craftingGeothermalGenerator", centrifugeHV, "craftingGeothermalGenerator", RECIPE_ThermalBoilerController); - + RecipeUtils.addShapedGregtechRecipe( "plateStainlessSteel", "plateStainlessSteel", "plateStainlessSteel", "circuitAdvanced", CI.machineCasing_HV, "circuitAdvanced", "plateStainlessSteel", "plateStainlessSteel", "plateStainlessSteel", RECIPE_ThermalBoilerCasing); - + //Lava Filter Recipe GT_Values.RA.addAssemblerRecipe(ItemUtils.getItemStackWithMeta(LoadedMods.IndustrialCraft2, "IC2:itemPartCarbonMesh", "RawCarbonMesh", 0, 8), GT_Values.NI, ItemUtils.getSimpleStack(ModItems.itemLavaFilter), 80*20, 16); } - + if (CORE.configSwitches.enableMultiblock_LiquidFluorideThoriumReactor){ - } + //Thorium Reactor + RECIPE_LFTRController = GregtechItemList.ThoriumReactor.get(1); + RECIPE_LFTRInnerCasing = GregtechItemList.Casing_Reactor_II.get(1); //Zeron + RECIPE_LFTROuterCasing = GregtechItemList.Casing_Reactor_I.get(1); //Hastelloy + ItemStack controlCircuit = ItemUtils.getSimpleStack(ModItems.itemCircuitLFTR); + RecipeUtils.addShapedGregtechRecipe( + controlCircuit, "cableGt12NaquadahAlloy", controlCircuit, + "plateDoubleHastelloyN", ItemList.Cover_Screen.get(1), "plateDoubleHastelloyN", + "plateThorium232", CI.machineHull_UV, "plateThorium232", + RECIPE_LFTRController); + + RecipeUtils.addShapedGregtechRecipe( + "plateDoubleZeron100", CI.craftingToolScrewdriver, "plateDoubleZeron100", + "gearTalonite", CI.fieldGenerator_ULV, "gearTalonite", + "plateDoubleZeron100", CI.craftingToolHammer_Hard, "plateDoubleZeron100", + RECIPE_LFTRInnerCasing); + ItemStack IC2HeatPlate = ItemUtils.getItemStackWithMeta(LoadedMods.IndustrialCraft2, "IC2:itemreactorPlatingHeat", "ReactorHeatPlating", 0, 1); + RecipeUtils.addShapedGregtechRecipe( + "plateDoubleHastelloyN", IC2HeatPlate, "plateDoubleHastelloyN", + IC2HeatPlate, "frameGtHastelloyC276", IC2HeatPlate, + "plateDoubleHastelloyN", IC2HeatPlate, "plateDoubleHastelloyN", + RECIPE_LFTROuterCasing); + + //LFTR Control Circuit + ItemStack circuitT5 = ItemList.Circuit_Master.get(1); + GT_Values.RA.addAssemblerRecipe(circuitT5, CI.fieldGenerator_MV, controlCircuit, 240*20, 500); + + } + } Utils.LOG_INFO("Done loading recipes for the Various machine blocks."); } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/recipe/common/CI.java b/src/Java/gtPlusPlus/core/recipe/common/CI.java index 37f9dca0e6..46f7f6e0e9 100644 --- a/src/Java/gtPlusPlus/core/recipe/common/CI.java +++ b/src/Java/gtPlusPlus/core/recipe/common/CI.java @@ -143,6 +143,16 @@ public class CI { public static String[] component_Plate; public static String[] component_Rod; public static String[] component_Ingot; + + //Crafting Tools + public static String craftingToolWrench = "craftingToolWrench"; + public static String craftingToolHammer_Hard = "craftingToolHardHammer"; + public static String craftingToolHammer_Soft = "craftingToolSoftHammer"; + public static String craftingToolScrewdriver = "craftingToolScrewdriver"; + public static String craftingToolFile = "craftingToolFile"; + public static String craftingToolKnife = "craftingToolKnife"; + public static String craftingToolCrowbar = "craftingToolCrowbar"; + public static String craftingToolWireCutter = "craftingToolWirecutter"; public static void Init(){ diff --git a/src/Java/gtPlusPlus/core/slots/SlotNoInput.java b/src/Java/gtPlusPlus/core/slots/SlotNoInput.java index 3177c24868..db0630c4cd 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotNoInput.java +++ b/src/Java/gtPlusPlus/core/slots/SlotNoInput.java @@ -6,8 +6,8 @@ import net.minecraft.item.ItemStack; public class SlotNoInput extends Slot{ - public SlotNoInput(final IInventory inventory, final int x, final int y, final int z) { - super(inventory, x, y, z); + public SlotNoInput(final IInventory inventory, final int index, final int x, final int y) { + super(inventory, index, x, y); } @Override diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java index 176d65ceac..c066a27b1f 100644 --- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java +++ b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java @@ -28,8 +28,8 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory { public TileEntityFishTrap() { this.inventoryContents = new InventoryFishTrap();// number of slots - - // without product - // slot + // without product + // slot this.setTileLocation(); } @@ -95,19 +95,64 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory { int checkingSlot = 0; final ItemStack loot = this.generateLootForFishTrap(); try { + Utils.LOG_INFO("Trying to add "+loot.getDisplayName()+" | "+loot.getItemDamage()); for (final ItemStack contents : this.getInventory().getInventory()) { + if (contents == null) { + Utils.LOG_INFO("Adding Item To Empty Slot. "+(checkingSlot+1)); this.getInventory().setInventorySlotContents(checkingSlot, loot); this.markDirty(); return true; } + else if (contents.getItem() == loot.getItem() && contents.stackSize <= contents.getMaxStackSize() - 1) { if (contents.stackSize < contents.getMaxStackSize()) { - contents.stackSize++; - this.markDirty(); - return true; + if (contents.getHasSubtypes()){ + if (contents.getItemDamage() == loot.getItemDamage()){ + Utils.LOG_INFO("1-Trying to add one more "+loot.getDisplayName()+" to an existing stack of "+contents.getDisplayName()+" with a size of "+contents.stackSize); + contents.stackSize++; + this.markDirty(); + return true; + } + else { + Utils.LOG_INFO("2-Trying to add one more "+loot.getDisplayName()+" to an existing stack of "+contents.getDisplayName()+" with a size of "+contents.stackSize); + // + } + } + else { + Utils.LOG_INFO("3-Trying to add one more "+loot.getDisplayName()+" to an existing stack of "+contents.getDisplayName()+" with a size of "+contents.stackSize); + contents.stackSize++; + this.markDirty(); + return true; + } + } } + + /*if (ItemUtils.simpleMetaStack(loot.getItem(), loot.getItemDamage(), 1) == ItemUtils.simpleMetaStack(contents.getItem(), contents.getItemDamage(), 1)){ + Utils.LOG_INFO("Found Item With Existing Stack & Meta."); + if (contents.stackSize <= contents.getMaxStackSize() - 1){ + Utils.LOG_INFO("Existing stack is not max stack size."); + if (contents.stackSize < contents.getMaxStackSize()) { + Utils.LOG_INFO("Adding Item To partially filled Slot."); + contents.stackSize++; + this.markDirty(); + return true; + } + } + } + else if (contents.getItem() == loot.getItem() && contents.getItemDamage() != loot.getItemDamage()) { + Utils.LOG_INFO("Found Item With Existing Stack & Different Meta."); + if (contents.stackSize <= contents.getMaxStackSize() - 1){ + Utils.LOG_INFO("Existing stack is not max stack size."); + if (contents.stackSize < contents.getMaxStackSize()) { + Utils.LOG_INFO("Adding Item To partially filled Slot."); + contents.stackSize++; + this.markDirty(); + return true; + } + } + }*/ checkingSlot++; } } @@ -130,26 +175,44 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory { else if (lootWeight <= 20) { loot = ItemUtils.getSimpleStack(Blocks.sand); } + // Junk Loot else if (lootWeight <= 30) { - loot = ItemUtils.getItemStackOfAmountFromOreDictNoBroken(seaweed, 1); + if (LoadedMods.PamsHarvestcraft) { + loot = ItemUtils.getItemStackOfAmountFromOreDictNoBroken(seaweed, 1); + } + else { + loot = ItemUtils.getSimpleStack(Blocks.dirt); + } } // Pam Fish - else if (lootWeight <= 60) { - if (LoadedMods.PamsHarvestcraft) { + else if (lootWeight <= 99) { + int lootSwitch = MathUtils.randInt(0, 1); + if (LoadedMods.PamsHarvestcraft && lootSwitch==0) { loot = ItemUtils.getItemStackOfAmountFromOreDictNoBroken( prefix + harvestcraftFish[MathUtils.randInt(0, harvestcraftFish.length - 1)] + suffix, 1); } else { - loot = ItemUtils.getSimpleStack(minecraftFish[MathUtils.randInt(0, minecraftFish.length - 1)], 1); + int fishID = MathUtils.randInt(0, minecraftFish.length - 1); + loot = minecraftFish[fishID]; } } - // Minecraft Fish - else if (lootWeight <= 99) { - loot = ItemUtils.getSimpleStack(minecraftFish[MathUtils.randInt(0, minecraftFish.length - 1)], 1); - } + else if (lootWeight == 100){ - if (MathUtils.randInt(0, 1) == 0){ - loot = ItemUtils.getSimpleStack(Items.emerald); + int rareLoot = MathUtils.randInt(1, 10); + if (rareLoot <= 4) { + loot = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("nuggetIron", 1); + if (loot == null){ + loot = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ingotIron", 1); + } + } + else if (rareLoot <= 7) { + loot = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("nuggetGold", 1); + if (loot == null){ + loot = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ingotGold", 1); + } + } + else if (rareLoot <= 9){ + loot = ItemUtils.getSimpleStack(Items.emerald); } else { loot = ItemUtils.getSimpleStack(Items.diamond); @@ -158,6 +221,8 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory { else { loot = ItemUtils.getSimpleStack(Blocks.diamond_ore); } + loot.stackSize=1; + Utils.LOG_INFO("Adding x"+loot.stackSize+" "+loot.getDisplayName()+"."); return loot; } @@ -216,7 +281,7 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory { calculateTickrate = 2000; } else if (this.waterSides == 6) { - calculateTickrate = 900; + calculateTickrate = 100; } this.baseTickRate = calculateTickrate; } @@ -256,9 +321,12 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory { "Crayfish", "Eel", "Frog", "Grouper", "Herring", "Jellyfish", "Mudfish", "Octopus", "Perch", "Scallop", "Shrimp", "Snail", "Snapper", "Tilapia", "Trout", "Tuna", "Turtle", "Walleye" }; - private static final ItemStack[] minecraftFish = { ItemUtils.getItemStack("minecraft:fish", 1), - ItemUtils.getItemStack("minecraft:fish:1", 1), ItemUtils.getItemStack("minecraft:fish:2", 1), - ItemUtils.getItemStack("minecraft:fish:3", 1) }; + private static final ItemStack[] minecraftFish = { + ItemUtils.simpleMetaStack(Items.fish, 0, 1).copy(), + ItemUtils.simpleMetaStack(Items.fish, 1, 1).copy(), + ItemUtils.simpleMetaStack(Items.fish, 2, 1).copy(), + ItemUtils.simpleMetaStack(Items.fish, 3, 1).copy() + }; public static void pamsHarvestCraftCompat() { for (int i = 0; i < harvestcraftFish.length; i++) { @@ -333,7 +401,7 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory { accessibleSides[r]=r; } return accessibleSides; - + } @Override diff --git a/src/Java/gtPlusPlus/core/util/Utils.java b/src/Java/gtPlusPlus/core/util/Utils.java index 471fcadb62..0653420e5b 100644 --- a/src/Java/gtPlusPlus/core/util/Utils.java +++ b/src/Java/gtPlusPlus/core/util/Utils.java @@ -22,6 +22,7 @@ import gtPlusPlus.core.proxy.ClientProxy; import gtPlusPlus.core.util.fluid.FluidUtils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; import ic2.core.Ic2Items; import ic2.core.init.InternalName; import ic2.core.item.resources.ItemCell; @@ -179,7 +180,8 @@ public class Utils { //Non-Dev Comments public static void LOG_MACHINE_INFO(final String s){ if (CORE.configSwitches.MACHINE_INFO || ClientProxy.playerName.toLowerCase().contains("draknyte1")){ - modLogger.info("Machine Info: "+s); + String name1 = gtPlusPlus.core.util.reflect.ReflectionUtils.getMethodName(2); + modLogger.info("Machine Info: "+s+" | "+name1); } } diff --git a/src/Java/gtPlusPlus/core/util/gregtech/material/MaterialBuilder.java b/src/Java/gtPlusPlus/core/util/gregtech/material/MaterialBuilder.java new file mode 100644 index 0000000000..e642258645 --- /dev/null +++ b/src/Java/gtPlusPlus/core/util/gregtech/material/MaterialBuilder.java @@ -0,0 +1,254 @@ +package gtPlusPlus.core.util.gregtech.material; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import gregtech.api.enums.Dyes; +import gregtech.api.enums.Materials; +import gregtech.api.enums.TC_Aspects; +import gregtech.api.enums.TextureSet; +import gregtech.api.objects.MaterialStack; + +public class MaterialBuilder { + public static final int DIESEL = 0, GAS = 1, THERMAL = 2, SEMIFLUID = 3, PLASMA = 4, MAGIC = 5; + + private int metaItemSubID; + private TextureSet iconSet; + private float toolSpeed = 1.0f; + private int durability = 0; + private int toolQuality = 0; + private int types = 0; + private int r = 255, g = 255, b = 255, a = 0; + private String name; + private String defaultLocalName; + private int fuelType = 0; + private int fuelPower = 0; + private int meltingPoint = 0; + private int blastFurnaceTemp = 0; + private boolean blastFurnaceRequired = false; + private boolean transparent = false; + private int oreValue = 1; + private int densityMultiplier = 1; + private int densityDivider = 1; + private Dyes color = Dyes._NULL; + private int extraData = 0; + private List<MaterialStack> materialList = new ArrayList<MaterialStack>(); + private List<TC_Aspects.TC_AspectStack> aspects = new ArrayList<TC_Aspects.TC_AspectStack>(); + private boolean canBeCracked = false; + private int liquidTemperature = 300; + private int gasTemperature = 300; + + public MaterialBuilder(int metaItemSubID, TextureSet iconSet, String defaultLocalName) { + this.metaItemSubID = metaItemSubID; + this.iconSet = iconSet; + this.name = defaultLocalName.replace(" ", "").replace("-", ""); + this.defaultLocalName = defaultLocalName; + } + + public Materials constructMaterial() { + return new Materials( + metaItemSubID, iconSet, toolSpeed, durability, toolQuality, types, r, g, b, a, name, defaultLocalName, fuelType, fuelPower, meltingPoint, blastFurnaceTemp, + blastFurnaceRequired, transparent, oreValue, densityMultiplier, densityDivider, color, extraData, materialList, aspects); + + } + + public MaterialBuilder setName(String name){ + this.name = name; + return this; + } + + public MaterialBuilder setTypes(int types){ + this.types = types; + return this; + } + + public MaterialBuilder addDustItems(){ + types = types | 1; + return this; + } + + public MaterialBuilder addMetalItems(){ + types = types | 2; + return this; + } + + public MaterialBuilder addGemItems(){ + types = types | 4; + return this; + } + + public MaterialBuilder addOreItems(){ + types = types | 8; + return this; + } + + public MaterialBuilder addCell(){ + types = types | 16; + return this; + } + + public MaterialBuilder addPlasma(){ + types = types | 32; + return this; + } + + public MaterialBuilder addToolHeadItems(){ + types = types | 64; + return this; + } + + public MaterialBuilder addGearItems(){ + types = types | 128; + return this; + } + + public MaterialBuilder addFluid(){ + return this; + } + + public MaterialBuilder addGas(){ + return this; + } + + + public MaterialBuilder setRGBA(int r, int g, int b, int a){ + this.r = r; + this.g = g; + this.b = b; + this.a = a; + return this; + } + + public MaterialBuilder setRGB(int r, int g, int b){ + this.r = r; + this.g = g; + this.b = b; + return this; + } + + public MaterialBuilder setTransparent(boolean transparent){ + this.transparent = transparent; + return this; + } + + public MaterialBuilder setColor(Dyes color){ + this.color = color; + return this; + } + + + public MaterialBuilder setToolSpeed(float toolSpeed) { + this.toolSpeed = toolSpeed; + return this; + } + + public MaterialBuilder setDurability(int durability) { + this.durability = durability; + return this; + } + + public MaterialBuilder setToolQuality(int toolQuality) { + this.toolQuality = toolQuality; + return this; + } + + + public MaterialBuilder setFuelType(int fuelType) { + this.fuelType = fuelType; + return this; + } + + public MaterialBuilder setFuelPower(int fuelPower) { + this.fuelPower = fuelPower; + return this; + } + + public MaterialBuilder setMeltingPoint(int meltingPoint) { + this.meltingPoint = meltingPoint; + return this; + } + + public MaterialBuilder setBlastFurnaceTemp(int blastFurnaceTemp) { + this.blastFurnaceTemp = blastFurnaceTemp; + return this; + } + + public MaterialBuilder setBlastFurnaceRequired(boolean blastFurnaceRequired) { + this.blastFurnaceRequired = blastFurnaceRequired; + return this; + } + + public MaterialBuilder setOreValue(int oreValue) { + this.oreValue = oreValue; + return this; + } + + public MaterialBuilder setDensityMultiplier(int densityMultiplier) { + this.densityMultiplier = densityMultiplier; + return this; + } + + public MaterialBuilder setDensityDivider(int densityDivider) { + this.densityDivider = densityDivider; + return this; + } + + public MaterialBuilder setExtraData(int extraData) { + this.extraData = extraData; + return this; + } + + public MaterialBuilder addElectrolyzerRecipe(){ + extraData = extraData | 1; + return this; + } + + public MaterialBuilder addCentrifugeRecipe(){ + extraData = extraData | 2; + return this; + } + + public MaterialBuilder setMaterialList(List<MaterialStack> materialList) { + this.materialList = materialList; + return this; + } + + public MaterialBuilder setMaterialList(MaterialStack ... materials) { + this.materialList = Arrays.asList(materials); + return this; + } + + public MaterialBuilder setAspects(List<TC_Aspects.TC_AspectStack> aspects) { + this.aspects = aspects; + return this; + } + + public int getLiquidTemperature() { + return liquidTemperature; + } + + public MaterialBuilder setLiquidTemperature(int liquidTemperature) { + this.liquidTemperature = liquidTemperature; + return this; + } + + public int getGasTemperature() { + return gasTemperature; + } + + public MaterialBuilder setGasTemperature(int gasTemperature) { + this.gasTemperature = gasTemperature; + return this; + } + + public boolean canBeCracked() { + return canBeCracked; + } + + public MaterialBuilder setCanBeCracked(boolean canBeCracked) { + this.canBeCracked = canBeCracked; + return this; + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java b/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java index 6dfcab91a7..1a5ef735f5 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java @@ -1,23 +1,36 @@ package gtPlusPlus.xmod.gregtech; +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import gregtech.api.GregTech_API; import gregtech.api.util.GT_Config; +import gregtech.api.world.GT_Worldgen; import gtPlusPlus.core.handler.COMPAT_HANDLER; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.recipe.RECIPES_LaserEngraver; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; +import gtPlusPlus.xmod.gregtech.api.util.GTPP_Config; +import gtPlusPlus.xmod.gregtech.api.world.GTPP_Worldgen; import gtPlusPlus.xmod.gregtech.common.blocks.fluid.GregtechFluidHandler; import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechItems; import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; import gtPlusPlus.xmod.gregtech.loaders.*; import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechConduits; +import net.minecraftforge.common.config.Configuration; public class HANDLER_GT { public static GT_Config mMaterialProperties = null; + + public static GTPP_Config sCustomWorldgenFile = null; + public static final List<GTPP_Worldgen> sCustomWorldgenList = new ArrayList<GTPP_Worldgen>(); @SuppressWarnings("unused") public static void preInit(){ new MetaGeneratedGregtechItems(); + if (mMaterialProperties != null){ GT_Materials.init(mMaterialProperties); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/util/GTPP_Config.java b/src/Java/gtPlusPlus/xmod/gregtech/api/util/GTPP_Config.java new file mode 100644 index 0000000000..5a5ddd9d53 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/util/GTPP_Config.java @@ -0,0 +1,98 @@ +package gtPlusPlus.xmod.gregtech.api.util; + +import gregtech.api.GregTech_API; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Utility; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.config.Configuration; +import net.minecraftforge.common.config.Property; + +import static gregtech.api.enums.GT_Values.E; + +public class GTPP_Config implements Runnable { + public static boolean troll = false; + + public static Configuration sConfigFileIDs; + public final Configuration mConfig; + + public GTPP_Config(Configuration aConfig) { + mConfig = aConfig; + mConfig.load(); + mConfig.save(); + } + + public static int addIDConfig(Object aCategory, String aName, int aDefault) { + if (GT_Utility.isStringInvalid(aName)) return aDefault; + Property tProperty = sConfigFileIDs.get(aCategory.toString().replaceAll("\\|", "."), aName.replaceAll("\\|", "."), aDefault); + int rResult = tProperty.getInt(aDefault); + if (!tProperty.wasRead() && GregTech_API.sPostloadFinished) sConfigFileIDs.save(); + return rResult; + } + + public static String getStackConfigName(ItemStack aStack) { + if (GT_Utility.isStackInvalid(aStack)) return E; + Object rName = GT_OreDictUnificator.getAssociation(aStack); + if (rName != null) return rName.toString(); + try { + if (GT_Utility.isStringValid(rName = aStack.getUnlocalizedName())) return rName.toString(); + } catch (Throwable e) {/*Do nothing*/} + String sName = aStack.getItem().toString(); + String[] tmp = sName.split("@"); + if (tmp.length > 0) sName = tmp[0]; + return sName + "." + aStack.getItemDamage(); + } + + public boolean get(Object aCategory, ItemStack aStack, boolean aDefault) { + String aName = getStackConfigName(aStack); + return get(aCategory, aName, aDefault); + } + + public boolean get(Object aCategory, String aName, boolean aDefault) { + if (GT_Utility.isStringInvalid(aName)) return aDefault; + Property tProperty = mConfig.get(aCategory.toString().replaceAll("\\|", "_"), (aName + "_" + aDefault).replaceAll("\\|", "_"), aDefault); + boolean rResult = tProperty.getBoolean(aDefault); + if (!tProperty.wasRead() && GregTech_API.sPostloadFinished) mConfig.save(); + return rResult; + } + + public int get(Object aCategory, ItemStack aStack, int aDefault) { + return get(aCategory, getStackConfigName(aStack), aDefault); + } + + public int get(Object aCategory, String aName, int aDefault) { + if (GT_Utility.isStringInvalid(aName)) return aDefault; + Property tProperty = mConfig.get(aCategory.toString().replaceAll("\\|", "_"), (aName + "_" + aDefault).replaceAll("\\|", "_"), aDefault); + int rResult = tProperty.getInt(aDefault); + if (!tProperty.wasRead() && GregTech_API.sPostloadFinished) mConfig.save(); + return rResult; + } + + public double get(Object aCategory, ItemStack aStack, double aDefault) { + return get(aCategory, getStackConfigName(aStack), aDefault); + } + + public double get(Object aCategory, String aName, double aDefault) { + if (GT_Utility.isStringInvalid(aName)) return aDefault; + Property tProperty = mConfig.get(aCategory.toString().replaceAll("\\|", "_"), (aName + "_" + aDefault).replaceAll("\\|", "_"), aDefault); + double rResult = tProperty.getDouble(aDefault); + if (!tProperty.wasRead() && GregTech_API.sPostloadFinished) mConfig.save(); + return rResult; + } + + public String get(Object aCategory, ItemStack aStack, String aDefault) { + return get(aCategory, getStackConfigName(aStack), aDefault); + } + + public String get(Object aCategory, String aName, String aDefault) { + if (GT_Utility.isStringInvalid(aName)) return aDefault; + Property tProperty = mConfig.get(aCategory.toString().replaceAll("\\|", "_"), (aName + "_" + aDefault).replaceAll("\\|", "_"), aDefault); + String rResult = tProperty.getString(); + if (!tProperty.wasRead() && GregTech_API.sPostloadFinished) mConfig.save(); + return rResult; + } + + @Override + public void run() { + mConfig.save(); + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen.java b/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen.java new file mode 100644 index 0000000000..6b627bd8a8 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen.java @@ -0,0 +1,61 @@ +package gtPlusPlus.xmod.gregtech.api.world; + +import net.minecraft.world.World; +import net.minecraft.world.chunk.IChunkProvider; + +import static gtPlusPlus.xmod.gregtech.HANDLER_GT.sCustomWorldgenFile; + +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.concurrent.ConcurrentHashMap; + +public abstract class GTPP_Worldgen{ + + public final String mWorldGenName; + public final boolean mEnabled; + private final Map<String, Boolean> mDimensionMap = new ConcurrentHashMap<String, Boolean>(); + + public GTPP_Worldgen(String aName, List aList, boolean aDefault) { + mWorldGenName = aName; + mEnabled = sCustomWorldgenFile.get("worldgen", mWorldGenName, aDefault); + if (mEnabled) aList.add(this); + } + + /** + * @param aWorld The World Object + * @param aRandom The Random Generator to use + * @param aBiome The Name of the Biome (always != null) + * @param aDimensionType The Type of Worldgeneration to add. -1 = Nether, 0 = Overworld, +1 = End + * @param aChunkX xCoord of the Chunk + * @param aChunkZ zCoord of the Chunk + * @return if the Worldgeneration has been successfully completed + */ + public boolean executeWorldgen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, int aChunkZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { + return false; + } + + /** + * @param aWorld The World Object + * @param aRandom The Random Generator to use + * @param aBiome The Name of the Biome (always != null) + * @param aDimensionType The Type of Worldgeneration to add. -1 = Nether, 0 = Overworld, +1 = End + * @param aChunkX xCoord of the Chunk + * @param aChunkZ zCoord of the Chunk + * @return if the Worldgeneration has been successfully completed + */ + public boolean executeCavegen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, int aChunkZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { + return false; + } + + public boolean isGenerationAllowed(World aWorld, int aDimensionType, int aAllowedDimensionType) { + String aDimName = aWorld.provider.getDimensionName(); + Boolean tAllowed = mDimensionMap.get(aDimName); + if (tAllowed == null) { + boolean tValue = sCustomWorldgenFile.get("worldgen.dimensions." + mWorldGenName, aDimName, aDimensionType == aAllowedDimensionType); + mDimensionMap.put(aDimName, tValue); + return tValue; + } + return tAllowed; + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Boulder.java b/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Boulder.java new file mode 100644 index 0000000000..80bf3ca691 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Boulder.java @@ -0,0 +1,76 @@ +package gtPlusPlus.xmod.gregtech.api.world; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockContainer; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraft.world.chunk.IChunkProvider; + +import java.util.Collection; +import java.util.Random; + +public class GTPP_Worldgen_Boulder extends GTPP_Worldgen_Ore { + public GTPP_Worldgen_Boulder(String aName, boolean aDefault, Block aBlock, int aBlockMeta, int aDimensionType, int aAmount, int aSize, int aProbability, int aMinY, int aMaxY, Collection<String> aBiomeList, boolean aAllowToGenerateinVoid) { + super(aName, aDefault, aBlock, aBlockMeta, aDimensionType, aAmount, aSize, aProbability, aMinY, aMaxY, aBiomeList, aAllowToGenerateinVoid); + } + + @Override + public boolean executeWorldgen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, int aChunkZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { + if (isGenerationAllowed(aWorld, aDimensionType, mDimensionType) && (mBiomeList.isEmpty() || mBiomeList.contains(aBiome)) && (mProbability <= 1 || aRandom.nextInt(mProbability) == 0)) { + for (int i = 0; i < mAmount; i++) { + int tX = aChunkX + aRandom.nextInt(16), tY = mMinY + aRandom.nextInt(mMaxY - mMinY), tZ = aChunkZ + aRandom.nextInt(16); + Block tBlock = aWorld.getBlock(tX, tY - 7, tZ); + if (tBlock != null && tBlock.isOpaqueCube() && aWorld.getBlock(tX, tY - 6, tZ).isAir(aWorld, tX, tY - 6, tZ)) { + float math_pi = 3.141593F; + float var6 = aRandom.nextFloat() * math_pi; + float var1b = mSize / 8.0F; + float var3b = MathHelper.sin(var6) * var1b; float var4b = MathHelper.cos(var6) * var1b; + float var8b = -2*var3b;float var9b = -2*var4b; + int var10b = (tX + 8);int var11b = (tZ + 8); + float var7 = (var10b + var3b); + float var11 = (var11b + var4b); + int var5b = aRandom.nextInt(3);int var6b = aRandom.nextInt(3);int var7b = var6b - var5b; + float var15 = (tY + var5b - 2); + float var12b = math_pi / mSize; + + for (int var19 = 0; var19 <= mSize; ++var19) { + float var2b = var19 / mSize; + float var20 = var7 + var8b * var2b; + float var22 = var15 + var7b * var2b; + float var24 = var11 + var9b * var2b; + float var26 = aRandom.nextFloat() * mSize / 16.0F; + float var28 = ((MathHelper.sin(var19 * var12b) + 1.0F) * var26 + 1.0F) / 2.0F; + int var32 = MathHelper.floor_float(var20 - var28); + int var33 = MathHelper.floor_float(var22 - var28); + int var34 = MathHelper.floor_float(var24 - var28); + int var35 = MathHelper.floor_float(var20 + var28); + int var36 = MathHelper.floor_float(var22 + var28); + int var37 = MathHelper.floor_float(var24 + var28); + + for (int var38 = var32; var38 <= var35; ++var38) { + float var39 = (var38 + 0.5F - var20) / (var28); + float var13b = var39 * var39; + if (var13b < 1.0F) { + for (int var41 = var33; var41 <= var36; ++var41) { + float var42 = (var41 + 0.5F - var22) / (var28); + float var14b = var13b + var42 * var42; + if (var14b < 1.0F) { + for (int var44 = var34; var44 <= var37; ++var44) { + float var45 = (var44 + 0.5F - var24) / (var28); + Block block = aWorld.getBlock(var38, var41, var44); + if (var14b + var45 * var45 < 1.0F && ((mAllowToGenerateinVoid && aWorld.getBlock(var38, var41, var44).isAir(aWorld, var38, var41, var44)) || (block != null && !(block instanceof BlockContainer)))) { + aWorld.setBlock(var38, var41, var44, mBlock, mBlockMeta, 0); + } + } + } + } + } + } + } + } + } + return true; + } + return false; + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_GT_Ore_Layer.java b/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_GT_Ore_Layer.java new file mode 100644 index 0000000000..eb91919686 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_GT_Ore_Layer.java @@ -0,0 +1,127 @@ +package gtPlusPlus.xmod.gregtech.api.world; + +import static gtPlusPlus.xmod.gregtech.HANDLER_GT.sCustomWorldgenFile; + +import gregtech.GT_Mod; +import gregtech.api.GregTech_API; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.Materials; +import gregtech.api.world.GT_Worldgen; +import gregtech.common.blocks.GT_TileEntity_Ores; +import gregtech.loaders.misc.GT_Achievements; +import gtPlusPlus.core.material.Material; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraft.world.chunk.IChunkProvider; + +import java.util.ArrayList; +import java.util.Random; + +public class GTPP_Worldgen_GT_Ore_Layer + extends GTPP_Worldgen { + public static ArrayList<GTPP_Worldgen_GT_Ore_Layer> sList = new ArrayList<GTPP_Worldgen_GT_Ore_Layer>(); + public static int sWeight = 0; + public final short mMinY; + public final short mMaxY; + public final short mWeight; + public final short mDensity; + public final short mSize; + public short mPrimaryMeta; + public short mSecondaryMeta; + public short mBetweenMeta; + public short mSporadicMeta; + public final String mRestrictBiome; + public final boolean mDarkWorld; + public final String aTextWorldgen = "worldgen.gtpp."; + + public GTPP_Worldgen_GT_Ore_Layer(String aName, boolean aDefault, int aMinY, int aMaxY, int aWeight, int aDensity, int aSize, boolean aOverworld, Materials aPrimary, Materials aSecondary, Materials aBetween, Materials aSporadic) { + super(aName, sList, aDefault); + this.mDarkWorld = sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Overworld", aOverworld); + this.mMinY = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MinHeight", aMinY)); + this.mMaxY = ((short) Math.max(this.mMinY + 5, sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MaxHeight", aMaxY))); + this.mWeight = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "RandomWeight", aWeight)); + this.mDensity = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Density", aDensity)); + this.mSize = ((short) Math.max(1, sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Size", aSize))); + this.mPrimaryMeta = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OrePrimaryLayer", aPrimary.mMetaItemSubID)); + this.mSecondaryMeta = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OreSecondaryLayer", aSecondary.mMetaItemSubID)); + this.mBetweenMeta = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OreSporadiclyInbetween", aBetween.mMetaItemSubID)); + this.mSporadicMeta = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OreSporaticlyAround", aSporadic.mMetaItemSubID)); + this.mRestrictBiome = sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "RestrictToBiomeName", "None"); + + if (this.mEnabled) { + GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mPrimaryMeta % 1000)], aMinY, aMaxY, aWeight, false, false, false); + GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mSecondaryMeta % 1000)], aMinY, aMaxY, aWeight, false, false, false); + GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mBetweenMeta % 1000)], aMinY, aMaxY, aWeight, false, false, false); + GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mSporadicMeta % 1000)], aMinY, aMaxY, aWeight, false, false, false); + sWeight += this.mWeight; + } + } + + public GTPP_Worldgen_GT_Ore_Layer(String aName, boolean aDefault, int aMinY, int aMaxY, int aWeight, int aDensity, + int aSize, Material aPrimary, Material aSecondary, Material aBetween, + Material aSporadic) { + super(aName, sList, aDefault); + this.mDarkWorld = sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Darkworld", true); + this.mMinY = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MinHeight", aMinY)); + this.mMaxY = ((short) Math.max(this.mMinY + 5, sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MaxHeight", aMaxY))); + this.mWeight = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "RandomWeight", aWeight)); + this.mDensity = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Density", aDensity)); + this.mSize = ((short) Math.max(1, sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Size", aSize))); + /* this.mPrimaryMeta = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OrePrimaryLayer", aPrimary.mMetaItemSubID)); + this.mSecondaryMeta = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OreSecondaryLayer", aSecondary.mMetaItemSubID)); + this.mBetweenMeta = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OreSporadiclyInbetween", aBetween.mMetaItemSubID)); + this.mSporadicMeta = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OreSporaticlyAround", aSporadic.mMetaItemSubID)); + */this.mRestrictBiome = sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "RestrictToBiomeName", "None"); + + if (this.mEnabled) { + GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mPrimaryMeta % 1000)], aMinY, aMaxY, aWeight, false, false, false); + GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mSecondaryMeta % 1000)], aMinY, aMaxY, aWeight, false, false, false); + GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mBetweenMeta % 1000)], aMinY, aMaxY, aWeight, false, false, false); + GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mSporadicMeta % 1000)], aMinY, aMaxY, aWeight, false, false, false); + sWeight += this.mWeight; + } + } + + public boolean executeWorldgen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, int aChunkZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { + if (!this.mRestrictBiome.equals("None") && !(this.mRestrictBiome.equals(aBiome))) { + return false; //Not the correct biome for ore mix + } + if (!isGenerationAllowed(aWorld, aDimensionType, ((aDimensionType == -1) && (false)) || ((aDimensionType == 0) && (this.mDarkWorld)) || ((aDimensionType == 1) && (false)) || ((aWorld.provider.getDimensionName().equals("Moon")) && (false)) || ((aWorld.provider.getDimensionName().equals("Mars")) && (false)) ? aDimensionType : aDimensionType ^ 0xFFFFFFFF)) { + return false; + } + int tMinY = this.mMinY + aRandom.nextInt(this.mMaxY - this.mMinY - 5); + + int cX = aChunkX - aRandom.nextInt(this.mSize); + int eX = aChunkX + 16 + aRandom.nextInt(this.mSize); + for (int tX = cX; tX <= eX; tX++) { + int cZ = aChunkZ - aRandom.nextInt(this.mSize); + int eZ = aChunkZ + 16 + aRandom.nextInt(this.mSize); + for (int tZ = cZ; tZ <= eZ; tZ++) { + if (this.mSecondaryMeta > 0) { + for (int i = tMinY - 1; i < tMinY + 2; i++) { + if ((aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) / this.mDensity)) == 0) || (aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) / this.mDensity)) == 0)) { + GT_TileEntity_Ores.setOreBlock(aWorld, tX, i, tZ, this.mSecondaryMeta, false); + } + } + } + if ((this.mBetweenMeta > 0) && ((aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) / this.mDensity)) == 0) || (aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) / this.mDensity)) == 0))) { + GT_TileEntity_Ores.setOreBlock(aWorld, tX, tMinY + 2 + aRandom.nextInt(2), tZ, this.mBetweenMeta, false); + } + if (this.mPrimaryMeta > 0) { + for (int i = tMinY + 3; i < tMinY + 6; i++) { + if ((aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) / this.mDensity)) == 0) || (aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) / this.mDensity)) == 0)) { + GT_TileEntity_Ores.setOreBlock(aWorld, tX, i, tZ, this.mPrimaryMeta, false); + } + } + } + if ((this.mSporadicMeta > 0) && ((aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) / this.mDensity)) == 0) || (aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) / this.mDensity)) == 0))) { + GT_TileEntity_Ores.setOreBlock(aWorld, tX, tMinY - 1 + aRandom.nextInt(7), tZ, this.mSporadicMeta, false); + } + } + } + if (GT_Values.D1) { + System.out.println("Generated Orevein: " + this.mWorldGenName+" "+aChunkX +" "+ aChunkZ); + } + return true; + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Handler.java b/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Handler.java new file mode 100644 index 0000000000..aae3bdd48a --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Handler.java @@ -0,0 +1,41 @@ +package gtPlusPlus.xmod.gregtech.api.world; + +import static gtPlusPlus.xmod.gregtech.api.world.WorldGenUtils.mOresToRegister; + +import gtPlusPlus.core.material.Material; + +public class GTPP_Worldgen_Handler implements Runnable{ + + + + @Override + public void run() { + + for (GT_OreVein_Object ore : mOresToRegister){ + generateNewVein(ore); + } + + } + + + + private final GTPP_Worldgen_GT_Ore_Layer generateNewVein(final GT_OreVein_Object ore){ + return generateNewVein(ore.mOreMixName, ore.minY, ore.maxY, ore.weight, ore.density, ore.size, ore.aPrimary, ore.aSecondary, ore.aBetween, ore.aSporadic); + } + + private final GTPP_Worldgen_GT_Ore_Layer generateNewVein(String mOreMixName, int minY, int maxY, int weight, int density, int size, + Material aPrimary, Material aSecondary, Material aBetween, Material aSporadic){ + return new GTPP_Worldgen_GT_Ore_Layer( + "ore.mix."+mOreMixName, //String aName, + true, //boolean aDefault, + minY, maxY, //int aMinY, int aMaxY, + weight, //int aWeight, + density, //int aDensity, + size, //int aSize, + aPrimary, //Materials aPrimary, + aSecondary, //Materials aSecondary, + aBetween, //Materials aBetween, + aSporadic); //Materials aSporadic + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Ore.java b/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Ore.java new file mode 100644 index 0000000000..8f68cb2179 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Ore.java @@ -0,0 +1,32 @@ +package gtPlusPlus.xmod.gregtech.api.world; + +import gtPlusPlus.xmod.gregtech.HANDLER_GT; +import net.minecraft.block.Block; + +import static gtPlusPlus.xmod.gregtech.HANDLER_GT.sCustomWorldgenFile; + +import java.util.ArrayList; +import java.util.Collection; + +public abstract class GTPP_Worldgen_Ore extends GTPP_Worldgen { + public final int mBlockMeta, mAmount, mSize, mMinY, mMaxY, mProbability, mDimensionType; + public final Block mBlock; + public final Collection<String> mBiomeList; + public final boolean mAllowToGenerateinVoid; + private final String aTextWorldgen = "worldgen."; + + public GTPP_Worldgen_Ore(String aName, boolean aDefault, Block aBlock, int aBlockMeta, int aDimensionType, int aAmount, int aSize, int aProbability, int aMinY, int aMaxY, Collection<String> aBiomeList, boolean aAllowToGenerateinVoid) { + super(aName, HANDLER_GT.sCustomWorldgenList, aDefault); + mDimensionType = aDimensionType; + mBlock = aBlock; + mBlockMeta = Math.min(Math.max(aBlockMeta, 0), 15); + mProbability = sCustomWorldgenFile.get(aTextWorldgen + mWorldGenName, "Probability", aProbability); + mAmount = sCustomWorldgenFile.get(aTextWorldgen + mWorldGenName, "Amount", aAmount); + mSize = sCustomWorldgenFile.get(aTextWorldgen + mWorldGenName, "Size", aSize); + mMinY = sCustomWorldgenFile.get(aTextWorldgen + mWorldGenName, "MinHeight", aMinY); + mMaxY = sCustomWorldgenFile.get(aTextWorldgen + mWorldGenName, "MaxHeight", aMaxY); + if (aBiomeList == null) mBiomeList = new ArrayList<String>(); + else mBiomeList = aBiomeList; + mAllowToGenerateinVoid = aAllowToGenerateinVoid; + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Ore_Normal.java b/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Ore_Normal.java new file mode 100644 index 0000000000..78d414fc4b --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Ore_Normal.java @@ -0,0 +1,74 @@ +package gtPlusPlus.xmod.gregtech.api.world; + +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraft.world.chunk.IChunkProvider; + +import java.util.Collection; +import java.util.Random; + +public class GTPP_Worldgen_Ore_Normal extends GTPP_Worldgen_Ore { + public GTPP_Worldgen_Ore_Normal(String aName, boolean aDefault, Block aBlock, int aBlockMeta, int aDimensionType, int aAmount, int aSize, int aProbability, int aMinY, int aMaxY, Collection<String> aBiomeList, boolean aAllowToGenerateinVoid) { + super(aName, aDefault, aBlock, aBlockMeta, aDimensionType, aAmount, aSize, aProbability, aMinY, aMaxY, aBiomeList, aAllowToGenerateinVoid); + } + + @Override + public boolean executeWorldgen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, int aChunkZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { + if (isGenerationAllowed(aWorld, aDimensionType, mDimensionType) && (mBiomeList.isEmpty() || mBiomeList.contains(aBiome)) && (mProbability <= 1 || aRandom.nextInt(mProbability) == 0)) { + for (int i = 0; i < mAmount; i++) { + int tX = aChunkX + aRandom.nextInt(16), tY = mMinY + aRandom.nextInt(mMaxY - mMinY), tZ = aChunkZ + aRandom.nextInt(16); + if (mAllowToGenerateinVoid || aWorld.getBlock(tX, tY, tZ).isAir(aWorld, tX, tY, tZ)) { + float math_pi = 3.141593F;float var1b = mSize / 8.0F; + float var6 = aRandom.nextFloat() * math_pi; + float var3b = MathHelper.sin(var6) * var1b; float var4b = MathHelper.cos(var6) * var1b; + float var8b = -2*var3b;float var9b = -2*var4b; + int var10b = (tX + 8);int var11b = (tZ + 8); + float var7 = (var10b + var3b); + float var11 = (var11b + var4b); + int var5b = aRandom.nextInt(3);int var6b = aRandom.nextInt(3);int var7b = var6b - var5b; + float var15 = (tY + var5b - 2); + float var12b = math_pi / mSize; + + for (int var19 = 0; var19 <= mSize; ++var19) { + float var2b = var19 / mSize; + float var20 = var7 + var8b * var2b; + float var22 = var15 + var7b * var2b; + float var24 = var11 + var9b * var2b; + float var26 = aRandom.nextFloat() * mSize / 16.0F; + float var28 = ((MathHelper.sin(var19 * var12b) + 1.0F) * var26 + 1.0F) / 2.0F; + int var32 = MathHelper.floor_float(var20 - var28); + int var33 = MathHelper.floor_float(var22 - var28); + int var34 = MathHelper.floor_float(var24 - var28); + int var35 = MathHelper.floor_float(var20 + var28); + int var36 = MathHelper.floor_float(var22 + var28); + int var37 = MathHelper.floor_float(var24 + var28); + + for (int var38 = var32; var38 <= var35; ++var38) { + float var39 = (var38 + 0.5F - var20) / (var28); + float var13b = var39 * var39; + if (var13b < 1.0F) { + for (int var41 = var33; var41 <= var36; ++var41) { + float var42 = (var41 + 0.5F - var22) / (var28); + float var14b = var13b + var42 * var42; + if (var14b < 1.0F) { + for (int var44 = var34; var44 <= var37; ++var44) { + float var45 = (var44 + 0.5F - var24) / (var28); + Block block = aWorld.getBlock(var38, var41, var44); + if (var14b + var45 * var45 < 1.0F && ((mAllowToGenerateinVoid && aWorld.getBlock(var38, var41, var44).isAir(aWorld, var38, var41, var44)) || (block != null && (block.isReplaceableOreGen(aWorld, var38, var41, var44, Blocks.stone) || block.isReplaceableOreGen(aWorld, var38, var41, var44, Blocks.end_stone) || block.isReplaceableOreGen(aWorld, var38, var41, var44, Blocks.netherrack))))) { + aWorld.setBlock(var38, var41, var44, mBlock, mBlockMeta, 0); + } + } + } + } + } + } + } + } + } + return true; + } + return false; + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/world/GT_OreVein_Object.java b/src/Java/gtPlusPlus/xmod/gregtech/api/world/GT_OreVein_Object.java new file mode 100644 index 0000000000..770083fee8 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/world/GT_OreVein_Object.java @@ -0,0 +1,31 @@ +package gtPlusPlus.xmod.gregtech.api.world; + +import gtPlusPlus.core.material.Material; + +public class GT_OreVein_Object { + + final String mOreMixName; //String aName, + final int minY, maxY; //int aMinY, int aMaxY, + final int weight; //int aWeight, + final int density; //int aDensity, + final int size; //int aSize, + final Material aPrimary; //Materials aPrimary, + final Material aSecondary; //Materials aSecondary, + final Material aBetween; //Materials aBetween, + final Material aSporadic; //Materials aSporadic + + GT_OreVein_Object(String mOreMixName, int minY, int maxY, int weight, int density, int size, + Material aPrimary, Material aSecondary, Material aBetween, Material aSporadic){ + this.mOreMixName = mOreMixName; + this.minY = minY; + this.maxY = maxY; + this.weight = weight; + this.density = density; + this.size = size; + this.aPrimary = aPrimary; + this.aSecondary = aSecondary; + this.aBetween = aBetween; + this.aSporadic = aSporadic; + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/world/WorldGenUtils.java b/src/Java/gtPlusPlus/xmod/gregtech/api/world/WorldGenUtils.java new file mode 100644 index 0000000000..fd0738596a --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/world/WorldGenUtils.java @@ -0,0 +1,23 @@ +package gtPlusPlus.xmod.gregtech.api.world; + +import java.util.ArrayList; +import java.util.List; + +import gtPlusPlus.core.material.Material; + +public class WorldGenUtils { + + static List<GT_OreVein_Object> mOresToRegister = new ArrayList<GT_OreVein_Object>(); + + public static final void addNewOreMixForWorldgen(GT_OreVein_Object newVein){ + mOresToRegister.add(newVein); + } + + public static boolean generateNewOreVeinObject(String mOreMixName, int minY, int maxY, int weight, int density, int size, + Material aPrimary, Material aSecondary, Material aBetween, Material aSporadic){ + GT_OreVein_Object newVein = new GT_OreVein_Object(mOreMixName, minY, maxY, weight, density, size, aPrimary, aSecondary, aBetween, aSporadic); + addNewOreMixForWorldgen(newVein); + return true; + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java index 09fa9dc2c3..11ac10db69 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java @@ -10,6 +10,13 @@ import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; import gregtech.api.objects.GT_ItemStack; import gregtech.api.objects.GT_RenderedTexture; @@ -21,6 +28,7 @@ import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.core.material.nuclear.FLUORIDES; import gtPlusPlus.core.material.nuclear.NUCLIDE; import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.fluid.FluidUtils; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; import net.minecraft.entity.player.InventoryPlayer; @@ -35,7 +43,6 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase protected int fuelConsumption = 0; protected int fuelValue = 0; protected int fuelRemaining = 0; - protected double realOptFlow = 0; protected boolean boostEu = false; protected boolean heliumSparging = false; @@ -78,13 +85,15 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase "Liquid Fluoride Thorium Reactor", tRunning, tMaintainance, - "Current Output: "+((this.mEUt*this.mEfficiency)/10000)+" EU/t", + "Current Output: "+this.mEUt+" EU/t", "Fuel Consumption: "+this.fuelConsumption+"L/t", "Fuel Value: "+this.fuelValue+" EU/L", "Fuel Remaining: "+this.fuelRemaining+" Litres", - "Current Efficiency: "+(this.mEfficiency/100)+"%", - "Optimal Fuel Flow: "+(int)this.realOptFlow+" L/t", - "Current Speed: "+(this.mEfficiency/100)+"%",}; + "Current Efficiency: "+(this.mEfficiency/5)+"%", + "Current Efficiency (Raw): "+(this.mEfficiency), + "Boosted Output: "+this.boostEu+".", + "Boosted Output gives 4x EU/t for double fuel usage.", + "It requires you to have 100% Efficiency."}; } @Override @@ -99,11 +108,22 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase @Override public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { - if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(12)], - new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_REPLICATOR_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_REPLICATOR)}; + if (!aBaseMetaTileEntity.isActive() || this.mEfficiency < 500){ + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(12)], + new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_REPLICATOR_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_REPLICATOR)}; + } + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(12)]}; + } + else if(aBaseMetaTileEntity.isActive() && this.mEfficiency >= 500){ + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(13)], + new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_REPLICATOR_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_REPLICATOR)}; + } + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(13)]}; } return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(12)]}; + } @Override @@ -147,14 +167,14 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase if ((h == 0) || (h == 3)) { //If not a hatch, continue, else add hatch and continue. - if ((!this.addMufflerToMachineList(tTileEntity, 70)) && (!this.addOutputToMachineList(tTileEntity, 70)) && (!this.addDynamoToMachineList(tTileEntity, 70))) { + if ((!this.addMufflerToMachineList(tTileEntity, TAE.GTPP_INDEX(12))) && (!this.addOutputToMachineList(tTileEntity, TAE.GTPP_INDEX(12))) && (!this.addDynamoToMachineList(tTileEntity, TAE.GTPP_INDEX(12)))) { if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { - Utils.LOG_INFO("LFTR Casing(s) Missing from one of the top layers inner 3x3."); + Utils.LOG_INFO("Hastelloy-N Reactor Casing(s) Missing from one of the top layers inner 3x3."); Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); return false; } if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 12) { - Utils.LOG_INFO("LFTR Casing(s) Missing from one of the top layers inner 3x3. Wrong Meta for Casing."); + Utils.LOG_INFO("Hastelloy-N Reactor Casing(s) Missing from one of the top layers inner 3x3. Wrong Meta for Casing."); return false; } } @@ -176,12 +196,12 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase /* else { //carbon moderation rods are at 1,1 & -1,-1 & 1,-1 & -1,1 if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { - Utils.LOG_INFO("LFTR Casing(s) Missing from one of the top layers inner 3x3."); - Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); + Utils.LOG_WARNING("LFTR Casing(s) Missing from one of the top layers inner 3x3."); + Utils.LOG_WARNING("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); return false; } if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 12) { - Utils.LOG_INFO("LFTR Casing(s) Missing from one of the top layers inner 3x3."); + Utils.LOG_WARNING("LFTR Casing(s) Missing from one of the top layers inner 3x3."); return false; } }*/ @@ -194,12 +214,12 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase //Deal with all 4 sides (Reactor walls) if ((h == 1) || (h == 2)) { if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { - Utils.LOG_INFO("Glass Casings Missing from somewhere in the second layer."); + Utils.LOG_INFO("Reactor Shielding Missing from somewhere in the second layer."); Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); return false; } if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 13) { - Utils.LOG_INFO("Glass Casings Missing from somewhere in the second layer."); + Utils.LOG_INFO("Reactor Shielding Missing from somewhere in the second layer."); Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); return false; } @@ -211,12 +231,12 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase if (((xDir + i) != 0) || ((zDir + j) != 0)) {//no controller if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { - Utils.LOG_INFO("LFTR Casing(s) Missing from one of the edges on the top layer."); + Utils.LOG_INFO("Hastelloy-N Reactor Casing(s) Missing from one of the edges on the top layer."); Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); return false; } if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 12) { - Utils.LOG_INFO("LFTR Casing(s) Missing from one of the edges on the top layer. "+h); + Utils.LOG_INFO("Hastelloy-N Reactor Casing(s) Missing from one of the edges on the top layer. "+h); Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); if (h ==0){ if (tTileEntity instanceof GregtechMTE_NuclearReactor){ @@ -235,14 +255,11 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase } } - if (this.mMufflerHatches.size() != 4){ - Utils.LOG_INFO("You require EXACTLY 4 muffler hatches on top. FOUR."); - return false; - } - if (this.mEnergyHatches != null) { - for (int i = 0; i < this.mEnergyHatches.size(); i++) { - if (this.mEnergyHatches.get(i).mTier < 5){ - Utils.LOG_INFO("You require at LEAST V tier Energy Hatches."); + + if (this.mDynamoHatches != null) { + for (int i = 0; i < this.mDynamoHatches.size(); i++) { + if (this.mDynamoHatches.get(i).mTier < 5){ + Utils.LOG_INFO("You require at LEAST IV tier Dynamo Hatches."); Utils.LOG_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord()); return false; } @@ -252,7 +269,7 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase for (int i = 0; i < this.mOutputHatches.size(); i++) { if ((this.mOutputHatches.get(i).mTier < 5) && (this.mOutputHatches.get(i).getBaseMetaTileEntity() instanceof GregtechMTE_NuclearReactor)){ - Utils.LOG_INFO("You require at LEAST V tier Output Hatches."); + Utils.LOG_INFO("You require at LEAST IV tier Output Hatches."); Utils.LOG_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord()); Utils.LOG_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getInventoryName()); return false; @@ -262,20 +279,40 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase if (this.mInputHatches != null) { for (int i = 0; i < this.mInputHatches.size(); i++) { if (this.mInputHatches.get(i).mTier < 5){ - Utils.LOG_INFO("You require at LEAST V tier Input Hatches."); + Utils.LOG_INFO("You require at LEAST IV tier Input Hatches."); Utils.LOG_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord()); Utils.LOG_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getInventoryName()); return false; } } } + if (this.mMufflerHatches.size() != 4){ + Utils.LOG_INFO("You require EXACTLY 4 muffler hatches on top. FOUR. You have "+this.mMufflerHatches.size()); + return false; + } + if (this.mInputHatches.size() < 4){ + Utils.LOG_INFO("You require 4 or more input hatches. You have "+this.mInputHatches.size()); + return false; + } + if (this.mOutputHatches.size() < 10){ + Utils.LOG_INFO("You require 10 or more output hatches. You have "+this.mOutputHatches.size()); + return false; + } + if (this.mDynamoHatches.size() != 4){ + Utils.LOG_INFO("You require EXACTLY 4 dynamo hatches. FOUR. You have "+this.mDynamoHatches.size()); + return false; + } + if (this.mMaintenanceHatches.size() != 2){ + Utils.LOG_INFO("You require EXACTLY 2 muffler hatches. TWO. You have "+this.mMaintenanceHatches.size()); + return false; + } this.mWrench = true; this.mScrewdriver = true; this.mSoftHammer = true; this.mHardHammer = true; this.mSolderingTool = true; this.mCrowbar = true; - this.turnCasingActive(true); + this.turnCasingActive(false); Utils.LOG_INFO("Multiblock Formed."); return true; } @@ -292,7 +329,7 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase @Override public int getPollutionPerTick(final ItemStack aStack) { - return 5; + return this.boostEu ? 8 : 4; } @Override @@ -316,36 +353,31 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase public boolean turnCasingActive(final boolean status) { //TODO - /*if (this.mDynamoHatches != null) { + if (this.mDynamoHatches != null) { for (final GT_MetaTileEntity_Hatch_Dynamo hatch : this.mDynamoHatches) { - hatch.mMachineBlock = status ? (byte) 70 : (byte) 71; + hatch.mMachineBlock = status ? (byte) TAE.GTPP_INDEX(13) : (byte) TAE.GTPP_INDEX(12); } } if (this.mMufflerHatches != null) { for (final GT_MetaTileEntity_Hatch_Muffler hatch : this.mMufflerHatches) { - hatch.mMachineBlock = status ? (byte) 70 : (byte) 71; + hatch.mMachineBlock = status ? (byte) TAE.GTPP_INDEX(13) : (byte) TAE.GTPP_INDEX(12); } } if (this.mOutputHatches != null) { for (final GT_MetaTileEntity_Hatch_Output hatch : this.mOutputHatches) { - hatch.mMachineBlock = status ? (byte) 70 : (byte) 71; + hatch.mMachineBlock = status ? (byte) TAE.GTPP_INDEX(13) : (byte) TAE.GTPP_INDEX(12); } } if (this.mInputHatches != null) { for (final GT_MetaTileEntity_Hatch_Input hatch : this.mInputHatches) { - hatch.mMachineBlock = status ? (byte) 70 : (byte) 71; + hatch.mMachineBlock = status ? (byte) TAE.GTPP_INDEX(13) : (byte) TAE.GTPP_INDEX(12); } } - if (this.mOutputBusses != null) { - for (final GT_MetaTileEntity_Hatch_OutputBus hatch : this.mOutputBusses) { - hatch.mMachineBlock = status ? (byte) 70 : (byte) 71; + if (this.mMaintenanceHatches != null) { + for (final GT_MetaTileEntity_Hatch_Maintenance hatch : this.mMaintenanceHatches) { + hatch.mMachineBlock = status ? (byte) TAE.GTPP_INDEX(13) : (byte) TAE.GTPP_INDEX(12); } } - if (this.mInputBusses != null) { - for (final GT_MetaTileEntity_Hatch_InputBus hatch : this.mInputBusses) { - hatch.mMachineBlock = status ? (byte) 70 : (byte) 71; - } - }*/ return true; } @@ -356,23 +388,18 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase final ArrayList<FluidStack> tFluids = this.getStoredFluids(); final Collection<GT_Recipe> tRecipeList = Recipe_GT.Gregtech_Recipe_Map.sLiquidFluorineThoriumReactorRecipes.mRecipeList; if((tFluids.size() > 0) && (tRecipeList != null)) { //Does input hatch have a LFTR fuel? - Utils.LOG_INFO("Found more than one input fluid and a list of valid recipes."); - final boolean containsFLIBE = false; - final boolean containsPrimarySalt = false; + Utils.LOG_WARNING("Found more than one input fluid and a list of valid recipes."); for (final FluidStack hatchFluid1 : tFluids) { //Loops through hatches - Utils.LOG_INFO("Looping through Input hatches - Found "+hatchFluid1.getLocalizedName()); + Utils.LOG_WARNING("Looping through Input hatches - Found "+hatchFluid1.getLocalizedName()); for(final GT_Recipe aFuel : tRecipeList) { //Loops through LFTR fuel recipes - Utils.LOG_INFO("Looping through Recipes. "+aFuel.mSpecialValue); + Utils.LOG_WARNING("Looping through Recipes. "+aFuel.mSpecialValue); FluidStack tLiquid; final FluidStack testStack = aFuel.mFluidInputs[1]; if ((tLiquid = testStack) != null) { //Create fluidstack from current recipe - Utils.LOG_INFO("Creating a fluidstack from the current recipe. "+testStack.getLocalizedName()); + Utils.LOG_WARNING("Creating a fluidstack from the current recipe. "+testStack.getLocalizedName()); if (hatchFluid1.isFluidEqual(tLiquid)) { //Has a LFTR fluid this.fuelConsumption = this.boostEu ? (aFuel.mSpecialValue/4096) : (aFuel.mSpecialValue/2048); //Calc fuel consumption - Utils.LOG_INFO("Input hatch contains some FLiBe Fuel, using "+this.fuelConsumption); - if(this.depleteInput(tLiquid)) { //Deplete that amount - Utils.LOG_INFO("Depleted some FLiBe fluid"); - + this.mMaxProgresstime = 500; if(tFluids.contains(NUCLIDE.LiFBeF2ThF4UF4.getFluid(1)) || @@ -383,18 +410,39 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase //U235 fuel is 10x less efficient than UF4 with Thorium, UF4 with Zirconium is only 2x less efficient than UF4 with Thorium. //Most Efficient if(tFluids.contains(NUCLIDE.LiFBeF2ThF4UF4.getFluid(2))){ + + FluidStack depletionStack = FluidUtils.getFluidStack(tLiquid, (this.boostEu ? (aFuel.mSpecialValue/4096) : (aFuel.mSpecialValue/2048))); + Utils.LOG_WARNING("Input hatch contains some FLiBe Fuel, using "+this.fuelConsumption+" | "+aFuel.mSpecialValue+" | "+depletionStack.amount); + if(this.depleteInput(depletionStack)) { //Deplete that amount + Utils.LOG_WARNING("Depleted some FLiBe fluid"); + } + this.depleteInput(NUCLIDE.LiFBeF2ThF4UF4.getFluid(this.boostEu ? 2 : 1)); - Utils.LOG_INFO("Depleted "+(this.boostEu ? 2 : 1)+"L of LiFBeF2ThF4UF4 fluid"); + Utils.LOG_WARNING("Depleted "+(this.boostEu ? 2 : 1)+"L of LiFBeF2ThF4UF4 fluid"); } //1/2 as Efficient if (tFluids.contains(NUCLIDE.LiFBeF2ZrF4UF4.getFluid(4))){ + + FluidStack depletionStack = FluidUtils.getFluidStack(tLiquid, (this.boostEu ? (aFuel.mSpecialValue/4096) : (aFuel.mSpecialValue/2048))); + Utils.LOG_WARNING("Input hatch contains some FLiBe Fuel, using "+this.fuelConsumption+" | "+aFuel.mSpecialValue+" | "+depletionStack.amount); + if(this.depleteInput(depletionStack)) { //Deplete that amount + Utils.LOG_WARNING("Depleted some FLiBe fluid"); + } + this.depleteInput(NUCLIDE.LiFBeF2ZrF4UF4.getFluid(this.boostEu ? 4 : 2)); - Utils.LOG_INFO("Depleted "+(this.boostEu ? 4 : 2)+"L of LiFBeF2ZrF4UF4 fluid"); + Utils.LOG_WARNING("Depleted "+(this.boostEu ? 4 : 2)+"L of LiFBeF2ZrF4UF4 fluid"); } //10x less Efficient. if (tFluids.contains(NUCLIDE.LiFBeF2ZrF4U235.getFluid(20))) { + + FluidStack depletionStack = FluidUtils.getFluidStack(tLiquid, (this.boostEu ? (aFuel.mSpecialValue/4096) : (aFuel.mSpecialValue/2048))); + Utils.LOG_WARNING("Input hatch contains some FLiBe Fuel, using "+this.fuelConsumption+" | "+aFuel.mSpecialValue+" | "+depletionStack.amount); + if(this.depleteInput(depletionStack)) { //Deplete that amount + Utils.LOG_WARNING("Depleted some FLiBe fluid"); + } + this.depleteInput(NUCLIDE.LiFBeF2ZrF4U235.getFluid(this.boostEu ? 20 : 10)); - Utils.LOG_INFO("Depleted "+(this.boostEu ? 20 : 10)+"L of LiFBeF2ZrF4U235 fluid"); + Utils.LOG_WARNING("Depleted "+(this.boostEu ? 20 : 10)+"L of LiFBeF2ZrF4U235 fluid"); } } } else { @@ -407,7 +455,7 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase if (this.depleteInput(Materials.Helium.getGas(1000L))){ //Make an empty fluid stack for possible sparging output FluidStack[] spargeOutput = new FluidStack[]{}; - Utils.LOG_INFO("Doing a Sparge with Helium - "+this.heliumSparging); + Utils.LOG_WARNING("Doing a Sparge with Helium - "+this.heliumSparging); this.heliumSparging = false; spargeOutput = this.getByproductsOfSparge(Materials.Helium.getGas(1000L)); @@ -415,7 +463,7 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase try { if (spargeOutput.length >= 1){ for (final FluidStack F : spargeOutput){ - Utils.LOG_INFO("Adding Sparge Output - "+F.getLocalizedName()); + Utils.LOG_WARNING("Adding Sparge Output - "+F.getLocalizedName()); this.addOutput(F); } } @@ -427,13 +475,13 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase if (this.depleteInput(Materials.Fluorine.getGas(100L))){ //Make an empty fluid stack for possible sparging output FluidStack[] spargeOutput = new FluidStack[]{}; - Utils.LOG_INFO("Doing a Sparge with Fluorine"); + Utils.LOG_WARNING("Doing a Sparge with Fluorine"); spargeOutput = this.getByproductsOfSparge(Materials.Fluorine.getGas(100L)); this.heliumSparging = true; //If Sparging occurred, try add the outputs to the output hatches. if (spargeOutput.length > 0){ for (final FluidStack F : spargeOutput){ - Utils.LOG_INFO("Adding Sparge Output - "+F.getLocalizedName()); + Utils.LOG_WARNING("Adding Sparge Output - "+F.getLocalizedName()); this.addOutput(F); } } @@ -442,7 +490,7 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase if (aFuel != null){ - //Utils.LOG_INFO("Saving previous Recipe."); + //Utils.LOG_WARNING("Saving previous Recipe."); //this.mLastRecipe = aFuel; } @@ -460,11 +508,11 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase else if (this.mEfficiency > 500){ this.mEfficiency = 500; } - Utils.LOG_INFO("Efficiency == "+this.mEfficiency); - - this.mEUt = (this.mEfficiency < 500 ? 2048 : (8196*4)); //Output 0 if startup is less than 20% - Utils.LOG_INFO("Generating "+this.mEUt+"EU/t @ an efficiency level of "+this.mEfficiency); + Utils.LOG_WARNING("Efficiency == "+this.mEfficiency); + this.mEUt = (this.mEfficiency < 500 ? 2048 : (8196)); //Output 0 if startup is less than 20% + Utils.LOG_WARNING("Generating "+this.mEUt+"EU/t @ an efficiency level of "+this.mEfficiency); + this.mProgresstime = 1; this.mMaxProgresstime = 1; this.mEfficiencyIncrease = 15; @@ -476,8 +524,7 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase } } } - } - } + } } this.mEUt = 0; this.mEfficiency = 0; @@ -487,7 +534,7 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase public int getAmountOfOutputs() { - return 1; + return 10; } @Override @@ -543,7 +590,7 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase MathUtils.roundToClosestInt(MathUtils.randInt(10, 100)/10) }; final int heliumContent = (1000-outputChances[0]-outputChances[1]-outputChances[2]-outputChances[3]-outputChances[4]); - Utils.LOG_INFO("Helium remaining: "+heliumContent); + Utils.LOG_WARNING("Helium remaining: "+heliumContent); outputArrayOfGases = new FluidStack[]{ ELEMENT.getInstance().XENON.getFluid(outputChances[0]), ELEMENT.getInstance().NEON.getFluid(outputChances[1]), @@ -561,7 +608,7 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase MathUtils.roundToClosestInt(MathUtils.randDouble(1, 50)/10) }; final int fluorineContent = (100-outputChances[0]-outputChances[1]-outputChances[2]-outputChances[3]); - Utils.LOG_INFO("Fluorine remaining: "+fluorineContent); + Utils.LOG_WARNING("Fluorine remaining: "+fluorineContent); outputArrayOfGases = new FluidStack[]{ FLUORIDES.LITHIUM_FLUORIDE.getFluid(outputChances[0]), FLUORIDES.NEPTUNIUM_HEXAFLUORIDE.getFluid(outputChances[1]), @@ -574,4 +621,38 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase return outputArrayOfGases; } + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + //Add Power if active + if (aBaseMetaTileEntity.isActive()){ + //this.getBaseMetaTileEntity().increaseStoredEnergyUnits(this.mEUt, false); + + if (this.mEfficiency >= 500){ + this.boostEu = true; + this.turnCasingActive(true); + } + else { + this.boostEu = false; + this.turnCasingActive(false); + } + + + if (this.mDynamoHatches != null) { + for (GT_MetaTileEntity_Hatch_Dynamo tHatch : this.mDynamoHatches) { + if (tHatch.mTier >= 5){ + if (isValidMetaTileEntity(tHatch)){ + tHatch.getBaseMetaTileEntity().increaseStoredEnergyUnits(this.mEUt, false); + //Utils.LOG_WARNING("Adding "+this.mEUt+"eu to internal storage of dynamo "+hatchNo+"."); + } + } + } + } + + } + else { + this.turnCasingActive(false); + } + super.onPostTick(aBaseMetaTileEntity, aTick); + } + }
\ No newline at end of file diff --git a/src/resources/assets/miscutils/textures/items/itemCircuitLFTR.png b/src/resources/assets/miscutils/textures/items/itemCircuitLFTR.png Binary files differnew file mode 100644 index 0000000000..723f62e278 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/itemCircuitLFTR.png |