2024/12/07
修复些可能会存在的问题
This commit is contained in:
parent
22fc64797d
commit
0ecfe88683
|
|
@ -178,7 +178,7 @@ public class LeashRopeArrow extends AbstractArrow {
|
||||||
else {
|
else {
|
||||||
Entity leashDataEntity = this.getOwner() instanceof PlayerLeashable ? PlayerLeashable.getLeashDataEntity((ServerPlayer) this.getOwner(), (ServerLevel) level()) : this.getOwner();
|
Entity leashDataEntity = this.getOwner() instanceof PlayerLeashable ? PlayerLeashable.getLeashDataEntity((ServerPlayer) this.getOwner(), (ServerLevel) level()) : this.getOwner();
|
||||||
if(this.ownedBy(pPlayer)) {
|
if(this.ownedBy(pPlayer)) {
|
||||||
this.pickup = Pickup.ALLOWED;
|
if (this.pickup == Pickup.DISALLOWED) this.pickup = Pickup.ALLOWED;
|
||||||
if(this.equals(leashDataEntity)) {
|
if(this.equals(leashDataEntity)) {
|
||||||
pPlayer.playSound(SoundEvents.LEASH_KNOT_BREAK, 1, 1);
|
pPlayer.playSound(SoundEvents.LEASH_KNOT_BREAK, 1, 1);
|
||||||
playerLeashable.dropLeash(true, false);
|
playerLeashable.dropLeash(true, false);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.r3944realms.leashedplayer.content.entities;
|
package com.r3944realms.leashedplayer.content.entities;
|
||||||
|
|
||||||
|
import com.r3944realms.leashedplayer.LeashedPlayer;
|
||||||
import com.r3944realms.leashedplayer.config.LeashPlayerCommonConfig;
|
import com.r3944realms.leashedplayer.config.LeashPlayerCommonConfig;
|
||||||
import com.r3944realms.leashedplayer.content.items.ModItemRegister;
|
import com.r3944realms.leashedplayer.content.items.ModItemRegister;
|
||||||
import io.github.kunosayo.nestle.entity.NestleLeadNormalEntity;
|
import io.github.kunosayo.nestle.entity.NestleLeadNormalEntity;
|
||||||
|
|
@ -35,7 +36,7 @@ public class NestleRopeArrow extends AbstractArrow {
|
||||||
}
|
}
|
||||||
serverPlayer.startRiding(this);
|
serverPlayer.startRiding(this);
|
||||||
this.setOwner(serverPlayer);
|
this.setOwner(serverPlayer);
|
||||||
}
|
} else this.setOwner(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public NestleRopeArrow(EntityType<? extends AbstractArrow> entityType, LivingEntity pOwner, Level pLevel, ItemStack pPickupItemStack, @Nullable ItemStack pFiredFromWeapon) {
|
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)
|
if (life <= 40)
|
||||||
return false;
|
return false;
|
||||||
else {
|
else {
|
||||||
this.pickup = Pickup.ALLOWED;
|
if (this.pickup == Pickup.DISALLOWED) this.pickup = Pickup.ALLOWED;
|
||||||
}
|
}
|
||||||
return super.tryPickup(pPlayer);
|
return super.tryPickup(pPlayer);
|
||||||
}
|
}
|
||||||
|
|
@ -116,7 +117,7 @@ public class NestleRopeArrow extends AbstractArrow {
|
||||||
this.setOwner(player);
|
this.setOwner(player);
|
||||||
}
|
}
|
||||||
else if (owner != null && entity != owner ) {
|
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());
|
ItemEntity arrow = new ItemEntity(this.level(), this.position().x, this.position().y, this.position().z, getOrginalItemStack());
|
||||||
if (livingEntity instanceof Player player) {
|
if (livingEntity instanceof Player player) {
|
||||||
if (NestleLeadData.isNestle(player, livingEntity)) {
|
if (NestleLeadData.isNestle(player, livingEntity)) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user