diff options
author | â€huajijam <strhuaji@gmail.com> | 2019-02-05 12:26:34 +0800 |
---|---|---|
committer | â€huajijam <strhuaji@gmail.com> | 2019-02-05 12:26:34 +0800 |
commit | 40d7e5da9f5b84213e2c3e4596fdc69b94bd523e (patch) | |
tree | 900ad3e45065d8ab8229d0f01823054d3b99583f /src/Java/gtPlusPlus/core | |
parent | 8e8a95f5a047a192a64d1e85fb297debac3decbc (diff) | |
parent | 3187b70de7bd7bb6eee323dd0f7f9e191fd8e7cf (diff) | |
download | GT5-Unofficial-40d7e5da9f5b84213e2c3e4596fdc69b94bd523e.tar.gz GT5-Unofficial-40d7e5da9f5b84213e2c3e4596fdc69b94bd523e.tar.bz2 GT5-Unofficial-40d7e5da9f5b84213e2c3e4596fdc69b94bd523e.zip |
Automatic synchronization
Diffstat (limited to 'src/Java/gtPlusPlus/core')
12 files changed, 899 insertions, 79 deletions
diff --git a/src/Java/gtPlusPlus/core/common/compat/COMPAT_Baubles.java b/src/Java/gtPlusPlus/core/common/compat/COMPAT_Baubles.java index 249ea78ff3..f57c09b62d 100644 --- a/src/Java/gtPlusPlus/core/common/compat/COMPAT_Baubles.java +++ b/src/Java/gtPlusPlus/core/common/compat/COMPAT_Baubles.java @@ -2,6 +2,7 @@ package gtPlusPlus.core.common.compat; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.item.ModItems; +import gtPlusPlus.core.item.bauble.BatteryPackBaseBauble; import gtPlusPlus.core.item.general.ItemCloakingDevice; import gtPlusPlus.core.item.general.ItemHealingDevice; import gtPlusPlus.core.item.general.ItemSlowBuildingRing; @@ -23,6 +24,17 @@ public class COMPAT_Baubles { ModItems.itemPersonalCloakingDevice = new ItemCloakingDevice(0); //itemPersonalCloakingDeviceCharged = new ItemCloakingDevice(0).set; ModItems.itemPersonalHealingDevice = new ItemHealingDevice(); + + try { + ModItems.itemChargePack1 = new BatteryPackBaseBauble(6); + ModItems.itemChargePack2 = new BatteryPackBaseBauble(7); + ModItems.itemChargePack3 = new BatteryPackBaseBauble(8); + ModItems.itemChargePack4 = new BatteryPackBaseBauble(9); + } + catch (Throwable t) { + t.printStackTrace(); + } + if (LoadedMods.PlayerAPI){ ModItems.itemSlowBuildingRing = new ItemSlowBuildingRing(); } diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java index 31819c5030..f6735de8e4 100644 --- a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java +++ b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java @@ -143,6 +143,9 @@ public class COMPAT_HANDLER { if (LoadedMods.OpenBlocks){ COMPAT_OpenBlocks.OreDict(); } + if (LoadedMods.Railcraft){ + COMPAT_Railcraft.OreDict(); + } if (LoadedMods.Simply_Jetpacks){ COMPAT_SimplyJetpacks.OreDict(); } diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java index b89fd2158f..8d7db4f40a 100644 --- a/src/Java/gtPlusPlus/core/item/ModItems.java +++ b/src/Java/gtPlusPlus/core/item/ModItems.java @@ -29,6 +29,7 @@ import gtPlusPlus.core.item.base.misc.BaseItemMisc; import gtPlusPlus.core.item.base.misc.BaseItemMisc.MiscTypes; import gtPlusPlus.core.item.base.plates.BaseItemPlate; import gtPlusPlus.core.item.base.plates.BaseItemPlateDouble; +import gtPlusPlus.core.item.bauble.BatteryPackBaseBauble; import gtPlusPlus.core.item.bauble.HealthBoostBauble; import gtPlusPlus.core.item.bauble.ModularBauble; import gtPlusPlus.core.item.chemistry.CoalTar; @@ -322,6 +323,11 @@ public final class ModItems { public static IonParticles itemIonParticleBase; public static StandardBaseParticles itemStandarParticleBase; + public static BatteryPackBaseBauble itemChargePack1; + public static BatteryPackBaseBauble itemChargePack2; + public static BatteryPackBaseBauble itemChargePack3; + public static BatteryPackBaseBauble itemChargePack4; + static { Logger.INFO("Items!"); //Default item used when recipes fail, handy for debugging. Let's make sure they exist when this class is called upon. @@ -908,10 +914,23 @@ public final class ModItems { GT_OreDictUnificator.registerOre("platePhasedGold", ItemUtils.getSimpleStack(itemPlateVibrantAlloy)); GT_OreDictUnificator.registerOre("dustPhasedIron", ItemUtils.getSimpleStack(itemDustPulsatingIron)); GT_OreDictUnificator.registerOre("platePhasedIron", ItemUtils.getSimpleStack(itemPlatePulsatingIron)); - GT_OreDictUnificator.registerOre("blockVibrantAlloy", ItemUtils.getItemStackOfAmountFromOreDict("blockPhasedGold", 1)); + GT_OreDictUnificator.registerOre("blockVibrantAlloy", ItemUtils.getItemStackOfAmountFromOreDict("blockPhasedGold", 1)); + + CORE.RA.addFluidExtractionRecipe(MaterialEIO.REDSTONE_ALLOY.getPlate(1), null, MaterialEIO.REDSTONE_ALLOY.getFluid(144), 10000, 16, 4*9); + CORE.RA.addFluidExtractionRecipe(MaterialEIO.REDSTONE_ALLOY.getIngot(1), null, MaterialEIO.REDSTONE_ALLOY.getFluid(144), 10000, 16, 4*9); + CORE.RA.addFluidExtractionRecipe(MaterialEIO.REDSTONE_ALLOY.getNugget(1), null, MaterialEIO.REDSTONE_ALLOY.getFluid(16), 10000, 16, 4); + CORE.RA.addFluidExtractionRecipe(MaterialEIO.REDSTONE_ALLOY.getBlock(1), null, MaterialEIO.REDSTONE_ALLOY.getFluid(1294), 10000, 16, 4*9*9); + } else { - Logger.WARNING("EnderIO not Found - Skipping Resources."); + /*Logger.WARNING("EnderIO not Found - Generating our own Resources."); + MaterialGenerator.generate(MaterialEIO.CONDUCTIVE_IRON); + MaterialGenerator.generate(MaterialEIO.PULSATING_IRON); + MaterialGenerator.generate(MaterialEIO.REDSTONE_ALLOY); + MaterialGenerator.generate(MaterialEIO.SOULARIUM); + MaterialGenerator.generate(MaterialEIO.ELECTRICAL_STEEL); + MaterialGenerator.generate(MaterialEIO.ENERGETIC_ALLOY); + MaterialGenerator.generate(MaterialEIO.VIBRANT_ALLOY); */ } //Big Reactors diff --git a/src/Java/gtPlusPlus/core/item/bauble/BaseBauble.java b/src/Java/gtPlusPlus/core/item/bauble/BaseBauble.java index 2661d3a3b0..fdd148b97b 100644 --- a/src/Java/gtPlusPlus/core/item/bauble/BaseBauble.java +++ b/src/Java/gtPlusPlus/core/item/bauble/BaseBauble.java @@ -51,9 +51,20 @@ public class BaseBauble extends Item implements IBauble { this.setUnlocalizedName(Utils.sanitizeString(displayName.toLowerCase())); GameRegistry.registerItem(this, getUnlocalizedName()); } + + public BaseBauble(BaubleType type, String unlocalName, int register) { + this.mThisBauble = type; + this.mDisplayName = ""; + Utils.registerEvent(this); + this.setMaxStackSize(1); + this.setCreativeTab(AddToCreativeTab.tabMisc); + } @Override - public String getItemStackDisplayName(final ItemStack tItem) { + public String getItemStackDisplayName(final ItemStack tItem) { + if (this.mDisplayName == null || this.mDisplayName.length() < 1) { + return super.getItemStackDisplayName(tItem).replaceAll(".name", ""); + } return this.mDisplayName; } diff --git a/src/Java/gtPlusPlus/core/item/bauble/BatteryPackBaseBauble.java b/src/Java/gtPlusPlus/core/item/bauble/BatteryPackBaseBauble.java new file mode 100644 index 0000000000..cc7979825a --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/bauble/BatteryPackBaseBauble.java @@ -0,0 +1,352 @@ +package gtPlusPlus.core.item.bauble; + +import java.util.List; + +import baubles.api.BaubleType; +import baubles.api.IBauble; +import cpw.mods.fml.common.Optional; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.enums.GT_Values; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.xmod.gregtech.common.helpers.ChargingHelper; +import ic2.api.item.ElectricItem; +import ic2.api.item.IElectricItem; +import ic2.api.item.IElectricItemManager; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; + +@Optional.InterfaceList(value = { @Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles"), + @Optional.Interface(iface = "baubles.api.BaubleType", modid = "Baubles") }) +public class BatteryPackBaseBauble extends BaseBauble implements IElectricItem, IElectricItemManager, IBauble { + + final int mTier; + private final double maxValueEU; + + public BatteryPackBaseBauble(int tier) { + super(BaubleType.BELT, "GTPP.BattPack.0" + tier + ".name", 0); + mTier = tier; + maxValueEU = GT_Values.V[mTier] * 20 * 300; + String aUnlocalName = "GTPP.BattPack.0" + mTier + ".name"; + this.setUnlocalizedName(aUnlocalName); + this.setTextureName(CORE.MODID + ":" + "chargepack/"+tier); + this.setMaxDamage(27); + this.setMaxStackSize(1); + this.setNoRepair(); + this.setCreativeTab(AddToCreativeTab.tabMachines); + if (GameRegistry.findItem(CORE.MODID, aUnlocalName) == null) { + GameRegistry.registerItem(this, aUnlocalName); + } + } + + @SideOnly(Side.CLIENT) + @Override + public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) { + ItemStack itemStack = new ItemStack(this, 1); + ItemStack charged; + if (this.getEmptyItem(itemStack) == this) { + charged = new ItemStack(this, 1); + ElectricItem.manager.charge(charged, 0.0D, Integer.MAX_VALUE, true, false); + itemList.add(charged); + } + if (this.getChargedItem(itemStack) == this) { + charged = new ItemStack(this, 1); + ElectricItem.manager.charge(charged, Double.POSITIVE_INFINITY, Integer.MAX_VALUE, true, false); + itemList.add(charged); + } + + } + + @Override + public void onUpdate(final ItemStack itemStack, final World worldObj, final Entity player, final int p_77663_4_, + final boolean p_77663_5_) { + super.onUpdate(itemStack, worldObj, player, p_77663_4_, p_77663_5_); + } + + @Override + public boolean canProvideEnergy(final ItemStack itemStack) { + double aItemCharge = ElectricItem.manager.getCharge(itemStack); + return aItemCharge > 0; + } + + @Override + public Item getChargedItem(final ItemStack itemStack) { + final ItemStack x = itemStack.copy(); + x.setItemDamage(27); + return x.getItem(); + } + + @Override + public Item getEmptyItem(final ItemStack itemStack) { + final ItemStack x = itemStack.copy(); + x.setItemDamage(0); + return x.getItem(); + } + + @Override + public double getMaxCharge(final ItemStack itemStack) { + return maxValueEU; + } + + @Override + public int getTier(final ItemStack itemStack) { + return mTier; + } + + @Override + public double getTransferLimit(final ItemStack itemStack) { + return GT_Values.V[mTier]; + } + + @Override + public String getItemStackDisplayName(final ItemStack p_77653_1_) { + return (EnumChatFormatting.BLUE + super.getItemStackDisplayName(p_77653_1_) + EnumChatFormatting.GRAY); + } + + @Override + public double getDurabilityForDisplay(final ItemStack stack) { + // return 1.0D - getEnergyStored(stack) / this.capacity; + return 1.0D - (this.getCharge(stack) / this.getMaxCharge(stack)); + } + + @Override + public boolean showDurabilityBar(final ItemStack stack) { + return true; + } + + public int secondsLeft(final ItemStack stack) { + double r = 0; + r = this.getCharge(stack) / (10000 * 20); + return (int) MathUtils.decimalRounding(r); + } + + @SuppressWarnings("unchecked") + @Override + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + list.add(""); + String aString1 = StatCollector.translateToLocal("GTPP.battpack.tooltip.1"); + String aString2 = StatCollector.translateToLocal("GTPP.battpack.tooltip.2"); + String aString3 = StatCollector.translateToLocal("GTPP.battpack.tooltip.3"); + String aString4 = StatCollector.translateToLocal("GTPP.battpack.tooltip.4"); + + String aEuInfo = StatCollector.translateToLocal("GTPP.info.euInfo"); + String aTier = StatCollector.translateToLocal("GTPP.machines.tier"); + String aInputLimit = StatCollector.translateToLocal("GTPP.info.inputLimit"); + String aCurrentPower = StatCollector.translateToLocal("GTPP.info.currentPower"); + String aEU = StatCollector.translateToLocal("GTPP.info.eu"); + String aEUT = aEU+"/t"; + + list.add(EnumChatFormatting.GREEN + aString1 + EnumChatFormatting.GRAY); + list.add(EnumChatFormatting.GREEN + aString2+" " + (int) getTransferLimit(stack) + aEUT +" "+ aString3 + EnumChatFormatting.GRAY); + list.add(EnumChatFormatting.GREEN + aString4 + EnumChatFormatting.GRAY); + list.add(""); + list.add(EnumChatFormatting.GOLD + aEuInfo + EnumChatFormatting.GRAY); + list.add(EnumChatFormatting.GRAY + aTier+": [" + EnumChatFormatting.YELLOW + this.getTier(stack) + + EnumChatFormatting.GRAY + "] "+aInputLimit+": [" + EnumChatFormatting.YELLOW + + this.getTransferLimit(stack) + EnumChatFormatting.GRAY + aEUT); + list.add(EnumChatFormatting.GRAY + aCurrentPower +": [" + EnumChatFormatting.YELLOW + (long) this.getCharge(stack) + + EnumChatFormatting.GRAY + aEU +"] [" + EnumChatFormatting.YELLOW + + MathUtils.findPercentage(this.getCharge(stack), this.getMaxCharge(stack)) + EnumChatFormatting.GRAY + + "%]"); + super.addInformation(stack, aPlayer, list, bool); + } + + @Override + public double charge(final ItemStack stack, final double amount, final int tier, final boolean ignoreTransferLimit, + final boolean simulate) { + + if (!simulate) { + ElectricItem.manager.charge(stack, amount, tier, true, simulate); + + } + return ElectricItem.manager.charge(stack, amount, tier, true, simulate); + } + + @Override + public double discharge(final ItemStack stack, final double amount, final int tier, + final boolean ignoreTransferLimit, final boolean externally, final boolean simulate) { + if (!simulate) { + ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate); + } + + return ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate); + } + + @Override + public double getCharge(final ItemStack stack) { + return ElectricItem.manager.getCharge(stack); + } + + @Override + public boolean canUse(final ItemStack stack, final double amount) { + return ElectricItem.manager.canUse(stack, amount); + } + + @Override + public boolean use(final ItemStack stack, final double amount, final EntityLivingBase entity) { + return ElectricItem.manager.use(stack, amount, entity); + } + + @Override + public void chargeFromArmor(final ItemStack stack, final EntityLivingBase entity) { + ElectricItem.manager.chargeFromArmor(stack, entity); + } + + @Override + public String getToolTip(final ItemStack stack) { + return ElectricItem.manager.getToolTip(stack); + } + + @Override + public boolean canEquip(final ItemStack arg0, final EntityLivingBase arg1) { + return true; + } + + @Override + public boolean canUnequip(final ItemStack arg0, final EntityLivingBase arg1) { + return true; + } + + @Override + public BaubleType getBaubleType(final ItemStack arg0) { + return BaubleType.BELT; + } + + @Override // TODO + public void onEquipped(final ItemStack arg0, final EntityLivingBase arg1) { + + } + + @Override // TODO + public void onUnequipped(final ItemStack arg0, final EntityLivingBase arg1) { + + } + + @Override // TODO + public void onWornTick(final ItemStack aBaubleStack, final EntityLivingBase aPlayer) { + if (!aPlayer.worldObj.isRemote) { + if (this.getCharge(aBaubleStack) >= getTransferLimit(aBaubleStack)) { + // Try Iterate Armour Slots of Player + if (aPlayer instanceof EntityPlayer) { + + // amour + for (final ItemStack aInvStack : ((EntityPlayer) aPlayer).inventory.armorInventory) { + if (aInvStack != null) { + if (aInvStack == aBaubleStack) { + continue; + } + if (ChargingHelper.isItemValid(aInvStack)) { + double aTransferRate = 0; + final IElectricItem electricItem = (IElectricItem) aInvStack.getItem(); + if (electricItem != null) { + aTransferRate = electricItem.getTransferLimit(aInvStack); + double aItemCharge = ElectricItem.manager.getCharge(aInvStack); + if (aItemCharge >= 0 && aItemCharge != electricItem.getMaxCharge(aInvStack)) { + if (aItemCharge <= (electricItem.getMaxCharge(aInvStack) - aTransferRate)) { + if (ElectricItem.manager.getCharge(aBaubleStack) >= aTransferRate) { + if (ElectricItem.manager.getCharge(aInvStack) <= (electricItem.getMaxCharge(aInvStack) - aTransferRate)) { + double d = ElectricItem.manager.charge(aInvStack, aTransferRate * 16, mTier, false, true); + if (d > 0) { + d = ElectricItem.manager.charge(aInvStack, aTransferRate * 16, mTier, false, false); + ElectricItem.manager.discharge(aBaubleStack, d, mTier, false, true, false); + //Logger.INFO("Charging " + aInvStack.getDisplayName() + " | " + d + " | "+electricItem.getMaxCharge(aInvStack)); + } + } + else { + //Logger.INFO("5"); + } + } + else { + //Logger.INFO("4"); + } + } + else { + //Logger.INFO("3"); + } + + } + else { + //Logger.INFO("1"); + } + } + + } + } + if (this.getCharge(aBaubleStack) > 0) { + continue; + } else { + break; + } + } + + // Hotbar Slots + int aSlotCounter = 0; + for (final ItemStack aInvStack : ((EntityPlayer) aPlayer).inventory.mainInventory) { + if (aSlotCounter > (InventoryPlayer.getHotbarSize() - 1)) { + break; + } + aSlotCounter++; + if (aInvStack != null) { + if (aInvStack == aBaubleStack) { + continue; + } + if (ChargingHelper.isItemValid(aInvStack)) { + double aTransferRate = 0; + final IElectricItem electricItem = (IElectricItem) aInvStack.getItem(); + if (electricItem != null) { + aTransferRate = electricItem.getTransferLimit(aInvStack); + double aItemCharge = ElectricItem.manager.getCharge(aInvStack); + if (aItemCharge >= 0 && aItemCharge != electricItem.getMaxCharge(aInvStack)) { + if (aItemCharge <= (electricItem.getMaxCharge(aInvStack) - aTransferRate)) { + if (ElectricItem.manager.getCharge(aBaubleStack) >= aTransferRate) { + if (ElectricItem.manager.getCharge(aInvStack) <= (electricItem.getMaxCharge(aInvStack) - aTransferRate)) { + double d = ElectricItem.manager.charge(aInvStack, aTransferRate, mTier, false, true); + if (d > 0) { + d = ElectricItem.manager.charge(aInvStack, aTransferRate, mTier, false, false); + ElectricItem.manager.discharge(aBaubleStack, d, mTier, false, true, false); + //Logger.INFO("Charging " + aInvStack.getDisplayName() + " | " + d + " | "+electricItem.getMaxCharge(aInvStack)); + } + } + else { + //Logger.INFO("5"); + } + } + else { + //Logger.INFO("4"); + } + } + else { + //Logger.INFO("3"); + } + + } + else { + //Logger.INFO("1"); + } + } + } + } + if (this.getCharge(aBaubleStack) > 0) { + continue; + } else { + break; + } + } + } + } + } + } + +} diff --git a/src/Java/gtPlusPlus/core/item/general/ItemGiantEgg.java b/src/Java/gtPlusPlus/core/item/general/ItemGiantEgg.java index c651fb38d9..4abb84a33c 100644 --- a/src/Java/gtPlusPlus/core/item/general/ItemGiantEgg.java +++ b/src/Java/gtPlusPlus/core/item/general/ItemGiantEgg.java @@ -136,7 +136,9 @@ public class ItemGiantEgg extends BaseItemBurnable { if (player && NBTUtils.getTagCompound(aStack, "GT.CraftingComponents") == null) { if (mCorrectStemCells == null) { if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK && Utils.getGregtechSubVersion() > 28) { - ItemList xl = ItemList.valueOf("Circuit_Chip_Stemcell"); + + + ItemList xl = Utils.getValueOfItemList("Circuit_Chip_Stemcell", ItemList.Circuit_Elite); if (xl != null && xl.hasBeenSet()) { mCorrectStemCells = xl.get(1); } diff --git a/src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java b/src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java index f458bce139..c8acdc2152 100644 --- a/src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java +++ b/src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java @@ -8,9 +8,13 @@ import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; import net.minecraft.world.World; import baubles.api.BaubleType; @@ -18,9 +22,12 @@ import baubles.api.IBauble; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.PlayerUtils; +import gtPlusPlus.core.util.sys.KeyboardUtils; +import gtPlusPlus.xmod.gregtech.common.helpers.ChargingHelper; import ic2.api.item.ElectricItem; import ic2.api.item.IElectricItem; import ic2.api.item.IElectricItemManager; @@ -47,29 +54,12 @@ public class ItemHealingDevice extends Item implements IElectricItem, IElectricI if (worldObj.isRemote) { return; } - - if (player instanceof EntityPlayer){ - for (final ItemStack is : ((EntityPlayer) player).inventory.mainInventory) { - if (is == itemStack) { - continue; - } - if (is != null) { - if (is.getItem() instanceof IElectricItem) { - final IElectricItem electricItem = (IElectricItem) is.getItem(); - this.chargeEU = ElectricItem.manager.getCharge(is); - } - - } - } - } - - super.onUpdate(itemStack, worldObj, player, p_77663_4_, p_77663_5_); } @Override public boolean canProvideEnergy(final ItemStack itemStack) { - return true; + return false; } @Override @@ -127,16 +117,43 @@ public class ItemHealingDevice extends Item implements IElectricItem, IElectricI return (int) r; } + @SuppressWarnings({ "rawtypes", "unchecked" }) @Override public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + + String aString1 = StatCollector.translateToLocal("GTPP.nanohealer.tooltip.1"); + String aString2 = StatCollector.translateToLocal("GTPP.nanohealer.tooltip.2"); + String aString3 = StatCollector.translateToLocal("GTPP.nanohealer.tooltip.3"); + String aString4 = StatCollector.translateToLocal("GTPP.nanohealer.tooltip.4"); + String aString5 = StatCollector.translateToLocal("GTPP.nanohealer.tooltip.5"); + String aStringTooltip = StatCollector.translateToLocal("GTPP.nanohealer.hidden"); + String aEuInfo = StatCollector.translateToLocal("GTPP.info.euInfo"); + String aTier = StatCollector.translateToLocal("GTPP.machines.tier"); + String aInputLimit = StatCollector.translateToLocal("GTPP.info.inputLimit"); + String aCurrentPower = StatCollector.translateToLocal("GTPP.info.currentPower"); + String aEU = StatCollector.translateToLocal("GTPP.info.eu"); + String aEUT = aEU+"/t"; + boolean isShowing = getShowMessages(stack); + + list.add(""); + + list.add(EnumChatFormatting.GREEN + aString1 + EnumChatFormatting.GRAY); + list.add(EnumChatFormatting.GREEN + aString2 + EnumChatFormatting.GRAY); + list.add(EnumChatFormatting.GREEN + aString3 + EnumChatFormatting.GRAY); + list.add(EnumChatFormatting.RED + aString4 + EnumChatFormatting.GRAY); + list.add(""); - list.add(EnumChatFormatting.GREEN+"Worn as a Necklace within Baubles."+EnumChatFormatting.GRAY); - list.add(EnumChatFormatting.GREEN+"Drains 1638400eu to restore hunger."+EnumChatFormatting.GRAY); - list.add(""); - list.add(EnumChatFormatting.GOLD+"IC2/EU Information"+EnumChatFormatting.GRAY); - list.add(EnumChatFormatting.GRAY+"Tier: ["+EnumChatFormatting.YELLOW+this.getTier(this.thisStack)+EnumChatFormatting.GRAY+"] Transfer Limit: ["+EnumChatFormatting.YELLOW+this.getTransferLimit(this.thisStack)+EnumChatFormatting.GRAY +"Eu/t]"); - list.add(EnumChatFormatting.GRAY+"Current Power: ["+EnumChatFormatting.YELLOW+(long) this.getCharge(stack)+EnumChatFormatting.GRAY+"Eu] ["+EnumChatFormatting.YELLOW+MathUtils.findPercentage(this.getCharge(stack), this.getMaxCharge(stack))+EnumChatFormatting.GRAY +"%]"); - list.add(EnumChatFormatting.GRAY+"Uses Remaining: ["+EnumChatFormatting.YELLOW+this.secondsLeft(stack)+ EnumChatFormatting.GRAY +"]"); + + list.add(EnumChatFormatting.GOLD + aEuInfo + EnumChatFormatting.GRAY); + list.add(EnumChatFormatting.GRAY + aTier+": [" + EnumChatFormatting.YELLOW + this.getTier(stack) + + EnumChatFormatting.GRAY + "] "+aInputLimit+": [" + EnumChatFormatting.YELLOW + + this.getTransferLimit(stack) + EnumChatFormatting.GRAY + aEUT); + list.add(EnumChatFormatting.GRAY + aCurrentPower +": [" + EnumChatFormatting.YELLOW + (long) this.getCharge(stack) + + EnumChatFormatting.GRAY + aEU +"] [" + EnumChatFormatting.YELLOW + + MathUtils.findPercentage(this.getCharge(stack), this.getMaxCharge(stack)) + EnumChatFormatting.GRAY + + "%]"); + list.add(EnumChatFormatting.GOLD + aString5 + EnumChatFormatting.GRAY); + list.add(EnumChatFormatting.GOLD + aStringTooltip + " " + (!isShowing ? EnumChatFormatting.DARK_GREEN : EnumChatFormatting.DARK_RED) + !isShowing + EnumChatFormatting.GRAY); super.addInformation(stack, aPlayer, list, bool); } @@ -214,19 +231,205 @@ public class ItemHealingDevice extends Item implements IElectricItem, IElectricI } @Override //TODO - public void onWornTick(final ItemStack arg0, final EntityLivingBase arg1) { + public void onWornTick(final ItemStack aBaubleStack, final EntityLivingBase arg1) { if (!arg1.worldObj.isRemote){ - if (this.getCharge(arg0) >= (1638400/4)){ + + //Try Charge First + + //Inv Slots + for (final ItemStack aInvStack : ((EntityPlayer) arg1).inventory.mainInventory) { + if (aInvStack == aBaubleStack) { + continue; + } + + if (this.getCharge(aBaubleStack) == this.getMaxCharge(aBaubleStack)) { + break; + } + + if (aInvStack != null) { + if (ChargingHelper.isItemValid(aInvStack)) { + + + double aTransferRate; + double aCurrentChargeForThisBauble; + int mTier; + final IElectricItem electricItem = (IElectricItem) aInvStack.getItem(); + + if (electricItem != null) { + + aTransferRate = electricItem.getTransferLimit(aInvStack); + mTier = electricItem.getTier(aInvStack); + aCurrentChargeForThisBauble = ElectricItem.manager.getCharge(aBaubleStack); + + if (aCurrentChargeForThisBauble < maxValueEU) { + if ((ElectricItem.manager.getCharge(aInvStack) >= aTransferRate)) { + if (electricItem.canProvideEnergy(aInvStack)) { + double d = ElectricItem.manager.discharge(aInvStack, aTransferRate, mTier, false, true, false); + //Logger.INFO("Charging from "+aInvStack.getDisplayName() +" | "+d); + ElectricItem.manager.charge(aBaubleStack, d, mTier, true, false); + } + } + } + } + } + } + if (this.getCharge(aBaubleStack) <= (this.getMaxCharge(aBaubleStack) - getTransferLimit(aBaubleStack))) { + continue; + } + else { + break; + } + } + + + //Try Heal + if (this.getCharge(aBaubleStack) > 0){ + + //health Check + float hp = 0; if (arg1.getHealth() < arg1.getMaxHealth()){ final float rx = arg1.getMaxHealth()-arg1.getHealth(); Logger.INFO("rx:"+rx); - arg1.heal(rx*2); - this.discharge(arg0, (1638400/4)*rx, 6, true, true, false); - PlayerUtils.messagePlayer((EntityPlayer) arg1, "Your NanoBooster Whirs! Leaving you feeling stronger. It Healed "+rx+" hp."); - PlayerUtils.messagePlayer((EntityPlayer) arg1, "You check it's remaining uses, it has "+this.secondsLeft(arg0)+"."); + arg1.heal(rx*2); + hp = rx; + this.discharge(aBaubleStack, (1638400)*rx, 6, true, true, false); + } + + //Hunger Check + int hunger = 0; + if (arg1 instanceof EntityPlayerMP) { + EntityPlayerMP g = (EntityPlayerMP) arg1; + if (g != null) { + hunger = 20 - g.getFoodStats().getFoodLevel(); + g.getFoodStats().setFoodLevel(g.getFoodStats().getFoodLevel() + hunger); + this.discharge(aBaubleStack, (1638400) * hunger, 6, true, true, false); + } + } + + //Saturation Check + float saturation = 0; + if (arg1 instanceof EntityPlayerMP) { + EntityPlayerMP g = (EntityPlayerMP) arg1; + if (g != null) { + saturation = 5f - g.getFoodStats().getSaturationLevel(); + g.getFoodStats().setFoodSaturationLevel(g.getFoodStats().getSaturationLevel() + saturation); + this.discharge(aBaubleStack, (1638400) * saturation, 6, true, true, false); + } } + + + saturation = (int) saturation; + + //Only show Messages if they're enabled. + if (getShowMessages(aBaubleStack)) { + if (hp > 0 || hunger > 0 || saturation > 0) + PlayerUtils.messagePlayer((EntityPlayer) arg1, + "Your NanoBooster Whirs! Leaving you feeling stronger."); + + if (hp > 0) + PlayerUtils.messagePlayer((EntityPlayer) arg1, "Healed " + hp + " hp."); + + if (hunger > 0) + PlayerUtils.messagePlayer((EntityPlayer) arg1, "Healed " + hunger + " hunger."); + + if (saturation > 0) + PlayerUtils.messagePlayer((EntityPlayer) arg1, "Satured Hunger by " + saturation + "."); + + if (hp > 0 || hunger > 0 || saturation > 0) + PlayerUtils.messagePlayer((EntityPlayer) arg1, + "You check it's remaining uses, it has " + (int) this.secondsLeft(aBaubleStack) + "."); + + } + + + + + } + } + } + + + + + + + + + + + + + + + + + + + + + + + private static boolean createNBT(ItemStack rStack){ + final NBTTagCompound tagMain = new NBTTagCompound(); + tagMain.setBoolean("ShowMSG", false); + rStack.setTagCompound(tagMain); + return true; + } + + public static final boolean getShowMessages(final ItemStack aStack) { + NBTTagCompound aNBT = aStack.getTagCompound(); + if (aNBT == null) { + if (!createNBT(aStack)) { + return false; + } + else { + aNBT = aStack.getTagCompound(); + } + } + return aNBT.getBoolean("ShowMSG"); + + } + + public static final boolean setShowMessages(final ItemStack aStack, final boolean aShow) { + NBTTagCompound aNBT = aStack.getTagCompound(); + if (aNBT == null) { + if (!createNBT(aStack)) { + return false; + } else { + aNBT = aStack.getTagCompound(); } } + aNBT.setBoolean("ShowMSG", aShow); + return true; + } + + @Override + public boolean onItemUse(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, + int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) { + // TODO Auto-generated method stub + return super.onItemUse(p_77648_1_, p_77648_2_, p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_, p_77648_7_, p_77648_8_, + p_77648_9_, p_77648_10_); + } + + @Override + public ItemStack onItemRightClick(ItemStack aStack, World aWorld, EntityPlayer aPlayer) { + ItemStack superStack = super.onItemRightClick(aStack, aWorld, aPlayer); + boolean isShiftHeld = KeyboardUtils.isShiftKeyDown(); + if (isShiftHeld) { + boolean oldState = getShowMessages(superStack); + boolean newState = Utils.invertBoolean(oldState); + ItemHealingDevice.setShowMessages(superStack, newState); + PlayerUtils.messagePlayer(aPlayer, (!oldState ? "Showing info messages" : "Hiding info messages")); + } + return superStack; + } + + @Override + public boolean doesSneakBypassUse(World world, int x, int y, int z, EntityPlayer player) { + return true; } + + + } diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java index eca9e278e2..25103c0f5a 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java @@ -61,6 +61,7 @@ public class RECIPES_GREGTECH { if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { largeChemReactorRecipes(); + fusionRecipes(); } fissionFuelRecipes(); @@ -80,11 +81,48 @@ public class RECIPES_GREGTECH { breweryRecipes(); laserEngraverRecipes(); assemblyLineRecipes(); + addFuels(); } + private static void fusionRecipes() { + + /** + * Adds a Fusion reactor Recipe + * + * @param aInput1 = first Input (not null, and respects StackSize) + * @param aInput2 = second Input (not null, and respects StackSize) + * @param aOutput = Output of the Fusion (can be null, and respects StackSize) + * @param aFusionDurationInTicks = How many ticks the Fusion lasts (must be > 0) + * @param aFusionEnergyPerTick = The EU generated per Tick (can even be negative!) + * @param aEnergyNeededForStartingFusion = EU needed for heating the Reactor up (must be >= 0) + */ + + //Hydrogen Plasma + /*CORE.RA.addFusionReactorRecipe( + Particle.getIon("Hydrogen", 0), + Particle.getIon("Hydrogen", 0), + Materials.Hydrogen.getPlasma(1), + 5000, + 16, + 4096, + 40000000);*/ + + + //Hypogen Creation + GT_Values.RA.addFusionReactorRecipe( + Materials.Neutronium.getMolten(128), + ALLOY.QUANTUM.getFluid(256), + ELEMENT.STANDALONE.HYPOGEN.getFluid(4), + 2048 * 4, + (int) GT_Values.V[9], + 600000000 * 2); + + } + private static void assemblyLineRecipes() { + //Containment Casings CORE.RA.addAssemblylineRecipe( ItemList.Field_Generator_IV.get(1), 20 * 60 * 30, @@ -114,6 +152,59 @@ public class RECIPES_GREGTECH { 20 * 60 * 10 * (GTNH ? 2 : 1), (int) GT_Values.V[6]); + //Slow Fusion Controller + CORE.RA.addAssemblylineRecipe( + GregtechItemList.COMET_Cyclotron.get(1), + 20 * 60 * 30, + new ItemStack[] { + CI.getFieldGenerator(6, GTNH ? 32 : 8), + ItemList.Electric_Motor_EV.get(GTNH ? 32 : 8), + ItemList.Tool_Scanner.get(GTNH ? 4 : 2), + CI.getTieredComponent(OrePrefixes.cableGt12, 6, GTNH ? 32 : 16), + CI.getTieredComponent(OrePrefixes.wireGt16, 5, GTNH ? 64 : 32), + CI.getTieredComponent(OrePrefixes.plate, 6, GTNH ? 64 : 32), + ELEMENT.getInstance().GADOLINIUM.getDust(GTNH ? 32 : 8), + ELEMENT.getInstance().SAMARIUM.getDust(GTNH ? 16 : 4), + ALLOY.INCOLOY_MA956.getGear(GTNH ? 8 : 2), + CI.getTieredComponent(OrePrefixes.circuit, 5, GTNH ? 64 : 32), + CI.getTieredComponent(OrePrefixes.circuit, 6, GTNH ? 32 : 16), + CI.getTieredComponent(OrePrefixes.circuit, 7, GTNH ? 16 : 8) + }, + new FluidStack[] { + CI.getTieredFluid(6, 144 * 9 * (GTNH ? 8 : 4)), + CI.getTertiaryTieredFluid(6, 144 * 9 * (GTNH ? 8 : 4)), + CI.getAlternativeTieredFluid(6, 144 * 9 * (GTNH ? 8 : 4)), + CI.getTieredFluid(5, 144 * 9 * (GTNH ? 16 : 8)), + CI.getTertiaryTieredFluid(5, 144 * 9 * (GTNH ? 16 : 8)), + CI.getAlternativeTieredFluid(5, 144 * 9 * (GTNH ? 16 : 8)), + + }, + GregtechItemList.Miniature_Fusion.get(1), + 20 * 60 * 5 * (GTNH ? 2 : 1), + (int) GT_Values.V[7]); + + + //Plasma Tank + CORE.RA.addAssemblylineRecipe( + ItemUtils.getOrePrefixStack(OrePrefixes.pipeMedium, Materials.Superconductor, 1), + 20 * 60 * 5, + new ItemStack[] { + CI.getTieredComponent(OrePrefixes.plate, 5, GTNH ? 32 : 16), + CI.getTieredComponent(OrePrefixes.circuit, 5, GTNH ? 16 : 4), + CI.getTieredComponent(OrePrefixes.pipeHuge, 5, GTNH ? 16 : 4), + CI.getTieredComponent(OrePrefixes.cableGt08, 7, GTNH ? 32 : 16), + CI.getTieredComponent(OrePrefixes.gearGt, 6, GTNH ? 8 : 4), + }, + new FluidStack[] { + CI.getTieredFluid(4, 144 * 9 * (GTNH ? 16 : 8)), + CI.getTertiaryTieredFluid(4, 144 * 9 * (GTNH ? 16 : 8)), + CI.getAlternativeTieredFluid(4, 144 * 9 * (GTNH ? 16 : 8)), + + }, + GregtechItemList.Plasma_Tank.get(1), + 20 * 60 * 1 * (GTNH ? 2 : 1), + (int) GT_Values.V[5]); + } private static void laserEngraverRecipes() { @@ -1347,39 +1438,39 @@ public class RECIPES_GREGTECH { private static void cyclotronRecipes() { - //Polonium + // Polonium CORE.RA.addCyclotronRecipe(CI.getNumberedCircuit(0), FluidUtils.getFluidStack("molten.bismuth", 1), - new ItemStack[] { GregtechItemList.Pellet_RTG_PO210.get(1) }, null, new int[] { 100 }, 20 * 300 * 100, 2040, + new ItemStack[] { GregtechItemList.Pellet_RTG_PO210.get(1) }, null, new int[] { 100 }, 20 * 300 * 100, 2040 * 4, 500 * 20); - //Americium + // Americium CORE.RA.addCyclotronRecipe(CI.getNumberedCircuit(0), FluidUtils.getFluidStack("molten.americium", 1), - new ItemStack[] { GregtechItemList.Pellet_RTG_AM241.get(4) }, null, new int[] { 2500 }, 20 * 300 * 100, 1020, + new ItemStack[] { GregtechItemList.Pellet_RTG_AM241.get(4) }, null, new int[] { 2500 }, 20 * 300 * 100, 1020 * 4, 500 * 20); //PO Special Value - //Strontium u235 + // Strontium u235 CORE.RA.addCyclotronRecipe(CI.getNumberedCircuit(0), FluidUtils.getFluidStack("molten.uranium235", 10), - new ItemStack[] { GregtechItemList.Pellet_RTG_SR90.get(1) }, null, new int[] { 570 }, 20 * 300 * 100, 1020, + new ItemStack[] { GregtechItemList.Pellet_RTG_SR90.get(1) }, null, new int[] { 570 }, 20 * 300 * 100, 1020 * 4, 500 * 20); //PO Special Value - //Strontium u233 + // Strontium u233 CORE.RA.addCyclotronRecipe(CI.getNumberedCircuit(0), FluidUtils.getFluidStack("molten.uranium233", 10), - new ItemStack[] { GregtechItemList.Pellet_RTG_SR90.get(1) }, null, new int[] { 660 }, 20 * 300 * 100, 1020, + new ItemStack[] { GregtechItemList.Pellet_RTG_SR90.get(1) }, null, new int[] { 660 }, 20 * 300 * 100, 1020 * 4, 500 * 20); //PO Special Value - //Strontium pu239 + // Strontium pu239 CORE.RA.addCyclotronRecipe(CI.getNumberedCircuit(0), FluidUtils.getFluidStack("molten.plutonium239", 10), - new ItemStack[] { GregtechItemList.Pellet_RTG_SR90.get(1) }, null, new int[] { 220 }, 20 * 300 * 100, 1020, + new ItemStack[] { GregtechItemList.Pellet_RTG_SR90.get(1) }, null, new int[] { 220 }, 20 * 300 * 100, 1020 * 4, 500 * 20); //PO Special Value - //Plutonium + // Plutonium CORE.RA.addCyclotronRecipe(CI.getNumberedCircuit(0), FluidUtils.getFluidStack("molten.plutonium238", 1), - new ItemStack[] { GregtechItemList.Pellet_RTG_PU238.get(2) }, null, new int[] { 780 }, 20 * 300 * 100, 1020, + new ItemStack[] { GregtechItemList.Pellet_RTG_PU238.get(2) }, null, new int[] { 780 }, 20 * 300 * 100, 1020 * 4, 500 * 20); //PO Special Value - //Neptunium + // Neptunium CORE.RA.addCyclotronRecipe(new ItemStack[] {ELEMENT.getInstance().URANIUM238.getDust(1) }, FluidUtils.getFluidStack("deuterium", 400), - new ItemStack[] {ItemUtils.getSimpleStack(ModItems.dustNeptunium238)}, null, new int[] { 500 }, 20 * 5, 500, + new ItemStack[] {ItemUtils.getSimpleStack(ModItems.dustNeptunium238)}, null, new int[] { 500 }, 20 * 5, 500 * 4, 500 * 20); //PO Special Value @@ -1424,7 +1515,7 @@ public class RECIPES_GREGTECH { (int) GT_Values.V[7], 750 * 20); - //Boson Smash + // Boson Smash CORE.RA.addCyclotronRecipe( CI.getNumberedCircuit(9), FluidUtils.getFluidStack("plasma.helium", 1500), @@ -1462,7 +1553,7 @@ public class RECIPES_GREGTECH { (int) GT_Values.V[8], 750 * 20); - //Graviton Smash + // Graviton Smash CORE.RA.addCyclotronRecipe( CI.getNumberedCircuit(15), FluidUtils.getFluidStack("plasma.hydrogen", GTNH ? 50 : 10), @@ -1483,7 +1574,7 @@ public class RECIPES_GREGTECH { aPlasma = Materials.Americium.getMolten(GTNH ? 20 : 5); } - //Quantum Anomaly + // Quantum Anomaly CORE.RA.addCyclotronRecipe( new ItemStack[] { CI.getNumberedCircuit(24), @@ -1506,7 +1597,10 @@ public class RECIPES_GREGTECH { int IonCount = 2; int tenCountA = (GTNH ? 2 : 1); int tenCountB = 0; - for (String y : IonParticles.MetaToNameMap.values()) { + for (String y : IonParticles.MetaToNameMap.values()) { + if (y.toLowerCase().contains("hydrogen")) { + continue; + } FluidStack aPlasma2 = FluidUtils.getFluidStack("plasma."+y.toLowerCase(), 2); Materials aTestMat = MaterialUtils.getMaterial(y); FluidStack aPlasma3 = aTestMat != null ? aTestMat.getPlasma(2) : aPlasma2; @@ -1528,7 +1622,7 @@ public class RECIPES_GREGTECH { Particle.getIon(y, -1), }, null, - new int[] { 75, 50, 25, 75, 50, 25, 75, 50, 75}, + new int[] { 275, 250, 225, 275, 250, 225, 275, 250, 275}, 20 * 20 * (IonCount++) * tenCountA, (int) GT_Values.V[7], 1500 * 20 * tenCountA); @@ -1545,6 +1639,101 @@ public class RECIPES_GREGTECH { tenCountB++; } } + + // Generate Hydrogen Ion Recipe + CORE.RA.addCyclotronRecipe( + CI.getNumberedCircuit(24), + FluidUtils.getWildcardFluidStack("hydrogen", 1000), + new ItemStack[] { + Particle.getIon("Hydrogen", 1), + Particle.getIon("Hydrogen", 2), + Particle.getIon("Hydrogen", 3), + Particle.getIon("Hydrogen", 1), + Particle.getIon("Hydrogen", 2), + Particle.getIon("Hydrogen", 3), + Particle.getIon("Hydrogen", -1), + Particle.getIon("Hydrogen", -2), + Particle.getIon("Hydrogen", -3) + }, + null, + new int[] { 125, 125, 125, 125, 125, 125, 125, 125, 125 }, + 20 * 20, + (int) GT_Values.V[6], + 15000); + + // Generate Hydrogen Plasma Recipe + CORE.RA.addCyclotronRecipe( + new ItemStack[] { + Particle.getIon("Hydrogen", 0), + ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogen", 1) + }, + null, + new ItemStack[] { + Particle.getBaseParticle(Particle.PROTON), + Particle.getBaseParticle(Particle.NEUTRON), + Particle.getBaseParticle(Particle.ELECTRON), + Particle.getBaseParticle(Particle.UNKNOWN), + Particle.getBaseParticle(Particle.UNKNOWN), + Particle.getBaseParticle(Particle.UNKNOWN), + CI.emptyCells(1) + }, + FluidUtils.getFluidStack("plasma.hydrogen", 1), + new int[] { 250, 250, 250, 500, 500, 500, 10000 }, + 20 * 60 * 2, + (int) GT_Values.V[7], + 750 * 20); + + + // Generate Protons Easily + CORE.RA.addCyclotronRecipe( + new ItemStack[] { + CI.getNumberedCircuit(20), + Particle.getIon("Hydrogen", 0) + }, + FluidUtils.getWildcardFluidStack("hydrogen", 100), + new ItemStack[] { + Particle.getBaseParticle(Particle.PROTON), + Particle.getBaseParticle(Particle.PROTON), + Particle.getBaseParticle(Particle.PROTON), + Particle.getBaseParticle(Particle.PROTON), + Particle.getBaseParticle(Particle.PROTON), + Particle.getBaseParticle(Particle.PROTON), + Particle.getBaseParticle(Particle.PROTON), + Particle.getBaseParticle(Particle.PROTON), + Particle.getBaseParticle(Particle.PROTON), + }, + null, + new int[] { 750, 750, 750, 750, 750, 750, 750, 750, 750 }, + 20 * 20, + (int) GT_Values.V[6], + 15000); + + CORE.RA.addCyclotronRecipe( + new ItemStack[] { + CI.getNumberedCircuit(22), + Particle.getBaseParticle(Particle.UNKNOWN), + }, + FluidUtils.getWildcardFluidStack("hydrogen", 100), + new ItemStack[] { + Particle.getBaseParticle(Particle.PROTON), + Particle.getBaseParticle(Particle.PROTON), + Particle.getBaseParticle(Particle.PROTON), + Particle.getBaseParticle(Particle.PROTON), + Particle.getBaseParticle(Particle.PROTON), + Particle.getBaseParticle(Particle.PROTON), + Particle.getBaseParticle(Particle.PROTON), + Particle.getBaseParticle(Particle.PROTON), + Particle.getBaseParticle(Particle.PROTON), + }, + null, + new int[] { 375, 375, 375, 375, 375, 375, 375, 375, 375 }, + 20 * 20, + (int) GT_Values.V[6], + 15000); + + + + } diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java index 5d8c040996..a12e8b28fd 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java @@ -13,6 +13,7 @@ import gtPlusPlus.core.material.ALLOY; import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.recipe.common.CI; +import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.*; import gtPlusPlus.everglades.dimension.Dimension_Everglades; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; @@ -246,7 +247,7 @@ public class RECIPES_Machines { EV_MACHINE_Wiremill= ItemList.Machine_IV_Wiremill.get(1); HV_MACHINE_Macerator= ItemList.Machine_EV_Macerator.get(1); EV_MACHINE_Macerator= ItemList.Machine_IV_Macerator.get(1); - EV_MACHINE_MassFabricator= CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK ? ItemList.valueOf("Machine_LuV_Massfab").get(1, ItemList.Machine_IV_Massfab.get(1)) : ItemList.Machine_IV_Massfab.get(1); + EV_MACHINE_MassFabricator= CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK ? gtPlusPlus.core.util.Utils.getValueOfItemList("Machine_LuV_Massfab", ItemList.Machine_IV_Massfab).get(1) : ItemList.Machine_IV_Massfab.get(1); EV_MACHINE_Centrifuge= ItemList.Machine_IV_Centrifuge.get(1); EV_MACHINE_Cutter = ItemList.Machine_IV_Cutter.get(1); EV_MACHINE_Extruder = ItemList.Machine_IV_Extruder.get(1); @@ -339,6 +340,19 @@ public class RECIPES_Machines { 60 * 20 * 10, 8000); + // Super Jukebox + CORE.RA.addSixSlotAssemblingRecipe( + new ItemStack[] { + CI.machineHull_LV, + ItemUtils.getItemStackOfAmountFromOreDict("circuitBaisc", 8), + ItemUtils.getItemStackOfAmountFromOreDict("plateTumbaga", 8), + ItemUtils.getSimpleStack(Blocks.jukebox) + }, + ELEMENT.getInstance().COPPER.getFluid(144 * 2), + ItemUtils.getSimpleStack(ModBlocks.blockCustomJukebox), + 20 * 30, + 30); + @@ -823,7 +837,10 @@ public class RECIPES_Machines { //Air Intake Hatch - ItemStack aTieredFluidRegulator = CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK ? ItemList.valueOf("FluidRegulator_IV").get(1, ItemList.Pump_IV.get(1)) : ItemList.Pump_IV.get(1); + + + ItemList FluidRegulator_IV = Utils.getValueOfItemList("FluidRegulator_IV", ItemList.Pump_IV); + ItemStack aTieredFluidRegulator = CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK ? FluidRegulator_IV.get(1) : ItemList.Pump_IV.get(1); RecipeUtils.addShapedGregtechRecipe( @@ -1393,19 +1410,7 @@ public class RECIPES_Machines { - ItemStack aDrillController; - if (GTNH) { - aDrillController = ItemList.valueOf("OreDrill4").get(1); - } - else { - ItemList g = ItemList.valueOf("OreDrill4"); - if (g == null) { - aDrillController = CI.machineHull_UV; - } - else { - aDrillController = g.get(1); - } - } + ItemStack aDrillController = Utils.getValueOfItemList("OreDrill4", ItemList.Hull_UV).get(1); //Drilling Platform CORE.RA.addSixSlotAssemblingRecipe( diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Old_Circuits.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Old_Circuits.java index dbdf6b1437..98ea687747 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Old_Circuits.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Old_Circuits.java @@ -445,7 +445,7 @@ public class RECIPES_Old_Circuits implements IOreRecipeRegistrator { for (String component : CircuitToHide){ try { - API.hideItem(ItemList.valueOf(component).get(1L, new Object[0])); + API.hideItem(Utils.getValueOfItemList(component, null).get(1L, new Object[0])); } catch (IllegalArgumentException I){ Logger.INFO("Could not find "+component+" in the Gregtech item list."); Logger.INFO("This is NOT an error, simply a notification."); diff --git a/src/Java/gtPlusPlus/core/recipe/common/CI.java b/src/Java/gtPlusPlus/core/recipe/common/CI.java index 13a30a510c..b473b30c3c 100644 --- a/src/Java/gtPlusPlus/core/recipe/common/CI.java +++ b/src/Java/gtPlusPlus/core/recipe/common/CI.java @@ -475,9 +475,10 @@ public class CI { public static void init() { //Set Explosives - try { - if (ItemList.valueOf("Block_Powderbarrel") != null){ - explosivePowderKeg = ItemList.valueOf("Block_Powderbarrel").get(1).copy(); + try { + ItemList PowerderBarrel = gtPlusPlus.core.util.Utils.getValueOfItemList("Block_Powderbarrel", null); + if (PowerderBarrel != null){ + explosivePowderKeg = PowerderBarrel.get(1).copy(); } } catch (java.lang.IllegalArgumentException Y) { explosivePowderKeg = ItemUtils.getSimpleStack(Items.gunpowder).copy(); @@ -530,7 +531,6 @@ public class CI { */ private static final Material[] aMaterial_Main = new Material[] { - MaterialEIO.REDSTONE_ALLOY, ALLOY.POTIN, ALLOY.ZIRCONIUM_CARBIDE, ALLOY.EGLIN_STEEL, @@ -541,11 +541,11 @@ public class CI { ALLOY.PIKYONIUM, ELEMENT.STANDALONE.ADVANCED_NITINOL, ALLOY.ABYSSAL, - ALLOY.QUANTUM + ALLOY.QUANTUM, + ELEMENT.STANDALONE.HYPOGEN }; private static final Material[] aMaterial_Secondary = new Material[] { - ELEMENT.getInstance().LEAD, ALLOY.TUMBAGA, ALLOY.SILICON_CARBIDE, ALLOY.TUNGSTEN_CARBIDE, @@ -556,11 +556,11 @@ public class CI { ALLOY.CINOBITE, ALLOY.TITANSTEEL, ALLOY.OCTIRON, - ELEMENT.STANDALONE.CELESTIAL_TUNGSTEN + ELEMENT.STANDALONE.CELESTIAL_TUNGSTEN, + ELEMENT.STANDALONE.HYPOGEN }; private static final Material[] aMaterial_Tertiary = new Material[] { - ELEMENT.getInstance().IRON, ALLOY.STEEL, ELEMENT.getInstance().ALUMINIUM, ALLOY.STAINLESSSTEEL, @@ -571,7 +571,8 @@ public class CI { ALLOY.TRINIUM_REINFORCED_STEEL, //Arceus ALLOY.TITANSTEEL, ELEMENT.STANDALONE.ASTRAL_TITANIUM, - ELEMENT.STANDALONE.CELESTIAL_TUNGSTEN + ELEMENT.STANDALONE.CELESTIAL_TUNGSTEN, + ELEMENT.STANDALONE.HYPOGEN }; private static final Materials[] aMaterial_Cables = new Materials[] { diff --git a/src/Java/gtPlusPlus/core/util/Utils.java b/src/Java/gtPlusPlus/core/util/Utils.java index 968de2f55a..eef768e799 100644 --- a/src/Java/gtPlusPlus/core/util/Utils.java +++ b/src/Java/gtPlusPlus/core/util/Utils.java @@ -31,7 +31,9 @@ import net.minecraft.util.IChatComponent; import net.minecraft.world.World; import gregtech.GT_Mod; +import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.TC_Aspects; import gregtech.api.enums.TC_Aspects.TC_AspectStack; import gregtech.api.util.GT_LanguageManager; @@ -916,4 +918,25 @@ public class Utils { return false; } + public static ItemList getValueOfItemList(String string, ItemList aOther) { + try { + Method method = ItemList.class.getDeclaredMethod("values"); + Object obj = method.invoke(null); + String y = Arrays.toString((Object[]) obj); + String[] aCurrentItemsInList = y.split(","); + boolean found = false; + for (String g : aCurrentItemsInList) { + if (g.equals(string)) { + found = true; + break; + } + } + if (found) { + return ItemList.valueOf(string); + } + } + catch (Throwable t) {} + return aOther; + } + } |