Skip to content

Commit

Permalink
Fix Twilight Lich NEI drops + modpack loading speed (#84)
Browse files Browse the repository at this point in the history
* Fix Twilight Lich NEI drops

* Use builder

* Update dependencies.gradle

* Update dependencies.gradle
  • Loading branch information
kuba6000 authored Aug 17, 2024
1 parent f7e2b81 commit 290c36e
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 2 deletions.
1 change: 1 addition & 0 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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.4.1-GTNH:dev")

// For Thaumcraft runtime
compileOnly ("com.github.GTNewHorizons:Baubles:1.0.4:dev")
Expand Down
48 changes: 46 additions & 2 deletions src/main/java/twilightforest/entity/boss/EntityTFLich.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -143,6 +152,42 @@ 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<MobDrop> drops) {
// scepter
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
double chance = MobDrop.getChanceBasedOnFromTo(2, 4) / 5d;
drops.add(
MobDrop.create(new ItemStack(Items.golden_sword)).withChance(chance).withRandomEnchant(25)
.withLooting());
drops.add(
MobDrop.create(new ItemStack(Items.golden_helmet)).withChance(chance).withRandomEnchant(25)
.withLooting());
drops.add(
MobDrop.create(new ItemStack(Items.golden_chestplate)).withChance(chance).withRandomEnchant(25)
.withLooting());
drops.add(
MobDrop.create(new ItemStack(Items.golden_leggings)).withChance(chance).withRandomEnchant(25)
.withLooting());
drops.add(
MobDrop.create(new ItemStack(Items.golden_boots)).withChance(chance).withRandomEnchant(25)
.withLooting());
// ender pearl
drops.add(
MobDrop.create(new ItemStack(Items.ender_pearl)).withChance(MobDrop.getChanceBasedOnFromTo(1, 4))
.withLooting());
// bones
drops.add(
MobDrop.create(new ItemStack(Items.bone)).withChance(MobDrop.getChanceBasedOnFromTo(5, 9))
.withLooting());
// trophy
drops.add(MobDrop.create(new ItemStack(TFItems.trophy, 1, 2)));
}

private void dropScepter() {
int scepterType = rand.nextInt(3);
switch (scepterType) {
Expand Down Expand Up @@ -1101,5 +1146,4 @@ public void onDeath(DamageSource par1DamageSource) {
public EnumCreatureAttribute getCreatureAttribute() {
return EnumCreatureAttribute.UNDEAD;
}

}

0 comments on commit 290c36e

Please sign in to comment.