3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-27 08:30:09 +01:00

Handle barrier/light particles in entity meta

Dieser Commit ist enthalten in:
Nassim Jahnke 2021-10-25 09:52:54 +02:00
Ursprung d8d65ea989
Commit 516f746061
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B

Datei anzeigen

@ -23,6 +23,7 @@ import com.viaversion.viaversion.api.minecraft.entities.EntityType;
import com.viaversion.viaversion.api.minecraft.metadata.types.MetaType1_18;
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.types.Particle;
import com.viaversion.viaversion.api.type.types.version.Types1_17;
import com.viaversion.viaversion.api.type.types.version.Types1_18;
import com.viaversion.viaversion.protocols.protocol1_17_1to1_17.ClientboundPackets1_17_1;
@ -86,8 +87,22 @@ public final class EntityPackets extends EntityRewriter<Protocol1_18To1_17_1> {
@Override
protected void registerRewrites() {
filter().handler((event, meta) -> meta.setMetaType(MetaType1_18.byId(meta.metaType().typeId())));
registerMetaTypeHandler(MetaType1_18.ITEM, null, MetaType1_18.PARTICLE);
filter().handler((event, meta) -> {
meta.setMetaType(MetaType1_18.byId(meta.metaType().typeId()));
if (meta.metaType() == MetaType1_18.PARTICLE) {
Particle particle = (Particle) meta.getValue();
if (particle.getId() == 2) { // Barrier
particle.setId(3); // Block marker
particle.getArguments().add(new Particle.ParticleData(Type.VAR_INT, 7754)); // Barrier state
} else if (particle.getId() == 3) { // Light block
particle.getArguments().add(new Particle.ParticleData(Type.VAR_INT, 7786)); // Light block state
} else {
rewriteParticle(particle);
}
}
});
registerMetaTypeHandler(MetaType1_18.ITEM, null, null);
/*filter().filterFamily(Entity1_17Types.MINECART_ABSTRACT).index(11).handler((event, meta) -> { //TODO check id
// Convert to new block id