Add NMS.setPeekShulker to replace old method
This commit is contained in:
parent
4c99dc0e7c
commit
772ab5fb7b
|
@ -247,6 +247,13 @@ public class NMS {
|
|||
BRIDGE.setNavigationTarget(handle, target, speed);
|
||||
}
|
||||
|
||||
public static void setPeekShulker(org.bukkit.entity.Entity entity, int peek) {
|
||||
if (entity.getType().name().equals("SHULKER")) {
|
||||
throw new IllegalArgumentException("entity must be a shulker");
|
||||
}
|
||||
BRIDGE.setPeekShulker(entity, peek);
|
||||
}
|
||||
|
||||
public static void setProfile(SkullMeta meta, GameProfile profile) {
|
||||
BRIDGE.setProfile(meta, profile);
|
||||
}
|
||||
|
|
|
@ -117,6 +117,8 @@ public interface NMSBridge {
|
|||
|
||||
public void setNavigationTarget(Entity handle, Entity target, float speed);
|
||||
|
||||
public void setPeekShulker(Entity entity, int peek);
|
||||
|
||||
public void setProfile(SkullMeta meta, GameProfile profile);
|
||||
|
||||
public void setShouldJump(Entity entity);
|
||||
|
|
|
@ -7,6 +7,7 @@ import net.citizensnpcs.api.persistence.Persist;
|
|||
import net.citizensnpcs.api.trait.Trait;
|
||||
import net.citizensnpcs.api.trait.TraitName;
|
||||
import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
|
||||
@TraitName("shulkertrait")
|
||||
public class ShulkerTrait extends Trait {
|
||||
|
@ -32,7 +33,7 @@ public class ShulkerTrait extends Trait {
|
|||
}
|
||||
if (npc.getEntity() instanceof Shulker) {
|
||||
if (peek != lastPeekSet) {
|
||||
NMSImpl.setShulkerPeek((Shulker) npc.getEntity(), peek);
|
||||
NMS.setPeekShulker((Shulker) npc.getEntity(), peek);
|
||||
lastPeekSet = peek;
|
||||
}
|
||||
NMSImpl.setShulkerColor((Shulker) npc.getEntity(), color);
|
||||
|
|
|
@ -840,6 +840,11 @@ public class NMSImpl implements NMSBridge {
|
|||
NMSImpl.getNavigation(handle).a(NMSImpl.getHandle(target), speed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPeekShulker(org.bukkit.entity.Entity shulker, int peek) {
|
||||
((EntityShulker) getHandle(shulker)).a((byte) peek);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProfile(SkullMeta meta, GameProfile profile) {
|
||||
if (SKULL_PROFILE_FIELD == null) {
|
||||
|
@ -1382,10 +1387,6 @@ public class NMSImpl implements NMSBridge {
|
|||
public static void setShulkerColor(Shulker shulker, DyeColor color) {
|
||||
}
|
||||
|
||||
public static void setShulkerPeek(Shulker shulker, int peek) {
|
||||
((EntityShulker) getHandle(shulker)).a((byte) peek);
|
||||
}
|
||||
|
||||
public static void setSize(Entity entity, float f, float f1, boolean justCreated) {
|
||||
if ((f != entity.width) || (f1 != entity.length)) {
|
||||
float f2 = entity.width;
|
||||
|
|
|
@ -90,6 +90,7 @@ public class PlayerControllerMove extends ControllerMove {
|
|||
AttributeInstance speed = this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
|
||||
speed.setValue(0.1D * this.e);
|
||||
float movement = (float) (this.e * speed.getValue()) * 10;
|
||||
this.a.l(movement);
|
||||
this.a.bg = movement;
|
||||
if (shouldSlimeJump() || ((d2 > 0.0D) && (d0 * d0 + d1 * d1 < 1.0D))) {
|
||||
this.h = cg();
|
||||
|
|
|
@ -7,6 +7,7 @@ import net.citizensnpcs.api.persistence.Persist;
|
|||
import net.citizensnpcs.api.trait.Trait;
|
||||
import net.citizensnpcs.api.trait.TraitName;
|
||||
import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
|
||||
@TraitName("shulkertrait")
|
||||
public class ShulkerTrait extends Trait {
|
||||
|
@ -32,7 +33,7 @@ public class ShulkerTrait extends Trait {
|
|||
}
|
||||
if (npc.getEntity() instanceof Shulker) {
|
||||
if (peek != lastPeekSet) {
|
||||
NMSImpl.setShulkerPeek((Shulker) npc.getEntity(), peek);
|
||||
NMS.setPeekShulker(npc.getEntity(), peek);
|
||||
lastPeekSet = peek;
|
||||
}
|
||||
NMSImpl.setShulkerColor((Shulker) npc.getEntity(), color);
|
||||
|
|
|
@ -899,6 +899,11 @@ public class NMSImpl implements NMSBridge {
|
|||
NMSImpl.getNavigation(handle).a(NMSImpl.getHandle(target), speed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPeekShulker(org.bukkit.entity.Entity shulker, int peek) {
|
||||
((EntityShulker) getHandle(shulker)).a((byte) peek);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProfile(SkullMeta meta, GameProfile profile) {
|
||||
if (SKULL_PROFILE_FIELD == null) {
|
||||
|
@ -1451,10 +1456,6 @@ public class NMSImpl implements NMSBridge {
|
|||
((EntityShulkerNPC) getHandle(shulker)).setColor(color);
|
||||
}
|
||||
|
||||
public static void setShulkerPeek(Shulker shulker, int peek) {
|
||||
((EntityShulker) getHandle(shulker)).a((byte) peek);
|
||||
}
|
||||
|
||||
public static void setSize(Entity entity, float f, float f1, boolean justCreated) {
|
||||
if ((f != entity.width) || (f1 != entity.length)) {
|
||||
float f2 = entity.width;
|
||||
|
|
|
@ -7,6 +7,7 @@ import net.citizensnpcs.api.persistence.Persist;
|
|||
import net.citizensnpcs.api.trait.Trait;
|
||||
import net.citizensnpcs.api.trait.TraitName;
|
||||
import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
|
||||
@TraitName("shulkertrait")
|
||||
public class ShulkerTrait extends Trait {
|
||||
|
@ -32,7 +33,7 @@ public class ShulkerTrait extends Trait {
|
|||
}
|
||||
if (npc.getEntity() instanceof Shulker) {
|
||||
if (peek != lastPeekSet) {
|
||||
NMSImpl.setShulkerPeek((Shulker) npc.getEntity(), peek);
|
||||
NMS.setPeekShulker((Shulker) npc.getEntity(), peek);
|
||||
lastPeekSet = peek;
|
||||
}
|
||||
NMSImpl.setShulkerColor((Shulker) npc.getEntity(), color);
|
||||
|
|
|
@ -913,6 +913,11 @@ public class NMSImpl implements NMSBridge {
|
|||
NMSImpl.getNavigation(handle).a(NMSImpl.getHandle(target), speed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPeekShulker(org.bukkit.entity.Entity shulker, int peek) {
|
||||
((EntityShulker) getHandle(shulker)).a((byte) peek);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProfile(SkullMeta meta, GameProfile profile) {
|
||||
if (SKULL_PROFILE_FIELD == null) {
|
||||
|
@ -1464,10 +1469,6 @@ public class NMSImpl implements NMSBridge {
|
|||
((EntityShulker) getHandle(shulker)).getDataWatcher().set(EntityShulker.COLOR, color.getWoolData());
|
||||
}
|
||||
|
||||
public static void setShulkerPeek(Shulker shulker, int peek) {
|
||||
((EntityShulker) getHandle(shulker)).a((byte) peek);
|
||||
}
|
||||
|
||||
public static void setSize(Entity entity, float f, float f1, boolean justCreated) {
|
||||
if ((f != entity.width) || (f1 != entity.length)) {
|
||||
float f2 = entity.width;
|
||||
|
|
|
@ -795,6 +795,11 @@ public class NMSImpl implements NMSBridge {
|
|||
NMSImpl.getNavigation(handle).a(NMSImpl.getHandle(target), speed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPeekShulker(org.bukkit.entity.Entity shulker, int peek) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProfile(SkullMeta meta, GameProfile profile) {
|
||||
if (SKULL_PROFILE_FIELD == null) {
|
||||
|
|
|
@ -90,6 +90,7 @@ public class PlayerControllerMove extends ControllerMove {
|
|||
AttributeInstance speed = this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
|
||||
speed.setValue(0.1D * this.e);
|
||||
float movement = (float) (this.e * speed.getValue()) * 10;
|
||||
this.a.k(movement);
|
||||
this.a.ba = movement;
|
||||
if (shouldSlimeJump() || ((d2 > 0.0D) && (d0 * d0 + d1 * d1 < 1.0D))) {
|
||||
this.h = cg();
|
||||
|
|
Loading…
Reference in New Issue