mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-04 12:06:41 +00:00
Merge remote-tracking branch 'refs/remotes/sk89q/master'
# Conflicts: # worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java # worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BaseBlock.java # worldedit-core/src/main/java/com/sk89q/worldedit/world/NullWorld.java
This commit is contained in:
@ -20,14 +20,14 @@
|
||||
package com.sk89q.worldedit.world.registry;
|
||||
|
||||
import com.google.common.io.Resources;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.*;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BlockMaterial;
|
||||
import com.sk89q.worldedit.util.gson.VectorAdapter;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Type;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.HashMap;
|
||||
@ -75,6 +75,18 @@ public class BundledBlockData {
|
||||
private void loadFromResource() throws IOException {
|
||||
GsonBuilder gsonBuilder = new GsonBuilder();
|
||||
gsonBuilder.registerTypeAdapter(Vector.class, new VectorAdapter());
|
||||
gsonBuilder.registerTypeAdapter(int.class, new JsonDeserializer<Integer>() {
|
||||
@Override
|
||||
public Integer deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||
JsonPrimitive primitive = (JsonPrimitive) json;
|
||||
if (primitive.isString()) {
|
||||
String value = primitive.getAsString();
|
||||
if (value.charAt(0) == '#') return Integer.parseInt(value.substring(1), 16);
|
||||
return Integer.parseInt(value);
|
||||
}
|
||||
return primitive.getAsInt();
|
||||
}
|
||||
});
|
||||
Gson gson = gsonBuilder.create();
|
||||
URL url = BundledBlockData.class.getResource("blocks.json");
|
||||
if (url == null) {
|
||||
|
@ -178,7 +178,11 @@ public class LegacyMapper {
|
||||
|
||||
private BlockState getBlock(int combinedId) {
|
||||
if (combinedId < blockArr.length) {
|
||||
return BlockState.get(blockArr[combinedId]);
|
||||
try {
|
||||
return BlockState.get(blockArr[combinedId]);
|
||||
} catch (IndexOutOfBoundsException ignore) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Integer extra = extraId4DataToStateId.get(combinedId);
|
||||
if (extra == null) {
|
||||
|
@ -40,6 +40,15 @@ public class PassthroughBlockMaterial implements BlockMaterial {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMapColor() {
|
||||
if (blockMaterial == null) {
|
||||
return 0;
|
||||
} else {
|
||||
return blockMaterial.getMapColor();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube() {
|
||||
if (blockMaterial == null) {
|
||||
|
@ -43,6 +43,7 @@ class SimpleBlockMaterial implements BlockMaterial {
|
||||
private boolean hasContainer;
|
||||
private int lightOpacity;
|
||||
private boolean isAir;
|
||||
private int mapColor;
|
||||
|
||||
@Override
|
||||
public boolean isAir() {
|
||||
@ -53,6 +54,15 @@ class SimpleBlockMaterial implements BlockMaterial {
|
||||
isAir = air;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMapColor() {
|
||||
return mapColor;
|
||||
}
|
||||
|
||||
public void setMapColor(int mapColor) {
|
||||
this.mapColor = mapColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightOpacity() {
|
||||
return lightOpacity;
|
||||
|
Reference in New Issue
Block a user