Enchant bow - looting

This commit is contained in:
netquick 2024-03-07 21:33:15 +01:00
parent f41113f881
commit 60c8b5136c
2 changed files with 25 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@ -1096,6 +1096,30 @@ public class EasyEnchantmentTableUpdateTickProcedure {
} }
}.getItemStack(world, BlockPos.containing(x, y, z), 0)); }.getItemStack(world, BlockPos.containing(x, y, z), 0));
} }
if (tool.getEnchantmentLevel(Enchantments.MOB_LOOTING) == 0) {
tool.enchant(Enchantments.MOB_LOOTING, 3);
{
BlockEntity _ent = world.getBlockEntity(BlockPos.containing(x, y, z));
if (_ent != null) {
final int _slotid = 6;
final ItemStack _setstack = tool.copy();
_setstack.setCount(1);
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> {
if (capability instanceof IItemHandlerModifiable)
((IItemHandlerModifiable) capability).setStackInSlot(_slotid, _setstack);
});
}
}
tool = (new Object() {
public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) {
AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
BlockEntity _ent = world.getBlockEntity(pos);
if (_ent != null)
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).copy()));
return _retval.get();
}
}.getItemStack(world, BlockPos.containing(x, y, z), 0));
}
} }
if (tool.getItem() == Items.FISHING_ROD) { if (tool.getItem() == Items.FISHING_ROD) {
if (tool.getEnchantmentLevel(Enchantments.FISHING_LUCK) == 0) { if (tool.getEnchantmentLevel(Enchantments.FISHING_LUCK) == 0) {