Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-09-07 13:22:54 +02:00
Improve map color rewriter, cc Gerrygames
Dieser Commit ist enthalten in:
Ursprung
63d3dcb31b
Commit
07078b21f1
@ -0,0 +1,44 @@
|
||||
package nl.matsv.viabackwards.protocol.protocol1_15_2to1_16.data;
|
||||
|
||||
import us.myles.viaversion.libs.fastutil.ints.Int2IntMap;
|
||||
import us.myles.viaversion.libs.fastutil.ints.Int2IntOpenHashMap;
|
||||
|
||||
public class MapColorRewriter {
|
||||
|
||||
private static final Int2IntMap MAPPINGS = new Int2IntOpenHashMap();
|
||||
|
||||
static {
|
||||
MAPPINGS.put(208, 113);
|
||||
MAPPINGS.put(209, 114);
|
||||
MAPPINGS.put(210, 114);
|
||||
MAPPINGS.put(211, 112);
|
||||
MAPPINGS.put(212, 152);
|
||||
MAPPINGS.put(213, 83);
|
||||
MAPPINGS.put(214, 83);
|
||||
MAPPINGS.put(215, 155);
|
||||
MAPPINGS.put(216, 143);
|
||||
MAPPINGS.put(217, 115);
|
||||
MAPPINGS.put(218, 115);
|
||||
MAPPINGS.put(219, 143);
|
||||
MAPPINGS.put(220, 127);
|
||||
MAPPINGS.put(221, 127);
|
||||
MAPPINGS.put(222, 127);
|
||||
MAPPINGS.put(223, 95);
|
||||
MAPPINGS.put(224, 127);
|
||||
MAPPINGS.put(225, 127);
|
||||
MAPPINGS.put(226, 124);
|
||||
MAPPINGS.put(227, 95);
|
||||
MAPPINGS.put(228, 187);
|
||||
MAPPINGS.put(229, 155);
|
||||
MAPPINGS.put(230, 184);
|
||||
MAPPINGS.put(231, 187);
|
||||
MAPPINGS.put(232, 127);
|
||||
MAPPINGS.put(233, 124);
|
||||
MAPPINGS.put(234, 125);
|
||||
MAPPINGS.put(235, 127);
|
||||
}
|
||||
|
||||
public static int getMappedColor(int color) {
|
||||
return MAPPINGS.getOrDefault(color, -1);
|
||||
}
|
||||
}
|
@ -5,6 +5,7 @@ import nl.matsv.viabackwards.api.rewriters.EnchantmentRewriter;
|
||||
import nl.matsv.viabackwards.api.rewriters.TranslatableRewriter;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_15_2to1_16.Protocol1_15_2To1_16;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_15_2to1_16.data.BackwardsMappings;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_15_2to1_16.data.MapColorRewriter;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_15_2to1_16.data.RecipeRewriter1_16;
|
||||
import us.myles.ViaVersion.api.PacketWrapper;
|
||||
import us.myles.ViaVersion.api.minecraft.Position;
|
||||
@ -235,31 +236,11 @@ public class BlockItemPackets1_16 extends nl.matsv.viabackwards.api.rewriters.It
|
||||
wrapper.passthrough(Type.BYTE); // Z
|
||||
byte[] data = wrapper.passthrough(Type.BYTE_ARRAY_PRIMITIVE);
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
int color = (data[i] & 0xFF) / 4;
|
||||
int newColor = -1;
|
||||
switch (color) {
|
||||
case 52:
|
||||
newColor = 28;
|
||||
break;
|
||||
case 53:
|
||||
newColor = 38;
|
||||
break;
|
||||
case 54:
|
||||
newColor = 35;
|
||||
break;
|
||||
case 55:
|
||||
newColor = 32;
|
||||
break;
|
||||
case 56:
|
||||
case 58:
|
||||
newColor = 23;
|
||||
break;
|
||||
case 57:
|
||||
newColor = 24;
|
||||
break;
|
||||
}
|
||||
if (newColor != -1) {
|
||||
data[i] = (byte) (newColor * 4);
|
||||
int color = data[i] & 0xFF;
|
||||
int mappedColor = MapColorRewriter.getMappedColor(color);
|
||||
if (mappedColor != -1) {
|
||||
data[i] = (byte) mappedColor;
|
||||
System.out.println(color + " -> " + mappedColor);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren