mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-26 20:16:02 +01:00
Merge pull request #1261 from KennyTV/dev
Remap areaeffectcloud particles
This commit is contained in:
commit
70cb461c32
@ -9,8 +9,8 @@ import us.myles.ViaVersion.api.minecraft.item.Item;
|
||||
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
||||
import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_14;
|
||||
import us.myles.ViaVersion.api.type.Type;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.Particle;
|
||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.packets.InventoryPackets;
|
||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.storage.EntityTracker;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -22,8 +22,6 @@ public class MetadataRewriter {
|
||||
try {
|
||||
metadata.setMetaType(MetaType1_14.byId(metadata.getMetaType().getTypeID()));
|
||||
|
||||
EntityTracker tracker = connection.get(EntityTracker.class);
|
||||
|
||||
if (metadata.getMetaType() == MetaType1_14.Slot) {
|
||||
InventoryPackets.toClient((Item) metadata.getValue());
|
||||
} else if (metadata.getMetaType() == MetaType1_14.BlockID) {
|
||||
@ -50,9 +48,7 @@ public class MetadataRewriter {
|
||||
int data = (int) metadata.getValue();
|
||||
metadata.setValue(Protocol1_14To1_13_2.getNewBlockStateId(data));
|
||||
}
|
||||
}
|
||||
|
||||
if (type.is(Entity1_14Types.EntityType.HORSE)) {
|
||||
} else if (type.is(Entity1_14Types.EntityType.HORSE)) {
|
||||
if (metadata.getId() == 18) {
|
||||
metadatas.remove(metadata);
|
||||
|
||||
@ -72,9 +68,7 @@ public class MetadataRewriter {
|
||||
equipmentPacket.write(Type.FLAT_VAR_INT_ITEM, armorItem);
|
||||
equipmentPacket.send(Protocol1_14To1_13_2.class);
|
||||
}
|
||||
}
|
||||
|
||||
if (type.is(Entity1_14Types.EntityType.VILLAGER)) {
|
||||
} else if (type.is(Entity1_14Types.EntityType.VILLAGER)) {
|
||||
if (metadata.getId() == 15) {
|
||||
// plains
|
||||
metadata.setValue(new VillagerData(2, getNewProfessionId((int) metadata.getValue()), 0));
|
||||
@ -86,33 +80,30 @@ public class MetadataRewriter {
|
||||
metadata.setValue(new VillagerData(2, getNewProfessionId((int) metadata.getValue()), 0));
|
||||
metadata.setMetaType(MetaType1_14.VillagerData);
|
||||
}
|
||||
}
|
||||
|
||||
if (type.isOrHasParent(Entity1_14Types.EntityType.ARROW)) {
|
||||
} else if (type.isOrHasParent(Entity1_14Types.EntityType.ARROW)) {
|
||||
if (metadata.getId() >= 9) {
|
||||
metadata.setId(metadata.getId() + 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (type.is(Entity1_14Types.EntityType.FIREWORKS_ROCKET)) {
|
||||
} else if (type.is(Entity1_14Types.EntityType.FIREWORKS_ROCKET)) {
|
||||
if (metadata.getId() == 8) {
|
||||
if (metadata.getValue().equals(0)) metadata.setValue(null); // https://bugs.mojang.com/browse/MC-111480
|
||||
metadata.setMetaType(MetaType1_14.OptVarInt);
|
||||
}
|
||||
}
|
||||
|
||||
if (type.isOrHasParent(Entity1_14Types.EntityType.ABSTRACT_SKELETON)) {
|
||||
} else if (type.isOrHasParent(Entity1_14Types.EntityType.ABSTRACT_SKELETON)) {
|
||||
if (metadata.getId() == 12) {
|
||||
metadatas.remove(metadata); // TODO "Is swinging arms", maybe moved to pos / entity status
|
||||
}
|
||||
}
|
||||
|
||||
if (type.isOrHasParent(Entity1_14Types.EntityType.ZOMBIE)) {
|
||||
} else if (type.isOrHasParent(Entity1_14Types.EntityType.ZOMBIE)) {
|
||||
if (metadata.getId() == 16) {
|
||||
metadatas.remove(metadata); // TODO "Are hands held up", maybe moved to pos / entity status
|
||||
} else if (metadata.getId() > 16) {
|
||||
metadata.setId(metadata.getId() - 1);
|
||||
}
|
||||
} else if (type.is(Entity1_14Types.EntityType.AREA_EFFECT_CLOUD)) {
|
||||
if (metadata.getId() == 10) {
|
||||
Particle particle = (Particle) metadata.getValue();
|
||||
particle.setId(getNewParticleId(particle.getId()));
|
||||
}
|
||||
}
|
||||
|
||||
if (type.isOrHasParent(Entity1_14Types.EntityType.ABSTRACT_ILLAGER_BASE)) {
|
||||
@ -158,4 +149,22 @@ public class MetadataRewriter {
|
||||
}
|
||||
}
|
||||
|
||||
public static int getNewParticleId(int id) {
|
||||
if (id >= 10) {
|
||||
id += 2; // new lava drips 10, 11
|
||||
}
|
||||
if (id >= 13) {
|
||||
id += 1; // new water drip 11 -> 13
|
||||
}
|
||||
if (id >= 27) {
|
||||
id += 1; // new 24 -> 27
|
||||
}
|
||||
if (id >= 29) {
|
||||
id += 1; // skip new short happy villager
|
||||
}
|
||||
if (id >= 44) {
|
||||
id += 1; // new 39 -> 44
|
||||
}
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ import us.myles.ViaVersion.api.type.Type;
|
||||
import us.myles.ViaVersion.packets.State;
|
||||
import us.myles.ViaVersion.protocols.base.ProtocolInfo;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.types.Chunk1_13Type;
|
||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.MetadataRewriter;
|
||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.Protocol1_14To1_13_2;
|
||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.data.MappingData;
|
||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.storage.EntityTracker;
|
||||
@ -248,23 +249,7 @@ public class WorldPackets {
|
||||
InventoryPackets.toClient(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM));
|
||||
}
|
||||
|
||||
int newId = id;
|
||||
if (newId >= 10) {
|
||||
newId += 2; // new lava drips 10, 11
|
||||
}
|
||||
if (newId >= 13) {
|
||||
newId += 1; // new water drip 11 -> 13
|
||||
}
|
||||
if (newId >= 27) {
|
||||
newId += 1; // new 24 -> 27
|
||||
}
|
||||
if (newId >= 29) {
|
||||
newId += 1; // skip new short happy villager
|
||||
}
|
||||
if (newId >= 44) {
|
||||
newId += 1; // new 39 -> 44
|
||||
}
|
||||
|
||||
int newId = MetadataRewriter.getNewParticleId(id);
|
||||
if (newId != id) {
|
||||
wrapper.set(Type.INT, 0, newId);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user