mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-03-03 22:34:42 +01:00
Alternate fix
Checking to see if the block is Frosted Ice is failing, possibly due to the event happening before the block is placed.
This commit is contained in:
parent
00468791dc
commit
6158272f4a
1 changed files with 5 additions and 10 deletions
|
@ -31,7 +31,9 @@ import net.minecraft.world.entity.projectile.ProjectileUtil;
|
|||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.enchantment.Enchantment;
|
||||
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.world.item.enchantment.Enchantments;
|
||||
import net.minecraft.world.item.enchantment.FrostWalkerEnchantment;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
|
@ -49,6 +51,7 @@ import net.minecraftforge.event.entity.living.LivingKnockBackEvent;
|
|||
import net.minecraftforge.event.entity.player.AttackEntityEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.event.level.BlockEvent;
|
||||
import net.minecraftforge.event.level.BlockEvent.BreakEvent;
|
||||
import net.minecraftforge.event.level.BlockEvent.EntityPlaceEvent;
|
||||
import net.minecraftforge.eventbus.api.EventPriority;
|
||||
|
@ -187,16 +190,8 @@ public class ExtendoGripItem extends Item {
|
|||
public static void consumeDurabilityOnPlace(EntityPlaceEvent event) {
|
||||
Entity entity = event.getEntity();
|
||||
if (entity instanceof Player player) {
|
||||
if (event.getPlacedBlock().is(Blocks.FROSTED_ICE)) {
|
||||
for (ItemStack armorSlot : player.getArmorSlots()) {
|
||||
for (Enchantment enchantment : armorSlot.getAllEnchantments().keySet()) {
|
||||
if (!enchantment.equals(Enchantments.FROST_WALKER)) {
|
||||
findAndDamageExtendoGrip(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else findAndDamageExtendoGrip(player);
|
||||
if (!event.getBlockSnapshot().getReplacedBlock().is(Blocks.WATER) && !event.getBlockSnapshot().getCurrentBlock().is(Blocks.WATER))
|
||||
findAndDamageExtendoGrip(player);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue