2024/12/07

修复些可能会存在的问题
This commit is contained in:
叁玖领域 2024-12-07 13:46:04 +08:00
parent 22fc64797d
commit 0ecfe88683
2 changed files with 5 additions and 4 deletions

View File

@ -178,7 +178,7 @@ public class LeashRopeArrow extends AbstractArrow {
else {
Entity leashDataEntity = this.getOwner() instanceof PlayerLeashable ? PlayerLeashable.getLeashDataEntity((ServerPlayer) this.getOwner(), (ServerLevel) level()) : this.getOwner();
if(this.ownedBy(pPlayer)) {
this.pickup = Pickup.ALLOWED;
if (this.pickup == Pickup.DISALLOWED) this.pickup = Pickup.ALLOWED;
if(this.equals(leashDataEntity)) {
pPlayer.playSound(SoundEvents.LEASH_KNOT_BREAK, 1, 1);
playerLeashable.dropLeash(true, false);

View File

@ -1,5 +1,6 @@
package com.r3944realms.leashedplayer.content.entities;
import com.r3944realms.leashedplayer.LeashedPlayer;
import com.r3944realms.leashedplayer.config.LeashPlayerCommonConfig;
import com.r3944realms.leashedplayer.content.items.ModItemRegister;
import io.github.kunosayo.nestle.entity.NestleLeadNormalEntity;
@ -35,7 +36,7 @@ public class NestleRopeArrow extends AbstractArrow {
}
serverPlayer.startRiding(this);
this.setOwner(serverPlayer);
}
} else this.setOwner(null);
}
public NestleRopeArrow(EntityType<? extends AbstractArrow> entityType, LivingEntity pOwner, Level pLevel, ItemStack pPickupItemStack, @Nullable ItemStack pFiredFromWeapon) {
@ -86,7 +87,7 @@ public class NestleRopeArrow extends AbstractArrow {
if (life <= 40)
return false;
else {
this.pickup = Pickup.ALLOWED;
if (this.pickup == Pickup.DISALLOWED) this.pickup = Pickup.ALLOWED;
}
return super.tryPickup(pPlayer);
}
@ -116,7 +117,7 @@ public class NestleRopeArrow extends AbstractArrow {
this.setOwner(player);
}
else if (owner != null && entity != owner ) {
if(entity instanceof LivingEntity livingEntity) {
if (entity instanceof LivingEntity livingEntity && LeashedPlayer.IS_NESTLE_LOADED) {//保证即使没Nestle 也不会导致使用该物品会抛异常
ItemEntity arrow = new ItemEntity(this.level(), this.position().x, this.position().y, this.position().z, getOrginalItemStack());
if (livingEntity instanceof Player player) {
if (NestleLeadData.isNestle(player, livingEntity)) {