mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-12-02 07:33:44 +01:00
Block minecraft warden/allay behaviours
This commit is contained in:
parent
6a15bc2d5a
commit
849561337b
@ -17,10 +17,13 @@ import net.minecraft.core.BlockPos;
|
|||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.sounds.SoundEvent;
|
import net.minecraft.sounds.SoundEvent;
|
||||||
|
import net.minecraft.world.InteractionHand;
|
||||||
|
import net.minecraft.world.InteractionResult;
|
||||||
import net.minecraft.world.damagesource.DamageSource;
|
import net.minecraft.world.damagesource.DamageSource;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.entity.animal.allay.Allay;
|
import net.minecraft.world.entity.animal.allay.Allay;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.entity.vehicle.AbstractMinecart;
|
import net.minecraft.world.entity.vehicle.AbstractMinecart;
|
||||||
import net.minecraft.world.entity.vehicle.Boat;
|
import net.minecraft.world.entity.vehicle.Boat;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
@ -151,6 +154,13 @@ public class AllayController extends MobEntityController {
|
|||||||
return false; // shouldLeash
|
return false; // shouldLeash
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected InteractionResult mobInteract(Player var0, InteractionHand var1) {
|
||||||
|
if (npc != null && npc.isProtected())
|
||||||
|
return InteractionResult.FAIL;
|
||||||
|
return super.mobInteract(var0, var1);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onClimbable() {
|
public boolean onClimbable() {
|
||||||
if (npc == null || !npc.isFlyable()) {
|
if (npc == null || !npc.isFlyable()) {
|
||||||
|
@ -84,10 +84,16 @@ public class WardenController extends MobEntityController {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void customServerAiStep() {
|
public void customServerAiStep() {
|
||||||
super.customServerAiStep();
|
|
||||||
if (npc != null) {
|
if (npc != null) {
|
||||||
|
if (npc.useMinecraftAI()) {
|
||||||
|
super.customServerAiStep();
|
||||||
|
} else {
|
||||||
|
NMSImpl.updateAI(this);
|
||||||
|
}
|
||||||
NMSImpl.updateMinecraftAIState(npc, this);
|
NMSImpl.updateMinecraftAIState(npc, this);
|
||||||
npc.update();
|
npc.update();
|
||||||
|
} else {
|
||||||
|
super.customServerAiStep();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user