mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-04 03:56:41 +00:00
Upstream, generics, formatting
This commit is contained in:
@ -154,4 +154,5 @@ public abstract class AbstractWorld implements World {
|
||||
return Double.compare(priority, other != null ? other.priority : 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit.world;
|
||||
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
@ -35,7 +34,6 @@ import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
@ -54,7 +52,7 @@ public class NullWorld extends AbstractWorld {
|
||||
|
||||
private static final NullWorld INSTANCE = new NullWorld();
|
||||
|
||||
public NullWorld() {
|
||||
protected NullWorld() {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -830,16 +830,15 @@ public final class BlockTypes {
|
||||
}
|
||||
}
|
||||
|
||||
{ // Register new blocks
|
||||
int internalId = 1;
|
||||
for (Map.Entry<String, String> entry : blockMap.entrySet()) {
|
||||
String id = entry.getKey();
|
||||
String defaultState = entry.getValue();
|
||||
// Skip already registered ids
|
||||
for (; values[internalId] != null; internalId++);
|
||||
BlockType type = register(defaultState, internalId, stateList);
|
||||
values[internalId] = type;
|
||||
}
|
||||
// Register new blocks
|
||||
int internalId = 1;
|
||||
for (Map.Entry<String, String> entry : blockMap.entrySet()) {
|
||||
String id = entry.getKey();
|
||||
String defaultState = entry.getValue();
|
||||
// Skip already registered ids
|
||||
for (; values[internalId] != null; internalId++);
|
||||
BlockType type = register(defaultState, internalId, stateList);
|
||||
values[internalId] = type;
|
||||
}
|
||||
|
||||
// Add to $Registry
|
||||
@ -866,9 +865,7 @@ public final class BlockTypes {
|
||||
try {
|
||||
Field field = BlockTypes.class.getDeclaredField(enumName);
|
||||
ReflectionUtils.setFailsafeFieldValue(field, null, existing);
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@ -898,12 +895,12 @@ public final class BlockTypes {
|
||||
try {
|
||||
BlockStateHolder block = LegacyMapper.getInstance().getBlockFromLegacy(input);
|
||||
if (block != null) return block.getBlockType();
|
||||
} catch (NumberFormatException | IndexOutOfBoundsException e) {
|
||||
} catch (NumberFormatException | IndexOutOfBoundsException ignored) {
|
||||
}
|
||||
|
||||
throw new SuggestInputParseException("Does not match a valid block type: " + inputLower, inputLower, () -> Stream.of(BlockTypes.values)
|
||||
.filter(b -> StringMan.blockStateMatches(inputLower, b.getId()))
|
||||
.map(e1 -> e1.getId())
|
||||
.map(BlockType::getId)
|
||||
.sorted(StringMan.blockStateComparator(inputLower))
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
@ -913,31 +910,31 @@ public final class BlockTypes {
|
||||
return $NAMESPACES;
|
||||
}
|
||||
|
||||
public static final @Nullable BlockType get(final String id) {
|
||||
public static @Nullable BlockType get(final String id) {
|
||||
return $REGISTRY.get(id);
|
||||
}
|
||||
|
||||
public static final @Nullable BlockType get(final CharSequence id) {
|
||||
public static @Nullable BlockType get(final CharSequence id) {
|
||||
return $REGISTRY.get(id);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static final BlockType get(final int ordinal) {
|
||||
public static BlockType get(final int ordinal) {
|
||||
return values[ordinal];
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static final BlockType getFromStateId(final int internalStateId) {
|
||||
public static BlockType getFromStateId(final int internalStateId) {
|
||||
return values[internalStateId & BIT_MASK];
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static final BlockType getFromStateOrdinal(final int internalStateOrdinal) {
|
||||
public static BlockType getFromStateOrdinal(final int internalStateOrdinal) {
|
||||
return states[internalStateOrdinal].getBlockType();
|
||||
}
|
||||
|
||||
public static int size() {
|
||||
return values.length;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -28,10 +28,9 @@ import com.google.common.io.Resources;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.sk89q.worldedit.registry.state.PropertyKey;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.registry.state.PropertyKey;
|
||||
import com.sk89q.worldedit.util.gson.VectorAdapter;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
@ -48,11 +47,8 @@ import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public class LegacyMapper {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(LegacyMapper.class);
|
||||
@ -226,7 +222,7 @@ public class LegacyMapper {
|
||||
Integer combinedId = getLegacyCombined(blockState);
|
||||
return combinedId == null ? null : new int[] { combinedId >> 4, combinedId & 0xF };
|
||||
}
|
||||
|
||||
|
||||
public BaseBlock getBaseBlockFromPlotBlock(PlotBlock plotBlock) {
|
||||
if(plotBlock instanceof StringPlotBlock) {
|
||||
try {
|
||||
|
Reference in New Issue
Block a user