Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Twilight Lich NEI drops + modpack loading speed #84

Merged
merged 4 commits into from
Aug 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}

}