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

Use FU map in FakeTileEntity

Dieser Commit ist enthalten in:
KennyTV 2020-11-29 16:40:40 +01:00
Ursprung 4cc0d2c1a2
Commit 4555c5dbf3
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B

Datei anzeigen

@ -3,18 +3,18 @@ package us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.chunks;
import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.github.steveice10.opennbt.tag.builtin.IntTag; import com.github.steveice10.opennbt.tag.builtin.IntTag;
import com.github.steveice10.opennbt.tag.builtin.StringTag; import com.github.steveice10.opennbt.tag.builtin.StringTag;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* Mojang changed the way how tile entities inside chunk packets work in 1.10.1 * Mojang changed the way how tile entities inside chunk packets work in 1.10.1
* It requires now to have all tile entity data included in the chunk packet, otherwise it'll crash. * It requires now to have all tile entity data included in the chunk packet, otherwise it'll crash.
*/ */
public class FakeTileEntity { public class FakeTileEntity {
private static final Map<Integer, CompoundTag> tileEntities = new HashMap<>(); private static final Int2ObjectMap<CompoundTag> tileEntities = new Int2ObjectOpenHashMap<>();
static { static {
register(Arrays.asList(61, 62), "Furnace"); register(Arrays.asList(61, 62), "Furnace");
@ -41,15 +41,16 @@ public class FakeTileEntity {
register(137, "Control"); register(137, "Control");
} }
private static void register(Integer material, String name) { private static void register(int material, String name) {
CompoundTag comp = new CompoundTag(""); CompoundTag comp = new CompoundTag("");
comp.put(new StringTag(name)); comp.put(new StringTag(name));
tileEntities.put(material, comp); tileEntities.put(material, comp);
} }
private static void register(List<Integer> materials, String name) { private static void register(List<Integer> materials, String name) {
for (int m : materials) for (int id : materials) {
register(m, name); register(id, name);
}
} }
public static boolean hasBlock(int block) { public static boolean hasBlock(int block) {