Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-08 17:20:24 +01:00
Maybe better performance?
Dieser Commit ist enthalten in:
Ursprung
e41f445e92
Commit
188cc5019f
@ -248,18 +248,19 @@ public class WorldPackets {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static int toNewId(int oldId) {
|
public static int toNewId(int oldId) {
|
||||||
if (MappingData.oldToNewBlocks.containsKey(oldId)) {
|
Integer newId = MappingData.oldToNewBlocks.get(oldId);
|
||||||
return MappingData.oldToNewBlocks.get(oldId);
|
if (newId != null) {
|
||||||
} else {
|
return newId;
|
||||||
if (MappingData.oldToNewBlocks.containsKey((oldId >> 4) << 4)) {
|
}
|
||||||
|
newId = MappingData.oldToNewBlocks.get(oldId & ~0xF); // Remove data
|
||||||
|
if (newId != null) {
|
||||||
System.out.println("Missing block " + oldId);
|
System.out.println("Missing block " + oldId);
|
||||||
return MappingData.oldToNewBlocks.get((oldId >> 4) << 4);
|
return newId;
|
||||||
}
|
}
|
||||||
System.out.println("Missing block completely " + oldId);
|
System.out.println("Missing block completely " + oldId);
|
||||||
// Default stone
|
// Default stone
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private static int checkStorage(UserConnection user, Position position, int newId) {
|
private static int checkStorage(UserConnection user, Position position, int newId) {
|
||||||
BlockStorage storage = user.get(BlockStorage.class);
|
BlockStorage storage = user.get(BlockStorage.class);
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
package us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.storage;
|
package us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.storage;
|
||||||
|
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import us.myles.ViaVersion.api.data.StoredObject;
|
import us.myles.ViaVersion.api.data.StoredObject;
|
||||||
import us.myles.ViaVersion.api.data.UserConnection;
|
import us.myles.ViaVersion.api.data.UserConnection;
|
||||||
import us.myles.ViaVersion.api.minecraft.Position;
|
import us.myles.ViaVersion.api.minecraft.Position;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
|
||||||
|
|
||||||
public class BlockStorage extends StoredObject {
|
public class BlockStorage extends StoredObject {
|
||||||
// This BlockStorage is very exclusive (;
|
// This BlockStorage is very exclusive (;
|
||||||
private static final List<Integer> whitelist = new CopyOnWriteArrayList<>();
|
private static final Set<Integer> whitelist = Sets.newConcurrentHashSet();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
// Flower pots
|
// Flower pots
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren