Fixed DroppedItem disguise

Fixed Fireworks disguise
Fixed SplashPotion disguise
Fixed Sheep disguise colors
Fixed Wolf disguise colors
Fixed error with isGlowing in FlagWatcher
This commit is contained in:
NavidK0
2016-03-20 23:29:48 -04:00
parent 12ea8ee35e
commit ed1bcc5ad9
8 changed files with 46 additions and 30 deletions

View File

@@ -1305,10 +1305,7 @@ public class PacketsManager {
// Else if the packet is sending entity metadata
else if (sentPacket.getType() == Server.ENTITY_METADATA) {
if (DisguiseConfig.isMetadataPacketsEnabled() && (disguise.getType() != DisguiseType.WOLF &&
disguise.getType() != DisguiseType.OCELOT &&
disguise.getType() != DisguiseType.ENDERMAN &&
disguise.getType() != DisguiseType.SHULKER)) {
if (DisguiseConfig.isMetadataPacketsEnabled() && !isStaticMetadataDisguiseType(disguise)) {
List<WrappedWatchableObject> watchableObjects = disguise.getWatcher().convert(
packets[0].getWatchableCollectionModifier().read(0));
packets[0] = new PacketContainer(sentPacket.getType());
@@ -1420,10 +1417,7 @@ public class PacketsManager {
if (heldItem != null && heldItem.getType() != Material.AIR) {
// Convert the datawatcher
List<WrappedWatchableObject> list = new ArrayList<>();
if (DisguiseConfig.isMetadataPacketsEnabled() && (disguise.getType() != DisguiseType.WOLF &&
disguise.getType() != DisguiseType.OCELOT &&
disguise.getType() != DisguiseType.ENDERMAN &&
disguise.getType() != DisguiseType.SHULKER)) {
if (DisguiseConfig.isMetadataPacketsEnabled() && !isStaticMetadataDisguiseType(disguise)) {
WrappedWatchableObject watch = new WrappedWatchableObject(ReflectionManager.createDataWatcherItem(0,
WrappedDataWatcher.getEntityWatcher(entity).getByte(0)));
list.add(watch);
@@ -1498,4 +1492,19 @@ public class PacketsManager {
}
return packets == null ? null : new PacketContainer[][]{packets, delayedPackets};
}
/**
* Returns true if this disguise type doesn't have changing metadata.
* @param disguise
* @return
*/
public static boolean isStaticMetadataDisguiseType(Disguise disguise) {
return (disguise.getType() == DisguiseType.WOLF ||
disguise.getType() == DisguiseType.OCELOT ||
disguise.getType() == DisguiseType.ENDERMAN ||
disguise.getType() == DisguiseType.SHULKER ||
disguise.getType() == DisguiseType.SPLASH_POTION ||
disguise.getType() == DisguiseType.FIREWORK ||
disguise.getType() == DisguiseType.DROPPED_ITEM);
}
}