Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-09-06 08:02:50 +02:00
Use a proper registry for biomes
Dieser Commit ist enthalten in:
Ursprung
d6bc85ccbe
Commit
1b101740fe
@ -33,6 +33,8 @@ import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
@ -43,9 +45,9 @@ import com.sk89q.worldedit.world.gamemode.GameMode;
|
||||
import com.sk89q.worldedit.world.gamemode.GameModes;
|
||||
import com.sk89q.worldedit.world.item.ItemType;
|
||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -304,6 +306,27 @@ public class BukkitAdapter {
|
||||
return GameModes.get(gameMode.name().toLowerCase());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a WorldEdit BiomeType from a Bukkit one.
|
||||
*
|
||||
* @param biome Bukkit Biome
|
||||
* @return WorldEdit BiomeType
|
||||
*/
|
||||
public static BiomeType adapt(Biome biome) {
|
||||
return BiomeTypes.get(biome.name().toLowerCase());
|
||||
}
|
||||
|
||||
public static Biome adapt(BiomeType biomeType) {
|
||||
if (!biomeType.getId().startsWith("minecraft:")) {
|
||||
throw new IllegalArgumentException("Bukkit only supports vanilla biomes");
|
||||
}
|
||||
try {
|
||||
return Biome.valueOf(biomeType.getId().substring(10).toUpperCase());
|
||||
} catch (IllegalArgumentException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a WorldEdit EntityType from a Bukkit one.
|
||||
*
|
||||
@ -318,7 +341,7 @@ public class BukkitAdapter {
|
||||
if (!entityType.getId().startsWith("minecraft:")) {
|
||||
throw new IllegalArgumentException("Bukkit only supports vanilla entities");
|
||||
}
|
||||
return org.bukkit.entity.EntityType.fromName(entityType.getId().substring(10).toLowerCase());
|
||||
return org.bukkit.entity.EntityType.fromName(entityType.getId().substring(10));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -19,16 +19,11 @@
|
||||
|
||||
package com.sk89q.worldedit.bukkit;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.biome.BiomeData;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.registry.BiomeRegistry;
|
||||
import org.bukkit.block.Biome;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
@ -41,35 +36,9 @@ class BukkitBiomeRegistry implements BiomeRegistry {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BaseBiome createFromId(int id) {
|
||||
return new BaseBiome(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BaseBiome> getBiomes() {
|
||||
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
|
||||
if (adapter != null) {
|
||||
List<BaseBiome> biomes = new ArrayList<>();
|
||||
for (Biome biome : Biome.values()) {
|
||||
int biomeId = adapter.getBiomeId(biome);
|
||||
biomes.add(new BaseBiome(biomeId));
|
||||
}
|
||||
return biomes;
|
||||
} else {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BiomeData getData(BaseBiome biome) {
|
||||
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
|
||||
if (adapter != null) {
|
||||
final Biome bukkitBiome = adapter.getBiome(biome.getId());
|
||||
return bukkitBiome::name;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
public BiomeData getData(BiomeType biome) {
|
||||
final Biome bukkitBiome = BukkitAdapter.adapt(biome);
|
||||
return bukkitBiome == null ? null : bukkitBiome::name;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -34,16 +34,14 @@ import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.TreeGenerator;
|
||||
import com.sk89q.worldedit.world.AbstractWorld;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.weather.WeatherType;
|
||||
import com.sk89q.worldedit.world.weather.WeatherTypes;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.TreeType;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.Chest;
|
||||
@ -465,25 +463,13 @@ public class BukkitWorld extends AbstractWorld {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBiome getBiome(BlockVector2 position) {
|
||||
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
|
||||
if (adapter != null) {
|
||||
int id = adapter.getBiomeId(getWorld().getBiome(position.getBlockX(), position.getBlockZ()));
|
||||
return new BaseBiome(id);
|
||||
} else {
|
||||
return new BaseBiome(0);
|
||||
}
|
||||
public BiomeType getBiome(BlockVector2 position) {
|
||||
return BukkitAdapter.adapt(getWorld().getBiome(position.getBlockX(), position.getBlockZ()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(BlockVector2 position, BaseBiome biome) {
|
||||
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
|
||||
if (adapter != null) {
|
||||
Biome bukkitBiome = adapter.getBiome(biome.getId());
|
||||
getWorld().setBiome(position.getBlockX(), position.getBlockZ(), bukkitBiome);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
public boolean setBiome(BlockVector2 position, BiomeType biome) {
|
||||
getWorld().setBiome(position.getBlockX(), position.getBlockZ(), BukkitAdapter.adapt(biome));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -20,15 +20,14 @@
|
||||
package com.sk89q.worldedit.bukkit.adapter;
|
||||
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.registry.state.Property;
|
||||
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.BlockType;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -41,26 +40,6 @@ import javax.annotation.Nullable;
|
||||
*/
|
||||
public interface BukkitImplAdapter {
|
||||
|
||||
/**
|
||||
* Get the biome ID for the given biome.
|
||||
*
|
||||
* <p>Returns 0 if it is not known or it doesn't exist.</p>
|
||||
*
|
||||
* @param biome biome
|
||||
* @return the biome ID
|
||||
*/
|
||||
int getBiomeId(Biome biome);
|
||||
|
||||
/**
|
||||
* Get the biome ID for the given biome ID..
|
||||
*
|
||||
* <p>Returns {@link Biome#OCEAN} if it is not known or it doesn't exist.</p>
|
||||
*
|
||||
* @param id the biome ID
|
||||
* @return the biome
|
||||
*/
|
||||
Biome getBiome(int id);
|
||||
|
||||
/**
|
||||
* Get the block at the given location.
|
||||
*
|
||||
|
@ -52,8 +52,8 @@ import com.sk89q.worldedit.function.block.Counter;
|
||||
import com.sk89q.worldedit.function.block.Naturalizer;
|
||||
import com.sk89q.worldedit.function.generator.GardenPatchGenerator;
|
||||
import com.sk89q.worldedit.function.mask.BlockMask;
|
||||
import com.sk89q.worldedit.function.mask.BlockTypeMask;
|
||||
import com.sk89q.worldedit.function.mask.BlockStateMask;
|
||||
import com.sk89q.worldedit.function.mask.BlockTypeMask;
|
||||
import com.sk89q.worldedit.function.mask.BoundedHeightMask;
|
||||
import com.sk89q.worldedit.function.mask.ExistingBlockMask;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
@ -108,7 +108,7 @@ import com.sk89q.worldedit.util.collection.DoubleArrayList;
|
||||
import com.sk89q.worldedit.util.eventbus.EventBus;
|
||||
import com.sk89q.worldedit.world.NullWorld;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockCategories;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
@ -117,7 +117,6 @@ import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@ -129,6 +128,8 @@ import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* An {@link Extent} that handles history, {@link BlockBag}s, change limits,
|
||||
* block re-ordering, and much more. Most operations in WorldEdit use this class.
|
||||
@ -562,12 +563,12 @@ public class EditSession implements Extent, AutoCloseable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBiome getBiome(BlockVector2 position) {
|
||||
public BiomeType getBiome(BlockVector2 position) {
|
||||
return bypassNone.getBiome(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(BlockVector2 position, BaseBiome biome) {
|
||||
public boolean setBiome(BlockVector2 position, BiomeType biome) {
|
||||
return bypassNone.setBiome(position, biome);
|
||||
}
|
||||
|
||||
@ -2202,7 +2203,7 @@ public class EditSession implements Extent, AutoCloseable {
|
||||
}
|
||||
}
|
||||
|
||||
public int makeBiomeShape(final Region region, final Vector3 zero, final Vector3 unit, final BaseBiome biomeType, final String expressionString, final boolean hollow) throws ExpressionException, MaxChangedBlocksException {
|
||||
public int makeBiomeShape(final Region region, final Vector3 zero, final Vector3 unit, final BiomeType biomeType, final String expressionString, final boolean hollow) throws ExpressionException, MaxChangedBlocksException {
|
||||
final Vector2 zero2D = zero.toVector2();
|
||||
final Vector2 unit2D = unit.toVector2();
|
||||
|
||||
@ -2215,7 +2216,7 @@ public class EditSession implements Extent, AutoCloseable {
|
||||
|
||||
final ArbitraryBiomeShape shape = new ArbitraryBiomeShape(region) {
|
||||
@Override
|
||||
protected BaseBiome getBiome(int x, int z, BaseBiome defaultBiomeType) {
|
||||
protected BiomeType getBiome(int x, int z, BiomeType defaultBiomeType) {
|
||||
final Vector2 current = Vector2.at(x, z);
|
||||
environment.setCurrentBlock(current.toVector3(0));
|
||||
final Vector2 scaled = current.subtract(zero2D).divide(unit2D);
|
||||
|
@ -48,12 +48,12 @@ import com.sk89q.worldedit.regions.Regions;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.command.binding.Switch;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.biome.BiomeData;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.registry.BiomeRegistry;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@ -94,10 +94,10 @@ public class BiomeCommands {
|
||||
|
||||
BiomeRegistry biomeRegistry = WorldEdit.getInstance().getPlatformManager()
|
||||
.queryCapability(Capability.GAME_HOOKS).getRegistries().getBiomeRegistry();
|
||||
List<BaseBiome> biomes = biomeRegistry.getBiomes();
|
||||
Collection<BiomeType> biomes = BiomeType.REGISTRY.values();
|
||||
int totalPages = biomes.size() / 19 + 1;
|
||||
player.print("Available Biomes (page " + page + "/" + totalPages + ") :");
|
||||
for (BaseBiome biome : biomes) {
|
||||
for (BiomeType biome : biomes) {
|
||||
if (offset > 0) {
|
||||
offset--;
|
||||
} else {
|
||||
@ -129,7 +129,7 @@ public class BiomeCommands {
|
||||
public void biomeInfo(Player player, LocalSession session, CommandContext args) throws WorldEditException {
|
||||
BiomeRegistry biomeRegistry = WorldEdit.getInstance().getPlatformManager()
|
||||
.queryCapability(Capability.GAME_HOOKS).getRegistries().getBiomeRegistry();
|
||||
Set<BaseBiome> biomes = new HashSet<>();
|
||||
Set<BiomeType> biomes = new HashSet<>();
|
||||
String qualifier;
|
||||
|
||||
if (args.hasFlag('t')) {
|
||||
@ -139,12 +139,12 @@ public class BiomeCommands {
|
||||
return;
|
||||
}
|
||||
|
||||
BaseBiome biome = player.getWorld().getBiome(blockPosition.toVector().toBlockPoint().toBlockVector2());
|
||||
BiomeType biome = player.getWorld().getBiome(blockPosition.toVector().toBlockPoint().toBlockVector2());
|
||||
biomes.add(biome);
|
||||
|
||||
qualifier = "at line of sight point";
|
||||
} else if (args.hasFlag('p')) {
|
||||
BaseBiome biome = player.getWorld().getBiome(player.getLocation().toVector().toBlockPoint().toBlockVector2());
|
||||
BiomeType biome = player.getWorld().getBiome(player.getLocation().toVector().toBlockPoint().toBlockVector2());
|
||||
biomes.add(biome);
|
||||
|
||||
qualifier = "at your position";
|
||||
@ -166,7 +166,7 @@ public class BiomeCommands {
|
||||
}
|
||||
|
||||
player.print(biomes.size() != 1 ? "Biomes " + qualifier + ":" : "Biome " + qualifier + ":");
|
||||
for (BaseBiome biome : biomes) {
|
||||
for (BiomeType biome : biomes) {
|
||||
BiomeData data = biomeRegistry.getData(biome);
|
||||
if (data != null) {
|
||||
player.print(" " + data.getName());
|
||||
@ -188,7 +188,7 @@ public class BiomeCommands {
|
||||
)
|
||||
@Logging(REGION)
|
||||
@CommandPermissions("worldedit.biome.set")
|
||||
public void setBiome(Player player, LocalSession session, EditSession editSession, BaseBiome target, @Switch('p') boolean atPosition) throws WorldEditException {
|
||||
public void setBiome(Player player, LocalSession session, EditSession editSession, BiomeType target, @Switch('p') boolean atPosition) throws WorldEditException {
|
||||
World world = player.getWorld();
|
||||
Region region;
|
||||
Mask mask = editSession.getMask();
|
||||
|
@ -43,7 +43,7 @@ import com.sk89q.worldedit.util.command.binding.Range;
|
||||
import com.sk89q.worldedit.util.command.binding.Switch;
|
||||
import com.sk89q.worldedit.util.command.binding.Text;
|
||||
import com.sk89q.worldedit.util.command.parametric.Optional;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
|
||||
/**
|
||||
* Commands for the generation of shapes and other objects.
|
||||
@ -337,7 +337,7 @@ public class GenerationCommands {
|
||||
@Logging(ALL)
|
||||
public void generateBiome(Player player, LocalSession session, EditSession editSession,
|
||||
@Selection Region region,
|
||||
BaseBiome target,
|
||||
BiomeType target,
|
||||
@Text String expression,
|
||||
@Switch('h') boolean hollow,
|
||||
@Switch('r') boolean useRawCoords,
|
||||
|
@ -28,12 +28,12 @@ import com.sk89q.worldedit.function.mask.BiomeMask2D;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.mask.Masks;
|
||||
import com.sk89q.worldedit.internal.registry.InputParser;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.biome.Biomes;
|
||||
import com.sk89q.worldedit.world.registry.BiomeRegistry;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class BiomeMaskParser extends InputParser<Mask> {
|
||||
@ -48,11 +48,11 @@ public class BiomeMaskParser extends InputParser<Mask> {
|
||||
return null;
|
||||
}
|
||||
|
||||
Set<BaseBiome> biomes = new HashSet<>();
|
||||
Set<BiomeType> biomes = new HashSet<>();
|
||||
BiomeRegistry biomeRegistry = worldEdit.getPlatformManager().queryCapability(Capability.GAME_HOOKS).getRegistries().getBiomeRegistry();
|
||||
List<BaseBiome> knownBiomes = biomeRegistry.getBiomes();
|
||||
Collection<BiomeType> knownBiomes = BiomeType.REGISTRY.values();
|
||||
for (String biomeName : Splitter.on(",").split(input.substring(1))) {
|
||||
BaseBiome biome = Biomes.findBiomeByName(knownBiomes, biomeName, biomeRegistry);
|
||||
BiomeType biome = Biomes.findBiomeByName(knownBiomes, biomeName, biomeRegistry);
|
||||
if (biome == null) {
|
||||
throw new InputParseException("Unknown biome '" + biomeName + '\'');
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
@ -97,12 +97,12 @@ public abstract class AbstractDelegateExtent implements Extent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBiome getBiome(BlockVector2 position) {
|
||||
public BiomeType getBiome(BlockVector2 position) {
|
||||
return extent.getBiome(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(BlockVector2 position, BaseBiome biome) {
|
||||
public boolean setBiome(BlockVector2 position, BiomeType biome) {
|
||||
return extent.setBiome(position, biome);
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
@ -69,9 +69,9 @@ public class ChangeSetExtent extends AbstractDelegateExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(BlockVector2 position, BaseBiome biome) {
|
||||
BaseBiome previous = getBiome(position);
|
||||
changeSet.add(new BiomeChange(position, previous, new BaseBiome(biome)));
|
||||
public boolean setBiome(BlockVector2 position, BiomeType biome) {
|
||||
BiomeType previous = getBiome(position);
|
||||
changeSet.add(new BiomeChange(position, previous, biome));
|
||||
return super.setBiome(position, biome);
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ package com.sk89q.worldedit.extent;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
|
||||
@ -64,6 +64,6 @@ public interface InputExtent {
|
||||
* @param position the (x, z) location to check the biome at
|
||||
* @return the biome at the location
|
||||
*/
|
||||
BaseBiome getBiome(BlockVector2 position);
|
||||
BiomeType getBiome(BlockVector2 position);
|
||||
|
||||
}
|
||||
|
@ -27,7 +27,8 @@ import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
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;
|
||||
@ -80,10 +81,9 @@ public class NullExtent implements Extent {
|
||||
return getBlock(position).toBaseBlock();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BaseBiome getBiome(BlockVector2 position) {
|
||||
return null;
|
||||
public BiomeType getBiome(BlockVector2 position) {
|
||||
return BiomeTypes.THE_VOID;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -92,7 +92,7 @@ public class NullExtent implements Extent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(BlockVector2 position, BaseBiome biome) {
|
||||
public boolean setBiome(BlockVector2 position, BiomeType biome) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@ -59,7 +59,7 @@ public interface OutputExtent {
|
||||
* @param biome the biome to set to
|
||||
* @return true if the biome was successfully set (return value may not be accurate)
|
||||
*/
|
||||
boolean setBiome(BlockVector2 position, BaseBiome biome);
|
||||
boolean setBiome(BlockVector2 position, BiomeType biome);
|
||||
|
||||
/**
|
||||
* Return an {@link Operation} that should be called to tie up loose ends
|
||||
|
@ -29,7 +29,8 @@ import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
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;
|
||||
@ -160,12 +161,12 @@ public class BlockArrayClipboard implements Clipboard {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBiome getBiome(BlockVector2 position) {
|
||||
return new BaseBiome(0);
|
||||
public BiomeType getBiome(BlockVector2 position) {
|
||||
return BiomeTypes.OCEAN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(BlockVector2 position, BaseBiome biome) {
|
||||
public boolean setBiome(BlockVector2 position, BiomeType biome) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.FlatRegionFunction;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
|
||||
/**
|
||||
* Replaces the biome at the locations that this function is applied to.
|
||||
@ -33,7 +33,7 @@ import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
public class BiomeReplace implements FlatRegionFunction {
|
||||
|
||||
private final Extent extent;
|
||||
private BaseBiome biome;
|
||||
private BiomeType biome;
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
@ -41,7 +41,7 @@ public class BiomeReplace implements FlatRegionFunction {
|
||||
* @param extent an extent
|
||||
* @param biome a biome
|
||||
*/
|
||||
public BiomeReplace(Extent extent, BaseBiome biome) {
|
||||
public BiomeReplace(Extent extent, BiomeType biome) {
|
||||
checkNotNull(extent);
|
||||
checkNotNull(biome);
|
||||
this.extent = extent;
|
||||
|
@ -23,7 +23,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@ -36,7 +36,7 @@ import java.util.Set;
|
||||
public class BiomeMask2D extends AbstractMask2D {
|
||||
|
||||
private final Extent extent;
|
||||
private final Set<BaseBiome> biomes = new HashSet<>();
|
||||
private final Set<BiomeType> biomes = new HashSet<>();
|
||||
|
||||
/**
|
||||
* Create a new biome mask.
|
||||
@ -44,7 +44,7 @@ public class BiomeMask2D extends AbstractMask2D {
|
||||
* @param extent the extent
|
||||
* @param biomes a list of biomes to match
|
||||
*/
|
||||
public BiomeMask2D(Extent extent, Collection<BaseBiome> biomes) {
|
||||
public BiomeMask2D(Extent extent, Collection<BiomeType> biomes) {
|
||||
checkNotNull(extent);
|
||||
checkNotNull(biomes);
|
||||
this.extent = extent;
|
||||
@ -57,7 +57,7 @@ public class BiomeMask2D extends AbstractMask2D {
|
||||
* @param extent the extent
|
||||
* @param biome an array of biomes to match
|
||||
*/
|
||||
public BiomeMask2D(Extent extent, BaseBiome... biome) {
|
||||
public BiomeMask2D(Extent extent, BiomeType... biome) {
|
||||
this(extent, Arrays.asList(checkNotNull(biome)));
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ public class BiomeMask2D extends AbstractMask2D {
|
||||
*
|
||||
* @param biomes a list of biomes
|
||||
*/
|
||||
public void add(Collection<BaseBiome> biomes) {
|
||||
public void add(Collection<BiomeType> biomes) {
|
||||
checkNotNull(biomes);
|
||||
this.biomes.addAll(biomes);
|
||||
}
|
||||
@ -76,7 +76,7 @@ public class BiomeMask2D extends AbstractMask2D {
|
||||
*
|
||||
* @param biome an array of biomes
|
||||
*/
|
||||
public void add(BaseBiome... biome) {
|
||||
public void add(BiomeType... biome) {
|
||||
add(Arrays.asList(checkNotNull(biome)));
|
||||
}
|
||||
|
||||
@ -85,13 +85,13 @@ public class BiomeMask2D extends AbstractMask2D {
|
||||
*
|
||||
* @return a list of biomes
|
||||
*/
|
||||
public Collection<BaseBiome> getBiomes() {
|
||||
public Collection<BiomeType> getBiomes() {
|
||||
return biomes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(BlockVector2 vector) {
|
||||
BaseBiome biome = extent.getBiome(vector);
|
||||
BiomeType biome = extent.getBiome(vector);
|
||||
return biomes.contains(biome);
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.history.UndoContext;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
|
||||
/**
|
||||
* Represents a biome change that may be undone or replayed.
|
||||
@ -37,8 +37,8 @@ import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
public class BiomeChange implements Change {
|
||||
|
||||
private final BlockVector2 position;
|
||||
private final BaseBiome previous;
|
||||
private final BaseBiome current;
|
||||
private final BiomeType previous;
|
||||
private final BiomeType current;
|
||||
|
||||
/**
|
||||
* Create a new biome change.
|
||||
@ -47,7 +47,7 @@ public class BiomeChange implements Change {
|
||||
* @param previous the previous biome
|
||||
* @param current the current biome
|
||||
*/
|
||||
public BiomeChange(BlockVector2 position, BaseBiome previous, BaseBiome current) {
|
||||
public BiomeChange(BlockVector2 position, BiomeType previous, BiomeType current) {
|
||||
checkNotNull(position);
|
||||
checkNotNull(previous);
|
||||
checkNotNull(current);
|
||||
@ -70,7 +70,7 @@ public class BiomeChange implements Change {
|
||||
*
|
||||
* @return the previous biome
|
||||
*/
|
||||
public BaseBiome getPrevious() {
|
||||
public BiomeType getPrevious() {
|
||||
return previous;
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ public class BiomeChange implements Change {
|
||||
*
|
||||
* @return the current biome
|
||||
*/
|
||||
public BaseBiome getCurrent() {
|
||||
public BiomeType getCurrent() {
|
||||
return current;
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ import com.sk89q.worldedit.util.command.parametric.BindingHelper;
|
||||
import com.sk89q.worldedit.util.command.parametric.BindingMatch;
|
||||
import com.sk89q.worldedit.util.command.parametric.ParameterException;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.biome.Biomes;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
@ -54,7 +54,7 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.registry.BiomeRegistry;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* Binds standard WorldEdit classes such as {@link Player} and {@link LocalSession}.
|
||||
@ -298,23 +298,23 @@ public class WorldEditBinding extends BindingHelper {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an {@link BaseBiome} from a {@link ArgumentStack}.
|
||||
* Gets an {@link BiomeType} from a {@link ArgumentStack}.
|
||||
*
|
||||
* @param context the context
|
||||
* @return a pattern
|
||||
* @throws ParameterException on error
|
||||
* @throws WorldEditException on error
|
||||
*/
|
||||
@BindingMatch(type = BaseBiome.class,
|
||||
@BindingMatch(type = BiomeType.class,
|
||||
behavior = BindingBehavior.CONSUMES,
|
||||
consumedCount = 1)
|
||||
public BaseBiome getBiomeType(ArgumentStack context) throws ParameterException, WorldEditException {
|
||||
public BiomeType getBiomeType(ArgumentStack context) throws ParameterException, WorldEditException {
|
||||
String input = context.next();
|
||||
if (input != null) {
|
||||
BiomeRegistry biomeRegistry = WorldEdit.getInstance().getPlatformManager()
|
||||
.queryCapability(Capability.GAME_HOOKS).getRegistries().getBiomeRegistry();
|
||||
List<BaseBiome> knownBiomes = biomeRegistry.getBiomes();
|
||||
BaseBiome biome = Biomes.findBiomeByName(knownBiomes, input, biomeRegistry);
|
||||
Collection<BiomeType> knownBiomes = BiomeType.REGISTRY.values();
|
||||
BiomeType biome = Biomes.findBiomeByName(knownBiomes, input, biomeRegistry);
|
||||
if (biome != null) {
|
||||
return biome;
|
||||
} else {
|
||||
|
@ -24,7 +24,8 @@ import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.FlatRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
||||
|
||||
/**
|
||||
* Generates solid and hollow shapes according to materials returned by the
|
||||
@ -54,10 +55,10 @@ public abstract class ArbitraryBiomeShape {
|
||||
cacheOffsetX = min.getBlockX() - 1;
|
||||
cacheOffsetZ = min.getBlockZ() - 1;
|
||||
|
||||
cacheSizeX = (int) (max.getX() - cacheOffsetX + 2);
|
||||
cacheSizeZ = (int) (max.getZ() - cacheOffsetZ + 2);
|
||||
cacheSizeX = max.getX() - cacheOffsetX + 2;
|
||||
cacheSizeZ = max.getZ() - cacheOffsetZ + 2;
|
||||
|
||||
cache = new BaseBiome[cacheSizeX * cacheSizeZ];
|
||||
cache = new BiomeType[cacheSizeX * cacheSizeZ];
|
||||
}
|
||||
|
||||
protected Iterable<BlockVector2> getExtent() {
|
||||
@ -71,7 +72,7 @@ public abstract class ArbitraryBiomeShape {
|
||||
* OUTSIDE = outside
|
||||
* else = inside
|
||||
*/
|
||||
private final BaseBiome[] cache;
|
||||
private final BiomeType[] cache;
|
||||
|
||||
/**
|
||||
* Override this function to specify the shape to generate.
|
||||
@ -81,17 +82,17 @@ public abstract class ArbitraryBiomeShape {
|
||||
* @param defaultBaseBiome The default biome for the current column.
|
||||
* @return material to place or null to not place anything.
|
||||
*/
|
||||
protected abstract BaseBiome getBiome(int x, int z, BaseBiome defaultBaseBiome);
|
||||
protected abstract BiomeType getBiome(int x, int z, BiomeType defaultBaseBiome);
|
||||
|
||||
private BaseBiome getBiomeCached(int x, int z, BaseBiome baseBiome) {
|
||||
private BiomeType getBiomeCached(int x, int z, BiomeType baseBiome) {
|
||||
final int index = (z - cacheOffsetZ) + (x - cacheOffsetX) * cacheSizeZ;
|
||||
|
||||
final BaseBiome cacheEntry = cache[index];
|
||||
final BiomeType cacheEntry = cache[index];
|
||||
if (cacheEntry == null) {// unknown, fetch material
|
||||
final BaseBiome material = getBiome(x, z, baseBiome);
|
||||
final BiomeType material = getBiome(x, z, baseBiome);
|
||||
if (material == null) {
|
||||
// outside
|
||||
cache[index] = OUTSIDE;
|
||||
cache[index] = BiomeTypes.THE_VOID;
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -99,7 +100,7 @@ public abstract class ArbitraryBiomeShape {
|
||||
return material;
|
||||
}
|
||||
|
||||
if (cacheEntry == OUTSIDE) {
|
||||
if (cacheEntry == BiomeTypes.THE_VOID) {
|
||||
// outside
|
||||
return null;
|
||||
}
|
||||
@ -107,16 +108,16 @@ public abstract class ArbitraryBiomeShape {
|
||||
return cacheEntry;
|
||||
}
|
||||
|
||||
private boolean isInsideCached(int x, int z, BaseBiome baseBiome) {
|
||||
private boolean isInsideCached(int x, int z, BiomeType baseBiome) {
|
||||
final int index = (z - cacheOffsetZ) + (x - cacheOffsetX) * cacheSizeZ;
|
||||
|
||||
final BaseBiome cacheEntry = cache[index];
|
||||
final BiomeType cacheEntry = cache[index];
|
||||
if (cacheEntry == null) {
|
||||
// unknown block, meaning they must be outside the extent at this stage, but might still be inside the shape
|
||||
return getBiomeCached(x, z, baseBiome) != null;
|
||||
}
|
||||
|
||||
return cacheEntry != OUTSIDE;
|
||||
return cacheEntry != BiomeTypes.THE_VOID;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -127,7 +128,7 @@ public abstract class ArbitraryBiomeShape {
|
||||
* @param hollow Specifies whether to generate a hollow shape.
|
||||
* @return number of affected blocks.
|
||||
*/
|
||||
public int generate(EditSession editSession, BaseBiome baseBiome, boolean hollow) {
|
||||
public int generate(EditSession editSession, BiomeType baseBiome, boolean hollow) {
|
||||
int affected = 0;
|
||||
|
||||
for (BlockVector2 position : getExtent()) {
|
||||
@ -135,8 +136,8 @@ public abstract class ArbitraryBiomeShape {
|
||||
int z = position.getBlockZ();
|
||||
|
||||
if (!hollow) {
|
||||
final BaseBiome material = getBiome(x, z, baseBiome);
|
||||
if (material != null && material != OUTSIDE) {
|
||||
final BiomeType material = getBiome(x, z, baseBiome);
|
||||
if (material != null && material != BiomeTypes.THE_VOID) {
|
||||
editSession.getWorld().setBiome(position, material);
|
||||
++affected;
|
||||
}
|
||||
@ -144,7 +145,7 @@ public abstract class ArbitraryBiomeShape {
|
||||
continue;
|
||||
}
|
||||
|
||||
final BaseBiome material = getBiomeCached(x, z, baseBiome);
|
||||
final BiomeType material = getBiomeCached(x, z, baseBiome);
|
||||
if (material == null) {
|
||||
continue;
|
||||
}
|
||||
@ -180,16 +181,4 @@ public abstract class ArbitraryBiomeShape {
|
||||
return affected;
|
||||
}
|
||||
|
||||
private static final BaseBiome OUTSIDE = new BaseBiome(0) {
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
return this == o;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -31,12 +31,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 java.util.Collections;
|
||||
import java.util.List;
|
||||
@ -80,12 +82,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 +111,7 @@ public class NullWorld extends AbstractWorld {
|
||||
|
||||
@Override
|
||||
public WeatherType getWeather() {
|
||||
return null;
|
||||
return WeatherTypes.CLEAR;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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();
|
||||
|
@ -19,64 +19,42 @@
|
||||
|
||||
package com.sk89q.worldedit.world.biome;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import com.sk89q.worldedit.registry.NamespacedRegistry;
|
||||
|
||||
/**
|
||||
* Basic storage object to represent a given biome.
|
||||
* All the types of biomes in the game.
|
||||
*/
|
||||
public class BaseBiome {
|
||||
public class BiomeType {
|
||||
|
||||
private int id;
|
||||
public static final NamespacedRegistry<BiomeType> REGISTRY = new NamespacedRegistry<>("biome type");
|
||||
|
||||
/**
|
||||
* Create a new biome with the given biome ID.
|
||||
*
|
||||
* @param id the biome ID
|
||||
*/
|
||||
public BaseBiome(int id) {
|
||||
private String id;
|
||||
|
||||
public BiomeType(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a clone of the given biome.
|
||||
* Gets the ID of this biome.
|
||||
*
|
||||
* @param biome the biome to clone
|
||||
* @return The id
|
||||
*/
|
||||
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;
|
||||
public String getId() {
|
||||
return this.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;
|
||||
public String toString() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return id;
|
||||
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 {
|
||||
|
||||
public static final BiomeType BADLANDS = register("minecraft:badlands");
|
||||
public static final BiomeType BADLANDS_PLATEAU = register("minecraft:badlands_plateau");
|
||||
public static final BiomeType BEACH = register("minecraft:beach");
|
||||
public static final BiomeType BIRCH_FOREST = register("minecraft:birch_forest");
|
||||
public static final BiomeType BIRCH_FOREST_HILLS = register("minecraft:birch_forest_hills");
|
||||
public static final BiomeType COLD_OCEAN = register("minecraft:cold_ocean");
|
||||
public static final BiomeType DARK_FOREST = register("minecraft:dark_forest");
|
||||
public static final BiomeType DARK_FOREST_HILLS = register("minecraft:dark_forest_hills");
|
||||
public static final BiomeType DEEP_COLD_OCEAN = register("minecraft:deep_cold_ocean");
|
||||
public static final BiomeType DEEP_FROZEN_OCEAN = register("minecraft:deep_frozen_ocean");
|
||||
public static final BiomeType DEEP_LUKEWARM_OCEAN = register("minecraft:deep_lukewarm_ocean");
|
||||
public static final BiomeType DEEP_OCEAN = register("minecraft:deep_ocean");
|
||||
public static final BiomeType DEEP_WARM_OCEAN = register("minecraft:deep_warm_ocean");
|
||||
public static final BiomeType DESERT = register("minecraft:desert");
|
||||
public static final BiomeType DESERT_HILLS = register("minecraft:desert_hills");
|
||||
public static final BiomeType DESERT_LAKES = register("minecraft:desert_lakes");
|
||||
public static final BiomeType END_BARRENS = register("minecraft:end_barrens");
|
||||
public static final BiomeType END_HIGHLANDS = register("minecraft:end_highlands");
|
||||
public static final BiomeType END_MIDLANDS = register("minecraft:end_midlands");
|
||||
public static final BiomeType ERODED_BADLANDS = register("minecraft:eroded_badlands");
|
||||
public static final BiomeType FLOWER_FOREST = register("minecraft:flower_forest");
|
||||
public static final BiomeType FOREST = register("minecraft:forest");
|
||||
public static final BiomeType FROZEN_OCEAN = register("minecraft:frozen_ocean");
|
||||
public static final BiomeType FROZEN_RIVER = register("minecraft:frozen_river");
|
||||
public static final BiomeType GIANT_SPRUCE_TAIGA = register("minecraft:giant_spruce_taiga");
|
||||
public static final BiomeType GIANT_SPRUCE_TAIGA_HILLS = register("minecraft:giant_spruce_taiga_hills");
|
||||
public static final BiomeType GIANT_TREE_TAIGA = register("minecraft:giant_tree_taiga");
|
||||
public static final BiomeType GIANT_TREE_TAIGA_HILLS = register("minecraft:giant_tree_taiga_hills");
|
||||
public static final BiomeType GRAVELLY_MOUNTAINS = register("minecraft:gravelly_mountains");
|
||||
public static final BiomeType ICE_SPIKES = register("minecraft:ice_spikes");
|
||||
public static final BiomeType JUNGLE = register("minecraft:jungle");
|
||||
public static final BiomeType JUNGLE_EDGE = register("minecraft:jungle_edge");
|
||||
public static final BiomeType JUNGLE_HILLS = register("minecraft:jungle_hills");
|
||||
public static final BiomeType LUKEWARM_OCEAN = register("minecraft:lukewarm_ocean");
|
||||
public static final BiomeType MODIFIED_BADLANDS_PLATEAU = register("minecraft:modified_badlands_plateau");
|
||||
public static final BiomeType MODIFIED_GRAVELLY_MOUNTAINS = register("minecraft:modified_gravelly_mountains");
|
||||
public static final BiomeType MODIFIED_JUNGLE = register("minecraft:modified_jungle");
|
||||
public static final BiomeType MODIFIED_JUNGLE_EDGE = register("minecraft:modified_jungle_edge");
|
||||
public static final BiomeType MODIFIED_WOODED_BADLANDS_PLATEAU = register("minecraft:modified_wooded_badlands_plateau");
|
||||
public static final BiomeType MOUNTAIN_EDGE = register("minecraft:mountain_edge");
|
||||
public static final BiomeType MOUNTAINS = register("minecraft:mountains");
|
||||
public static final BiomeType MUSHROOM_FIELD_SHORE = register("minecraft:mushroom_field_shore");
|
||||
public static final BiomeType MUSHROOM_FIELDS = register("minecraft:mushroom_fields");
|
||||
public static final BiomeType NETHER = register("minecraft:nether");
|
||||
public static final BiomeType OCEAN = register("minecraft:ocean");
|
||||
public static final BiomeType PLAINS = register("minecraft:plains");
|
||||
public static final BiomeType RIVER = register("minecraft:river");
|
||||
public static final BiomeType SAVANNA = register("minecraft:savanna");
|
||||
public static final BiomeType SAVANNA_PLATEAU = register("minecraft:savanna_plateau");
|
||||
public static final BiomeType SHATTERED_SAVANNA = register("minecraft:shattered_savanna");
|
||||
public static final BiomeType SHATTERED_SAVANNA_PLATEAU = register("minecraft:shattered_savanna_plateau");
|
||||
public static final BiomeType SMALL_END_ISLANDS = register("minecraft:small_end_islands");
|
||||
public static final BiomeType SNOWY_BEACH = register("minecraft:snowy_beach");
|
||||
public static final BiomeType SNOWY_MOUNTAINS = register("minecraft:snowy_mountains");
|
||||
public static final BiomeType SNOWY_TAIGA = register("minecraft:snowy_taiga");
|
||||
public static final BiomeType SNOWY_TAIGA_HILLS = register("minecraft:snowy_taiga_hills");
|
||||
public static final BiomeType SNOWY_TAIGA_MOUNTAINS = register("minecraft:snowy_taiga_mountains");
|
||||
public static final BiomeType SNOWY_TUNDRA = register("minecraft:snowy_tundra");
|
||||
public static final BiomeType STONE_SHORE = register("minecraft:stone_shore");
|
||||
public static final BiomeType SUNFLOWER_PLAINS = register("minecraft:sunflower_plains");
|
||||
public static final BiomeType SWAMP = register("minecraft:swamp");
|
||||
public static final BiomeType SWAMP_HILLS = register("minecraft:swamp_hills");
|
||||
public static final BiomeType TAIGA = register("minecraft:taiga");
|
||||
public static final BiomeType TAIGA_HILLS = register("minecraft:taiga_hills");
|
||||
public static final BiomeType TAIGA_MOUNTAINS = register("minecraft:taiga_mountains");
|
||||
public static final BiomeType TALL_BIRCH_FOREST = register("minecraft:tall_birch_forest");
|
||||
public static final BiomeType TALL_BIRCH_HILLS = register("minecraft:tall_birch_hills");
|
||||
public static final BiomeType THE_END = register("minecraft:the_end");
|
||||
public static final BiomeType THE_VOID = register("minecraft:the_void");
|
||||
public static final BiomeType WARM_OCEAN = register("minecraft:warm_ocean");
|
||||
public static final BiomeType WOODED_BADLANDS_PLATEAU = register("minecraft:wooded_badlands_plateau");
|
||||
public static final BiomeType WOODED_HILLS = register("minecraft:wooded_hills");
|
||||
public static final BiomeType WOODED_MOUNTAINS = register("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 {
|
||||
|
@ -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);
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -30,14 +30,18 @@ import com.sk89q.worldedit.registry.state.Property;
|
||||
import com.sk89q.worldedit.util.Direction;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.properties.PropertyDirection;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -50,6 +54,14 @@ final class ForgeAdapter {
|
||||
return new ForgeWorld(world);
|
||||
}
|
||||
|
||||
public static Biome adapt(BiomeType biomeType) {
|
||||
return Biome.REGISTRY.getObject(new ResourceLocation(biomeType.getId()));
|
||||
}
|
||||
|
||||
public static BiomeType adapt(Biome biome) {
|
||||
return BiomeTypes.get(biome.getRegistryName().toString());
|
||||
}
|
||||
|
||||
public static Vector3 adapt(Vec3d vector) {
|
||||
return Vector3.at(vector.x, vector.y, vector.z);
|
||||
}
|
||||
|
@ -19,36 +19,20 @@
|
||||
|
||||
package com.sk89q.worldedit.forge;
|
||||
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.biome.BiomeData;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.registry.BiomeRegistry;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Provides access to biome data in Forge.
|
||||
*/
|
||||
class ForgeBiomeRegistry implements BiomeRegistry {
|
||||
|
||||
@Override
|
||||
public BaseBiome createFromId(int id) {
|
||||
return new BaseBiome(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BaseBiome> getBiomes() {
|
||||
List<BaseBiome> list = new ArrayList<>();
|
||||
for (Biome biome : Biome.REGISTRY) {
|
||||
list.add(new BaseBiome(Biome.getIdForBiome(biome)));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeData getData(BaseBiome biome) {
|
||||
return new ForgeBiomeData(Biome.getBiome(biome.getId()));
|
||||
public BiomeData getData(BiomeType biome) {
|
||||
return new ForgeBiomeData(ForgeAdapter.adapt(biome));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -41,7 +41,7 @@ import com.sk89q.worldedit.util.Direction;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
|
||||
import com.sk89q.worldedit.world.AbstractWorld;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
@ -49,7 +49,6 @@ import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||
import com.sk89q.worldedit.world.weather.WeatherType;
|
||||
import com.sk89q.worldedit.world.weather.WeatherTypes;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockLeaves;
|
||||
import net.minecraft.block.BlockOldLeaf;
|
||||
@ -262,19 +261,19 @@ public class ForgeWorld extends AbstractWorld {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBiome getBiome(BlockVector2 position) {
|
||||
public BiomeType getBiome(BlockVector2 position) {
|
||||
checkNotNull(position);
|
||||
return new BaseBiome(Biome.getIdForBiome(getWorld().getBiomeForCoordsBody(new BlockPos(position.getBlockX(), 0, position.getBlockZ()))));
|
||||
return ForgeAdapter.adapt(getWorld().getBiomeForCoordsBody(new BlockPos(position.getBlockX(), 0, position.getBlockZ())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(BlockVector2 position, BaseBiome biome) {
|
||||
public boolean setBiome(BlockVector2 position, BiomeType biome) {
|
||||
checkNotNull(position);
|
||||
checkNotNull(biome);
|
||||
|
||||
Chunk chunk = getWorld().getChunkFromBlockCoords(new BlockPos(position.getBlockX(), 0, position.getBlockZ()));
|
||||
if (chunk.isLoaded()) {
|
||||
chunk.getBiomeArray()[((position.getBlockZ() & 0xF) << 4 | position.getBlockX() & 0xF)] = (byte) biome.getId();
|
||||
chunk.getBiomeArray()[((position.getBlockZ() & 0xF) << 4 | position.getBlockX() & 0xF)] = (byte) Biome.getIdForBiome(ForgeAdapter.adapt(biome));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,8 @@ import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
||||
import org.spongepowered.api.Sponge;
|
||||
import org.spongepowered.api.entity.living.player.Player;
|
||||
|
||||
@ -103,6 +105,14 @@ public class SpongeAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
public static BiomeType adapt(org.spongepowered.api.world.biome.BiomeType biomeType) {
|
||||
return BiomeTypes.get(biomeType.getId());
|
||||
}
|
||||
|
||||
public static org.spongepowered.api.world.biome.BiomeType adapt(BiomeType biomeType) {
|
||||
return Sponge.getRegistry().getType(org.spongepowered.api.world.biome.BiomeType.class, biomeType.getId()).orElse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a WorldEdit location from a Sponge location.
|
||||
*
|
||||
|
@ -19,15 +19,10 @@
|
||||
|
||||
package com.sk89q.worldedit.sponge;
|
||||
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.biome.BiomeData;
|
||||
import com.sk89q.worldedit.world.registry.BiomeRegistry;
|
||||
import org.spongepowered.api.Sponge;
|
||||
import org.spongepowered.api.world.biome.BiomeType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
@ -37,23 +32,8 @@ class SpongeBiomeRegistry implements BiomeRegistry {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BaseBiome createFromId(int id) {
|
||||
return new BaseBiome(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BaseBiome> getBiomes() {
|
||||
List<BaseBiome> list = new ArrayList<>();
|
||||
for (BiomeType biome : Sponge.getGame().getRegistry().getAllOf(BiomeType.class)) {
|
||||
list.add(new BaseBiome(SpongeWorldEdit.inst().getAdapter().resolve(biome)));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BiomeData getData(BaseBiome biome) {
|
||||
return new SpongeBiomeData(SpongeWorldEdit.inst().getAdapter().resolveBiome(biome.getId()));
|
||||
public BiomeData getData(com.sk89q.worldedit.world.biome.BiomeType biome) {
|
||||
return new SpongeBiomeData(SpongeAdapter.adapt(biome));
|
||||
}
|
||||
|
||||
private static class SpongeBiomeData implements BiomeData {
|
||||
|
@ -35,7 +35,7 @@ import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.registry.state.Property;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.AbstractWorld;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||
@ -192,17 +192,17 @@ public abstract class SpongeWorld extends AbstractWorld {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBiome getBiome(BlockVector2 position) {
|
||||
public BiomeType getBiome(BlockVector2 position) {
|
||||
checkNotNull(position);
|
||||
return new BaseBiome(SpongeWorldEdit.inst().getAdapter().resolve(getWorld().getBiome(position.getBlockX(), 0, position.getBlockZ())));
|
||||
return SpongeAdapter.adapt(getWorld().getBiome(position.getBlockX(), 0, position.getBlockZ()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(BlockVector2 position, BaseBiome biome) {
|
||||
public boolean setBiome(BlockVector2 position, BiomeType biome) {
|
||||
checkNotNull(position);
|
||||
checkNotNull(biome);
|
||||
|
||||
getWorld().setBiome(position.getBlockX(), 0, position.getBlockZ(), SpongeWorldEdit.inst().getAdapter().resolveBiome(biome.getId()));
|
||||
getWorld().setBiome(position.getBlockX(), 0, position.getBlockZ(), SpongeAdapter.adapt(biome));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -36,16 +36,6 @@ import org.spongepowered.api.world.biome.BiomeType;
|
||||
*/
|
||||
public interface SpongeImplAdapter {
|
||||
|
||||
/**
|
||||
* Resolves the numerical ID from this {@link BiomeType}
|
||||
*
|
||||
* @param type The biometype
|
||||
* @return The numerical ID
|
||||
*/
|
||||
int resolve(BiomeType type);
|
||||
|
||||
BiomeType resolveBiome(int intID);
|
||||
|
||||
BaseEntity createBaseEntity(Entity entity);
|
||||
|
||||
ItemStack makeSpongeStack(BaseItemStack itemStack);
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren