Add upside down for all disguises, add rainbow wool for sheep
This commit is contained in:
parent
a018973eeb
commit
52eec84d23
@ -325,6 +325,16 @@ public abstract class Disguise {
|
|||||||
bar.addPlayer((Player) getEntity());
|
bar.addPlayer((Player) getEntity());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isUpsideDown() {
|
||||||
|
return getWatcher().isUpsideDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Disguise setUpsideDown(boolean upsideDown) {
|
||||||
|
getWatcher().setUpsideDown(upsideDown);
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
private void createRunnable() {
|
private void createRunnable() {
|
||||||
final boolean alwaysSendVelocity;
|
final boolean alwaysSendVelocity;
|
||||||
|
|
||||||
|
@ -53,6 +53,8 @@ public class FlagWatcher {
|
|||||||
private boolean sleeping;
|
private boolean sleeping;
|
||||||
private boolean swimming;
|
private boolean swimming;
|
||||||
private transient boolean previouslySneaking;
|
private transient boolean previouslySneaking;
|
||||||
|
@Getter
|
||||||
|
private boolean upsideDown;
|
||||||
|
|
||||||
public FlagWatcher(Disguise disguise) {
|
public FlagWatcher(Disguise disguise) {
|
||||||
this.disguise = (TargetedDisguise) disguise;
|
this.disguise = (TargetedDisguise) disguise;
|
||||||
@ -84,6 +86,9 @@ public class FlagWatcher {
|
|||||||
cloned.equipment = equipment.clone(cloned);
|
cloned.equipment = equipment.clone(cloned);
|
||||||
cloned.modifiedEntityAnimations = Arrays.copyOf(modifiedEntityAnimations, modifiedEntityAnimations.length);
|
cloned.modifiedEntityAnimations = Arrays.copyOf(modifiedEntityAnimations, modifiedEntityAnimations.length);
|
||||||
cloned.addEntityAnimations = addEntityAnimations;
|
cloned.addEntityAnimations = addEntityAnimations;
|
||||||
|
cloned.upsideDown = upsideDown;
|
||||||
|
cloned.swimming = swimming;
|
||||||
|
cloned.sleeping = sleeping;
|
||||||
|
|
||||||
return cloned;
|
return cloned;
|
||||||
}
|
}
|
||||||
@ -120,6 +125,25 @@ public class FlagWatcher {
|
|||||||
getEquipment().setChestplate(itemStack);
|
getEquipment().setChestplate(itemStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public void setInternalUpsideDown(boolean upsideDown) {
|
||||||
|
this.upsideDown = upsideDown;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpsideDown(boolean upsideDown) {
|
||||||
|
if (isUpsideDown() == upsideDown) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.upsideDown = upsideDown;
|
||||||
|
|
||||||
|
if (getDisguise().isPlayerDisguise()) {
|
||||||
|
((PlayerDisguise) getDisguise()).setUpsideDown(upsideDown);
|
||||||
|
} else {
|
||||||
|
setInteralCustomName(isUpsideDown() ? "Dinnerbone" : "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public List<WrappedWatchableObject> convert(List<WrappedWatchableObject> list) {
|
public List<WrappedWatchableObject> convert(List<WrappedWatchableObject> list) {
|
||||||
List<WrappedWatchableObject> newList = new ArrayList<>();
|
List<WrappedWatchableObject> newList = new ArrayList<>();
|
||||||
HashSet<Integer> sentValues = new HashSet<>();
|
HashSet<Integer> sentValues = new HashSet<>();
|
||||||
@ -377,6 +401,10 @@ public class FlagWatcher {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setInteralCustomName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setInteralCustomName(String name) {
|
||||||
if (Strings.isNullOrEmpty(name)) {
|
if (Strings.isNullOrEmpty(name)) {
|
||||||
if (NmsVersion.v1_13.isSupported()) {
|
if (NmsVersion.v1_13.isSupported()) {
|
||||||
setData(MetaIndex.ENTITY_CUSTOM_NAME, Optional.empty());
|
setData(MetaIndex.ENTITY_CUSTOM_NAME, Optional.empty());
|
||||||
|
@ -32,8 +32,6 @@ public class PlayerDisguise extends TargetedDisguise {
|
|||||||
private boolean explicitNameVisible = false;
|
private boolean explicitNameVisible = false;
|
||||||
private UUID uuid = UUID.randomUUID();
|
private UUID uuid = UUID.randomUUID();
|
||||||
private volatile DisguiseUtilities.DScoreTeam scoreboardName;
|
private volatile DisguiseUtilities.DScoreTeam scoreboardName;
|
||||||
@Getter
|
|
||||||
private boolean upsideDown;
|
|
||||||
|
|
||||||
private PlayerDisguise() {
|
private PlayerDisguise() {
|
||||||
super(DisguiseType.PLAYER);
|
super(DisguiseType.PLAYER);
|
||||||
@ -197,7 +195,7 @@ public class PlayerDisguise extends TargetedDisguise {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.upsideDown = upsideDown;
|
getWatcher().setInternalUpsideDown(upsideDown);
|
||||||
|
|
||||||
if (isDisguiseInUse()) {
|
if (isDisguiseInUse()) {
|
||||||
resendDisguise(DisguiseConfig.isArmorstandsName() ? getName() : "Dinnerbone", true);
|
resendDisguise(DisguiseConfig.isArmorstandsName() ? getName() : "Dinnerbone", true);
|
||||||
|
@ -37,14 +37,6 @@ public class PlayerWatcher extends LivingWatcher {
|
|||||||
((PlayerDisguise) getDisguise()).setNameVisible(nameVisible);
|
((PlayerDisguise) getDisguise()).setNameVisible(nameVisible);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUpsideDown() {
|
|
||||||
return ((PlayerDisguise) getDisguise()).isUpsideDown();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUpsideDown(boolean upsideDown) {
|
|
||||||
((PlayerDisguise) getDisguise()).setUpsideDown(upsideDown);
|
|
||||||
}
|
|
||||||
|
|
||||||
@RandomDefaultValue
|
@RandomDefaultValue
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return ((PlayerDisguise) getDisguise()).getName();
|
return ((PlayerDisguise) getDisguise()).getName();
|
||||||
|
@ -15,10 +15,6 @@ public class SheepWatcher extends AgeableWatcher {
|
|||||||
return AnimalColor.getColorByWool(((int) getData(MetaIndex.SHEEP_WOOL) & 15)).getDyeColor();
|
return AnimalColor.getColorByWool(((int) getData(MetaIndex.SHEEP_WOOL) & 15)).getDyeColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSheared() {
|
|
||||||
return (getData(MetaIndex.SHEEP_WOOL) & 16) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void setColor(AnimalColor color) {
|
public void setColor(AnimalColor color) {
|
||||||
setColor(color.getDyeColor());
|
setColor(color.getDyeColor());
|
||||||
@ -31,6 +27,22 @@ public class SheepWatcher extends AgeableWatcher {
|
|||||||
sendData(MetaIndex.SHEEP_WOOL);
|
sendData(MetaIndex.SHEEP_WOOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isRainbowWool() {
|
||||||
|
return "jeb_".equals(getCustomName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRainbowWool(boolean rainbow) {
|
||||||
|
if (isRainbowWool() == rainbow) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setInteralCustomName("jeb_");
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSheared() {
|
||||||
|
return (getData(MetaIndex.SHEEP_WOOL) & 16) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
public void setSheared(boolean flag) {
|
public void setSheared(boolean flag) {
|
||||||
byte b0 = getData(MetaIndex.SHEEP_WOOL);
|
byte b0 = getData(MetaIndex.SHEEP_WOOL);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user