diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2019-05-13 18:20:11 +1000 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2019-05-13 18:20:11 +1000 |
commit | ff47ff098d524402639b3593a0eb58dbbcbeb538 (patch) | |
tree | 5dbf22a9a978e6b1c6fc690c5d3a54c6b70bc5c7 /src | |
parent | f7390af19986b4e4370379bb46dee71f12b717e8 (diff) | |
download | GT5-Unofficial-ff47ff098d524402639b3593a0eb58dbbcbeb538.tar.gz GT5-Unofficial-ff47ff098d524402639b3593a0eb58dbbcbeb538.tar.bz2 GT5-Unofficial-ff47ff098d524402639b3593a0eb58dbbcbeb538.zip |
+ Added EntityDeathHandler.java, along with some custom drops for Zombies, Blazes and SpecialMob's Brutish Zombie.
$ Temporarily disabled bonus outputs again on Multiblocks, fixing the ghost item issue along with processing.
Diffstat (limited to 'src')
7 files changed, 341 insertions, 59 deletions
diff --git a/src/Java/gtPlusPlus/core/common/CommonProxy.java b/src/Java/gtPlusPlus/core/common/CommonProxy.java index 23bdb2c5f1..6058d03b80 100644 --- a/src/Java/gtPlusPlus/core/common/CommonProxy.java +++ b/src/Java/gtPlusPlus/core/common/CommonProxy.java @@ -28,6 +28,7 @@ import gtPlusPlus.core.handler.GuiHandler; import gtPlusPlus.core.handler.StopAnnoyingFuckingAchievements; import gtPlusPlus.core.handler.events.BlockEventHandler; import gtPlusPlus.core.handler.events.EnderDragonDeathHandler; +import gtPlusPlus.core.handler.events.EntityDeathHandler; import gtPlusPlus.core.handler.events.GeneralTooltipEventHandler; import gtPlusPlus.core.handler.events.PickaxeBlockBreakEventHandler; import gtPlusPlus.core.handler.events.ZombieBackupSpawnEventHandler; @@ -36,17 +37,26 @@ import gtPlusPlus.core.item.chemistry.GenericChem; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.CORE.ConfigSwitches; import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.core.material.ALLOY; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.tileentities.ModTileEntities; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.debug.DEBUG_INIT; +import gtPlusPlus.core.util.minecraft.EntityUtils; +import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.player.PlayerCache; +import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.plugin.villagers.block.BlockGenericSpawner; import gtPlusPlus.xmod.eio.handler.HandlerTooltip_EIO; import gtPlusPlus.xmod.galacticraft.handler.HandlerTooltip_GC; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import gtPlusPlus.xmod.thermalfoundation.item.TF_Items; +import net.minecraft.enchantment.Enchantment; import net.minecraft.entity.Entity; +import net.minecraft.entity.monster.EntityBlaze; +import net.minecraft.entity.monster.EntityZombie; +import net.minecraft.item.ItemStack; import net.minecraftforge.common.ForgeChunkManager; public class CommonProxy { @@ -147,6 +157,7 @@ public class CommonProxy { ForgeChunkManager.setForcedChunkLoadingCallback(GTplusplus.instance, ChunkManager.getInstance()); Utils.registerEvent(ChunkManager.getInstance()); Utils.registerEvent(new EnderDragonDeathHandler()); + Utils.registerEvent(new EntityDeathHandler()); if (ConfigSwitches.disableZombieReinforcement) { // Make Zombie reinforcements fuck off. @@ -181,6 +192,7 @@ public class CommonProxy { COMPAT_HANDLER.startLoadingGregAPIBasedRecipes(); COMPAT_IntermodStaging.postInit(e); COMPAT_HANDLER.runQueuedRecipes(); + registerCustomMobDrops(); } public void serverStarting(final FMLServerStartingEvent e) { @@ -226,5 +238,35 @@ public class CommonProxy { public void registerCustomItemsForMaterials() { Material.registerComponentForMaterial(GenericChem.CARBYNE, OrePrefixes.plate, GregtechItemList.Carbyne_Sheet_Finished.get(1)); } + + public void registerCustomMobDrops() { + + //Zombie + EntityUtils.registerDropsForMob(EntityZombie.class, ItemUtils.getSimpleStack(ModItems.itemRope), 3, 100); + EntityUtils.registerDropsForMob(EntityZombie.class, ItemUtils.getSimpleStack(ModItems.itemFiber), 5, 250); + EntityUtils.registerDropsForMob(EntityZombie.class, ItemUtils.getSimpleStack(ModItems.itemSandstoneHammer), 1, 10); + EntityUtils.registerDropsForMob(EntityZombie.class, ItemUtils.getSimpleStack(ModItems.itemBomb), 2, 10); + EntityUtils.registerDropsForMob(EntityZombie.class, ALLOY.TUMBAGA.getTinyDust(1), 1, 10); + EntityUtils.registerDropsForMob(EntityZombie.class, ALLOY.POTIN.getTinyDust(1), 1, 10); + + //Blazes + EntityUtils.registerDropsForMob(EntityBlaze.class, ItemUtils.getSimpleStack(TF_Items.dustPyrotheum, 1), 1, 10); + EntityUtils.registerDropsForMob(EntityBlaze.class, ItemUtils.getSimpleStack(TF_Items.dustPyrotheum, 1), 1, 10); + + //Special mobs Support + if (ReflectionUtils.doesClassExist("toast.specialMobs.entity.zombie.EntityBrutishZombie")) { + Class aBrutishZombie = ReflectionUtils.getClass("toast.specialMobs.entity.zombie.EntityBrutishZombie"); + ItemStack aFortune1 = ItemUtils.getEnchantedBook(Enchantment.fortune, 1); + ItemStack aFortune2 = ItemUtils.getEnchantedBook(Enchantment.fortune, 1); + ItemStack aFortune3 = ItemUtils.getEnchantedBook(Enchantment.fortune, 1); + EntityUtils.registerDropsForMob(aBrutishZombie, aFortune1, 1, 100); + EntityUtils.registerDropsForMob(aBrutishZombie, aFortune2, 1, 50); + EntityUtils.registerDropsForMob(aBrutishZombie, aFortune3, 1, 1); + EntityUtils.registerDropsForMob(aBrutishZombie, ItemUtils.getItemStackOfAmountFromOreDict("ingotRedAlloy", 1), 3, 200); + } + + + + } } diff --git a/src/Java/gtPlusPlus/core/handler/events/EnderDragonDeathHandler.java b/src/Java/gtPlusPlus/core/handler/events/EnderDragonDeathHandler.java index c1c2341dd6..884f14386d 100644 --- a/src/Java/gtPlusPlus/core/handler/events/EnderDragonDeathHandler.java +++ b/src/Java/gtPlusPlus/core/handler/events/EnderDragonDeathHandler.java @@ -2,7 +2,6 @@ package gtPlusPlus.core.handler.events; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import gtPlusPlus.core.material.ELEMENT; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.PlayerUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; @@ -24,6 +23,7 @@ public class EnderDragonDeathHandler { public void onEntityDrop(LivingDropsEvent event) { boolean aDidDrop = false; + int aCountTotal = 0; //HEE Dragon if (mHEE) { @@ -33,6 +33,7 @@ public class EnderDragonDeathHandler { int aAmount = MathUtils.randInt(5, 25); event.entityLiving.entityDropItem(ELEMENT.STANDALONE.DRAGON_METAL.getNugget(aAmount), MathUtils.randFloat(0, 1)); aDidDrop = true; + aCountTotal =+ aAmount; } } } @@ -44,12 +45,13 @@ public class EnderDragonDeathHandler { int aAmount = MathUtils.randInt(1, 10); event.entityLiving.entityDropItem(ELEMENT.STANDALONE.DRAGON_METAL.getNugget(aAmount), MathUtils.randFloat(0, 1)); aDidDrop = true; + aCountTotal =+ aAmount; } } } if (aDidDrop) { - PlayerUtils.messageAllPlayers("Small quantities of Dragonsblood has crystalized after the death of the Ender Dragon!"); + PlayerUtils.messageAllPlayers(aCountTotal+" Shards of Dragons Blood have crystalized into a metallic form."); } } diff --git a/src/Java/gtPlusPlus/core/handler/events/EntityDeathHandler.java b/src/Java/gtPlusPlus/core/handler/events/EntityDeathHandler.java new file mode 100644 index 0000000000..c4ab6edaa6 --- /dev/null +++ b/src/Java/gtPlusPlus/core/handler/events/EntityDeathHandler.java @@ -0,0 +1,95 @@ +package gtPlusPlus.core.handler.events; + +import java.util.HashMap; +import java.util.HashSet; + +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.api.objects.data.Triplet; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; +import net.minecraftforge.event.entity.living.LivingDropsEvent; + +public class EntityDeathHandler { + + + private static final HashMap<Class, AutoMap<Triplet<ItemStack, Integer, Integer>>> mMobDropMap = new HashMap<Class, AutoMap<Triplet<ItemStack, Integer, Integer>>>(); + private static final HashSet<Class> mInternalClassKeyCache = new HashSet<Class>(); + + /** + * Provides the ability to provide custom drops upon the death of EntityLivingBase objects. + * @param aMobClass - The Base Class you want to drop this item. + * @param aStack - The ItemStack, stack size is not respected. + * @param aMaxAmount - The maximum size of the ItemStack which drops. + * @param aChance - Chance out of 10000, where 100 is 1%. (1 = 0.01% - this is ok) + */ + public static void registerDropsForMob(Class aMobClass, ItemStack aStack, int aMaxAmount, int aChance) { + Triplet<ItemStack, Integer, Integer> aData = new Triplet<ItemStack, Integer, Integer>(aStack, aMaxAmount, aChance); + AutoMap<Triplet<ItemStack, Integer, Integer>> aDataMap = mMobDropMap.get(aMobClass); + if (aDataMap == null) { + aDataMap = new AutoMap<Triplet<ItemStack, Integer, Integer>>(); + } + aDataMap.put(aData); + mMobDropMap.put(aMobClass, aDataMap); + + Logger.INFO("[Loot] Registered "+aStack.getDisplayName()+" (1-"+aMaxAmount+") as a valid drop for "+aMobClass.getCanonicalName()); + + if (!mInternalClassKeyCache.contains(aMobClass)) { + mInternalClassKeyCache.add(aMobClass); + } + + } + + private static ItemStack processItemDropTriplet(Triplet<ItemStack, Integer, Integer> aData) { + ItemStack aLoot = aData.getValue_1(); + int aMaxDrop = aData.getValue_2(); + int aChanceOutOf10000 = aData.getValue_3(); + if (MathUtils.randInt(0, 10000) <= aChanceOutOf10000) { + aLoot = ItemUtils.getSimpleStack(aLoot, MathUtils.randInt(1, aMaxDrop)); + if (ItemUtils.checkForInvalidItems(aLoot)) { + return aLoot; + } + } + return null; + } + + private static boolean processDropsForMob(EntityLivingBase entityLiving) { + AutoMap<Triplet<ItemStack, Integer, Integer>> aMobData = mMobDropMap.get(entityLiving.getClass()); + boolean aDidDrop = false; + if (aMobData != null) { + if (!aMobData.isEmpty()) { + ItemStack aPossibleDrop; + for (Triplet<ItemStack, Integer, Integer> g : aMobData) { + aPossibleDrop = processItemDropTriplet(g); + if (aPossibleDrop != null) { + if (entityLiving.entityDropItem(aPossibleDrop, MathUtils.randFloat(0, 1)) != null) { + aDidDrop = true; + } + } + } + } + } + return aDidDrop; + } + + + + + + @SubscribeEvent + public void onEntityDrop(LivingDropsEvent event) { + boolean aDidDrop = false; + if (event == null || event.entityLiving == null) { + return; + } + for (Class c : mInternalClassKeyCache) { + if (c.isInstance(event.entityLiving)) { + aDidDrop = processDropsForMob(event.entityLiving); + } + } + } + +} diff --git a/src/Java/gtPlusPlus/core/util/minecraft/EntityUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/EntityUtils.java index 8c5a9f6581..49aa3a1306 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/EntityUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/EntityUtils.java @@ -11,6 +11,7 @@ import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.api.objects.minecraft.AABB; import gtPlusPlus.api.objects.minecraft.BlockPos; +import gtPlusPlus.core.handler.events.EntityDeathHandler; import gtPlusPlus.core.util.reflect.ReflectionUtils; import ic2.core.IC2Potion; import ic2.core.item.armor.ItemArmorHazmat; @@ -20,6 +21,7 @@ import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EnumCreatureType; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; import net.minecraft.world.World; @@ -87,7 +89,7 @@ public class EntityUtils { } return false; } - + public static boolean applyHeatDamageToEntity(final int heatLevel, final World world, final Entity entityHolding){ if (!world.isRemote){ if ((heatLevel > 0) && (entityHolding instanceof EntityLivingBase)) { @@ -113,11 +115,7 @@ public class EntityUtils { */ public synchronized static boolean doFireDamage(Entity entity, int amount){ if (dealFireDamage == null){ - try { - dealFireDamage = Entity.class.getDeclaredMethod("dealFireDamage", int.class); - dealFireDamage.setAccessible(true); - } - catch (NoSuchMethodException | SecurityException e) {} + dealFireDamage = ReflectionUtils.getMethod(Entity.class, "dealFireDamage", int.class); } else { try { @@ -131,42 +129,41 @@ public class EntityUtils { public static void doDamage(Entity entity, DamageSource dmg, int i) { entity.attackEntityFrom(dmg, i); } - + public static boolean isTileEntityRegistered(Class aTileClass, String aTileName) { Field aRegistry = ReflectionUtils.getField(ReflectionUtils.getClass("net.minecraft.tileentity.TileEntity"), "nameToClassMap"); Field aRegistry2 = ReflectionUtils.getField(ReflectionUtils.getClass("net.minecraft.tileentity.TileEntity"), "classToNameMap"); try { Object o = aRegistry.get(null); if (o != null) { - Map nameToClassMap = (Map) o; - if (!nameToClassMap.containsKey(aTileName)) { - o = aRegistry2.get(null); - if (o != null) { - Map classToNameMap = (Map) o; - if (!classToNameMap.containsKey(aTileClass)) { - return false; - } - else { - return true; - } - } - } - else { - return true; - } + Map nameToClassMap = (Map) o; + if (!nameToClassMap.containsKey(aTileName)) { + o = aRegistry2.get(null); + if (o != null) { + Map classToNameMap = (Map) o; + if (!classToNameMap.containsKey(aTileClass)) { + return false; + } + else { + return true; + } + } + } + else { + return true; + } } } catch (IllegalArgumentException | IllegalAccessException e) { e.printStackTrace(); } return false; } - + public static double getDistance(Entity p1, Entity p2) { - return Math.sqrt( Math.pow(p1.posX - p2.posX, 2) + Math.pow(p1.posY - p2.posY, 2) + Math.pow(p1.posZ - p2.posZ, 2)); + return Math.sqrt( Math.pow(p1.posX - p2.posX, 2) + Math.pow(p1.posY - p2.posY, 2) + Math.pow(p1.posZ - p2.posZ, 2)); } - + public static AutoMap<Entity> getEntitiesWithinBoundingBoxExcluding(Entity aExclusion, AABB aBoundingBox){ - if (aExclusion == null) { return new AutoMap<Entity>(); } @@ -175,9 +172,8 @@ public class EntityUtils { return new AutoMap<Entity>(aEntities); } } - + public static AutoMap<Entity> getEntitiesWithinBoundingBox(Class aEntityType, AABB aBoundingBox){ - if (aEntityType == null) { return new AutoMap<Entity>(); } @@ -186,5 +182,26 @@ public class EntityUtils { return new AutoMap<Entity>(aEntities); } } + + /** + * Provides the ability to provide custom drops upon the death of EntityLivingBase objects. Simplified function with static Max drop size of 1. + * @param aMobClass - The Base Class you want to drop this item. + * @param aStack - The ItemStack, stack size is not respected. + * @param aChance - Chance out of 10000, where 100 is 1%. (1 = 0.01% - this is ok) + */ + public static void registerDropsForMob(Class aMobClass, ItemStack aStack, int aChance) { + registerDropsForMob(aMobClass, aStack, 1, aChance); + } + + /** + * Provides the ability to provide custom drops upon the death of EntityLivingBase objects. + * @param aMobClass - The Base Class you want to drop this item. + * @param aStack - The ItemStack, stack size is not respected. + * @param aMaxAmount - The maximum size of the ItemStack which drops. + * @param aChance - Chance out of 10000, where 100 is 1%. (1 = 0.01% - this is ok) + */ + public static void registerDropsForMob(Class aMobClass, ItemStack aStack, int aMaxAmount, int aChance) { + EntityDeathHandler.registerDropsForMob(aMobClass, aStack, aMaxAmount, aChance); + } } diff --git a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java index 8b2e04d738..433f26aa11 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java @@ -35,6 +35,8 @@ import gtPlusPlus.xmod.gregtech.api.items.Gregtech_MetaTool; import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_DustGeneration; import net.minecraft.block.Block; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnchantmentData; import net.minecraft.init.Items; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; @@ -1205,4 +1207,13 @@ public class ItemUtils { return aOutput; } + public static ItemStack getEnchantedBook(Enchantment aEnch, int aLevel) { + return enchantItem(new ItemStack(Items.enchanted_book), aEnch, aLevel); + } + + public static ItemStack enchantItem(ItemStack aStack, Enchantment aEnch, int aLevel) { + Items.enchanted_book.addEnchantment(aStack, new EnchantmentData(aEnch, aLevel)); + return aStack; + } + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index e9f8546545..0e1ef0e47e 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -540,26 +540,149 @@ GT_MetaTileEntity_MultiBlockBase { } + /* + * public boolean checkRecipeGeneric( ItemStack[] aItemInputs, FluidStack[] + * aFluidInputs, int aMaxParallelRecipes, int aEUPercent, int + * aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe) { // Based on + * the Processing Array. A bit overkill, but very flexible. + * + * + * if (this.doesMachineBoostOutput()) { log("Boosting."); return + * checkRecipeBoostedOutputs(aItemInputs, aFluidInputs, aMaxParallelRecipes, + * aEUPercent, aSpeedBonusPercent, aOutputChanceRoll, aRecipe); } + * + * + * //Control Core to control the Multiblocks behaviour. int aControlCoreTier = + * getControlCoreTier(); + * + * //If no core, return false; if (aControlCoreTier > 0) { + * log("Control core found."); } + * + * + * // Reset outputs and progress stats this.mEUt = 0; this.mMaxProgresstime = 0; + * this.mOutputItems = new ItemStack[]{}; this.mOutputFluids = new + * FluidStack[]{}; + * + * long tVoltage = getMaxInputVoltage(); byte tTier = (byte) Math.max(1, + * GT_Utility.getTier(tVoltage)); log("Running checkRecipeGeneric(0)"); + * + * //Check to see if Voltage Tier > Control Core Tier if (tTier > + * aControlCoreTier) { + * log("Control core found is lower tier than power tier. OK"); tTier = (byte) + * aControlCoreTier; } + * + * tTier = (byte) MathUtils.getValueWithinRange(tTier, 0, 9); + * + * GT_Recipe tRecipe = aRecipe != null ? aRecipe : findRecipe( + * getBaseMetaTileEntity(), mLastRecipe, false, + * gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs); + * + * log("Running checkRecipeGeneric(1)"); // Remember last recipe - an + * optimization for findRecipe() this.mLastRecipe = tRecipe; + * + * if (tRecipe == null) { log("BAD RETURN - 1"); return false; } + * + * if (!this.canBufferOutputs(tRecipe, aMaxParallelRecipes)) { + * log("BAD RETURN - 2"); return false; } + * + * // EU discount float tRecipeEUt = (tRecipe.mEUt * aEUPercent) / 100.0f; float + * tTotalEUt = 0.0f; + * + * int parallelRecipes = 0; + * + * log("parallelRecipes: "+parallelRecipes); + * log("aMaxParallelRecipes: "+aMaxParallelRecipes); + * log("tTotalEUt: "+tTotalEUt); log("tVoltage: "+tVoltage); + * log("tRecipeEUt: "+tRecipeEUt); Logger.INFO("EU1: "+tRecipeEUt); // Count + * recipes to do in parallel, consuming input items and fluids and considering + * input voltage limits for (; parallelRecipes < aMaxParallelRecipes && + * tTotalEUt < (tVoltage - tRecipeEUt); parallelRecipes++) { if + * (!tRecipe.isRecipeInputEqual(true, aFluidInputs, aItemInputs)) { + * log("Broke at "+parallelRecipes+"."); break; } + * log("Bumped EU from "+tTotalEUt+" to "+(tTotalEUt+tRecipeEUt)+"."); tTotalEUt + * += tRecipeEUt; Logger.INFO("EU2: "+tTotalEUt); } + * + * if (parallelRecipes == 0) { log("BAD RETURN - 3"); return false; } + * + * Logger.INFO("EU3: "+tTotalEUt); + * + * // -- Try not to fail after this point - inputs have already been consumed! + * -- + * + * + * // Convert speed bonus to duration multiplier // e.g. 100% speed bonus = 200% + * speed = 100%/200% = 50% recipe duration. aSpeedBonusPercent = Math.max(-99, + * aSpeedBonusPercent); float tTimeFactor = 100.0f / (100.0f + + * aSpeedBonusPercent); this.mMaxProgresstime = (int)(tRecipe.mDuration * + * tTimeFactor * 10000); + * + * int aTempEu = (int) Math.floor(tTotalEUt); Logger.INFO("EU4: "+aTempEu); + * this.mEUt = (int) aTempEu; + * + * + * this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + * this.mEfficiencyIncrease = 10000; + * + * // Overclock if (this.mEUt <= 16) { this.mEUt = (this.mEUt * (1 << tTier - 1) + * * (1 << tTier - 1)); this.mMaxProgresstime = (this.mMaxProgresstime / (1 << + * tTier - 1)); } else { while (this.mEUt <= + * gregtech.api.enums.GT_Values.V[(tTier - 1)]) { this.mEUt *= 4; + * this.mMaxProgresstime /= 2; } } + * + * if (this.mEUt > 0) { this.mEUt = (-this.mEUt); } + * + * this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + * + * // Collect fluid outputs FluidStack[] tOutputFluids = new + * FluidStack[tRecipe.mFluidOutputs.length]; for (int h = 0; h < + * tRecipe.mFluidOutputs.length; h++) { if (tRecipe.getFluidOutput(h) != null) { + * tOutputFluids[h] = tRecipe.getFluidOutput(h).copy(); tOutputFluids[h].amount + * *= parallelRecipes; } } + * + * // Collect output item types ItemStack[] tOutputItems = new + * ItemStack[tRecipe.mOutputs.length]; for (int h = 0; h < + * tRecipe.mOutputs.length; h++) { if (tRecipe.getOutput(h) != null) { + * tOutputItems[h] = tRecipe.getOutput(h).copy(); tOutputItems[h].stackSize = 0; + * } } + * + * // Set output item stack sizes (taking output chance into account) for (int f + * = 0; f < tOutputItems.length; f++) { if (tRecipe.mOutputs[f] != null && + * tOutputItems[f] != null) { for (int g = 0; g < parallelRecipes; g++) { if + * (getBaseMetaTileEntity().getRandomNumber(aOutputChanceRoll) < + * tRecipe.getOutputChance(f)) tOutputItems[f].stackSize += + * tRecipe.mOutputs[f].stackSize; } } } + * + * tOutputItems = removeNulls(tOutputItems); + * + * // Sanitize item stack size, splitting any stacks greater than max stack size + * List<ItemStack> splitStacks = new ArrayList<ItemStack>(); for (ItemStack + * tItem : tOutputItems) { while (tItem.getMaxStackSize() < tItem.stackSize) { + * ItemStack tmp = tItem.copy(); tmp.stackSize = tmp.getMaxStackSize(); + * tItem.stackSize = tItem.stackSize - tItem.getMaxStackSize(); + * splitStacks.add(tmp); } } + * + * if (splitStacks.size() > 0) { ItemStack[] tmp = new + * ItemStack[splitStacks.size()]; tmp = splitStacks.toArray(tmp); tOutputItems = + * ArrayUtils.addAll(tOutputItems, tmp); } + * + * // Strip empty stacks List<ItemStack> tSList = new ArrayList<ItemStack>(); + * for (ItemStack tS : tOutputItems) { if (tS.stackSize > 0) tSList.add(tS); } + * tOutputItems = tSList.toArray(new ItemStack[tSList.size()]); + * + * // Commit outputs this.mOutputItems = tOutputItems; this.mOutputFluids = + * tOutputFluids; updateSlots(); + * + * // Play sounds (GT++ addition - GT multiblocks play no sounds) + * startProcess(); + * + * log("GOOD RETURN - 1"); return true; } + */ + public boolean checkRecipeGeneric( ItemStack[] aItemInputs, FluidStack[] aFluidInputs, int aMaxParallelRecipes, int aEUPercent, int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe) { - // Based on the Processing Array. A bit overkill, but very flexible. - - - if (this.doesMachineBoostOutput()) { - log("Boosting."); - return checkRecipeBoostedOutputs(aItemInputs, aFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll, aRecipe); - } - - - //Control Core to control the Multiblocks behaviour. - int aControlCoreTier = getControlCoreTier(); - - //If no core, return false; - if (aControlCoreTier > 0) { - log("Control core found."); - } + // Based on the Processing Array. A bit overkill, but very flexible. // Reset outputs and progress stats @@ -572,15 +695,8 @@ GT_MetaTileEntity_MultiBlockBase { byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); log("Running checkRecipeGeneric(0)"); - //Check to see if Voltage Tier > Control Core Tier - if (tTier > aControlCoreTier) { - log("Control core found is lower tier than power tier. OK"); - tTier = (byte) aControlCoreTier; - } - tTier = (byte) MathUtils.getValueWithinRange(tTier, 0, 9); - - GT_Recipe tRecipe = aRecipe != null ? aRecipe : findRecipe( + GT_Recipe tRecipe = findRecipe( getBaseMetaTileEntity(), mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs); @@ -636,7 +752,7 @@ GT_MetaTileEntity_MultiBlockBase { this.mEUt = (int)Math.ceil(tTotalEUt); this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); - this.mEfficiencyIncrease = 10000; + this.mEfficiencyIncrease = 10000; // Overclock if (this.mEUt <= 16) { @@ -719,8 +835,7 @@ GT_MetaTileEntity_MultiBlockBase { log("GOOD RETURN - 1"); return true; - } - +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java index 7c57f799d7..38306d914d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java @@ -120,7 +120,7 @@ extends GregtechMeta_MultiBlockBase { @Override protected boolean doesMachineBoostOutput() { - return true; + return false; } @Override |