From c4b5f6949719c8b4524239dafd83136b80bc32f6 Mon Sep 17 00:00:00 2001 From: kuba6000 Date: Mon, 12 Aug 2024 17:36:18 +0200 Subject: [PATCH 1/4] Fix Twilight Lich NEI drops --- dependencies.gradle | 1 + .../entity/boss/EntityTFLich.java | 100 +++++++++++++++++- 2 files changed, 99 insertions(+), 2 deletions(-) diff --git a/dependencies.gradle b/dependencies.gradle index 203574d727..b83f0e8b2b 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -6,6 +6,7 @@ dependencies { compileOnly("com.github.GTNewHorizons:Battlegear2:1.4.0:api") {} //For TiC to work compileOnly("com.github.GTNewHorizons:NotEnoughItems:2.6.14-GTNH:dev") compileOnly("curse.maven:skinport-234948:3212017") + compileOnly("com.github.GTNewHorizons:Mobs-Info:0.3.4-GTNH-pre:dev") // For Thaumcraft runtime compileOnly ("com.github.GTNewHorizons:Baubles:1.0.4:dev") diff --git a/src/main/java/twilightforest/entity/boss/EntityTFLich.java b/src/main/java/twilightforest/entity/boss/EntityTFLich.java index 24b2a91c2c..b96f9a40e3 100644 --- a/src/main/java/twilightforest/entity/boss/EntityTFLich.java +++ b/src/main/java/twilightforest/entity/boss/EntityTFLich.java @@ -1,7 +1,10 @@ package twilightforest.entity.boss; +import java.util.ArrayList; import java.util.List; +import javax.annotation.Nonnull; + import net.minecraft.block.Block; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; @@ -30,6 +33,10 @@ import net.minecraft.world.EnumDifficulty; import net.minecraft.world.World; +import com.kuba6000.mobsinfo.api.IMobInfoProvider; +import com.kuba6000.mobsinfo.api.MobDrop; + +import cpw.mods.fml.common.Optional; import twilightforest.TFAchievementPage; import twilightforest.TFFeature; import twilightforest.TwilightForestMod; @@ -40,7 +47,8 @@ import twilightforest.world.TFWorldChunkManager; import twilightforest.world.WorldProviderTwilightForest; -public class EntityTFLich extends EntityMob implements IBossDisplayData { +@Optional.Interface(iface = "com.kuba6000.mobsinfo.api.IMobInfoProvider", modid = "mobsinfo") +public class EntityTFLich extends EntityMob implements IBossDisplayData, IMobInfoProvider { private static final int DATA_ISCLONE = 21; private static final int DATA_SHIELDSTRENGTH = 17; @@ -121,6 +129,7 @@ public ItemStack getHeldItem() { @Override protected void dropFewItems(boolean par1, int par2) { + // EVERY CHANGE MADE IN HERE MUST BE ALSO MADE IN provideDropsInformation dropScepter(); int totalDrops = this.rand.nextInt(3 + par2) + 2; @@ -143,6 +152,94 @@ protected void dropFewItems(boolean par1, int par2) { this.entityDropItem(new ItemStack(TFItems.trophy, 1, 2), 0); } + @Optional.Method(modid = "mobsinfo") + @Override + public void provideDropsInformation(@Nonnull ArrayList drops) { + // scepter + drops.add( + new MobDrop( + new ItemStack(TFItems.scepterZombie), + MobDrop.DropType.Normal, + 3333, + null, + null, + false, + false)); + drops.add( + new MobDrop( + new ItemStack(TFItems.scepterLifeDrain), + MobDrop.DropType.Normal, + 3333, + null, + null, + false, + false)); + drops.add( + new MobDrop( + new ItemStack(TFItems.scepterTwilight), + MobDrop.DropType.Normal, + 3333, + null, + null, + false, + false)); + // gold thing + int chance = (int) ((MobDrop.getChanceBasedOnFromTo(2, 4) / 5d) * 10000d); + drops.add( + new MobDrop(new ItemStack(Items.golden_sword), MobDrop.DropType.Normal, chance, 25, null, true, false)); + drops.add( + new MobDrop( + new ItemStack(Items.golden_helmet), + MobDrop.DropType.Normal, + chance, + 25, + null, + true, + false)); + drops.add( + new MobDrop( + new ItemStack(Items.golden_chestplate), + MobDrop.DropType.Normal, + chance, + 25, + null, + true, + false)); + drops.add( + new MobDrop( + new ItemStack(Items.golden_leggings), + MobDrop.DropType.Normal, + chance, + 25, + null, + true, + false)); + drops.add( + new MobDrop(new ItemStack(Items.golden_boots), MobDrop.DropType.Normal, chance, 25, null, true, false)); + // ender pearl + drops.add( + new MobDrop( + new ItemStack(Items.ender_pearl), + MobDrop.DropType.Normal, + (int) (MobDrop.getChanceBasedOnFromTo(1, 4) * 10000d), + null, + null, + true, + false)); + // bones + drops.add( + new MobDrop( + new ItemStack(Items.bone), + MobDrop.DropType.Normal, + (int) (MobDrop.getChanceBasedOnFromTo(5, 9) * 10000d), + null, + null, + true, + false)); + // trophy + drops.add(new MobDrop(new ItemStack(TFItems.trophy), MobDrop.DropType.Normal, 10000, null, null, true, false)); + } + private void dropScepter() { int scepterType = rand.nextInt(3); switch (scepterType) { @@ -1101,5 +1198,4 @@ public void onDeath(DamageSource par1DamageSource) { public EnumCreatureAttribute getCreatureAttribute() { return EnumCreatureAttribute.UNDEAD; } - } From 312080a7f2e2d8075ee1a3c29739831989e07e0b Mon Sep 17 00:00:00 2001 From: kuba6000 Date: Mon, 12 Aug 2024 19:22:33 +0200 Subject: [PATCH 2/4] Use builder --- dependencies.gradle | 2 +- .../entity/boss/EntityTFLich.java | 90 ++++--------------- 2 files changed, 20 insertions(+), 72 deletions(-) diff --git a/dependencies.gradle b/dependencies.gradle index b83f0e8b2b..7827acf67a 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -6,7 +6,7 @@ dependencies { compileOnly("com.github.GTNewHorizons:Battlegear2:1.4.0:api") {} //For TiC to work compileOnly("com.github.GTNewHorizons:NotEnoughItems:2.6.14-GTNH:dev") compileOnly("curse.maven:skinport-234948:3212017") - compileOnly("com.github.GTNewHorizons:Mobs-Info:0.3.4-GTNH-pre:dev") + compileOnly("com.github.GTNewHorizons:Mobs-Info:0.3.5-GTNH-pre:dev") // For Thaumcraft runtime compileOnly ("com.github.GTNewHorizons:Baubles:1.0.4:dev") diff --git a/src/main/java/twilightforest/entity/boss/EntityTFLich.java b/src/main/java/twilightforest/entity/boss/EntityTFLich.java index b96f9a40e3..05d2290db0 100644 --- a/src/main/java/twilightforest/entity/boss/EntityTFLich.java +++ b/src/main/java/twilightforest/entity/boss/EntityTFLich.java @@ -156,88 +156,36 @@ protected void dropFewItems(boolean par1, int par2) { @Override public void provideDropsInformation(@Nonnull ArrayList drops) { // scepter - drops.add( - new MobDrop( - new ItemStack(TFItems.scepterZombie), - MobDrop.DropType.Normal, - 3333, - null, - null, - false, - false)); - drops.add( - new MobDrop( - new ItemStack(TFItems.scepterLifeDrain), - MobDrop.DropType.Normal, - 3333, - null, - null, - false, - false)); - drops.add( - new MobDrop( - new ItemStack(TFItems.scepterTwilight), - MobDrop.DropType.Normal, - 3333, - null, - null, - false, - false)); + drops.add(MobDrop.create(new ItemStack(TFItems.scepterZombie)).withChance(0.3333d)); + drops.add(MobDrop.create(new ItemStack(TFItems.scepterLifeDrain)).withChance(0.3333d)); + drops.add(MobDrop.create(new ItemStack(TFItems.scepterTwilight)).withChance(0.3333d)); // gold thing - int chance = (int) ((MobDrop.getChanceBasedOnFromTo(2, 4) / 5d) * 10000d); + double chance = MobDrop.getChanceBasedOnFromTo(2, 4) / 5d; drops.add( - new MobDrop(new ItemStack(Items.golden_sword), MobDrop.DropType.Normal, chance, 25, null, true, false)); + MobDrop.create(new ItemStack(Items.golden_sword)).withChance(chance).withRandomEnchant(25) + .withLooting()); drops.add( - new MobDrop( - new ItemStack(Items.golden_helmet), - MobDrop.DropType.Normal, - chance, - 25, - null, - true, - false)); + MobDrop.create(new ItemStack(Items.golden_helmet)).withChance(chance).withRandomEnchant(25) + .withLooting()); drops.add( - new MobDrop( - new ItemStack(Items.golden_chestplate), - MobDrop.DropType.Normal, - chance, - 25, - null, - true, - false)); + MobDrop.create(new ItemStack(Items.golden_chestplate)).withChance(chance).withRandomEnchant(25) + .withLooting()); drops.add( - new MobDrop( - new ItemStack(Items.golden_leggings), - MobDrop.DropType.Normal, - chance, - 25, - null, - true, - false)); + MobDrop.create(new ItemStack(Items.golden_leggings)).withChance(chance).withRandomEnchant(25) + .withLooting()); drops.add( - new MobDrop(new ItemStack(Items.golden_boots), MobDrop.DropType.Normal, chance, 25, null, true, false)); + MobDrop.create(new ItemStack(Items.golden_boots)).withChance(chance).withRandomEnchant(25) + .withLooting()); // ender pearl drops.add( - new MobDrop( - new ItemStack(Items.ender_pearl), - MobDrop.DropType.Normal, - (int) (MobDrop.getChanceBasedOnFromTo(1, 4) * 10000d), - null, - null, - true, - false)); + MobDrop.create(new ItemStack(Items.ender_pearl)).withChance(MobDrop.getChanceBasedOnFromTo(1, 4)) + .withLooting()); // bones drops.add( - new MobDrop( - new ItemStack(Items.bone), - MobDrop.DropType.Normal, - (int) (MobDrop.getChanceBasedOnFromTo(5, 9) * 10000d), - null, - null, - true, - false)); + MobDrop.create(new ItemStack(Items.bone)).withChance(MobDrop.getChanceBasedOnFromTo(5, 9)) + .withLooting()); // trophy - drops.add(new MobDrop(new ItemStack(TFItems.trophy), MobDrop.DropType.Normal, 10000, null, null, true, false)); + drops.add(MobDrop.create(new ItemStack(TFItems.trophy, 1, 2))); } private void dropScepter() { From f011032f25d67b7ca578648edb760f2a8827a993 Mon Sep 17 00:00:00 2001 From: kuba6000 Date: Tue, 13 Aug 2024 18:24:27 +0200 Subject: [PATCH 3/4] Update dependencies.gradle --- dependencies.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies.gradle b/dependencies.gradle index 7827acf67a..1074150daf 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -6,7 +6,7 @@ dependencies { compileOnly("com.github.GTNewHorizons:Battlegear2:1.4.0:api") {} //For TiC to work compileOnly("com.github.GTNewHorizons:NotEnoughItems:2.6.14-GTNH:dev") compileOnly("curse.maven:skinport-234948:3212017") - compileOnly("com.github.GTNewHorizons:Mobs-Info:0.3.5-GTNH-pre:dev") + compileOnly("com.github.GTNewHorizons:Mobs-Info:0.4.0-GTNH:dev") // For Thaumcraft runtime compileOnly ("com.github.GTNewHorizons:Baubles:1.0.4:dev") From 5edce7cda818717d0bbc9e574cbbcea0b8a3b1b3 Mon Sep 17 00:00:00 2001 From: kuba6000 Date: Tue, 13 Aug 2024 22:38:49 +0200 Subject: [PATCH 4/4] Update dependencies.gradle --- dependencies.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies.gradle b/dependencies.gradle index 1074150daf..c9489da09c 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -6,7 +6,7 @@ dependencies { compileOnly("com.github.GTNewHorizons:Battlegear2:1.4.0:api") {} //For TiC to work compileOnly("com.github.GTNewHorizons:NotEnoughItems:2.6.14-GTNH:dev") compileOnly("curse.maven:skinport-234948:3212017") - compileOnly("com.github.GTNewHorizons:Mobs-Info:0.4.0-GTNH:dev") + compileOnly("com.github.GTNewHorizons:Mobs-Info:0.4.1-GTNH:dev") // For Thaumcraft runtime compileOnly ("com.github.GTNewHorizons:Baubles:1.0.4:dev")