Default allow to entity head pitching.

This commit is contained in:
fullwall 2023-04-25 21:26:57 +08:00
parent 283a2a3381
commit 0b82ee214e
8 changed files with 14 additions and 44 deletions

View File

@ -8,16 +8,15 @@ import net.minecraft.server.v1_14_R1.ControllerLook;
import net.minecraft.server.v1_14_R1.EntityInsentient; import net.minecraft.server.v1_14_R1.EntityInsentient;
public class PitchableLookControl extends ControllerLook { public class PitchableLookControl extends ControllerLook {
private boolean explicit = true;
private final Supplier<Boolean> resetOnTick; private final Supplier<Boolean> resetOnTick;
public PitchableLookControl(EntityInsentient var0) { public PitchableLookControl(EntityInsentient var0) {
super(var0); super(var0);
if (var0 instanceof NPCHolder) { if (var0 instanceof NPCHolder) {
NPC npc = ((NPCHolder) var0).getNPC(); NPC npc = ((NPCHolder) var0).getNPC();
resetOnTick = () -> npc.data().get(NPC.Metadata.RESET_PITCH_ON_TICK, explicit); resetOnTick = () -> npc.data().get(NPC.Metadata.RESET_PITCH_ON_TICK, false);
} else { } else {
resetOnTick = () -> explicit; resetOnTick = () -> true;
} }
} }
@ -25,8 +24,4 @@ public class PitchableLookControl extends ControllerLook {
public boolean b() { public boolean b() {
return resetOnTick.get(); return resetOnTick.get();
} }
public void setResetXRotOnTick(boolean val) {
explicit = val;
}
} }

View File

@ -8,16 +8,15 @@ import net.minecraft.server.v1_15_R1.ControllerLook;
import net.minecraft.server.v1_15_R1.EntityInsentient; import net.minecraft.server.v1_15_R1.EntityInsentient;
public class PitchableLookControl extends ControllerLook { public class PitchableLookControl extends ControllerLook {
private boolean explicit = true;
private final Supplier<Boolean> resetOnTick; private final Supplier<Boolean> resetOnTick;
public PitchableLookControl(EntityInsentient var0) { public PitchableLookControl(EntityInsentient var0) {
super(var0); super(var0);
if (var0 instanceof NPCHolder) { if (var0 instanceof NPCHolder) {
NPC npc = ((NPCHolder) var0).getNPC(); NPC npc = ((NPCHolder) var0).getNPC();
resetOnTick = () -> npc.data().get(NPC.Metadata.RESET_PITCH_ON_TICK, explicit); resetOnTick = () -> npc.data().get(NPC.Metadata.RESET_PITCH_ON_TICK, false);
} else { } else {
resetOnTick = () -> explicit; resetOnTick = () -> true;
} }
} }
@ -25,8 +24,4 @@ public class PitchableLookControl extends ControllerLook {
public boolean b() { public boolean b() {
return resetOnTick.get(); return resetOnTick.get();
} }
public void setResetXRotOnTick(boolean val) {
explicit = val;
}
} }

View File

@ -8,16 +8,15 @@ import net.minecraft.server.v1_16_R3.ControllerLook;
import net.minecraft.server.v1_16_R3.EntityInsentient; import net.minecraft.server.v1_16_R3.EntityInsentient;
public class PitchableLookControl extends ControllerLook { public class PitchableLookControl extends ControllerLook {
private boolean explicit = true;
private final Supplier<Boolean> resetOnTick; private final Supplier<Boolean> resetOnTick;
public PitchableLookControl(EntityInsentient var0) { public PitchableLookControl(EntityInsentient var0) {
super(var0); super(var0);
if (var0 instanceof NPCHolder) { if (var0 instanceof NPCHolder) {
NPC npc = ((NPCHolder) var0).getNPC(); NPC npc = ((NPCHolder) var0).getNPC();
resetOnTick = () -> npc.data().get(NPC.Metadata.RESET_PITCH_ON_TICK, explicit); resetOnTick = () -> npc.data().get(NPC.Metadata.RESET_PITCH_ON_TICK, false);
} else { } else {
resetOnTick = () -> explicit; resetOnTick = () -> true;
} }
} }
@ -25,8 +24,4 @@ public class PitchableLookControl extends ControllerLook {
public boolean b() { public boolean b() {
return resetOnTick.get(); return resetOnTick.get();
} }
public void setResetXRotOnTick(boolean val) {
explicit = val;
}
} }

View File

@ -8,16 +8,15 @@ import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.ai.control.LookControl; import net.minecraft.world.entity.ai.control.LookControl;
public class PitchableLookControl extends LookControl { public class PitchableLookControl extends LookControl {
private boolean explicit = true;
private final Supplier<Boolean> resetOnTick; private final Supplier<Boolean> resetOnTick;
public PitchableLookControl(Mob var0) { public PitchableLookControl(Mob var0) {
super(var0); super(var0);
if (var0 instanceof NPCHolder) { if (var0 instanceof NPCHolder) {
NPC npc = ((NPCHolder) var0).getNPC(); NPC npc = ((NPCHolder) var0).getNPC();
resetOnTick = () -> npc.data().get(NPC.Metadata.RESET_PITCH_ON_TICK, explicit); resetOnTick = () -> npc.data().get(NPC.Metadata.RESET_PITCH_ON_TICK, false);
} else { } else {
resetOnTick = () -> explicit; resetOnTick = () -> true;
} }
} }
@ -25,8 +24,4 @@ public class PitchableLookControl extends LookControl {
public boolean resetXRotOnTick() { public boolean resetXRotOnTick() {
return resetOnTick.get(); return resetOnTick.get();
} }
public void setResetXRotOnTick(boolean val) {
explicit = val;
}
} }

View File

@ -8,16 +8,15 @@ import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.ai.control.LookControl; import net.minecraft.world.entity.ai.control.LookControl;
public class PitchableLookControl extends LookControl { public class PitchableLookControl extends LookControl {
private boolean explicit = true;
private final Supplier<Boolean> resetOnTick; private final Supplier<Boolean> resetOnTick;
public PitchableLookControl(Mob var0) { public PitchableLookControl(Mob var0) {
super(var0); super(var0);
if (var0 instanceof NPCHolder) { if (var0 instanceof NPCHolder) {
NPC npc = ((NPCHolder) var0).getNPC(); NPC npc = ((NPCHolder) var0).getNPC();
resetOnTick = () -> npc.data().get(NPC.Metadata.RESET_PITCH_ON_TICK, explicit); resetOnTick = () -> npc.data().get(NPC.Metadata.RESET_PITCH_ON_TICK, false);
} else { } else {
resetOnTick = () -> explicit; resetOnTick = () -> true;
} }
} }
@ -25,8 +24,4 @@ public class PitchableLookControl extends LookControl {
public boolean resetXRotOnTick() { public boolean resetXRotOnTick() {
return resetOnTick.get(); return resetOnTick.get();
} }
public void setResetXRotOnTick(boolean val) {
explicit = val;
}
} }

View File

@ -59,7 +59,6 @@ public class AllayController extends MobEntityController {
public static class EntityAllayNPC extends Allay implements NPCHolder { public static class EntityAllayNPC extends Allay implements NPCHolder {
private final CitizensNPC npc; private final CitizensNPC npc;
private int taskId = -1; private int taskId = -1;
public EntityAllayNPC(EntityType<? extends Allay> types, Level level) { public EntityAllayNPC(EntityType<? extends Allay> types, Level level) {

View File

@ -1197,8 +1197,9 @@ public class NMSImpl implements NMSBridge {
changed = true; changed = true;
} }
MirrorTrait trait = npc.getTraitNullable(MirrorTrait.class); MirrorTrait trait = npc.getTraitNullable(MirrorTrait.class);
if (trait == null || !trait.isMirroring(player)) if (trait == null || !trait.isMirroring(player)) {
continue; continue;
}
GameProfile profile = NMS.getProfile(player); GameProfile profile = NMS.getProfile(player);
if (trait.mirrorName()) { if (trait.mirrorName()) {
list.set(i, list.set(i,

View File

@ -8,16 +8,15 @@ import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.ai.control.LookControl; import net.minecraft.world.entity.ai.control.LookControl;
public class PitchableLookControl extends LookControl { public class PitchableLookControl extends LookControl {
private boolean explicit = true;
private final Supplier<Boolean> resetOnTick; private final Supplier<Boolean> resetOnTick;
public PitchableLookControl(Mob var0) { public PitchableLookControl(Mob var0) {
super(var0); super(var0);
if (var0 instanceof NPCHolder) { if (var0 instanceof NPCHolder) {
NPC npc = ((NPCHolder) var0).getNPC(); NPC npc = ((NPCHolder) var0).getNPC();
resetOnTick = () -> npc.data().get(NPC.Metadata.RESET_PITCH_ON_TICK, explicit); resetOnTick = () -> npc.data().get(NPC.Metadata.RESET_PITCH_ON_TICK, false);
} else { } else {
resetOnTick = () -> explicit; resetOnTick = () -> true;
} }
} }
@ -25,8 +24,4 @@ public class PitchableLookControl extends LookControl {
public boolean resetXRotOnTick() { public boolean resetXRotOnTick() {
return resetOnTick.get(); return resetOnTick.get();
} }
public void setResetXRotOnTick(boolean val) {
explicit = val;
}
} }