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

Handle (id+(data<<12)) encoded particle blocks; finish particle rewriting (:

Dieser Commit ist enthalten in:
Matsv 2018-04-05 19:01:37 +02:00
Ursprung 45105d8c6a
Commit 07fa0f3e55

Datei anzeigen

@ -60,6 +60,7 @@ public class ParticleRewriter {
add(27, iconcrackHandler()); // (36->27) iconcrack_(id)_(data) -> minecraft:item
// Item Slot The item that will be used.
add(3, blockHandler()); // (37->3) blockcrack_(id+(data<<12)) -> minecraft:block
// BlockState VarInt The ID of the block state.
add(3, blockWithoutMetaHandler()); // (38->3) blockdust_(id) -> minecraft:block
// BlockState VarInt The ID of the block state.
add(36); // (39->36) droplet -> minecraft:rain
@ -135,17 +136,22 @@ public class ParticleRewriter {
// Transform to new Item
InventoryPackets.toClient(item);
particle.getArguments().add(new Particle.ParticleData(Type.FLAT_ITEM, item));
particle.getArguments().add(new Particle.ParticleData(Type.FLAT_ITEM, item)); // Item Slot The item that will be used.
return particle;
}
};
}
// TODO HANDLE
// Handle (id+(data<<12)) encoded blocks
private static ParticleDataHandler blockHandler() {
return new ParticleDataHandler() {
@Override
public Particle handler(Particle particle, Integer[] data) {
int value = data[0];
int combined = (((value & 4095) << 4) | (value >> 12 & 15));
int newId = WorldPackets.toNewId(combined);
particle.getArguments().add(new Particle.ParticleData(Type.VAR_INT, newId)); // BlockState VarInt The ID of the block state.
return particle;
}
};
@ -158,7 +164,7 @@ public class ParticleRewriter {
public Particle handler(Particle particle, Integer[] data) {
int blockId = data[0].shortValue() << 4;
int newBlockId = WorldPackets.toNewId(blockId);
particle.getArguments().add(new Particle.ParticleData(Type.VAR_INT, newBlockId));
particle.getArguments().add(new Particle.ParticleData(Type.VAR_INT, newBlockId)); // BlockState VarInt The ID of the block state.
return particle;
}
};