mirror of
https://github.com/TotalFreedomMC/TF-LibsDisguises.git
synced 2024-11-11 01:17:16 +00:00
Fixed adult problems. tehehe
This commit is contained in:
parent
823914d626
commit
6034ae612a
4 changed files with 24 additions and 16 deletions
|
@ -1,13 +1,14 @@
|
|||
package me.libraryaddict.disguise.DisguiseTypes;
|
||||
|
||||
import me.libraryaddict.disguise.DisguiseTypes.Watchers.AgeableWatcher;
|
||||
import me.libraryaddict.disguise.DisguiseTypes.Watchers.ZombieWatcher;
|
||||
|
||||
public class MobDisguise extends Disguise {
|
||||
|
||||
private boolean isAdult;
|
||||
|
||||
public MobDisguise(DisguiseType disguiseType, boolean isAdult) {
|
||||
super(disguiseType, true);
|
||||
this(disguiseType, isAdult, true);
|
||||
}
|
||||
|
||||
public MobDisguise(DisguiseType disguiseType, boolean isAdult, boolean replaceSounds) {
|
||||
|
@ -15,11 +16,18 @@ public class MobDisguise extends Disguise {
|
|||
this.isAdult = isAdult;
|
||||
}
|
||||
|
||||
public MobDisguise clone() {
|
||||
MobDisguise disguise = new MobDisguise(getType(), isAdult(), replaceSounds());
|
||||
return disguise;
|
||||
}
|
||||
|
||||
public boolean isAdult() {
|
||||
if (getWatcher() != null) {
|
||||
if (getWatcher() instanceof AgeableWatcher)
|
||||
return ((AgeableWatcher) getWatcher()).isAdult();
|
||||
return false;
|
||||
else if (getWatcher() instanceof ZombieWatcher)
|
||||
return ((ZombieWatcher) getWatcher()).isAdult();
|
||||
return isAdult;
|
||||
}
|
||||
return isAdult;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ public abstract class AgeableWatcher extends LivingWatcher {
|
|||
|
||||
public void setAdult(boolean isAdult) {
|
||||
if (isAdult != isAdult()) {
|
||||
setValue(12, isAdult ? 0 : -23999);
|
||||
setValue(12, isAdult ? 0 : -24000);
|
||||
sendData(12);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,20 +1,9 @@
|
|||
package me.libraryaddict.disguise.DisguiseTypes.Watchers;
|
||||
|
||||
public class PigZombieWatcher extends LivingWatcher {
|
||||
public class PigZombieWatcher extends ZombieWatcher {
|
||||
|
||||
public PigZombieWatcher(int 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;
|
||||
|
||||
public class ZombieWatcher extends PigZombieWatcher {
|
||||
public class ZombieWatcher extends LivingWatcher {
|
||||
|
||||
public ZombieWatcher(int entityId) {
|
||||
super(entityId);
|
||||
}
|
||||
|
||||
public boolean isAdult() {
|
||||
return (Byte) getValue(12, (byte) 0) == 0;
|
||||
}
|
||||
|
||||
public boolean isVillager() {
|
||||
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) {
|
||||
if (isVillager() != villager) {
|
||||
setValue(13, (byte) (villager ? 1 : 0));
|
||||
|
|
Loading…
Reference in a new issue