Fixed adult problems. tehehe
This commit is contained in:
parent
823914d626
commit
6034ae612a
@ -1,13 +1,14 @@
|
|||||||
package me.libraryaddict.disguise.DisguiseTypes;
|
package me.libraryaddict.disguise.DisguiseTypes;
|
||||||
|
|
||||||
import me.libraryaddict.disguise.DisguiseTypes.Watchers.AgeableWatcher;
|
import me.libraryaddict.disguise.DisguiseTypes.Watchers.AgeableWatcher;
|
||||||
|
import me.libraryaddict.disguise.DisguiseTypes.Watchers.ZombieWatcher;
|
||||||
|
|
||||||
public class MobDisguise extends Disguise {
|
public class MobDisguise extends Disguise {
|
||||||
|
|
||||||
private boolean isAdult;
|
private boolean isAdult;
|
||||||
|
|
||||||
public MobDisguise(DisguiseType disguiseType, boolean isAdult) {
|
public MobDisguise(DisguiseType disguiseType, boolean isAdult) {
|
||||||
super(disguiseType, true);
|
this(disguiseType, isAdult, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MobDisguise(DisguiseType disguiseType, boolean isAdult, boolean replaceSounds) {
|
public MobDisguise(DisguiseType disguiseType, boolean isAdult, boolean replaceSounds) {
|
||||||
@ -15,11 +16,18 @@ public class MobDisguise extends Disguise {
|
|||||||
this.isAdult = isAdult;
|
this.isAdult = isAdult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MobDisguise clone() {
|
||||||
|
MobDisguise disguise = new MobDisguise(getType(), isAdult(), replaceSounds());
|
||||||
|
return disguise;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isAdult() {
|
public boolean isAdult() {
|
||||||
if (getWatcher() != null) {
|
if (getWatcher() != null) {
|
||||||
if (getWatcher() instanceof AgeableWatcher)
|
if (getWatcher() instanceof AgeableWatcher)
|
||||||
return ((AgeableWatcher) getWatcher()).isAdult();
|
return ((AgeableWatcher) getWatcher()).isAdult();
|
||||||
return false;
|
else if (getWatcher() instanceof ZombieWatcher)
|
||||||
|
return ((ZombieWatcher) getWatcher()).isAdult();
|
||||||
|
return isAdult;
|
||||||
}
|
}
|
||||||
return isAdult;
|
return isAdult;
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ public abstract class AgeableWatcher extends LivingWatcher {
|
|||||||
|
|
||||||
public void setAdult(boolean isAdult) {
|
public void setAdult(boolean isAdult) {
|
||||||
if (isAdult != isAdult()) {
|
if (isAdult != isAdult()) {
|
||||||
setValue(12, isAdult ? 0 : -23999);
|
setValue(12, isAdult ? 0 : -24000);
|
||||||
sendData(12);
|
sendData(12);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,9 @@
|
|||||||
package me.libraryaddict.disguise.DisguiseTypes.Watchers;
|
package me.libraryaddict.disguise.DisguiseTypes.Watchers;
|
||||||
|
|
||||||
public class PigZombieWatcher extends LivingWatcher {
|
public class PigZombieWatcher extends ZombieWatcher {
|
||||||
|
|
||||||
public PigZombieWatcher(int entityId) {
|
public PigZombieWatcher(int entityId) {
|
||||||
super(entityId);
|
super(entityId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBaby() {
|
|
||||||
return (Byte) getValue(12, (byte) 0) == 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBaby(boolean baby) {
|
|
||||||
if (isBaby() != baby) {
|
|
||||||
setValue(12, (byte) (baby ? 1 : 0));
|
|
||||||
sendData(12);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,26 @@
|
|||||||
package me.libraryaddict.disguise.DisguiseTypes.Watchers;
|
package me.libraryaddict.disguise.DisguiseTypes.Watchers;
|
||||||
|
|
||||||
public class ZombieWatcher extends PigZombieWatcher {
|
public class ZombieWatcher extends LivingWatcher {
|
||||||
|
|
||||||
public ZombieWatcher(int entityId) {
|
public ZombieWatcher(int entityId) {
|
||||||
super(entityId);
|
super(entityId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isAdult() {
|
||||||
|
return (Byte) getValue(12, (byte) 0) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isVillager() {
|
public boolean isVillager() {
|
||||||
return (Byte) getValue(13, (byte) 0) == 1;
|
return (Byte) getValue(13, (byte) 0) == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setAdult(boolean adult) {
|
||||||
|
if (isAdult() != adult) {
|
||||||
|
setValue(12, (byte) (adult ? 0 : 1));
|
||||||
|
sendData(12);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setVillager(boolean villager) {
|
public void setVillager(boolean villager) {
|
||||||
if (isVillager() != villager) {
|
if (isVillager() != villager) {
|
||||||
setValue(13, (byte) (villager ? 1 : 0));
|
setValue(13, (byte) (villager ? 1 : 0));
|
||||||
|
Loading…
Reference in New Issue
Block a user