mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-04 03:56:41 +00:00
Make registries Keyed.
This commit is contained in:
@ -19,12 +19,13 @@
|
||||
|
||||
package com.sk89q.worldedit.world.biome;
|
||||
|
||||
import com.sk89q.worldedit.registry.Keyed;
|
||||
import com.sk89q.worldedit.registry.NamespacedRegistry;
|
||||
|
||||
/**
|
||||
* All the types of biomes in the game.
|
||||
*/
|
||||
public class BiomeType {
|
||||
public class BiomeType implements Keyed {
|
||||
|
||||
public static final NamespacedRegistry<BiomeType> REGISTRY = new NamespacedRegistry<>("biome type");
|
||||
|
||||
@ -39,6 +40,7 @@ public class BiomeType {
|
||||
*
|
||||
* @return The id
|
||||
*/
|
||||
@Override
|
||||
public String getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ package com.sk89q.worldedit.world.block;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.registry.Category;
|
||||
import com.sk89q.worldedit.registry.Keyed;
|
||||
import com.sk89q.worldedit.registry.NamespacedRegistry;
|
||||
|
||||
import java.util.Set;
|
||||
@ -30,7 +31,7 @@ import java.util.Set;
|
||||
* A category of blocks. This is due to the splitting up of
|
||||
* blocks such as wool into separate ids.
|
||||
*/
|
||||
public class BlockCategory extends Category<BlockType> {
|
||||
public class BlockCategory extends Category<BlockType> implements Keyed {
|
||||
|
||||
public static final NamespacedRegistry<BlockCategory> REGISTRY = new NamespacedRegistry<>("block tag");
|
||||
|
||||
|
@ -25,6 +25,7 @@ import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.registry.Keyed;
|
||||
import com.sk89q.worldedit.registry.NamespacedRegistry;
|
||||
import com.sk89q.worldedit.registry.state.Property;
|
||||
import com.sk89q.worldedit.world.item.ItemType;
|
||||
@ -41,7 +42,7 @@ import java.util.function.Supplier;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockType {
|
||||
public class BlockType implements Keyed {
|
||||
|
||||
public static final NamespacedRegistry<BlockType> REGISTRY = new NamespacedRegistry<>("block type");
|
||||
|
||||
@ -91,6 +92,7 @@ public class BlockType {
|
||||
*
|
||||
* @return The id
|
||||
*/
|
||||
@Override
|
||||
public String getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
@ -19,9 +19,10 @@
|
||||
|
||||
package com.sk89q.worldedit.world.entity;
|
||||
|
||||
import com.sk89q.worldedit.registry.Keyed;
|
||||
import com.sk89q.worldedit.registry.NamespacedRegistry;
|
||||
|
||||
public class EntityType {
|
||||
public class EntityType implements Keyed {
|
||||
|
||||
public static final NamespacedRegistry<EntityType> REGISTRY = new NamespacedRegistry<>("entity type");
|
||||
|
||||
@ -35,6 +36,7 @@ public class EntityType {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
package com.sk89q.worldedit.world.fluid;
|
||||
|
||||
import com.sk89q.worldedit.registry.Category;
|
||||
import com.sk89q.worldedit.registry.Keyed;
|
||||
import com.sk89q.worldedit.registry.NamespacedRegistry;
|
||||
|
||||
import java.util.Collections;
|
||||
@ -29,7 +30,7 @@ import java.util.Set;
|
||||
* A category of fluids. This is due to the splitting up of
|
||||
* blocks such as wool into separate ids.
|
||||
*/
|
||||
public class FluidCategory extends Category<FluidType> {
|
||||
public class FluidCategory extends Category<FluidType> implements Keyed {
|
||||
|
||||
public static final NamespacedRegistry<FluidCategory> REGISTRY = new NamespacedRegistry<>("fluid tag");
|
||||
|
||||
|
@ -19,13 +19,14 @@
|
||||
|
||||
package com.sk89q.worldedit.world.fluid;
|
||||
|
||||
import com.sk89q.worldedit.registry.Keyed;
|
||||
import com.sk89q.worldedit.registry.NamespacedRegistry;
|
||||
|
||||
/**
|
||||
* Minecraft now has a 'fluid' system. This is a
|
||||
* stub class to represent what it may be in the future.
|
||||
*/
|
||||
public class FluidType {
|
||||
public class FluidType implements Keyed {
|
||||
|
||||
public static final NamespacedRegistry<FluidType> REGISTRY = new NamespacedRegistry<>("fluid type");
|
||||
|
||||
@ -40,6 +41,7 @@ public class FluidType {
|
||||
*
|
||||
* @return The id
|
||||
*/
|
||||
@Override
|
||||
public String getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
@ -19,9 +19,10 @@
|
||||
|
||||
package com.sk89q.worldedit.world.gamemode;
|
||||
|
||||
import com.sk89q.worldedit.registry.Keyed;
|
||||
import com.sk89q.worldedit.registry.Registry;
|
||||
|
||||
public class GameMode {
|
||||
public class GameMode implements Keyed {
|
||||
|
||||
public static final Registry<GameMode> REGISTRY = new Registry<>("game mode");
|
||||
|
||||
@ -31,6 +32,7 @@ public class GameMode {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
@ -23,7 +23,6 @@ import javax.annotation.Nullable;
|
||||
|
||||
public class GameModes {
|
||||
|
||||
public static final GameMode NOT_SET = register("");
|
||||
public static final GameMode SURVIVAL = register("survival");
|
||||
public static final GameMode CREATIVE = register("creative");
|
||||
public static final GameMode ADVENTURE = register("adventure");
|
||||
@ -40,7 +39,8 @@ public class GameModes {
|
||||
return GameMode.REGISTRY.register(gameMode.getId(), gameMode);
|
||||
}
|
||||
|
||||
public static @Nullable GameMode get(final String id) {
|
||||
@Nullable
|
||||
public static GameMode get(final String id) {
|
||||
return GameMode.REGISTRY.get(id);
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@ import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.blocks.BaseItem;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.registry.Category;
|
||||
import com.sk89q.worldedit.registry.Keyed;
|
||||
import com.sk89q.worldedit.registry.NamespacedRegistry;
|
||||
|
||||
import java.util.Set;
|
||||
@ -31,7 +32,7 @@ import java.util.Set;
|
||||
* A category of items. This is due to the splitting up of
|
||||
* items such as wool into separate ids.
|
||||
*/
|
||||
public class ItemCategory extends Category<ItemType> {
|
||||
public class ItemCategory extends Category<ItemType> implements Keyed {
|
||||
|
||||
public static final NamespacedRegistry<ItemCategory> REGISTRY = new NamespacedRegistry<>("item tag");
|
||||
|
||||
|
@ -21,13 +21,14 @@ package com.sk89q.worldedit.world.item;
|
||||
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.registry.Keyed;
|
||||
import com.sk89q.worldedit.registry.NamespacedRegistry;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class ItemType {
|
||||
public class ItemType implements Keyed {
|
||||
|
||||
public static final NamespacedRegistry<ItemType> REGISTRY = new NamespacedRegistry<>("item type");
|
||||
|
||||
@ -41,6 +42,7 @@ public class ItemType {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
@ -20,13 +20,14 @@
|
||||
package com.sk89q.worldedit.world.registry;
|
||||
|
||||
import com.sk89q.worldedit.registry.Category;
|
||||
import com.sk89q.worldedit.registry.Keyed;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* A registry of categories. Minecraft internally calls these 'Tags'.
|
||||
*/
|
||||
public interface CategoryRegistry<T> {
|
||||
public interface CategoryRegistry<T extends Keyed> {
|
||||
|
||||
/**
|
||||
* Gets a set of values with a given category.
|
||||
|
@ -19,9 +19,10 @@
|
||||
|
||||
package com.sk89q.worldedit.world.weather;
|
||||
|
||||
import com.sk89q.worldedit.registry.Keyed;
|
||||
import com.sk89q.worldedit.registry.Registry;
|
||||
|
||||
public class WeatherType {
|
||||
public class WeatherType implements Keyed {
|
||||
|
||||
public static final Registry<WeatherType> REGISTRY = new Registry<>("weather type");
|
||||
|
||||
@ -31,6 +32,7 @@ public class WeatherType {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
Reference in New Issue
Block a user