diff options
-rw-r--r-- | src/main/java/kubatech/loaders/MobRecipeLoader.java | 15 | ||||
-rw-r--r-- | src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeExterminationChamber.java | 46 |
2 files changed, 48 insertions, 13 deletions
diff --git a/src/main/java/kubatech/loaders/MobRecipeLoader.java b/src/main/java/kubatech/loaders/MobRecipeLoader.java index eeb37ba2fb..25ed2780da 100644 --- a/src/main/java/kubatech/loaders/MobRecipeLoader.java +++ b/src/main/java/kubatech/loaders/MobRecipeLoader.java @@ -113,6 +113,7 @@ public class MobRecipeLoader { public static droplist infernaldrops; public final boolean isPeacefulAllowed; public final EntityLiving entity; + public final float maxEntityHealth; @SuppressWarnings("unchecked") public MobRecipe copy() { @@ -123,7 +124,8 @@ public class MobRecipeLoader { infernalityAllowed, alwaysinfernal, isPeacefulAllowed, - entity); + entity, + maxEntityHealth); } private MobRecipe( @@ -133,7 +135,8 @@ public class MobRecipeLoader { boolean infernalityAllowed, boolean alwaysinfernal, boolean isPeacefulAllowed, - EntityLiving entity) { + EntityLiving entity, + float maxEntityHealth) { this.mOutputs = mOutputs; this.mDuration = mDuration; this.mMaxDamageChance = mMaxDamageChance; @@ -141,6 +144,7 @@ public class MobRecipeLoader { this.alwaysinfernal = alwaysinfernal; this.isPeacefulAllowed = isPeacefulAllowed; this.entity = entity; + this.maxEntityHealth = maxEntityHealth; } @SuppressWarnings("unchecked") @@ -203,14 +207,15 @@ public class MobRecipeLoader { } mMaxDamageChance = maxdamagechance; // Powered spawner with octadic capacitor spawns ~22/min ~= 0.366/sec ~= 2.72s/spawn ~= 54.54t/spawn - mDuration = 55 + 10 + (((int) e.getMaxHealth() / 5) * 10); + maxEntityHealth = e.getMaxHealth(); + mDuration = 55 + (int) (maxEntityHealth * 10); entity = e; } public ItemStack[] generateOutputs( - Random rnd, GT_MetaTileEntity_ExtremeExterminationChamber MTE, int lootinglevel) { + Random rnd, GT_MetaTileEntity_ExtremeExterminationChamber MTE, double attackDamage, int lootinglevel) { MTE.mEUt = mEUt; - MTE.mMaxProgresstime = mDuration; + MTE.mMaxProgresstime = Math.min(55, (int) ((maxEntityHealth / attackDamage) * 10d)); ArrayList<ItemStack> stacks = new ArrayList<>(mOutputs.size()); for (MobDrop o : mOutputs) { int chance = o.chance; diff --git a/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeExterminationChamber.java b/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeExterminationChamber.java index 03bc9f7cdc..6eda8055be 100644 --- a/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeExterminationChamber.java +++ b/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeExterminationChamber.java @@ -34,6 +34,7 @@ import WayofTime.alchemicalWizardry.api.tile.IBloodAltar; import WayofTime.alchemicalWizardry.common.rituals.RitualEffectWellOfSuffering; import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone; import com.github.bartimaeusnek.bartworks.API.BorosilicateGlass; +import com.google.common.collect.Multimap; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import com.gtnewhorizon.structurelib.structure.StructureDefinition; import cpw.mods.fml.common.eventhandler.EventPriority; @@ -67,6 +68,9 @@ import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.EnumCreatureAttribute; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.Item; @@ -428,20 +432,45 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber if (!recipe.isPeacefulAllowed && this.getBaseMetaTileEntity().getWorld().difficultySetting == EnumDifficulty.PEACEFUL) return false; - GT_MetaTileEntity_Hatch_InputBus inputbus = this.mInputBusses.get(0); - if (inputbus == null || !isValidMetaTileEntity(inputbus)) return false; - ItemStack lootingholder = inputbus.getStackInSlot(0); - if (lootingholder == null || !Enchantment.looting.canApply(lootingholder)) return false; - - this.mOutputItems = recipe.generateOutputs( - rand, this, EnchantmentHelper.getEnchantmentLevel(Enchantment.looting.effectId, lootingholder)); - if (isInRitualMode && isRitualValid()) { this.mMaxProgresstime = 400; this.mEUt /= 4; this.mOutputFluids = new FluidStack[] {FluidRegistry.getFluidStack("xpjuice", 5000)}; + this.mOutputItems = recipe.generateOutputs(rand, this, 3, 0); } else { + GT_MetaTileEntity_Hatch_InputBus inputbus = this.mInputBusses.get(0); + if (inputbus == null || !isValidMetaTileEntity(inputbus)) return false; + ItemStack lootingholder = inputbus.getStackInSlot(0); + if (lootingholder == null || !Enchantment.looting.canApply(lootingholder)) return false; + double attackDamage = 3; + + try { + //noinspection unchecked + attackDamage += ((Multimap<String, AttributeModifier>) lootingholder.getAttributeModifiers()) + .get(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName()).stream() + .mapToDouble(attr -> attr.getAmount() + + (double) EnchantmentHelper.func_152377_a( + lootingholder, EnumCreatureAttribute.UNDEFINED)) + .sum(); + } catch (Exception ex) { + ex.printStackTrace(); + } + + this.mOutputItems = recipe.generateOutputs( + rand, + this, + attackDamage, + EnchantmentHelper.getEnchantmentLevel(Enchantment.looting.effectId, lootingholder)); + int eut = this.mEUt; calculatePerfectOverclockedNessMulti(this.mEUt, this.mMaxProgresstime, 2, getMaxInputVoltage()); + if (lootingholder.isItemStackDamageable()) { + do { + if (lootingholder.attemptDamageItem(1, rand)) { + inputbus.setInventorySlotContents(0, null); + break; + } + } while ((eut <<= 2) < this.mEUt); + } this.mOutputFluids = new FluidStack[] {FluidRegistry.getFluidStack("xpjuice", 120)}; } if (this.mEUt > 0) this.mEUt = -this.mEUt; @@ -454,6 +483,7 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber if (mAnimationEnabled) mobPacket.addData(mobType); mobPacket.sendToAllAround(16); + this.updateSlots(); return true; } |