Map new 1.15 particles, fix remap in 1.14

This commit is contained in:
KennyTV 2020-01-13 22:24:44 +01:00
parent d50c26dd55
commit 71e24d9797
3 changed files with 30 additions and 3 deletions

View File

@ -576,11 +576,13 @@ public class EntityPackets1_14 extends EntityRewriter<Protocol1_13_2To1_14> {
if (id >= 28) {
id -= 1; // new 24 -> 27
}
if (id >= 14) {
if (id >= 13) {
id -= 1; // new water drip 11 -> 13
}
if (id >= 12) {
id -= 2; // new lava drips 10, 11
if (id == 10 || id == 11) {
id = 9; // set both landing/falling lava to dripping lava
} else if (id > 11) {
id -= 2;
}
return id;
}

View File

@ -0,0 +1,19 @@
package nl.matsv.viabackwards.protocol.protocol1_14_4to1_15.data;
public class ParticleMapping {
public static int getOldId(int newId) {
switch (newId) {
case 58: // dripping honey -> dripping lava
return 9;
case 59: // falling honey -> falling lava
return 10;
case 60: // landing honey -> landing lava
return 11;
case 61: // falling nectar -> falling water
return 13;
default:
return newId;
}
}
}

View File

@ -4,6 +4,7 @@ import nl.matsv.viabackwards.ViaBackwards;
import nl.matsv.viabackwards.api.rewriters.BlockItemRewriter;
import nl.matsv.viabackwards.api.rewriters.RecipeRewriter;
import nl.matsv.viabackwards.protocol.protocol1_14_4to1_15.Protocol1_14_4To1_15;
import nl.matsv.viabackwards.protocol.protocol1_14_4to1_15.data.ParticleMapping;
import nl.matsv.viabackwards.protocol.protocol1_14_4to1_15.data.RecipeRewriter1_15;
import us.myles.ViaVersion.api.PacketWrapper;
import us.myles.ViaVersion.api.minecraft.chunks.Chunk;
@ -188,6 +189,11 @@ public class BlockItemPackets1_15 extends BlockItemRewriter<Protocol1_14_4To1_15
@Override
public void handle(PacketWrapper wrapper) throws Exception {
int id = wrapper.get(Type.INT, 0);
int mappedId = ParticleMapping.getOldId(id);
if (id != mappedId) {
wrapper.set(Type.INT, 0, mappedId);
}
if (id == 3 || id == 23) {
int data = wrapper.passthrough(Type.VAR_INT);
wrapper.set(Type.VAR_INT, 0, Protocol1_14_4To1_15.getNewBlockStateId(data));