3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-26 08:10:11 +01:00

even more mappings!

Dieser Commit ist enthalten in:
EOT3000 2019-08-07 19:56:44 -04:00
Ursprung d22861d61b
Commit 7c807740a4
2 geänderte Dateien mit 29 neuen und 25 gelöschten Zeilen

Datei anzeigen

@ -77,6 +77,7 @@ public class ItemTranslator {
public BedrockItem getBedrockItem(ItemStack stack) { public BedrockItem getBedrockItem(ItemStack stack) {
Map<String, Object> m = Remapper.JAVA_TO_BEDROCK.get(stack.getId()); Map<String, Object> m = Remapper.JAVA_TO_BEDROCK.get(stack.getId());
System.out.println(stack.getId());
return new BedrockItem((String) m.get("name"), (Integer) m.get("id"), (Integer) m.get("data")); return new BedrockItem((String) m.get("name"), (Integer) m.get("id"), (Integer) m.get("data"));
} }

Datei anzeigen

@ -1,9 +1,6 @@
package org.geysermc.connector.utils; package org.geysermc.connector.utils;
import org.geysermc.connector.network.translators.item.BedrockItem; import org.geysermc.connector.network.translators.item.*;
import org.geysermc.connector.network.translators.item.DyeColor;
import org.geysermc.connector.network.translators.item.JavaItem;
import org.geysermc.connector.network.translators.item.WoodType;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -30,12 +27,31 @@ class RemapUtils {
} }
} }
});
//stone
Remapper.predicates.put((x) -> x.getF().contains("stone"), (x, y) -> {
//System.out.println(x.getIdentifier());
if(customStoneIfNeeded(y)) return;
if (y.getIdentifier().replaceAll("stone_", "")
.equalsIgnoreCase(x.getIdentifier()) && x.getData() == 0) {
/*for (WoodType woodType : WoodType.values()) {
JavaItem j = new JavaItem(y.getIdentifier().replaceAll("oak", woodType.getName()), y.getId());
Remapper.convertions.computeIfAbsent(j, (q) -> new ArrayList<>());
Remapper.convertions.get(j).add(new BedrockItem(x.getIdentifier(), x.getId(), woodType.getId()));
}*/
}
}); });
//shared name //shared name
Remapper.predicates.put((x) -> x.getF().equalsIgnoreCase(x.getS()), (x, y) -> { Remapper.predicates.put((x) -> x.getF().equalsIgnoreCase(x.getS()), (x, y) -> {
if(customColorIfNeeded(y)) return; try {
Remapper.convertions.computeIfAbsent(y, (q) -> new ArrayList<>()); Remapper.convertions.computeIfAbsent(y, (q) -> new ArrayList<>());
Remapper.convertions.get(y).add(x); Remapper.convertions.get(y).add(x);
} catch (Exception e) {
//
}
}); });
//wood //wood
Remapper.predicates.put((x) -> x.getF().contains("oak"), (x, y) -> { Remapper.predicates.put((x) -> x.getF().contains("oak"), (x, y) -> {
@ -53,26 +69,10 @@ class RemapUtils {
} }
}); });
Remapper.predicates.put((x) -> x.getF().contains("stone"), (x, y) -> {
//System.out.println(x.getIdentifier());
if(customStoneIfNeeded(y)) return;
if (y.getIdentifier().replaceAll("stone_", "")
.equalsIgnoreCase(x.getIdentifier()) && x.getData() == 0) {
for (WoodType woodType : WoodType.values()) {
JavaItem j = new JavaItem(y.getIdentifier().replaceAll("oak", woodType.getName()), y.getId());
Remapper.convertions.computeIfAbsent(j, (q) -> new ArrayList<>());
Remapper.convertions.get(j).add(new BedrockItem(x.getIdentifier(), x.getId(), woodType.getId()));
}
}
});
} }
private static boolean customColorIfNeeded(JavaItem j) { private static boolean customColorIfNeeded(JavaItem j) {
if(j.getIdentifier().equalsIgnoreCase(MINECRAFT + "shulker_box")) { if(j.getIdentifier().equalsIgnoreCase(MINECRAFT + "shulker_box")) {
System.out.println(j.getIdentifier());
Remapper.convertions.put(j, Arrays.asList(new BedrockItem(MINECRAFT + "undyed_shulker_box", 205, 0))); Remapper.convertions.put(j, Arrays.asList(new BedrockItem(MINECRAFT + "undyed_shulker_box", 205, 0)));
return true; return true;
} }
@ -90,8 +90,11 @@ class RemapUtils {
} }
private static boolean customStoneIfNeeded(JavaItem j) { private static boolean customStoneIfNeeded(JavaItem j) {
if(j.getIdentifier().equalsIgnoreCase("")) { if (j.getIdentifier().equalsIgnoreCase(MINECRAFT + "stone")) {
for (StoneType type : StoneType.values()) {
Remapper.convertions.put(new JavaItem(MINECRAFT + type.getName(), type.getId() + 1), Arrays.asList(new BedrockItem(MINECRAFT + "stone", 1, type.getId())));
}
return true;
} }
return false; return false;
} }