mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-26 04:35:50 +01:00
Test fix for phantoms
This commit is contained in:
parent
f2d4c38843
commit
8d17d85392
@ -19,6 +19,7 @@ import net.minecraft.server.v1_16_R3.BlockPosition;
|
||||
import net.minecraft.server.v1_16_R3.ControllerLook;
|
||||
import net.minecraft.server.v1_16_R3.ControllerMove;
|
||||
import net.minecraft.server.v1_16_R3.DamageSource;
|
||||
import net.minecraft.server.v1_16_R3.DataWatcherObject;
|
||||
import net.minecraft.server.v1_16_R3.Entity;
|
||||
import net.minecraft.server.v1_16_R3.EntityBoat;
|
||||
import net.minecraft.server.v1_16_R3.EntityMinecartAbstract;
|
||||
@ -43,6 +44,7 @@ public class PhantomController extends MobEntityController {
|
||||
}
|
||||
|
||||
public static class EntityPhantomNPC extends EntityPhantom implements NPCHolder {
|
||||
boolean calledNMSHeight = false;
|
||||
private final CitizensNPC npc;
|
||||
private ControllerLook oldLookController;
|
||||
private ControllerMove oldMoveController;
|
||||
@ -65,6 +67,17 @@ public class PhantomController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(DataWatcherObject<?> datawatcherobject) {
|
||||
if (npc != null && !calledNMSHeight) {
|
||||
calledNMSHeight = true;
|
||||
NMSImpl.checkAndUpdateHeight(this, datawatcherobject);
|
||||
calledNMSHeight = false;
|
||||
}
|
||||
|
||||
super.a(datawatcherobject);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void a(double d0, boolean flag, IBlockData block, BlockPosition blockposition) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
|
@ -16,6 +16,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.util.Util;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.syncher.EntityDataAccessor;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.world.Difficulty;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
@ -42,6 +43,7 @@ public class PhantomController extends MobEntityController {
|
||||
}
|
||||
|
||||
public static class EntityPhantomNPC extends Phantom implements NPCHolder {
|
||||
boolean calledNMSHeight = false;
|
||||
private final CitizensNPC npc;
|
||||
private LookControl oldLookController;
|
||||
private MoveControl oldMoveController;
|
||||
@ -186,6 +188,17 @@ public class PhantomController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSyncedDataUpdated(EntityDataAccessor<?> datawatcherobject) {
|
||||
if (npc != null && !calledNMSHeight) {
|
||||
calledNMSHeight = true;
|
||||
NMSImpl.checkAndUpdateHeight(this, datawatcherobject);
|
||||
calledNMSHeight = false;
|
||||
}
|
||||
|
||||
super.onSyncedDataUpdated(datawatcherobject);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void push(double x, double y, double z) {
|
||||
Vector vector = Util.callPushEvent(npc, x, y, z);
|
||||
|
@ -1465,7 +1465,6 @@ public class NMSImpl implements NMSBridge {
|
||||
size = (EntityDimensions) SIZE_FIELD_GETTER.invoke(living);
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
living.onSyncedDataUpdated(datawatcherobject);
|
||||
return;
|
||||
}
|
||||
float oldw = size.width;
|
||||
|
Loading…
Reference in New Issue
Block a user