Fix miniature red hearts not dropping in EEC and not showing in NEI mob drops (#231)

This commit is contained in:
chochem authored and GitHub committed 2025-12-01 16:17:52 +01:00
1 parent b60c05172c
commit 2d14b43dbc
2 files changed
+62 -62

No files matched your search

@@ -34,8 +34,7 @@ import tconstruct.library.modifier.IModifyable;
import tconstruct.util.config.PHConstruct;
import tconstruct.util.network.ArmourGuiSyncPacket;
@Optional.Interface(iface = "com.kuba6000.mobsinfo.api.IMobExtraInfoProvider", modid = "mobsinfo")
public class TinkerArmorEvents implements IMobExtraInfoProvider {
public class TinkerArmorEvents {
public void registerEvents() {
MinecraftForge.EVENT_BUS.register(new EventHandler());
@@ -80,39 +79,6 @@ public class TinkerArmorEvents implements IMobExtraInfoProvider {
}
}
@Optional.Method(modid = "mobsinfo")
@Override
public void provideExtraDropsInformation(@Nonnull String entityString, @Nonnull ArrayList<MobDrop> drops,
@Nonnull MobRecipe recipe) {
if (recipe.entity instanceof IMob) {
MobDrop drop = new MobDrop(
new ItemStack(TinkerArmor.heartCanister, 1, 1),
MobDrop.DropType.Normal,
50,
null,
null,
false,
false);
drops.add(drop);
}
if (recipe.entity instanceof IBossDisplayData) {
String entityName = recipe.entity.getClass().getSimpleName().toLowerCase();
for (String name : PHConstruct.heartDropBlacklist)
if (name.toLowerCase(Locale.US).equals(entityName)) return;
MobDrop drop = new MobDrop(
new ItemStack(TinkerArmor.heartCanister, recipe.entity instanceof EntityDragon ? 5 : 1, 3),
MobDrop.DropType.Normal,
10000,
null,
null,
false,
false);
drops.add(drop);
}
}
/* Abilities */
public void armorMineSpeed(PlayerEvent.BreakSpeed event) {
if (event.entityPlayer == null) return;
@@ -181,7 +147,8 @@ public class TinkerArmorEvents implements IMobExtraInfoProvider {
}
}
public class EventHandler {
@Optional.Interface(iface = "com.kuba6000.mobsinfo.api.IMobExtraInfoProvider", modid = "mobsinfo")
public class EventHandler implements IMobExtraInfoProvider {
@SubscribeEvent
public void onLivingDropWrapper(LivingDropsEvent event) {
@@ -213,5 +180,38 @@ public class TinkerArmorEvents implements IMobExtraInfoProvider {
public void joinWorldWrapper(EntityJoinWorldEvent event) {
TinkerArmorEvents.this.joinWorld(event);
}
@Optional.Method(modid = "mobsinfo")
@Override
public void provideExtraDropsInformation(@Nonnull String entityString, @Nonnull ArrayList<MobDrop> drops,
@Nonnull MobRecipe recipe) {
if (recipe.entity instanceof IMob) {
MobDrop drop = new MobDrop(
new ItemStack(TinkerArmor.heartCanister, 1, 1),
MobDrop.DropType.Normal,
50,
null,
null,
false,
false);
drops.add(drop);
}
if (recipe.entity instanceof IBossDisplayData) {
String entityName = recipe.entity.getClass().getSimpleName().toLowerCase();
for (String name : PHConstruct.heartDropBlacklist)
if (name.toLowerCase(Locale.US).equals(entityName)) return;
MobDrop drop = new MobDrop(
new ItemStack(TinkerArmor.heartCanister, recipe.entity instanceof EntityDragon ? 5 : 1, 3),
MobDrop.DropType.Normal,
10000,
null,
null,
false,
false);
drops.add(drop);
}
}
}
}
@@ -38,8 +38,7 @@ import tconstruct.tools.TinkerTools;
import tconstruct.util.ItemHelper;
import tconstruct.util.config.PHConstruct;
@Optional.Interface(iface = "com.kuba6000.mobsinfo.api.IMobExtraInfoProvider", modid = "mobsinfo")
public class TinkerWorldEvents implements IMobExtraInfoProvider {
public class TinkerWorldEvents {
public void registerEvents() {
MinecraftForge.EVENT_BUS.register(new EventHandler());
@@ -131,30 +130,8 @@ public class TinkerWorldEvents implements IMobExtraInfoProvider {
}
}
@Optional.Method(modid = "mobsinfo")
@Override
public void provideExtraDropsInformation(@Nonnull String entityString, @Nonnull ArrayList<MobDrop> drops,
@Nonnull MobRecipe recipe) {
if (recipe.entity.getClass() == EntityGhast.class) {
if (PHConstruct.uhcGhastDrops) {
for (MobDrop drop : drops) {
if (drop.stack.getItem() == Items.ghast_tear) {
drop.stack = new ItemStack(Items.gold_ingot);
drop.reconstructableStack = new ConstructableItemStack(drop.stack);
}
}
} else {
for (MobDrop drop : drops) {
if (drop.stack.getItem() == Items.ghast_tear) {
drop.chance += 10000;
drop.clampChance();
}
}
}
}
}
public class EventHandler {
@Optional.Interface(iface = "com.kuba6000.mobsinfo.api.IMobExtraInfoProvider", modid = "mobsinfo")
public class EventHandler implements IMobExtraInfoProvider {
@SubscribeEvent
public void onLivingSpawn(LivingSpawnEvent.SpecialSpawn event) {
@@ -177,5 +154,28 @@ public class TinkerWorldEvents implements IMobExtraInfoProvider {
public void onLivingDrop(LivingDropsEvent event) {
TinkerWorldEvents.this.onLivingDrop(event);
}
@Optional.Method(modid = "mobsinfo")
@Override
public void provideExtraDropsInformation(@Nonnull String entityString, @Nonnull ArrayList<MobDrop> drops,
@Nonnull MobRecipe recipe) {
if (recipe.entity.getClass() == EntityGhast.class) {
if (PHConstruct.uhcGhastDrops) {
for (MobDrop drop : drops) {
if (drop.stack.getItem() == Items.ghast_tear) {
drop.stack = new ItemStack(Items.gold_ingot);
drop.reconstructableStack = new ConstructableItemStack(drop.stack);
}
}
} else {
for (MobDrop drop : drops) {
if (drop.stack.getItem() == Items.ghast_tear) {
drop.chance += 10000;
drop.clampChance();
}
}
}
}
}
}
}