Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-08 17:20:24 +01:00
Use FU map in FakeTileEntity
Dieser Commit ist enthalten in:
Ursprung
4cc0d2c1a2
Commit
4555c5dbf3
@ -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) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren