Fix deployer duplicating Quark pickarang

This commit is contained in:
Snownee 2020-11-08 16:30:55 +08:00
parent 073e3980ee
commit 428dda58e7

View File

@ -26,7 +26,6 @@ import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.item.ItemEntity; import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.Fluids; import net.minecraft.fluid.Fluids;
import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.inventory.EquipmentSlotType;
@ -294,7 +293,10 @@ public class DeployerHandler {
itemUseWorld = new ItemUseWorld(world, face, pos); itemUseWorld = new ItemUseWorld(world, face, pos);
ActionResult<ItemStack> onItemRightClick = item.onItemRightClick(itemUseWorld, player, hand); ActionResult<ItemStack> onItemRightClick = item.onItemRightClick(itemUseWorld, player, hand);
ItemStack resultStack = onItemRightClick.getResult();
if (resultStack != stack || resultStack.getCount() != stack.getCount() || resultStack.getUseDuration() > 0 || resultStack.getDamage() != stack.getDamage()) {
player.setHeldItem(hand, onItemRightClick.getResult()); player.setHeldItem(hand, onItemRightClick.getResult());
}
CompoundNBT tag = stack.getTag(); CompoundNBT tag = stack.getTag();
if (tag != null && stack.getItem() instanceof SandPaperItem && tag.contains("Polishing")) if (tag != null && stack.getItem() instanceof SandPaperItem && tag.contains("Polishing"))
@ -349,7 +351,7 @@ public class DeployerHandler {
interactionManager.world.updateComparatorOutputLevel(clickedPos, state.getBlock()); interactionManager.world.updateComparatorOutputLevel(clickedPos, state.getBlock());
} }
CriteriaTriggers.BEE_NEST_DESTROYED.test((ServerPlayerEntity) interactionManager.player, CriteriaTriggers.BEE_NEST_DESTROYED.test(interactionManager.player,
state.getBlock(), heldItem, beehivetileentity.getBeeCount()); state.getBlock(), heldItem, beehivetileentity.getBeeCount());
} }
} }