make metadata always send
This commit is contained in:
parent
37a093b037
commit
74ed109543
7 changed files with 22 additions and 27 deletions
|
@ -4,7 +4,7 @@ import com.github.retrooper.packetevents.protocol.entity.data.EntityData;
|
|||
|
||||
public class V1_14Factory extends V1_13Factory {
|
||||
@Override
|
||||
public EntityData skinLayers() {
|
||||
return createSkinLayers(15);
|
||||
public EntityData skinLayers(boolean enabled) {
|
||||
return createSkinLayers(15, enabled);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.github.retrooper.packetevents.protocol.entity.data.EntityData;
|
|||
|
||||
public class V1_16Factory extends V1_14Factory {
|
||||
@Override
|
||||
public EntityData skinLayers() {
|
||||
return createSkinLayers(16);
|
||||
public EntityData skinLayers(boolean enabled) {
|
||||
return createSkinLayers(16, enabled);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.github.retrooper.packetevents.protocol.entity.data.EntityData;
|
|||
|
||||
public class V1_17Factory extends V1_16Factory {
|
||||
@Override
|
||||
public EntityData skinLayers() {
|
||||
return createSkinLayers(17);
|
||||
public EntityData skinLayers(boolean enabled) {
|
||||
return createSkinLayers(17, enabled);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,8 @@ import java.util.Collection;
|
|||
|
||||
public class V1_8Factory implements MetadataFactory {
|
||||
@Override
|
||||
public EntityData skinLayers() {
|
||||
return createSkinLayers(12);
|
||||
public EntityData skinLayers(boolean enabled) {
|
||||
return createSkinLayers(12, enabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -28,11 +28,11 @@ public class V1_8Factory implements MetadataFactory {
|
|||
}
|
||||
|
||||
@Override
|
||||
public EntityData silent() {
|
||||
return new EntityData(4, EntityDataTypes.BYTE, 1);
|
||||
public EntityData silent(boolean enabled) {
|
||||
return new EntityData(4, EntityDataTypes.BYTE, enabled ? 1 : 0);
|
||||
}
|
||||
|
||||
protected EntityData createSkinLayers(int index) {
|
||||
return new EntityData(index, EntityDataTypes.BYTE, Byte.MAX_VALUE);
|
||||
protected EntityData createSkinLayers(int index, boolean enabled) {
|
||||
return new EntityData(index, EntityDataTypes.BYTE, enabled ? Byte.MAX_VALUE : 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,8 @@ import java.util.Collection;
|
|||
|
||||
public class V1_9Factory extends V1_8Factory {
|
||||
@Override
|
||||
public EntityData skinLayers() {
|
||||
return createSkinLayers(13);
|
||||
public EntityData skinLayers(boolean enabled) {
|
||||
return createSkinLayers(13, enabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -28,7 +28,7 @@ public class V1_9Factory extends V1_8Factory {
|
|||
}
|
||||
|
||||
@Override
|
||||
public EntityData silent() {
|
||||
return new EntityData(4, EntityDataTypes.BOOLEAN, true);
|
||||
public EntityData silent(boolean enabled) {
|
||||
return new EntityData(4, EntityDataTypes.BOOLEAN, enabled);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,11 +109,9 @@ public class V1_8Factory implements PacketFactory {
|
|||
@Override
|
||||
public void sendAllMetadata(Player player, PacketEntity entity, PropertyHolder properties) {
|
||||
ArrayList<EntityData> data = new ArrayList<>();
|
||||
if (entity.getType() == EntityTypes.PLAYER && properties.getProperty(EntityPropertyImpl.SKIN_LAYERS)) data.add(MetadataFactory.get().skinLayers());
|
||||
boolean fire = properties.getProperty(EntityPropertyImpl.FIRE);
|
||||
boolean invisible = properties.getProperty(EntityPropertyImpl.INVISIBLE);
|
||||
if (fire || invisible) data.add(MetadataFactory.get().effects(fire, false, invisible));
|
||||
if (properties.getProperty(EntityPropertyImpl.SILENT)) data.add(MetadataFactory.get().silent());
|
||||
if (entity.getType() == EntityTypes.PLAYER) data.add(MetadataFactory.get().skinLayers(properties.getProperty(EntityPropertyImpl.SKIN_LAYERS)));
|
||||
data.add(MetadataFactory.get().effects(properties.getProperty(EntityPropertyImpl.FIRE), false, properties.getProperty(EntityPropertyImpl.INVISIBLE)));
|
||||
data.add(MetadataFactory.get().silent(properties.getProperty(EntityPropertyImpl.SILENT)));
|
||||
if (properties.hasProperty(EntityPropertyImpl.NAME)) data.addAll(MetadataFactory.get().name(properties.getProperty(EntityPropertyImpl.NAME)));
|
||||
sendMetadata(player, entity, data);
|
||||
}
|
||||
|
|
|
@ -14,12 +14,9 @@ public class V1_9Factory extends V1_8Factory {
|
|||
@Override
|
||||
public void sendAllMetadata(Player player, PacketEntity entity, PropertyHolder properties) {
|
||||
ArrayList<EntityData> data = new ArrayList<>();
|
||||
if (entity.getType() == EntityTypes.PLAYER && properties.getProperty(EntityPropertyImpl.SKIN_LAYERS)) data.add(MetadataFactory.get().skinLayers());
|
||||
boolean glow = properties.hasProperty(EntityPropertyImpl.GLOW);
|
||||
boolean fire = properties.getProperty(EntityPropertyImpl.FIRE);
|
||||
boolean invisible = properties.getProperty(EntityPropertyImpl.INVISIBLE);
|
||||
if (glow || fire || invisible) data.add(MetadataFactory.get().effects(fire, glow, invisible));
|
||||
if (properties.getProperty(EntityPropertyImpl.SILENT)) data.add(MetadataFactory.get().silent());
|
||||
if (entity.getType() == EntityTypes.PLAYER) data.add(MetadataFactory.get().skinLayers(properties.getProperty(EntityPropertyImpl.SKIN_LAYERS)));
|
||||
data.add(MetadataFactory.get().effects(properties.getProperty(EntityPropertyImpl.FIRE), properties.hasProperty(EntityPropertyImpl.GLOW), properties.getProperty(EntityPropertyImpl.INVISIBLE)));
|
||||
data.add(MetadataFactory.get().silent(properties.getProperty(EntityPropertyImpl.SILENT)));
|
||||
if (properties.hasProperty(EntityPropertyImpl.NAME)) data.addAll(MetadataFactory.get().name(properties.getProperty(EntityPropertyImpl.NAME)));
|
||||
sendMetadata(player, entity, data);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue