diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2018-10-26 15:46:55 +0100 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2018-10-26 15:46:55 +0100 |
commit | 2cf05c4deaf3a26626853431f725d0ca375ffec3 (patch) | |
tree | 025ae135b88af6b9a0437a3721bcc2dec9ccc3e3 /src/Java/gtPlusPlus/xmod | |
parent | e9dbe58c39b56d562bcdc17b1100a7c26ce7c10e (diff) | |
download | GT5-Unofficial-2cf05c4deaf3a26626853431f725d0ca375ffec3.tar.gz GT5-Unofficial-2cf05c4deaf3a26626853431f725d0ca375ffec3.tar.bz2 GT5-Unofficial-2cf05c4deaf3a26626853431f725d0ca375ffec3.zip |
+ Added 4 new High-Tier Alloys. Lafium, Cinobite, Pikyonite & Abyssal.
+ Added missing Germanium Dust.
+ Added compatibility for Witchery.
- Removed portability of Tanks for GTNH, tanks are still portable otherwise.
$ Fixed calculations for automatic recipe generation, EBF and ABS recipe requirements for GT++ Alloys are now significantly increased.
$ Fixed missing Control Core textures.
% Cleaned up some recipe generation.
% Improved Material.java.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod')
4 files changed, 134 insertions, 30 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java index 9c67f0f84f..81559db1a5 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java @@ -13,6 +13,7 @@ import gregtech.api.objects.GT_RenderedTexture; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.preloader.asm.AsmConfig; public class GT_MetaTileEntity_TieredTank extends GT_MetaTileEntity_BasicTank { @@ -27,11 +28,14 @@ public class GT_MetaTileEntity_TieredTank extends GT_MetaTileEntity_BasicTank { @Override public String[] getDescription() { String[] aTip; + + String aTankPortableness = CORE.GTNH ? "non-portable" : "portable"; + if (this.mFluid == null) { - aTip = new String[] {this.mDescription, "A portable tank.", CORE.GT_Tooltip}; + aTip = new String[] {this.mDescription, "A "+aTankPortableness+" tank.", CORE.GT_Tooltip}; } else { - aTip = new String[] {this.mDescription, "A portable tank.", "Fluid: "+mFluid.getLocalizedName()+" "+mFluid.amount+"L", CORE.GT_Tooltip}; + aTip = new String[] {this.mDescription, "A "+aTankPortableness+" tank.", "Fluid: "+mFluid.getLocalizedName()+" "+mFluid.amount+"L", CORE.GT_Tooltip}; } return aTip; } @@ -129,27 +133,28 @@ public class GT_MetaTileEntity_TieredTank extends GT_MetaTileEntity_BasicTank { aBaseMetaTileEntity.openGUI(aPlayer); return true; } - + @Override public boolean displaysItemStack() { return true; } - + @Override public boolean displaysStackSize() { return false; } - - @Override - public void setItemNBT(NBTTagCompound aNBT) { - super.setItemNBT(aNBT); - if (mFluid != null){ - Logger.INFO("Setting item fluid nbt"); - aNBT.setTag("mFluid", mFluid.writeToNBT(new NBTTagCompound())); - if (aNBT.hasKey("mFluid")) { - Logger.INFO("Set mFluid to NBT."); - } - } - } + + @Override + public void setItemNBT(NBTTagCompound aNBT) { + if (CORE.NBT_PERSISTENCY_PATCH_APPLIED) { + if (mFluid != null){ + Logger.INFO("Setting item fluid nbt"); + aNBT.setTag("mFluid", mFluid.writeToNBT(new NBTTagCompound())); + if (aNBT.hasKey("mFluid")) { + Logger.INFO("Set mFluid to NBT."); + } + } + } + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java index 05f25e3cf0..ac3c8727d7 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java @@ -78,12 +78,19 @@ public class RecipeGen_BlastSmelter extends RecipeGen_Base { else { duration = (int) Math.max(M.getMass() / 50L, 1L) * 150; }*/ - + + int aSlot = M.vTier - 2; + if (aSlot < 2) { + aSlot = 2; + } + long aVoltage = GT_Values.V[aSlot >= 2 ? aSlot : 2]; + + //Set a duration - NEW - int duration = 200*M.vTier*20; + int duration = 120*M.vTier*20; if (M.vTier <= 4){ - duration = 40*M.vTier*20; + duration = 20*M.vTier*20; } int mMaterialListSize=0; @@ -123,7 +130,7 @@ public class RecipeGen_BlastSmelter extends RecipeGen_Base { //Generate Recipes for all singular materials that can be made molten. if (hasMoreInputThanACircuit){ if (M.requiresBlastFurnace()) { - if (CORE.RA.addBlastSmelterRecipe(tItemStackTest, M.getFluid(fluidAmount), 100, duration, 240)){ + if (CORE.RA.addBlastSmelterRecipe(tItemStackTest, M.getFluid(fluidAmount), 100, duration, (int) aVoltage)){ Logger.WARNING("[BAS] Success."); Logger.WARNING("[BAS] Success, Also added a Fluid solidifier recipe."); if (GT_Values.RA.addFluidExtractionRecipe(M.getIngot(1), null, M.getFluid(144), 100, duration, 120)){ @@ -145,7 +152,7 @@ public class RecipeGen_BlastSmelter extends RecipeGen_Base { } } else { - if (CORE.RA.addBlastSmelterRecipe(tItemStackTest, M.getFluid(fluidAmount), 100, duration/2, 120)){ + if (CORE.RA.addBlastSmelterRecipe(tItemStackTest, M.getFluid(fluidAmount), 100, duration/2, (int) aVoltage)){ Logger.WARNING("[BAS] Success."); if (GT_Values.RA.addFluidSolidifierRecipe(ItemList.Shape_Mold_Ingot.get(0), M.getFluid(144), M.getIngot(1), duration/2, 60)){ Logger.WARNING("[BAS] Success, Also added a Fluid solidifier recipe."); @@ -246,7 +253,7 @@ public class RecipeGen_BlastSmelter extends RecipeGen_Base { //Adds Recipe if (M.requiresBlastFurnace()) { - if (CORE.RA.addBlastSmelterRecipe(components, componentsFluid, M.getFluid(fluidAmount), 100, duration, 500)){ + if (CORE.RA.addBlastSmelterRecipe(components, componentsFluid, M.getFluid(fluidAmount), 100, duration, (int) aVoltage)){ Logger.WARNING("[BAS] Success."); } else { @@ -254,7 +261,7 @@ public class RecipeGen_BlastSmelter extends RecipeGen_Base { } } else { - if (CORE.RA.addBlastSmelterRecipe(components, componentsFluid, M.getFluid(fluidAmount), 100, duration, 240)){ + if (CORE.RA.addBlastSmelterRecipe(components, componentsFluid, M.getFluid(fluidAmount), 100, duration, (int) aVoltage/2)){ Logger.WARNING("[BAS] Success."); } else { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java index 49407f843c..f78f81f82c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java @@ -244,20 +244,23 @@ public class RecipeGen_DustGeneration extends RecipeGen_Base { input4 = (inputStacks.length >= 4) ? (input4 = (inputStacks[3] == null) ? null : inputStacks[3]) : null; if (inputStacks.length == 1) { - input2 = CI.getNumberedCircuit(20); + input2 = input1; + input1 = CI.getNumberedCircuit(20); } else if (inputStacks.length == 2) { - input3 = CI.getNumberedCircuit(20); + input3 = input2; + input2 = input1; + input1 = CI.getNumberedCircuit(20); } else if (inputStacks.length == 3) { - input4 = CI.getNumberedCircuit(20); - + input4 = input3; + input3 = input2; + input2 = input1; + input1 = CI.getNumberedCircuit(20); } - - + //Add mixer Recipe - FluidStack oxygen = GT_Values.NF; if (material.getComposites() != null){ int compSlot = 0; diff --git a/src/Java/gtPlusPlus/xmod/witchery/WitchUtils.java b/src/Java/gtPlusPlus/xmod/witchery/WitchUtils.java new file mode 100644 index 0000000000..b28ccdaa9b --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/witchery/WitchUtils.java @@ -0,0 +1,89 @@ +package gtPlusPlus.xmod.witchery; + +import java.lang.reflect.Field; +import java.util.ArrayList; + +import com.emoniph.witchery.Witchery; +import com.emoniph.witchery.entity.ai.EntityAIDigBlocks; +import com.mojang.authlib.GameProfile; + +import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.FurnaceRecipes; +import net.minecraftforge.event.world.BlockEvent; +import net.minecraftforge.oredict.OreDictionary; + +public class WitchUtils { + + private static final Field KOBOLDITE_MINER_PROFILE; + + static { + if (LoadedMods.Witchery) { + KOBOLDITE_MINER_PROFILE = getField("com.emoniph.witchery.entity.ai.EntityAIDigBlocks", "KOBOLDITE_MINER_PROFILE"); + } + else { + KOBOLDITE_MINER_PROFILE = null; + } + + } + + //com.emoniph.witchery.entity.ai.EntityAIDigBlocks.onHarvestDrops(EntityPlayer, HarvestDropsEvent) + public static void onHarvestDrops(final EntityPlayer harvester, final BlockEvent.HarvestDropsEvent event) { + if (harvester != null && !harvester.worldObj.isRemote && !event.isCanceled() && (isEqual(harvester.getGameProfile(), EntityAIDigBlocks.KOBOLDITE_MINER_PROFILE) || isEqual(harvester.getGameProfile(), EntityAIDigBlocks.NORMAL_MINER_PROFILE))) { + final boolean hasKobolditePick = isEqual(harvester.getGameProfile(), EntityAIDigBlocks.KOBOLDITE_MINER_PROFILE); + final ArrayList<ItemStack> newDrops = new ArrayList<ItemStack>(); + double kobolditeChance = hasKobolditePick ? 0.02 : 0.01; + for (final ItemStack drop : event.drops) { + final int[] oreIDs = OreDictionary.getOreIDs(drop); + boolean addOriginal = true; + if (oreIDs.length > 0) { + final String oreName = OreDictionary.getOreName(oreIDs[0]); + if (oreName != null && oreName.startsWith("ore")) { + final ItemStack smeltedDrop = FurnaceRecipes.smelting().getSmeltingResult(drop); + if (smeltedDrop != null && hasKobolditePick && harvester.worldObj.rand.nextDouble() < 0.5) { + addOriginal = false; + newDrops.add(smeltedDrop.copy()); + newDrops.add(smeltedDrop.copy()); + if (harvester.worldObj.rand.nextDouble() < 0.25) { + newDrops.add(smeltedDrop.copy()); + } + } + kobolditeChance = (hasKobolditePick ? 0.08 : 0.05); + } + } + if (addOriginal) { + newDrops.add(drop); + } + } + event.drops.clear(); + for (final ItemStack newDrop : newDrops) { + event.drops.add(newDrop); + } + if (kobolditeChance > 0.0 && harvester.worldObj.rand.nextDouble() < kobolditeChance) { + event.drops.add(Witchery.Items.GENERIC.itemKobolditeDust.createStack()); + } + } + } + + public static Field getField(String aClassName, String aFieldName) { + Class c; + try { + c = Class.forName(aClassName); + if (c != null) { + Field f = ReflectionUtils.getField(c, aFieldName); + if (f != null) { + return f; + } + } + } catch (ClassNotFoundException | NoSuchFieldException e) { + } + return null; + } + + public static boolean isEqual(final GameProfile a, final GameProfile b) { + return a != null && b != null && a.getId() != null && b.getId() != null && a.getId().equals(b.getId()); + } + +} |