Skip to content

Commit ac9e680

Browse files
committed
Remove redundant beheading code for Elementium Axe on Forge
(left-over from #4752; fixes #4954)
1 parent bd119f8 commit ac9e680

File tree

3 files changed

+1
-31
lines changed

3 files changed

+1
-31
lines changed

Forge/src/main/java/vazkii/botania/forge/ForgeCommonInitializer.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@
110110
import vazkii.botania.common.item.*;
111111
import vazkii.botania.common.item.equipment.armor.terrasteel.TerrasteelHelmItem;
112112
import vazkii.botania.common.item.equipment.bauble.*;
113-
import vazkii.botania.common.item.equipment.tool.elementium.ElementiumAxeItem;
114113
import vazkii.botania.common.item.equipment.tool.terrasteel.TerraBladeItem;
115114
import vazkii.botania.common.item.equipment.tool.terrasteel.TerraShattererItem;
116115
import vazkii.botania.common.item.equipment.tool.terrasteel.TerraTruncatorItem;
@@ -396,11 +395,6 @@ private void registerEvents() {
396395
{
397396
bus.addListener((LivingDropsEvent e) -> {
398397
var living = e.getEntity();
399-
ElementiumAxeItem.onEntityDrops(e.isRecentlyHit(), e.getSource(), living, stack -> {
400-
var ent = new ItemEntity(living.level(), living.getX(), living.getY(), living.getZ(), stack);
401-
ent.setDefaultPickUpDelay();
402-
e.getDrops().add(ent);
403-
});
404398
LooniumBlockEntity.dropLooniumItems(living, stack -> {
405399
e.getDrops().clear();
406400
if (!stack.isEmpty()) {

Xplat/src/main/java/vazkii/botania/common/item/equipment/tool/elementium/ElementiumAxeItem.java

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,18 @@
99
package vazkii.botania.common.item.equipment.tool.elementium;
1010

1111
import net.minecraft.resources.ResourceLocation;
12-
import net.minecraft.server.level.ServerLevel;
13-
import net.minecraft.world.damagesource.DamageSource;
1412
import net.minecraft.world.entity.EquipmentSlot;
1513
import net.minecraft.world.entity.LivingEntity;
16-
import net.minecraft.world.entity.player.Player;
1714
import net.minecraft.world.item.ItemStack;
1815
import net.minecraft.world.item.enchantment.Enchantment;
1916
import net.minecraft.world.item.enchantment.Enchantments;
20-
import net.minecraft.world.level.storage.loot.LootParams;
21-
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets;
22-
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
2317

2418
import org.jetbrains.annotations.NotNull;
2519

2620
import vazkii.botania.api.BotaniaAPI;
2721
import vazkii.botania.common.annotations.SoftImplement;
2822
import vazkii.botania.common.item.equipment.tool.manasteel.ManasteelAxeItem;
2923

30-
import java.util.function.Consumer;
31-
3224
import static vazkii.botania.common.lib.ResourceLocationHelper.prefix;
3325

3426
public class ElementiumAxeItem extends ManasteelAxeItem {
@@ -38,23 +30,6 @@ public ElementiumAxeItem(Properties props) {
3830
super(BotaniaAPI.instance().getElementiumItemTier(), 6F, -3.1F, props);
3931
}
4032

41-
public static void onEntityDrops(boolean hitRecently, DamageSource source, LivingEntity target,
42-
Consumer<ItemStack> consumer) {
43-
LootParams.Builder ctx = (new LootParams.Builder((ServerLevel) target.level()))
44-
.withParameter(LootContextParams.THIS_ENTITY, target)
45-
.withParameter(LootContextParams.ORIGIN, target.position())
46-
.withParameter(LootContextParams.DAMAGE_SOURCE, source)
47-
.withOptionalParameter(LootContextParams.KILLER_ENTITY, source.getEntity())
48-
.withOptionalParameter(LootContextParams.DIRECT_KILLER_ENTITY, source.getDirectEntity());
49-
50-
if (hitRecently && target.getKillCredit() != null && target.getKillCredit() instanceof Player p) {
51-
ctx = ctx.withParameter(LootContextParams.LAST_DAMAGE_PLAYER, p).withLuck(p.getLuck());
52-
}
53-
54-
target.level().getServer().getLootData().getLootTable(BEHEADING_LOOT_TABLE)
55-
.getRandomItems(ctx.create(LootContextParamSets.ENTITY), target.getLootTableSeed(), consumer);
56-
}
57-
5833
@SoftImplement("IForgeItem")
5934
public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment) {
6035
if (enchantment == Enchantments.MOB_LOOTING) {

web/changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ In the meantime, Botania for Minecraft 1.20.1 may still receive updates for bug
4242
* Fix: Mana bursts going through a nether portal could cause lag spikes
4343
* Fix: Potential client memory leak in ManaNetworkHandler
4444
* Fix: Guardian of Gaia stopped teleporting until getting hit after a world reload
45+
* Fix: Elementium Axe beheading logic could run twice and still duplicate LootJS script executions on Forge
4546

4647
---
4748

0 commit comments

Comments
 (0)