mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-12 10:38:34 +00:00
Merge remote-tracking branch 'upstream/master' into breaking
This commit is contained in:
@ -93,7 +93,7 @@ public abstract class AbstractWorld implements World {
|
||||
|
||||
@Override
|
||||
public BlockState getLazyBlock(BlockVector3 position) {
|
||||
return new BaseBlock(getBlock(position)).toImmutableState();
|
||||
return getBlock(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -33,11 +33,14 @@ import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
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;
|
||||
import com.sk89q.worldedit.world.weather.WeatherType;
|
||||
import com.sk89q.worldedit.world.weather.WeatherTypes;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collections;
|
||||
@ -80,12 +83,12 @@ public class NullWorld extends AbstractWorld {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBiome getBiome(BlockVector2 position) {
|
||||
return null;
|
||||
public BiomeType getBiome(BlockVector2 position) {
|
||||
return BiomeTypes.THE_VOID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(BlockVector2 position, BaseBiome biome) {
|
||||
public boolean setBiome(BlockVector2 position, BiomeType biome) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -109,7 +112,7 @@ public class NullWorld extends AbstractWorld {
|
||||
|
||||
@Override
|
||||
public WeatherType getWeather() {
|
||||
return null;
|
||||
return WeatherTypes.CLEAR;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -136,7 +139,6 @@ public class NullWorld extends AbstractWorld {
|
||||
}
|
||||
|
||||
@Override
|
||||
//<<<<<<< HEAD
|
||||
public BlockState getLazyBlock(BlockVector3 position) {
|
||||
return getBlock(position);
|
||||
}
|
||||
@ -145,10 +147,6 @@ public class NullWorld extends AbstractWorld {
|
||||
public BaseBlock getFullBlock(BlockVector3 position) {
|
||||
return getBlock(position).toBaseBlock();
|
||||
}
|
||||
//=======
|
||||
// public BaseBlock getFullBlock(BlockVector3 position) {
|
||||
// return getBlock(position).toBaseBlock();
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner }
|
||||
|
||||
@Override
|
||||
public List<Entity> getEntities(Region region) {
|
||||
|
@ -1,87 +0,0 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldEdit team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.world.biome;
|
||||
|
||||
import com.sk89q.minecraft.util.commands.Link;
|
||||
import com.sk89q.worldedit.command.BiomeCommands;
|
||||
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* Basic storage object to represent a given biome.
|
||||
*/
|
||||
@Link(clazz = BiomeCommands.class, value = "biomelist")
|
||||
public class BaseBiome {
|
||||
|
||||
private int id;
|
||||
|
||||
/**
|
||||
* Create a new biome with the given biome ID.
|
||||
*
|
||||
* @param id the biome ID
|
||||
*/
|
||||
public BaseBiome(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a clone of the given biome.
|
||||
*
|
||||
* @param biome the biome to clone
|
||||
*/
|
||||
public BaseBiome(BaseBiome biome) {
|
||||
checkNotNull(biome);
|
||||
this.id = biome.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the biome ID.
|
||||
*
|
||||
* @return the biome ID
|
||||
*/
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the biome id.
|
||||
*
|
||||
* @param id the biome ID
|
||||
*/
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
BaseBiome baseBiome = (BaseBiome) o;
|
||||
|
||||
return id == baseBiome.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return id;
|
||||
}
|
||||
}
|
@ -29,7 +29,7 @@ import javax.annotation.Nullable;
|
||||
/**
|
||||
* Returns the name of a biome using a given {@code BiomeRegistry}.
|
||||
*/
|
||||
class BiomeName implements Function<BaseBiome, String> {
|
||||
class BiomeName implements Function<BiomeType, String> {
|
||||
|
||||
private final BiomeRegistry registry;
|
||||
|
||||
@ -45,7 +45,7 @@ class BiomeName implements Function<BaseBiome, String> {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String apply(BaseBiome input) {
|
||||
public String apply(BiomeType input) {
|
||||
BiomeData data = registry.getData(input);
|
||||
if (data != null) {
|
||||
return data.getName();
|
||||
|
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldEdit team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.world.biome;
|
||||
|
||||
import com.sk89q.worldedit.registry.NamespacedRegistry;
|
||||
|
||||
/**
|
||||
* All the types of biomes in the game.
|
||||
*/
|
||||
public class BiomeType {
|
||||
|
||||
public static final NamespacedRegistry<BiomeType> REGISTRY = new NamespacedRegistry<>("biome type");
|
||||
|
||||
private String id;
|
||||
|
||||
public BiomeType(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the ID of this biome.
|
||||
*
|
||||
* @return The id
|
||||
*/
|
||||
public String getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.id.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof BiomeType && this.id.equals(((BiomeType) obj).id);
|
||||
}
|
||||
}
|
@ -0,0 +1,117 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldEdit team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.world.biome;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Stores a list of common Biome String IDs.
|
||||
*/
|
||||
public class BiomeTypes {
|
||||
|
||||
@Nullable public static final BiomeType BADLANDS = get("minecraft:badlands");
|
||||
@Nullable public static final BiomeType BADLANDS_PLATEAU = get("minecraft:badlands_plateau");
|
||||
@Nullable public static final BiomeType BEACH = get("minecraft:beach");
|
||||
@Nullable public static final BiomeType BIRCH_FOREST = get("minecraft:birch_forest");
|
||||
@Nullable public static final BiomeType BIRCH_FOREST_HILLS = get("minecraft:birch_forest_hills");
|
||||
@Nullable public static final BiomeType COLD_OCEAN = get("minecraft:cold_ocean");
|
||||
@Nullable public static final BiomeType DARK_FOREST = get("minecraft:dark_forest");
|
||||
@Nullable public static final BiomeType DARK_FOREST_HILLS = get("minecraft:dark_forest_hills");
|
||||
@Nullable public static final BiomeType DEEP_COLD_OCEAN = get("minecraft:deep_cold_ocean");
|
||||
@Nullable public static final BiomeType DEEP_FROZEN_OCEAN = get("minecraft:deep_frozen_ocean");
|
||||
@Nullable public static final BiomeType DEEP_LUKEWARM_OCEAN = get("minecraft:deep_lukewarm_ocean");
|
||||
@Nullable public static final BiomeType DEEP_OCEAN = get("minecraft:deep_ocean");
|
||||
@Nullable public static final BiomeType DEEP_WARM_OCEAN = get("minecraft:deep_warm_ocean");
|
||||
@Nullable public static final BiomeType DESERT = get("minecraft:desert");
|
||||
@Nullable public static final BiomeType DESERT_HILLS = get("minecraft:desert_hills");
|
||||
@Nullable public static final BiomeType DESERT_LAKES = get("minecraft:desert_lakes");
|
||||
@Nullable public static final BiomeType END_BARRENS = get("minecraft:end_barrens");
|
||||
@Nullable public static final BiomeType END_HIGHLANDS = get("minecraft:end_highlands");
|
||||
@Nullable public static final BiomeType END_MIDLANDS = get("minecraft:end_midlands");
|
||||
@Nullable public static final BiomeType ERODED_BADLANDS = get("minecraft:eroded_badlands");
|
||||
@Nullable public static final BiomeType FLOWER_FOREST = get("minecraft:flower_forest");
|
||||
@Nullable public static final BiomeType FOREST = get("minecraft:forest");
|
||||
@Nullable public static final BiomeType FROZEN_OCEAN = get("minecraft:frozen_ocean");
|
||||
@Nullable public static final BiomeType FROZEN_RIVER = get("minecraft:frozen_river");
|
||||
@Nullable public static final BiomeType GIANT_SPRUCE_TAIGA = get("minecraft:giant_spruce_taiga");
|
||||
@Nullable public static final BiomeType GIANT_SPRUCE_TAIGA_HILLS = get("minecraft:giant_spruce_taiga_hills");
|
||||
@Nullable public static final BiomeType GIANT_TREE_TAIGA = get("minecraft:giant_tree_taiga");
|
||||
@Nullable public static final BiomeType GIANT_TREE_TAIGA_HILLS = get("minecraft:giant_tree_taiga_hills");
|
||||
@Nullable public static final BiomeType GRAVELLY_MOUNTAINS = get("minecraft:gravelly_mountains");
|
||||
@Nullable public static final BiomeType ICE_SPIKES = get("minecraft:ice_spikes");
|
||||
@Nullable public static final BiomeType JUNGLE = get("minecraft:jungle");
|
||||
@Nullable public static final BiomeType JUNGLE_EDGE = get("minecraft:jungle_edge");
|
||||
@Nullable public static final BiomeType JUNGLE_HILLS = get("minecraft:jungle_hills");
|
||||
@Nullable public static final BiomeType LUKEWARM_OCEAN = get("minecraft:lukewarm_ocean");
|
||||
@Nullable public static final BiomeType MODIFIED_BADLANDS_PLATEAU = get("minecraft:modified_badlands_plateau");
|
||||
@Nullable public static final BiomeType MODIFIED_GRAVELLY_MOUNTAINS = get("minecraft:modified_gravelly_mountains");
|
||||
@Nullable public static final BiomeType MODIFIED_JUNGLE = get("minecraft:modified_jungle");
|
||||
@Nullable public static final BiomeType MODIFIED_JUNGLE_EDGE = get("minecraft:modified_jungle_edge");
|
||||
@Nullable public static final BiomeType MODIFIED_WOODED_BADLANDS_PLATEAU = get("minecraft:modified_wooded_badlands_plateau");
|
||||
@Nullable public static final BiomeType MOUNTAIN_EDGE = get("minecraft:mountain_edge");
|
||||
@Nullable public static final BiomeType MOUNTAINS = get("minecraft:mountains");
|
||||
@Nullable public static final BiomeType MUSHROOM_FIELD_SHORE = get("minecraft:mushroom_field_shore");
|
||||
@Nullable public static final BiomeType MUSHROOM_FIELDS = get("minecraft:mushroom_fields");
|
||||
@Nullable public static final BiomeType NETHER = get("minecraft:nether");
|
||||
@Nullable public static final BiomeType OCEAN = get("minecraft:ocean");
|
||||
@Nullable public static final BiomeType PLAINS = get("minecraft:plains");
|
||||
@Nullable public static final BiomeType RIVER = get("minecraft:river");
|
||||
@Nullable public static final BiomeType SAVANNA = get("minecraft:savanna");
|
||||
@Nullable public static final BiomeType SAVANNA_PLATEAU = get("minecraft:savanna_plateau");
|
||||
@Nullable public static final BiomeType SHATTERED_SAVANNA = get("minecraft:shattered_savanna");
|
||||
@Nullable public static final BiomeType SHATTERED_SAVANNA_PLATEAU = get("minecraft:shattered_savanna_plateau");
|
||||
@Nullable public static final BiomeType SMALL_END_ISLANDS = get("minecraft:small_end_islands");
|
||||
@Nullable public static final BiomeType SNOWY_BEACH = get("minecraft:snowy_beach");
|
||||
@Nullable public static final BiomeType SNOWY_MOUNTAINS = get("minecraft:snowy_mountains");
|
||||
@Nullable public static final BiomeType SNOWY_TAIGA = get("minecraft:snowy_taiga");
|
||||
@Nullable public static final BiomeType SNOWY_TAIGA_HILLS = get("minecraft:snowy_taiga_hills");
|
||||
@Nullable public static final BiomeType SNOWY_TAIGA_MOUNTAINS = get("minecraft:snowy_taiga_mountains");
|
||||
@Nullable public static final BiomeType SNOWY_TUNDRA = get("minecraft:snowy_tundra");
|
||||
@Nullable public static final BiomeType STONE_SHORE = get("minecraft:stone_shore");
|
||||
@Nullable public static final BiomeType SUNFLOWER_PLAINS = get("minecraft:sunflower_plains");
|
||||
@Nullable public static final BiomeType SWAMP = get("minecraft:swamp");
|
||||
@Nullable public static final BiomeType SWAMP_HILLS = get("minecraft:swamp_hills");
|
||||
@Nullable public static final BiomeType TAIGA = get("minecraft:taiga");
|
||||
@Nullable public static final BiomeType TAIGA_HILLS = get("minecraft:taiga_hills");
|
||||
@Nullable public static final BiomeType TAIGA_MOUNTAINS = get("minecraft:taiga_mountains");
|
||||
@Nullable public static final BiomeType TALL_BIRCH_FOREST = get("minecraft:tall_birch_forest");
|
||||
@Nullable public static final BiomeType TALL_BIRCH_HILLS = get("minecraft:tall_birch_hills");
|
||||
@Nullable public static final BiomeType THE_END = get("minecraft:the_end");
|
||||
@Nullable public static final BiomeType THE_VOID = get("minecraft:the_void");
|
||||
@Nullable public static final BiomeType WARM_OCEAN = get("minecraft:warm_ocean");
|
||||
@Nullable public static final BiomeType WOODED_BADLANDS_PLATEAU = get("minecraft:wooded_badlands_plateau");
|
||||
@Nullable public static final BiomeType WOODED_HILLS = get("minecraft:wooded_hills");
|
||||
@Nullable public static final BiomeType WOODED_MOUNTAINS = get("minecraft:wooded_mountains");
|
||||
|
||||
private BiomeTypes() {
|
||||
}
|
||||
|
||||
private static BiomeType register(final String id) {
|
||||
return register(new BiomeType(id));
|
||||
}
|
||||
|
||||
public static BiomeType register(final BiomeType biome) {
|
||||
return BiomeType.REGISTRY.register(biome.getId(), biome);
|
||||
}
|
||||
|
||||
public static @Nullable BiomeType get(final String id) {
|
||||
return BiomeType.REGISTRY.get(id);
|
||||
}
|
||||
}
|
@ -50,17 +50,17 @@ public final class Biomes {
|
||||
* @return a biome or null
|
||||
*/
|
||||
@Nullable
|
||||
public static BaseBiome findBiomeByName(Collection<BaseBiome> biomes, String name, BiomeRegistry registry) {
|
||||
public static BiomeType findBiomeByName(Collection<BiomeType> biomes, String name, BiomeRegistry registry) {
|
||||
checkNotNull(biomes);
|
||||
checkNotNull(name);
|
||||
checkNotNull(registry);
|
||||
|
||||
Function<String, ? extends Number> compare = new LevenshteinDistance(name, false, LevenshteinDistance.STANDARD_CHARS);
|
||||
WeightedChoice<BaseBiome> chooser = new WeightedChoice<>(Functions.compose(compare::apply, new BiomeName(registry)), 0);
|
||||
for (BaseBiome biome : biomes) {
|
||||
WeightedChoice<BiomeType> chooser = new WeightedChoice<>(Functions.compose(compare::apply, new BiomeName(registry)), 0);
|
||||
for (BiomeType biome : biomes) {
|
||||
chooser.consider(biome);
|
||||
}
|
||||
Optional<Choice<BaseBiome>> choice = chooser.getChoice();
|
||||
Optional<Choice<BiomeType>> choice = chooser.getChoice();
|
||||
if (choice.isPresent() && choice.get().getScore() <= 1) {
|
||||
return choice.get().getValue();
|
||||
} else {
|
||||
|
@ -223,11 +223,7 @@ public class BaseBlock implements BlockStateHolder<BaseBlock>, TileEntityBlock {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int ret = toImmutableState().hashCode() << 3;
|
||||
if (hasNbtData()) {
|
||||
ret += getNbtData().hashCode();
|
||||
}
|
||||
return ret;
|
||||
return getOrdinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -19,58 +19,52 @@
|
||||
|
||||
package com.sk89q.worldedit.world.block;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Stores a list of categories of Block Types.
|
||||
*/
|
||||
public final class BlockCategories {
|
||||
|
||||
public static final BlockCategory ACACIA_LOGS = register("minecraft:acacia_logs");
|
||||
public static final BlockCategory ANVIL = register("minecraft:anvil");
|
||||
public static final BlockCategory BANNERS = register("minecraft:banners");
|
||||
public static final BlockCategory BIRCH_LOGS = register("minecraft:birch_logs");
|
||||
public static final BlockCategory BUTTONS = register("minecraft:buttons");
|
||||
public static final BlockCategory CARPETS = register("minecraft:carpets");
|
||||
public static final BlockCategory CORAL = register("minecraft:coral");
|
||||
public static final BlockCategory CORAL_PLANTS = register("minecraft:coral_plants");
|
||||
public static final BlockCategory DARK_OAK_LOGS = register("minecraft:dark_oak_logs");
|
||||
public static final BlockCategory DOORS = register("minecraft:doors");
|
||||
public static final BlockCategory ENDERMAN_HOLDABLE = register("minecraft:enderman_holdable");
|
||||
public static final BlockCategory FLOWER_POTS = register("minecraft:flower_pots");
|
||||
public static final BlockCategory ICE = register("minecraft:ice");
|
||||
public static final BlockCategory JUNGLE_LOGS = register("minecraft:jungle_logs");
|
||||
public static final BlockCategory LEAVES = register("minecraft:leaves");
|
||||
public static final BlockCategory LOGS = register("minecraft:logs");
|
||||
public static final BlockCategory OAK_LOGS = register("minecraft:oak_logs");
|
||||
public static final BlockCategory PLANKS = register("minecraft:planks");
|
||||
public static final BlockCategory RAILS = register("minecraft:rails");
|
||||
public static final BlockCategory SAND = register("minecraft:sand");
|
||||
public static final BlockCategory SAPLINGS = register("minecraft:saplings");
|
||||
public static final BlockCategory SLABS = register("minecraft:slabs");
|
||||
public static final BlockCategory SPRUCE_LOGS = register("minecraft:spruce_logs");
|
||||
public static final BlockCategory STAIRS = register("minecraft:stairs");
|
||||
public static final BlockCategory STONE_BRICKS = register("minecraft:stone_bricks");
|
||||
public static final BlockCategory VALID_SPAWN = register("minecraft:valid_spawn");
|
||||
public static final BlockCategory WOODEN_BUTTONS = register("minecraft:wooden_buttons");
|
||||
public static final BlockCategory WOODEN_DOORS = register("minecraft:wooden_doors");
|
||||
public static final BlockCategory WOODEN_PRESSURE_PLATES = register("minecraft:wooden_pressure_plates");
|
||||
public static final BlockCategory WOODEN_SLABS = register("minecraft:wooden_slabs");
|
||||
public static final BlockCategory WOODEN_STAIRS = register("minecraft:wooden_stairs");
|
||||
public static final BlockCategory WOOL = register("minecraft:wool");
|
||||
public static final BlockCategory ACACIA_LOGS = get("minecraft:acacia_logs");
|
||||
public static final BlockCategory ANVIL = get("minecraft:anvil");
|
||||
public static final BlockCategory BANNERS = get("minecraft:banners");
|
||||
public static final BlockCategory BIRCH_LOGS = get("minecraft:birch_logs");
|
||||
public static final BlockCategory BUTTONS = get("minecraft:buttons");
|
||||
public static final BlockCategory CARPETS = get("minecraft:carpets");
|
||||
public static final BlockCategory CORALS = get("minecraft:corals");
|
||||
public static final BlockCategory CORAL_BLOCKS = get("minecraft:coral_blocks");
|
||||
public static final BlockCategory DARK_OAK_LOGS = get("minecraft:dark_oak_logs");
|
||||
public static final BlockCategory DOORS = get("minecraft:doors");
|
||||
public static final BlockCategory ENDERMAN_HOLDABLE = get("minecraft:enderman_holdable");
|
||||
public static final BlockCategory FLOWER_POTS = get("minecraft:flower_pots");
|
||||
public static final BlockCategory ICE = get("minecraft:ice");
|
||||
public static final BlockCategory JUNGLE_LOGS = get("minecraft:jungle_logs");
|
||||
public static final BlockCategory LEAVES = get("minecraft:leaves");
|
||||
public static final BlockCategory LOGS = get("minecraft:logs");
|
||||
public static final BlockCategory OAK_LOGS = get("minecraft:oak_logs");
|
||||
public static final BlockCategory PLANKS = get("minecraft:planks");
|
||||
public static final BlockCategory RAILS = get("minecraft:rails");
|
||||
public static final BlockCategory SAND = get("minecraft:sand");
|
||||
public static final BlockCategory SAPLINGS = get("minecraft:saplings");
|
||||
public static final BlockCategory SLABS = get("minecraft:slabs");
|
||||
public static final BlockCategory SPRUCE_LOGS = get("minecraft:spruce_logs");
|
||||
public static final BlockCategory STAIRS = get("minecraft:stairs");
|
||||
public static final BlockCategory STONE_BRICKS = get("minecraft:stone_bricks");
|
||||
public static final BlockCategory VALID_SPAWN = get("minecraft:valid_spawn");
|
||||
public static final BlockCategory WOODEN_BUTTONS = get("minecraft:wooden_buttons");
|
||||
public static final BlockCategory WOODEN_DOORS = get("minecraft:wooden_doors");
|
||||
public static final BlockCategory WOODEN_PRESSURE_PLATES = get("minecraft:wooden_pressure_plates");
|
||||
public static final BlockCategory WOODEN_SLABS = get("minecraft:wooden_slabs");
|
||||
public static final BlockCategory WOODEN_STAIRS = get("minecraft:wooden_stairs");
|
||||
public static final BlockCategory WOOL = get("minecraft:wool");
|
||||
|
||||
private BlockCategories() {
|
||||
}
|
||||
|
||||
private static BlockCategory register(final String id) {
|
||||
return register(new BlockCategory(id));
|
||||
}
|
||||
|
||||
public static BlockCategory register(final BlockCategory tag) {
|
||||
return BlockCategory.REGISTRY.register(tag.getId(), tag);
|
||||
}
|
||||
|
||||
public static @Nullable BlockCategory get(final String id) {
|
||||
return BlockCategory.REGISTRY.get(id);
|
||||
private static BlockCategory get(final String id) {
|
||||
BlockCategory blockCategory = BlockCategory.REGISTRY.get(id);
|
||||
if (blockCategory == null) {
|
||||
return new BlockCategory(id);
|
||||
}
|
||||
return blockCategory;
|
||||
}
|
||||
}
|
||||
|
@ -22,8 +22,11 @@ package com.sk89q.worldedit.world.block;
|
||||
import com.boydti.fawe.command.SuggestInputParseException;
|
||||
import com.boydti.fawe.object.string.MutableCharSequence;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Table;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
@ -314,15 +317,10 @@ public class BlockState implements BlockStateHolder<BlockState> {
|
||||
return this.blockType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return getOrdinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsFuzzy(BlockStateHolder<?> o) {
|
||||
if (this == o) {
|
||||
// Added a reference equality check for
|
||||
// Added a reference equality check for speediness
|
||||
return true;
|
||||
}
|
||||
if (!getBlockType().equals(o.getBlockType())) {
|
||||
@ -359,8 +357,8 @@ public class BlockState implements BlockStateHolder<BlockState> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getAsString();
|
||||
public BaseBlock toBaseBlock() {
|
||||
return this.emptyBaseBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -375,9 +373,27 @@ public class BlockState implements BlockStateHolder<BlockState> {
|
||||
|
||||
@Override
|
||||
public int getOrdinal() {
|
||||
//?
|
||||
return 0;
|
||||
get ordinal
|
||||
}
|
||||
/**
|
||||
* Internal method used for creating the initial BlockState.
|
||||
*
|
||||
* Sets a value. DO NOT USE THIS.
|
||||
*
|
||||
* @param property The state
|
||||
* @param value The value
|
||||
* @return The blockstate, for chaining
|
||||
*/
|
||||
BlockState setState(final Property<?> property, final Object value) {
|
||||
this.values.put(property, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getAsString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof BlockState)) {
|
||||
@ -386,4 +402,11 @@ public class BlockState implements BlockStateHolder<BlockState> {
|
||||
|
||||
return equalsFuzzy((BlockState) obj);
|
||||
}
|
||||
|
||||
private Integer hashCodeCache = null;
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return getOrdinal();
|
||||
}
|
||||
}
|
||||
|
@ -39,11 +39,13 @@ import com.sk89q.worldedit.registry.state.PropertyKey;
|
||||
import com.sk89q.worldedit.world.item.ItemType;
|
||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||
import com.sk89q.worldedit.world.registry.BundledBlockData;
|
||||
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
||||
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
@ -222,6 +224,10 @@ public class BlockType implements FawePattern {
|
||||
return new FuzzyBlockState(this);
|
||||
}
|
||||
|
||||
public FuzzyBlockState getFuzzyMatcher() {
|
||||
return updateField(emptyFuzzy, () -> new FuzzyBlockState(this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Slow
|
||||
* @return collection of states
|
||||
@ -311,7 +317,7 @@ public class BlockType implements FawePattern {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.id.hashCode();
|
||||
return this.getSettings().defaultState.ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -40,8 +40,7 @@ public class FuzzyBlockState extends BlockState {
|
||||
private FuzzyBlockState(BlockType blockType, Map<Property<?>, Object> values) {
|
||||
this(blockType);
|
||||
for (Map.Entry<Property<?>, Object> entry : values.entrySet()) {
|
||||
// setState(entry.getKey(), entry.getValue());
|
||||
with((Property<Object>)entry.getKey(), entry.getValue());
|
||||
setState(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,7 +57,12 @@ public class FuzzyBlockState extends BlockState {
|
||||
Property<Object> objKey = (Property<Object>) entry.getKey();
|
||||
state = state.with(objKey, entry.getValue());
|
||||
}
|
||||
return getBlockType().getDefaultState();
|
||||
return state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState toImmutableState() {
|
||||
return getFullState();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -142,4 +146,4 @@ public class FuzzyBlockState extends BlockState {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,6 @@ import com.sk89q.jnbt.ListTag;
|
||||
import com.sk89q.jnbt.NBTUtils;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.DataException;
|
||||
@ -260,7 +259,7 @@ public class AnvilChunk implements Chunk {
|
||||
|
||||
BlockState state = LegacyMapper.getInstance().getBlockFromLegacy(id, data);
|
||||
if (state == null) {
|
||||
WorldEdit.logger.warning("Unknown legacy block " + id + ":" + data + " found when loading legacy anvil chunk.");
|
||||
WorldEdit.logger.warn("Unknown legacy block " + id + ":" + data + " found when loading legacy anvil chunk.");
|
||||
return BlockTypes.AIR.getDefaultState().toBaseBlock();
|
||||
}
|
||||
if (state.getMaterial().hasContainer()) {
|
||||
|
@ -26,7 +26,6 @@ import com.sk89q.jnbt.ListTag;
|
||||
import com.sk89q.jnbt.LongArrayTag;
|
||||
import com.sk89q.jnbt.NBTUtils;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.registry.state.Property;
|
||||
import com.sk89q.worldedit.world.DataException;
|
||||
|
@ -153,7 +153,6 @@ public class OldChunk implements Chunk {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public BaseBlock getBlock(BlockVector3 position) throws DataException {
|
||||
if(position.getY() >= 128) return BlockTypes.VOID_AIR.getDefaultState().toBaseBlock();
|
||||
int id, dataVal;
|
||||
@ -183,7 +182,7 @@ public class OldChunk implements Chunk {
|
||||
|
||||
BlockState state = LegacyMapper.getInstance().getBlockFromLegacy(id, dataVal);
|
||||
if (state == null) {
|
||||
WorldEdit.logger.warning("Unknown legacy block " + id + ":" + dataVal + " found when loading legacy anvil chunk.");
|
||||
WorldEdit.logger.warn("Unknown legacy block " + id + ":" + dataVal + " found when loading legacy anvil chunk.");
|
||||
return BlockTypes.AIR.getDefaultState().toBaseBlock();
|
||||
}
|
||||
if (state.getBlockType().getMaterial().hasContainer()) {
|
||||
|
@ -23,113 +23,105 @@ import javax.annotation.Nullable;
|
||||
|
||||
public class EntityTypes {
|
||||
|
||||
public static final EntityType AREA_EFFECT_CLOUD = register("minecraft:area_effect_cloud");
|
||||
public static final EntityType ARMOR_STAND = register("minecraft:armor_stand");
|
||||
public static final EntityType ARROW = register("minecraft:arrow");
|
||||
public static final EntityType BAT = register("minecraft:bat");
|
||||
public static final EntityType BLAZE = register("minecraft:blaze");
|
||||
public static final EntityType BOAT = register("minecraft:boat");
|
||||
public static final EntityType CAVE_SPIDER = register("minecraft:cave_spider");
|
||||
public static final EntityType CHEST_MINECART = register("minecraft:chest_minecart");
|
||||
public static final EntityType CHICKEN = register("minecraft:chicken");
|
||||
public static final EntityType COD = register("minecraft:cod");
|
||||
public static final EntityType COMMAND_BLOCK_MINECART = register("minecraft:command_block_minecart");
|
||||
public static final EntityType COW = register("minecraft:cow");
|
||||
public static final EntityType CREEPER = register("minecraft:creeper");
|
||||
public static final EntityType DOLPHIN = register("minecraft:dolphin");
|
||||
public static final EntityType DONKEY = register("minecraft:donkey");
|
||||
public static final EntityType DRAGON_FIREBALL = register("minecraft:dragon_fireball");
|
||||
public static final EntityType DROWNED = register("minecraft:drowned");
|
||||
public static final EntityType EGG = register("minecraft:egg");
|
||||
public static final EntityType ELDER_GUARDIAN = register("minecraft:elder_guardian");
|
||||
public static final EntityType END_CRYSTAL = register("minecraft:end_crystal");
|
||||
public static final EntityType ENDER_DRAGON = register("minecraft:ender_dragon");
|
||||
public static final EntityType ENDER_PEARL = register("minecraft:ender_pearl");
|
||||
public static final EntityType ENDERMAN = register("minecraft:enderman");
|
||||
public static final EntityType ENDERMITE = register("minecraft:endermite");
|
||||
public static final EntityType EVOKER = register("minecraft:evoker");
|
||||
public static final EntityType EVOKER_FANGS = register("minecraft:evoker_fangs");
|
||||
public static final EntityType EXPERIENCE_BOTTLE = register("minecraft:experience_bottle");
|
||||
public static final EntityType EXPERIENCE_ORB = register("minecraft:experience_orb");
|
||||
public static final EntityType EYE_OF_ENDER = register("minecraft:eye_of_ender");
|
||||
public static final EntityType FALLING_BLOCK = register("minecraft:falling_block");
|
||||
public static final EntityType FIREBALL = register("minecraft:fireball");
|
||||
public static final EntityType FIREWORK_ROCKET = register("minecraft:firework_rocket");
|
||||
public static final EntityType FISHING_BOBBER = register("minecraft:fishing_bobber");
|
||||
public static final EntityType FURNACE_MINECART = register("minecraft:furnace_minecart");
|
||||
public static final EntityType GHAST = register("minecraft:ghast");
|
||||
public static final EntityType GIANT = register("minecraft:giant");
|
||||
public static final EntityType GUARDIAN = register("minecraft:guardian");
|
||||
public static final EntityType HOPPER_MINECART = register("minecraft:hopper_minecart");
|
||||
public static final EntityType HORSE = register("minecraft:horse");
|
||||
public static final EntityType HUSK = register("minecraft:husk");
|
||||
public static final EntityType ILLUSIONER = register("minecraft:illusioner");
|
||||
public static final EntityType IRON_GOLEM = register("minecraft:iron_golem");
|
||||
public static final EntityType ITEM = register("minecraft:item");
|
||||
public static final EntityType ITEM_FRAME = register("minecraft:item_frame");
|
||||
public static final EntityType LEASH_KNOT = register("minecraft:leash_knot");
|
||||
public static final EntityType LIGHTNING_BOLT = register("minecraft:lightning_bolt");
|
||||
public static final EntityType LLAMA = register("minecraft:llama");
|
||||
public static final EntityType LLAMA_SPIT = register("minecraft:llama_spit");
|
||||
public static final EntityType MAGMA_CUBE = register("minecraft:magma_cube");
|
||||
public static final EntityType MINECART = register("minecraft:minecart");
|
||||
public static final EntityType MOOSHROOM = register("minecraft:mooshroom");
|
||||
public static final EntityType MULE = register("minecraft:mule");
|
||||
public static final EntityType OCELOT = register("minecraft:ocelot");
|
||||
public static final EntityType PAINTING = register("minecraft:painting");
|
||||
public static final EntityType PARROT = register("minecraft:parrot");
|
||||
public static final EntityType PHANTOM = register("minecraft:phantom");
|
||||
public static final EntityType PIG = register("minecraft:pig");
|
||||
public static final EntityType PLAYER = register("minecraft:player");
|
||||
public static final EntityType POLAR_BEAR = register("minecraft:polar_bear");
|
||||
public static final EntityType POTION = register("minecraft:potion");
|
||||
public static final EntityType PUFFERFISH = register("minecraft:pufferfish");
|
||||
public static final EntityType RABBIT = register("minecraft:rabbit");
|
||||
public static final EntityType SALMON = register("minecraft:salmon");
|
||||
public static final EntityType SHEEP = register("minecraft:sheep");
|
||||
public static final EntityType SHULKER = register("minecraft:shulker");
|
||||
public static final EntityType SHULKER_BULLET = register("minecraft:shulker_bullet");
|
||||
public static final EntityType SILVERFISH = register("minecraft:silverfish");
|
||||
public static final EntityType SKELETON = register("minecraft:skeleton");
|
||||
public static final EntityType SKELETON_HORSE = register("minecraft:skeleton_horse");
|
||||
public static final EntityType SLIME = register("minecraft:slime");
|
||||
public static final EntityType SMALL_FIREBALL = register("minecraft:small_fireball");
|
||||
public static final EntityType SNOW_GOLEM = register("minecraft:snow_golem");
|
||||
public static final EntityType SNOWBALL = register("minecraft:snowball");
|
||||
public static final EntityType SPAWNER_MINECART = register("minecraft:spawner_minecart");
|
||||
public static final EntityType SPECTRAL_ARROW = register("minecraft:spectral_arrow");
|
||||
public static final EntityType SPIDER = register("minecraft:spider");
|
||||
public static final EntityType SQUID = register("minecraft:squid");
|
||||
public static final EntityType STRAY = register("minecraft:stray");
|
||||
public static final EntityType TNT = register("minecraft:tnt");
|
||||
public static final EntityType TNT_MINECART = register("minecraft:tnt_minecart");
|
||||
public static final EntityType TRIDENT = register("minecraft:trident");
|
||||
public static final EntityType TROPICAL_FISH = register("minecraft:tropical_fish");
|
||||
public static final EntityType TURTLE = register("minecraft:turtle");
|
||||
public static final EntityType VEX = register("minecraft:vex");
|
||||
public static final EntityType VILLAGER = register("minecraft:villager");
|
||||
public static final EntityType VINDICATOR = register("minecraft:vindicator");
|
||||
public static final EntityType WITCH = register("minecraft:witch");
|
||||
public static final EntityType WITHER = register("minecraft:wither");
|
||||
public static final EntityType WITHER_SKELETON = register("minecraft:wither_skeleton");
|
||||
public static final EntityType WITHER_SKULL = register("minecraft:wither_skull");
|
||||
public static final EntityType WOLF = register("minecraft:wolf");
|
||||
public static final EntityType ZOMBIE = register("minecraft:zombie");
|
||||
public static final EntityType ZOMBIE_HORSE = register("minecraft:zombie_horse");
|
||||
public static final EntityType ZOMBIE_PIGMAN = register("minecraft:zombie_pigman");
|
||||
public static final EntityType ZOMBIE_VILLAGER = register("minecraft:zombie_villager");
|
||||
@Nullable public static final EntityType AREA_EFFECT_CLOUD = get("minecraft:area_effect_cloud");
|
||||
@Nullable public static final EntityType ARMOR_STAND = get("minecraft:armor_stand");
|
||||
@Nullable public static final EntityType ARROW = get("minecraft:arrow");
|
||||
@Nullable public static final EntityType BAT = get("minecraft:bat");
|
||||
@Nullable public static final EntityType BLAZE = get("minecraft:blaze");
|
||||
@Nullable public static final EntityType BOAT = get("minecraft:boat");
|
||||
@Nullable public static final EntityType CAVE_SPIDER = get("minecraft:cave_spider");
|
||||
@Nullable public static final EntityType CHEST_MINECART = get("minecraft:chest_minecart");
|
||||
@Nullable public static final EntityType CHICKEN = get("minecraft:chicken");
|
||||
@Nullable public static final EntityType COD = get("minecraft:cod");
|
||||
@Nullable public static final EntityType COMMAND_BLOCK_MINECART = get("minecraft:command_block_minecart");
|
||||
@Nullable public static final EntityType COW = get("minecraft:cow");
|
||||
@Nullable public static final EntityType CREEPER = get("minecraft:creeper");
|
||||
@Nullable public static final EntityType DOLPHIN = get("minecraft:dolphin");
|
||||
@Nullable public static final EntityType DONKEY = get("minecraft:donkey");
|
||||
@Nullable public static final EntityType DRAGON_FIREBALL = get("minecraft:dragon_fireball");
|
||||
@Nullable public static final EntityType DROWNED = get("minecraft:drowned");
|
||||
@Nullable public static final EntityType EGG = get("minecraft:egg");
|
||||
@Nullable public static final EntityType ELDER_GUARDIAN = get("minecraft:elder_guardian");
|
||||
@Nullable public static final EntityType END_CRYSTAL = get("minecraft:end_crystal");
|
||||
@Nullable public static final EntityType ENDER_DRAGON = get("minecraft:ender_dragon");
|
||||
@Nullable public static final EntityType ENDER_PEARL = get("minecraft:ender_pearl");
|
||||
@Nullable public static final EntityType ENDERMAN = get("minecraft:enderman");
|
||||
@Nullable public static final EntityType ENDERMITE = get("minecraft:endermite");
|
||||
@Nullable public static final EntityType EVOKER = get("minecraft:evoker");
|
||||
@Nullable public static final EntityType EVOKER_FANGS = get("minecraft:evoker_fangs");
|
||||
@Nullable public static final EntityType EXPERIENCE_BOTTLE = get("minecraft:experience_bottle");
|
||||
@Nullable public static final EntityType EXPERIENCE_ORB = get("minecraft:experience_orb");
|
||||
@Nullable public static final EntityType EYE_OF_ENDER = get("minecraft:eye_of_ender");
|
||||
@Nullable public static final EntityType FALLING_BLOCK = get("minecraft:falling_block");
|
||||
@Nullable public static final EntityType FIREBALL = get("minecraft:fireball");
|
||||
@Nullable public static final EntityType FIREWORK_ROCKET = get("minecraft:firework_rocket");
|
||||
@Nullable public static final EntityType FISHING_BOBBER = get("minecraft:fishing_bobber");
|
||||
@Nullable public static final EntityType FURNACE_MINECART = get("minecraft:furnace_minecart");
|
||||
@Nullable public static final EntityType GHAST = get("minecraft:ghast");
|
||||
@Nullable public static final EntityType GIANT = get("minecraft:giant");
|
||||
@Nullable public static final EntityType GUARDIAN = get("minecraft:guardian");
|
||||
@Nullable public static final EntityType HOPPER_MINECART = get("minecraft:hopper_minecart");
|
||||
@Nullable public static final EntityType HORSE = get("minecraft:horse");
|
||||
@Nullable public static final EntityType HUSK = get("minecraft:husk");
|
||||
@Nullable public static final EntityType ILLUSIONER = get("minecraft:illusioner");
|
||||
@Nullable public static final EntityType IRON_GOLEM = get("minecraft:iron_golem");
|
||||
@Nullable public static final EntityType ITEM = get("minecraft:item");
|
||||
@Nullable public static final EntityType ITEM_FRAME = get("minecraft:item_frame");
|
||||
@Nullable public static final EntityType LEASH_KNOT = get("minecraft:leash_knot");
|
||||
@Nullable public static final EntityType LIGHTNING_BOLT = get("minecraft:lightning_bolt");
|
||||
@Nullable public static final EntityType LLAMA = get("minecraft:llama");
|
||||
@Nullable public static final EntityType LLAMA_SPIT = get("minecraft:llama_spit");
|
||||
@Nullable public static final EntityType MAGMA_CUBE = get("minecraft:magma_cube");
|
||||
@Nullable public static final EntityType MINECART = get("minecraft:minecart");
|
||||
@Nullable public static final EntityType MOOSHROOM = get("minecraft:mooshroom");
|
||||
@Nullable public static final EntityType MULE = get("minecraft:mule");
|
||||
@Nullable public static final EntityType OCELOT = get("minecraft:ocelot");
|
||||
@Nullable public static final EntityType PAINTING = get("minecraft:painting");
|
||||
@Nullable public static final EntityType PARROT = get("minecraft:parrot");
|
||||
@Nullable public static final EntityType PHANTOM = get("minecraft:phantom");
|
||||
@Nullable public static final EntityType PIG = get("minecraft:pig");
|
||||
@Nullable public static final EntityType PLAYER = get("minecraft:player");
|
||||
@Nullable public static final EntityType POLAR_BEAR = get("minecraft:polar_bear");
|
||||
@Nullable public static final EntityType POTION = get("minecraft:potion");
|
||||
@Nullable public static final EntityType PUFFERFISH = get("minecraft:pufferfish");
|
||||
@Nullable public static final EntityType RABBIT = get("minecraft:rabbit");
|
||||
@Nullable public static final EntityType SALMON = get("minecraft:salmon");
|
||||
@Nullable public static final EntityType SHEEP = get("minecraft:sheep");
|
||||
@Nullable public static final EntityType SHULKER = get("minecraft:shulker");
|
||||
@Nullable public static final EntityType SHULKER_BULLET = get("minecraft:shulker_bullet");
|
||||
@Nullable public static final EntityType SILVERFISH = get("minecraft:silverfish");
|
||||
@Nullable public static final EntityType SKELETON = get("minecraft:skeleton");
|
||||
@Nullable public static final EntityType SKELETON_HORSE = get("minecraft:skeleton_horse");
|
||||
@Nullable public static final EntityType SLIME = get("minecraft:slime");
|
||||
@Nullable public static final EntityType SMALL_FIREBALL = get("minecraft:small_fireball");
|
||||
@Nullable public static final EntityType SNOW_GOLEM = get("minecraft:snow_golem");
|
||||
@Nullable public static final EntityType SNOWBALL = get("minecraft:snowball");
|
||||
@Nullable public static final EntityType SPAWNER_MINECART = get("minecraft:spawner_minecart");
|
||||
@Nullable public static final EntityType SPECTRAL_ARROW = get("minecraft:spectral_arrow");
|
||||
@Nullable public static final EntityType SPIDER = get("minecraft:spider");
|
||||
@Nullable public static final EntityType SQUID = get("minecraft:squid");
|
||||
@Nullable public static final EntityType STRAY = get("minecraft:stray");
|
||||
@Nullable public static final EntityType TNT = get("minecraft:tnt");
|
||||
@Nullable public static final EntityType TNT_MINECART = get("minecraft:tnt_minecart");
|
||||
@Nullable public static final EntityType TRIDENT = get("minecraft:trident");
|
||||
@Nullable public static final EntityType TROPICAL_FISH = get("minecraft:tropical_fish");
|
||||
@Nullable public static final EntityType TURTLE = get("minecraft:turtle");
|
||||
@Nullable public static final EntityType VEX = get("minecraft:vex");
|
||||
@Nullable public static final EntityType VILLAGER = get("minecraft:villager");
|
||||
@Nullable public static final EntityType VINDICATOR = get("minecraft:vindicator");
|
||||
@Nullable public static final EntityType WITCH = get("minecraft:witch");
|
||||
@Nullable public static final EntityType WITHER = get("minecraft:wither");
|
||||
@Nullable public static final EntityType WITHER_SKELETON = get("minecraft:wither_skeleton");
|
||||
@Nullable public static final EntityType WITHER_SKULL = get("minecraft:wither_skull");
|
||||
@Nullable public static final EntityType WOLF = get("minecraft:wolf");
|
||||
@Nullable public static final EntityType ZOMBIE = get("minecraft:zombie");
|
||||
@Nullable public static final EntityType ZOMBIE_HORSE = get("minecraft:zombie_horse");
|
||||
@Nullable public static final EntityType ZOMBIE_PIGMAN = get("minecraft:zombie_pigman");
|
||||
@Nullable public static final EntityType ZOMBIE_VILLAGER = get("minecraft:zombie_villager");
|
||||
|
||||
private EntityTypes() {
|
||||
}
|
||||
|
||||
private static EntityType register(final String id) {
|
||||
return register(new EntityType(id));
|
||||
}
|
||||
|
||||
public static EntityType register(final EntityType entityType) {
|
||||
return EntityType.REGISTRY.register(entityType.getId(), entityType);
|
||||
}
|
||||
|
||||
public static @Nullable EntityType get(final String id) {
|
||||
return EntityType.REGISTRY.get(id);
|
||||
}
|
||||
|
@ -19,56 +19,50 @@
|
||||
|
||||
package com.sk89q.worldedit.world.item;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Stores a list of categories of Item Types.
|
||||
*/
|
||||
public final class ItemCategories {
|
||||
|
||||
public static final ItemCategory ACACIA_LOGS = register("minecraft:acacia_logs");
|
||||
public static final ItemCategory ANVIL = register("minecraft:anvil");
|
||||
public static final ItemCategory BANNERS = register("minecraft:banners");
|
||||
public static final ItemCategory BIRCH_LOGS = register("minecraft:birch_logs");
|
||||
public static final ItemCategory BOATS = register("minecraft:boats");
|
||||
public static final ItemCategory BUTTONS = register("minecraft:buttons");
|
||||
public static final ItemCategory CARPETS = register("minecraft:carpets");
|
||||
public static final ItemCategory CORAL = register("minecraft:coral");
|
||||
public static final ItemCategory CORAL_PLANTS = register("minecraft:coral_plants");
|
||||
public static final ItemCategory DARK_OAK_LOGS = register("minecraft:dark_oak_logs");
|
||||
public static final ItemCategory DOORS = register("minecraft:doors");
|
||||
public static final ItemCategory FISHES = register("minecraft:fishes");
|
||||
public static final ItemCategory JUNGLE_LOGS = register("minecraft:jungle_logs");
|
||||
public static final ItemCategory LEAVES = register("minecraft:leaves");
|
||||
public static final ItemCategory LOGS = register("minecraft:logs");
|
||||
public static final ItemCategory OAK_LOGS = register("minecraft:oak_logs");
|
||||
public static final ItemCategory PLANKS = register("minecraft:planks");
|
||||
public static final ItemCategory RAILS = register("minecraft:rails");
|
||||
public static final ItemCategory SAND = register("minecraft:sand");
|
||||
public static final ItemCategory SAPLINGS = register("minecraft:saplings");
|
||||
public static final ItemCategory SLABS = register("minecraft:slabs");
|
||||
public static final ItemCategory SPRUCE_LOGS = register("minecraft:spruce_logs");
|
||||
public static final ItemCategory STAIRS = register("minecraft:stairs");
|
||||
public static final ItemCategory STONE_BRICKS = register("minecraft:stone_bricks");
|
||||
public static final ItemCategory WOODEN_BUTTONS = register("minecraft:wooden_buttons");
|
||||
public static final ItemCategory WOODEN_DOORS = register("minecraft:wooden_doors");
|
||||
public static final ItemCategory WOODEN_PRESSURE_PLATES = register("minecraft:wooden_pressure_plates");
|
||||
public static final ItemCategory WOODEN_SLABS = register("minecraft:wooden_slabs");
|
||||
public static final ItemCategory WOODEN_STAIRS = register("minecraft:wooden_stairs");
|
||||
public static final ItemCategory WOOL = register("minecraft:wool");
|
||||
public static final ItemCategory ACACIA_LOGS = get("minecraft:acacia_logs");
|
||||
public static final ItemCategory ANVIL = get("minecraft:anvil");
|
||||
public static final ItemCategory BANNERS = get("minecraft:banners");
|
||||
public static final ItemCategory BIRCH_LOGS = get("minecraft:birch_logs");
|
||||
public static final ItemCategory BOATS = get("minecraft:boats");
|
||||
public static final ItemCategory BUTTONS = get("minecraft:buttons");
|
||||
public static final ItemCategory CARPETS = get("minecraft:carpets");
|
||||
public static final ItemCategory CORAL = get("minecraft:coral");
|
||||
public static final ItemCategory CORAL_PLANTS = get("minecraft:coral_plants");
|
||||
public static final ItemCategory DARK_OAK_LOGS = get("minecraft:dark_oak_logs");
|
||||
public static final ItemCategory DOORS = get("minecraft:doors");
|
||||
public static final ItemCategory FISHES = get("minecraft:fishes");
|
||||
public static final ItemCategory JUNGLE_LOGS = get("minecraft:jungle_logs");
|
||||
public static final ItemCategory LEAVES = get("minecraft:leaves");
|
||||
public static final ItemCategory LOGS = get("minecraft:logs");
|
||||
public static final ItemCategory OAK_LOGS = get("minecraft:oak_logs");
|
||||
public static final ItemCategory PLANKS = get("minecraft:planks");
|
||||
public static final ItemCategory RAILS = get("minecraft:rails");
|
||||
public static final ItemCategory SAND = get("minecraft:sand");
|
||||
public static final ItemCategory SAPLINGS = get("minecraft:saplings");
|
||||
public static final ItemCategory SLABS = get("minecraft:slabs");
|
||||
public static final ItemCategory SPRUCE_LOGS = get("minecraft:spruce_logs");
|
||||
public static final ItemCategory STAIRS = get("minecraft:stairs");
|
||||
public static final ItemCategory STONE_BRICKS = get("minecraft:stone_bricks");
|
||||
public static final ItemCategory WOODEN_BUTTONS = get("minecraft:wooden_buttons");
|
||||
public static final ItemCategory WOODEN_DOORS = get("minecraft:wooden_doors");
|
||||
public static final ItemCategory WOODEN_PRESSURE_PLATES = get("minecraft:wooden_pressure_plates");
|
||||
public static final ItemCategory WOODEN_SLABS = get("minecraft:wooden_slabs");
|
||||
public static final ItemCategory WOODEN_STAIRS = get("minecraft:wooden_stairs");
|
||||
public static final ItemCategory WOOL = get("minecraft:wool");
|
||||
|
||||
private ItemCategories() {
|
||||
}
|
||||
|
||||
private static ItemCategory register(final String id) {
|
||||
return register(new ItemCategory(id));
|
||||
}
|
||||
|
||||
public static ItemCategory register(final ItemCategory tag) {
|
||||
return ItemCategory.REGISTRY.register(tag.getId(), tag);
|
||||
}
|
||||
|
||||
public static @Nullable ItemCategory get(final String id) {
|
||||
return ItemCategory.REGISTRY.get(id);
|
||||
private static ItemCategory get(final String id) {
|
||||
ItemCategory itemCategory = ItemCategory.REGISTRY.get(id);
|
||||
if (itemCategory == null) {
|
||||
return new ItemCategory(id);
|
||||
}
|
||||
return itemCategory;
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,6 @@
|
||||
package com.sk89q.worldedit.world.item;
|
||||
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.blocks.BaseItem;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.registry.NamespacedRegistry;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -19,10 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.world.registry;
|
||||
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.biome.BiomeData;
|
||||
|
||||
import java.util.List;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@ -31,22 +29,6 @@ import javax.annotation.Nullable;
|
||||
*/
|
||||
public interface BiomeRegistry {
|
||||
|
||||
/**
|
||||
* Create a new biome given its biome ID.
|
||||
*
|
||||
* @param id its biome ID
|
||||
* @return a new biome or null if it can't be created
|
||||
*/
|
||||
@Nullable
|
||||
BaseBiome createFromId(int id);
|
||||
|
||||
/**
|
||||
* Get a list of available biomes.
|
||||
*
|
||||
* @return a list of biomes
|
||||
*/
|
||||
List<BaseBiome> getBiomes();
|
||||
|
||||
/**
|
||||
* Get data about a biome.
|
||||
*
|
||||
@ -54,6 +36,6 @@ public interface BiomeRegistry {
|
||||
* @return a data object or null if information is not known
|
||||
*/
|
||||
@Nullable
|
||||
BiomeData getData(BaseBiome biome);
|
||||
BiomeData getData(BiomeType biome);
|
||||
|
||||
}
|
||||
|
@ -24,7 +24,10 @@ import com.google.gson.*;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.util.gson.VectorAdapter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Type;
|
||||
import java.net.URL;
|
||||
@ -32,10 +35,6 @@ import java.nio.charset.Charset;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Provides block data based on the built-in block database that is bundled
|
||||
@ -50,7 +49,7 @@ import javax.annotation.Nullable;
|
||||
*/
|
||||
public class BundledBlockData {
|
||||
|
||||
private static final Logger log = Logger.getLogger(BundledBlockData.class.getCanonicalName());
|
||||
private static final Logger log = LoggerFactory.getLogger(BundledBlockData.class);
|
||||
private static BundledBlockData INSTANCE;
|
||||
|
||||
private final Map<String, BlockEntry> idMap = new HashMap<>();
|
||||
@ -62,7 +61,7 @@ public class BundledBlockData {
|
||||
try {
|
||||
loadFromResource();
|
||||
} catch (Throwable e) {
|
||||
log.log(Level.WARNING, "Failed to load the built-in block registry", e);
|
||||
log.warn("Failed to load the built-in block registry", e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,7 +72,6 @@ public class BundledBlockData {
|
||||
*/
|
||||
private void loadFromResource() throws IOException {
|
||||
GsonBuilder gsonBuilder = new GsonBuilder();
|
||||
//<<<<<<< HEAD
|
||||
gsonBuilder.registerTypeAdapter(Vector3.class, new VectorAdapter());
|
||||
gsonBuilder.registerTypeAdapter(int.class, new JsonDeserializer<Integer>() {
|
||||
@Override
|
||||
@ -87,9 +85,6 @@ public class BundledBlockData {
|
||||
return primitive.getAsInt();
|
||||
}
|
||||
});
|
||||
//=======
|
||||
// gsonBuilder.registerTypeAdapter(Vector3.class, new VectorAdapter());
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
Gson gson = gsonBuilder.create();
|
||||
URL url = BundledBlockData.class.getResource("blocks.json");
|
||||
if (url == null) {
|
||||
|
@ -25,17 +25,16 @@ import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.util.gson.VectorAdapter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Provides item data based on the built-in item database that is bundled
|
||||
@ -50,7 +49,7 @@ import javax.annotation.Nullable;
|
||||
*/
|
||||
public class BundledItemData {
|
||||
|
||||
private static final Logger log = Logger.getLogger(BundledItemData.class.getCanonicalName());
|
||||
private static final Logger log = LoggerFactory.getLogger(BundledItemData.class);
|
||||
private static BundledItemData INSTANCE;
|
||||
|
||||
private final Map<String, ItemEntry> idMap = new HashMap<>();
|
||||
@ -62,7 +61,7 @@ public class BundledItemData {
|
||||
try {
|
||||
loadFromResource();
|
||||
} catch (Throwable e) {
|
||||
log.log(Level.WARNING, "Failed to load the built-in item registry", e);
|
||||
log.warn("Failed to load the built-in item registry", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,9 +19,7 @@
|
||||
|
||||
package com.sk89q.worldedit.world.registry;
|
||||
|
||||
import com.sk89q.worldedit.blocks.BaseItem;
|
||||
import com.sk89q.worldedit.world.item.ItemType;
|
||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
@ -35,9 +33,18 @@ public class BundledItemRegistry implements ItemRegistry {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BaseItem createFromId(String id) {
|
||||
ItemType itemType = ItemTypes.get(id);
|
||||
return itemType == null ? null : new BaseItem(itemType);
|
||||
public String getName(ItemType itemType) {
|
||||
String id = itemType.getId();
|
||||
BundledItemData.ItemEntry itemEntry = BundledItemData.getInstance().findById(id);
|
||||
if (itemEntry != null) {
|
||||
String localized = itemEntry.localizedName;
|
||||
if (localized.equals("Air")) {
|
||||
int c = id.indexOf(':');
|
||||
return c < 0 ? id : id.substring(c + 1);
|
||||
}
|
||||
return localized;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit.world.registry;
|
||||
|
||||
import com.sk89q.worldedit.blocks.BaseItem;
|
||||
import com.sk89q.worldedit.world.item.ItemType;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@ -29,13 +28,13 @@ import java.util.Collections;
|
||||
public interface ItemRegistry {
|
||||
|
||||
/**
|
||||
* Create a new item using its ID.
|
||||
* Gets the name for the given item.
|
||||
*
|
||||
* @param id the id
|
||||
* @return the item, which may be null if no item exists
|
||||
* @param itemType the item
|
||||
* @return The name, or null if it's unknown
|
||||
*/
|
||||
@Nullable
|
||||
BaseItem createFromId(String id);
|
||||
String getName(ItemType itemType);
|
||||
|
||||
/**
|
||||
* Register all items
|
||||
|
@ -43,19 +43,20 @@ import com.sk89q.worldedit.world.item.ItemTypes;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
import com.sk89q.worldedit.util.gson.VectorAdapter;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public class LegacyMapper {
|
||||
|
||||
private static final Logger log = Logger.getLogger(LegacyMapper.class.getCanonicalName());
|
||||
private static final Logger log = LoggerFactory.getLogger(LegacyMapper.class);
|
||||
private static LegacyMapper INSTANCE;
|
||||
|
||||
private final Int2ObjectArrayMap<Integer> blockStateToLegacyId4Data = new Int2ObjectArrayMap<>();
|
||||
@ -71,7 +72,7 @@ public class LegacyMapper {
|
||||
loadFromResource();
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
log.log(Level.WARNING, "Failed to load the built-in legacy id registry", e);
|
||||
log.warn("Failed to load the built-in legacy id registry", e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -110,7 +111,7 @@ public class LegacyMapper {
|
||||
blockStateToLegacyId4Data.put(blockState.getInternalId(), (Integer) combinedId);
|
||||
blockStateToLegacyId4Data.putIfAbsent(blockState.getInternalBlockTypeId(), combinedId);
|
||||
} catch (Exception e) {
|
||||
log.fine("Unknown block: " + blockEntry.getValue());
|
||||
log.warn("Unknown block: " + blockEntry.getValue());
|
||||
}
|
||||
}
|
||||
for (int id = 0; id < 256; id++) {
|
||||
@ -127,7 +128,7 @@ public class LegacyMapper {
|
||||
try {
|
||||
itemMap.put(getCombinedId(itemEntry.getKey()), ItemTypes.get(itemEntry.getValue()));
|
||||
} catch (Exception e) {
|
||||
log.fine("Unknown item: " + itemEntry.getValue());
|
||||
log.warn("Unknown item: " + itemEntry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,11 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.world.registry;
|
||||
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.biome.BiomeData;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@ -40,18 +37,7 @@ public class NullBiomeRegistry implements BiomeRegistry {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BaseBiome createFromId(int id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BaseBiome> getBiomes() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BiomeData getData(BaseBiome biome) {
|
||||
public BiomeData getData(BiomeType biome) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -29,11 +29,12 @@ import com.sk89q.worldedit.world.storage.TrueZipLegacyChunkStore;
|
||||
import com.sk89q.worldedit.world.storage.TrueZipMcRegionChunkStore;
|
||||
import com.sk89q.worldedit.world.storage.ZippedLegacyChunkStore;
|
||||
import com.sk89q.worldedit.world.storage.ZippedMcRegionChunkStore;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Calendar;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
/**
|
||||
@ -41,7 +42,7 @@ import java.util.zip.ZipFile;
|
||||
*/
|
||||
public class Snapshot implements Comparable<Snapshot> {
|
||||
|
||||
protected static Logger logger = Logger.getLogger(Snapshot.class.getCanonicalName());
|
||||
protected static Logger logger = LoggerFactory.getLogger(Snapshot.class);
|
||||
|
||||
protected File file;
|
||||
protected String name;
|
||||
|
@ -23,7 +23,6 @@ import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.world.DataException;
|
||||
|
@ -29,7 +29,6 @@ import com.sk89q.worldedit.world.World;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Map;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
/**
|
||||
|
@ -23,21 +23,20 @@ import javax.annotation.Nullable;
|
||||
|
||||
public class WeatherTypes {
|
||||
|
||||
public static final WeatherType CLEAR = register("clear");
|
||||
public static final WeatherType RAIN = register("rain");
|
||||
public static final WeatherType THUNDER_STORM = register("thunder_storm");
|
||||
static {
|
||||
// This isn't really a proper registry - so inject these before they're obtained.
|
||||
WeatherType.REGISTRY.register("clear", new WeatherType("clear"));
|
||||
WeatherType.REGISTRY.register("rain", new WeatherType("rain"));
|
||||
WeatherType.REGISTRY.register("thunder_storm", new WeatherType("thunder_storm"));
|
||||
}
|
||||
|
||||
@Nullable public static final WeatherType CLEAR = get("clear");
|
||||
@Nullable public static final WeatherType RAIN = get("rain");
|
||||
@Nullable public static final WeatherType THUNDER_STORM = get("thunder_storm");
|
||||
|
||||
private WeatherTypes() {
|
||||
}
|
||||
|
||||
private static WeatherType register(final String id) {
|
||||
return register(new WeatherType(id));
|
||||
}
|
||||
|
||||
public static WeatherType register(final WeatherType weatherType) {
|
||||
return WeatherType.REGISTRY.register(weatherType.getId(), weatherType);
|
||||
}
|
||||
|
||||
public static @Nullable WeatherType get(final String id) {
|
||||
return WeatherType.REGISTRY.get(id);
|
||||
}
|
||||
|
Reference in New Issue
Block a user