3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-28 00:50:13 +01:00

Add block marker id to ParticleMappings

Dieser Commit ist enthalten in:
Nassim Jahnke 2021-10-20 18:51:53 +02:00
Ursprung 02bf9501a9
Commit 2f28b25af3
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
2 geänderte Dateien mit 8 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -29,6 +29,7 @@ public class ParticleMappings {
private final Mappings mappings; private final Mappings mappings;
private final int blockId; private final int blockId;
private final int fallingDustId; private final int fallingDustId;
private final int blockMarkerId;
private final int itemId; private final int itemId;
public ParticleMappings(JsonArray oldMappings, Mappings mappings) { public ParticleMappings(JsonArray oldMappings, Mappings mappings) {
@ -37,6 +38,7 @@ public class ParticleMappings {
Object2IntMap<String> map = MappingDataLoader.arrayToMap(oldMappings); Object2IntMap<String> map = MappingDataLoader.arrayToMap(oldMappings);
blockId = map.getInt("block"); blockId = map.getInt("block");
fallingDustId = map.getInt("falling_dust"); fallingDustId = map.getInt("falling_dust");
blockMarkerId = map.getInt("block_marker");
itemId = map.getInt("item"); itemId = map.getInt("item");
} }
@ -52,6 +54,10 @@ public class ParticleMappings {
return fallingDustId; return fallingDustId;
} }
public int getBlockmarkerid() {
return blockMarkerId;
}
public int getItemId() { public int getItemId() {
return itemId; return itemId;
} }

Datei anzeigen

@ -479,7 +479,8 @@ public abstract class EntityRewriter<T extends Protocol> extends RewriterBase<T>
protected void rewriteParticle(Particle particle) { protected void rewriteParticle(Particle particle) {
ParticleMappings mappings = protocol.getMappingData().getParticleMappings(); ParticleMappings mappings = protocol.getMappingData().getParticleMappings();
int id = particle.getId(); 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); Particle.ParticleData data = particle.getArguments().get(0);
data.setValue(protocol.getMappingData().getNewBlockStateId(data.get())); data.setValue(protocol.getMappingData().getNewBlockStateId(data.get()));
} else if (id == mappings.getItemId()) { } else if (id == mappings.getItemId()) {