Fixed 2 bugs with entity location and metadata. Released 2,2
This commit is contained in:
parent
e20732836d
commit
005e28fe8b
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>LibsDisguises</groupId>
|
||||
<artifactId>LibsDisguises</artifactId>
|
||||
<version>v2.1</version>
|
||||
<version>v2.2</version>
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<defaultGoal>clean package</defaultGoal>
|
||||
|
@ -65,8 +65,10 @@ public class Disguise {
|
||||
}
|
||||
|
||||
public Entity getEntity(World world, Location loc, int entityId) {
|
||||
if (entity != null)
|
||||
if (entity != null) {
|
||||
entity.setLocation(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch());
|
||||
return entity;
|
||||
}
|
||||
try {
|
||||
String name = toReadable(disguiseType.name());
|
||||
if (disguiseType == DisguiseType.WITHER_SKELETON) {
|
||||
|
@ -27,13 +27,17 @@ public abstract class FlagWatcher {
|
||||
|
||||
protected FlagWatcher(int entityId) {
|
||||
this.entityId = entityId;
|
||||
setValue(6, (byte) 0);
|
||||
setValue(5, "");
|
||||
}
|
||||
|
||||
public List<WatchableObject> convert(List<WatchableObject> list) {
|
||||
Iterator<WatchableObject> itel = list.iterator();
|
||||
List<WatchableObject> newList = new ArrayList<WatchableObject>();
|
||||
List<Integer> sentValues = new ArrayList<Integer>();
|
||||
while (itel.hasNext()) {
|
||||
WatchableObject watch = itel.next();
|
||||
sentValues.add(watch.a());
|
||||
if (entityValues.containsKey(watch.a())) {
|
||||
boolean doD = watch.d();
|
||||
watch = new WatchableObject(watch.c(), watch.a(), watch.b());
|
||||
@ -59,6 +63,18 @@ public abstract class FlagWatcher {
|
||||
}
|
||||
newList.add(watch);
|
||||
}
|
||||
if (list.size() == 10) {
|
||||
// Its sending the entire meta data. Better add the custom meta
|
||||
for (int value : entityValues.keySet()) {
|
||||
if (sentValues.contains(value))
|
||||
continue;
|
||||
Object obj = entityValues.get(value);
|
||||
if (obj == null)
|
||||
continue;
|
||||
WatchableObject watch = new WatchableObject(classTypes.get(obj.getClass()), value, obj);
|
||||
newList.add(watch);
|
||||
}
|
||||
}
|
||||
return newList;
|
||||
}
|
||||
|
||||
@ -84,6 +100,17 @@ public abstract class FlagWatcher {
|
||||
}
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
setValue(5, name);
|
||||
}
|
||||
|
||||
public void displayName(boolean display) {
|
||||
if ((Byte) getValue(6) != (display ? 1 : 0)) {
|
||||
setValue(6, (byte) (display ? 1 : 0));
|
||||
sendData(6);
|
||||
}
|
||||
}
|
||||
|
||||
protected void setValue(int no, Object value) {
|
||||
entityValues.put(no, value);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user