From 2f28b25af365ee64b574352580f7d9b4aed6e660 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Wed, 20 Oct 2021 18:51:53 +0200 Subject: [PATCH] Add block marker id to ParticleMappings --- .../viaversion/viaversion/api/data/ParticleMappings.java | 6 ++++++ .../com/viaversion/viaversion/rewriter/EntityRewriter.java | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/api/src/main/java/com/viaversion/viaversion/api/data/ParticleMappings.java b/api/src/main/java/com/viaversion/viaversion/api/data/ParticleMappings.java index fcb0ca4bf..33eea692a 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/data/ParticleMappings.java +++ b/api/src/main/java/com/viaversion/viaversion/api/data/ParticleMappings.java @@ -29,6 +29,7 @@ public class ParticleMappings { private final Mappings mappings; private final int blockId; private final int fallingDustId; + private final int blockMarkerId; private final int itemId; public ParticleMappings(JsonArray oldMappings, Mappings mappings) { @@ -37,6 +38,7 @@ public class ParticleMappings { Object2IntMap map = MappingDataLoader.arrayToMap(oldMappings); blockId = map.getInt("block"); fallingDustId = map.getInt("falling_dust"); + blockMarkerId = map.getInt("block_marker"); itemId = map.getInt("item"); } @@ -52,6 +54,10 @@ public class ParticleMappings { return fallingDustId; } + public int getBlockmarkerid() { + return blockMarkerId; + } + public int getItemId() { return itemId; } diff --git a/common/src/main/java/com/viaversion/viaversion/rewriter/EntityRewriter.java b/common/src/main/java/com/viaversion/viaversion/rewriter/EntityRewriter.java index 84f4103c5..d22c24a67 100644 --- a/common/src/main/java/com/viaversion/viaversion/rewriter/EntityRewriter.java +++ b/common/src/main/java/com/viaversion/viaversion/rewriter/EntityRewriter.java @@ -479,7 +479,8 @@ public abstract class EntityRewriter extends RewriterBase protected void rewriteParticle(Particle particle) { ParticleMappings mappings = protocol.getMappingData().getParticleMappings(); int id = particle.getId(); - if (id == mappings.getBlockId() || id == mappings.getFallingDustId()) { + if (id == mappings.getBlockId() || id == mappings.getFallingDustId() + || (mappings.getBlockmarkerid() != -1 && id == mappings.getBlockmarkerid())) { Particle.ParticleData data = particle.getArguments().get(0); data.setValue(protocol.getMappingData().getNewBlockStateId(data.get())); } else if (id == mappings.getItemId()) {