Here are the examples of the java api org.bukkit.block.Biome taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
92 Examples
19
Source : EntityBlock.java
with MIT License
from Tsuser1
with MIT License
from Tsuser1
@Override
public void setBiome(Biome arg0) {
// TODO Auto-generated method stub
}
19
Source : CraftWorld.java
with GNU General Public License v3.0
from tr7zw
with GNU General Public License v3.0
from tr7zw
@Override
public void setBiome(int x, int y, int z, @NotNull Biome bio) {
// TODO Auto-generated method stub
}
19
Source : CraftWorld.java
with GNU General Public License v3.0
from tr7zw
with GNU General Public License v3.0
from tr7zw
@Override
public void setBiome(int x, int z, Biome bio) {
// TODO Auto-generated method stub
}
19
Source : WorldMock.java
with MIT License
from seeseemelk
with MIT License
from seeseemelk
@Override
public void setBiome(int x, int y, int z, Biome bio) {
// TODO Auto-generated method stub
throw new UnimplementedOperationException();
}
19
Source : WorldMock.java
with MIT License
from seeseemelk
with MIT License
from seeseemelk
@Override
public void setBiome(int x, int z, Biome bio) {
// TODO Auto-generated method stub
throw new UnimplementedOperationException();
}
19
Source : BlockMock.java
with MIT License
from seeseemelk
with MIT License
from seeseemelk
@Override
public void setBiome(Biome bio) {
// TODO Auto-generated method stub
throw new UnimplementedOperationException();
}
19
Source : Property.java
with MIT License
from rutgerkok
with MIT License
from rutgerkok
/**
* Gets the property.
*
* @param world
* The world.
* @param biome
* The biome.
* @return The value of the property.
* @since 0.1
*/
public final T get(WorldRef world, Biome biome) {
T value = getBiomeInWorldDefault(world, biome);
if (value != null) {
return value;
}
value = getBiomeDefault(biome);
if (value != null) {
return value;
}
return get(world);
}
19
Source : FloatProperty.java
with MIT License
from rutgerkok
with MIT License
from rutgerkok
/**
* Gets the default value explicitly specified for a given biome. May return
* {@link Float#NaN}, in which case the call is driven to
* {@link #getWorldDefault(WorldRef)}.
*
* @param biome
* The biome.
* @return The default value.
*/
protected float getBiomeDefault(Biome biome) {
float[] defaultValues = this.defaultValues;
if (defaultValues.length == 1) {
return Float.NaN;
}
return defaultValues[biome.ordinal()];
}
19
Source : CustomBiome.java
with MIT License
from Redempt
with MIT License
from Redempt
/**
* @deprecated Implementation in progress.
*/
public abstract clreplaced CustomBiome {
private String name;
private int temperature;
private int elevationMin;
private int elevationMax;
private Biome vanillaBiome;
public CustomBiome(String name, int temperature, int elevationMin, int elevationMax, Biome vanillaBiome) {
this.name = name;
this.temperature = temperature;
this.elevationMin = elevationMin;
this.elevationMax = elevationMax;
this.vanillaBiome = vanillaBiome;
}
public abstract void generateColumn(ChunkData data, int cx, int cz, int bx, int bz, int height);
public abstract int getBlockHeight(int x, int z);
public abstract int getCaveHeight(int x, int z, int blockHeight);
public String getName() {
return name;
}
public int getTemperature() {
return temperature;
}
public int getElevationMin() {
return elevationMin;
}
public int getElevationMax() {
return elevationMax;
}
public Biome getVanillaBiome() {
return vanillaBiome;
}
public void prefill(int cx, int cz) {
}
}
19
Source : NMSAdapter_v1_16_R1.java
with GNU General Public License v3.0
from OmerBenGera
with GNU General Public License v3.0
from OmerBenGera
@Override
public void setBiome(ChunkGenerator.BiomeGrid biomeGrid, Biome biome) {
BiomeBase biomeBase = CraftBlock.biomeToBiomeBase(biome);
BiomeStorage biomeStorage = BIOME_STORAGE.get(biomeGrid);
BiomeBase[] biomeBases = BIOME_BASE_ARRAY.get(biomeStorage);
if (biomeBases == null)
return;
Arrays.fill(biomeBases, biomeBase);
}
19
Source : CommandArguments.java
with GNU General Public License v3.0
from OmerBenGera
with GNU General Public License v3.0
from OmerBenGera
public static Biome getBiome(CommandSender sender, String argument) {
Biome biome = null;
try {
biome = Biome.valueOf(argument.toUpperCase());
} catch (Exception ex) {
Locale.INVALID_BIOME.send(sender, argument);
}
return biome;
}
19
Source : SpawnIsland.java
with GNU General Public License v3.0
from OmerBenGera
with GNU General Public License v3.0
from OmerBenGera
@Override
public void setBiome(Biome biome) {
}
19
Source : SpawnIsland.java
with GNU General Public License v3.0
from OmerBenGera
with GNU General Public License v3.0
from OmerBenGera
@Override
public void setBiome(Biome biome, boolean updateBlocks) {
}
19
Source : IslandBiomeChangeEvent.java
with GNU General Public License v3.0
from OmerBenGera
with GNU General Public License v3.0
from OmerBenGera
/**
* IslandCreateEvent is called when a new island is created.
*/
public clreplaced IslandBiomeChangeEvent extends IslandEvent implements Cancellable {
private final SuperiorPlayer superiorPlayer;
private Biome biome;
private boolean cancelled = false;
/**
* The constructor for the event.
* @param superiorPlayer The player who changed the biome of the island.
* @param island The island object that was changed.
* @param biome The name of the new biome.
*/
public IslandBiomeChangeEvent(SuperiorPlayer superiorPlayer, Island island, Biome biome) {
super(island);
this.superiorPlayer = superiorPlayer;
this.biome = biome;
}
/**
* Get the player who upgraded the island.
*/
public SuperiorPlayer getPlayer() {
return superiorPlayer;
}
/**
* Get the new biome.
*/
public Biome getBiome() {
return biome;
}
/**
* Set the new biome.
*/
public void setBiome(Biome biome) {
this.biome = biome;
}
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}
}
19
Source : IslandBiomeChangeEvent.java
with GNU General Public License v3.0
from OmerBenGera
with GNU General Public License v3.0
from OmerBenGera
/**
* Set the new biome.
*/
public void setBiome(Biome biome) {
this.biome = biome;
}
19
Source : LanguageHelper.java
with MIT License
from NyaaCat
with MIT License
from NyaaCat
/**
* Return the unlocalized name of the biome(Minecraft convention)
*
* @param biome The biome
* @return The unlocalized name. If the biome doesn't have a unlocalized name, this method will return the Biome of it.
*/
public static String getBiomeUnlocalizedName(Biome biome) {
EnumBiome enumBiome = EnumBiome.get(biome);
return enumBiome != null ? enumBiome.getUnlocalizedName() : biome.toString();
}
19
Source : LanguageHelper.java
with MIT License
from NyaaCat
with MIT License
from NyaaCat
/**
* Return the localized name of the biome.
*
* @param biome The biome
* @param locale The language of the biome
* @return The localized name. if the biome doesn't have a localized name, this method will return the unlocalized name of it.
*/
public static String getBiomeName(Biome biome, String locale) {
return translateToLocal(getBiomeUnlocalizedName(biome), locale);
}
19
Source : CraftBlock.java
with GNU General Public License v3.0
from Mohist-Community
with GNU General Public License v3.0
from Mohist-Community
@Override
public void setBiome(Biome bio) {
getWorld().setBiome(getX(), getY(), getZ(), bio);
}
19
Source : CraftBlock.java
with GNU Lesser General Public License v3.0
from Luohuayu
with GNU Lesser General Public License v3.0
from Luohuayu
public static net.minecraft.world.biome.Biome biomeToBiomeBase(Biome bio) {
if (bio == null) {
return null;
}
return net.minecraft.world.biome.Biome.REGISTRY.getObject(new ResourceLocation(bio.name().toLowerCase(java.util.Locale.ENGLISH)));
}
19
Source : CraftBlock.java
with GNU Lesser General Public License v3.0
from Luohuayu
with GNU Lesser General Public License v3.0
from Luohuayu
public void setBiome(Biome bio) {
getWorld().setBiome(x, z, bio);
}
19
Source : CraftBlock.java
with GNU General Public License v3.0
from kmecpp
with GNU General Public License v3.0
from kmecpp
public void setBiome(Biome bio) {
getWorld().setBiome(getX(), getZ(), bio);
}
19
Source : CraftBlock.java
with GNU General Public License v3.0
from kmecpp
with GNU General Public License v3.0
from kmecpp
public static BiomeBase biomeToBiomeBase(Biome bio) {
if (bio == null) {
return null;
}
return BiomeBase.REGISTRY_ID.get(new MinecraftKey(bio.name().toLowerCase(java.util.Locale.ENGLISH)));
}
19
Source : BukkitRegistry.java
with GNU General Public License v3.0
from IzzelAliz
with GNU General Public License v3.0
from IzzelAliz
private static void loadBiomes() {
int i = Biome.values().length;
List<Biome> newTypes = new ArrayList<>();
Field key = Arrays.stream(Biome.clreplaced.getDeclaredFields()).filter(it -> it.getName().equals("key")).findAny().orElse(null);
long keyOffset = Unsafe.objectFieldOffset(key);
for (net.minecraft.world.biome.Biome biome : ForgeRegistries.BIOMES) {
String name = ResourceLocationUtil.standardize(biome.getRegistryName());
Biome bukkit;
try {
bukkit = Biome.valueOf(name);
} catch (Throwable t) {
bukkit = null;
}
if (bukkit == null) {
bukkit = EnumHelper.makeEnum(Biome.clreplaced, name, i++, ImmutableList.of(), ImmutableList.of());
newTypes.add(bukkit);
Unsafe.putObject(bukkit, keyOffset, CraftNamespacedKey.fromMinecraft(biome.getRegistryName()));
ArclightMod.LOGGER.debug("Registered {} as biome {}", biome.getRegistryName(), bukkit);
}
}
EnumHelper.addEnums(Biome.clreplaced, newTypes);
ArclightMod.LOGGER.info("registry.biome", newTypes.size());
}
19
Source : OccurredEvent.java
with GNU General Public License v3.0
from CoolLord22
with GNU General Public License v3.0
from CoolLord22
// Constructor helpers
private void setWeatherTimeHeight(Location loc) {
World world = loc.getWorld();
Biome biome = loc.getBlock().getBiome();
weather = Weather.match(biome, world.hreplacedtorm(), world.isThundering());
time = world.getTime();
height = loc.getBlockY();
}
19
Source : CustomDrop.java
with GNU General Public License v3.0
from CoolLord22
with GNU General Public License v3.0
from CoolLord22
public boolean isBiome(Biome biome) {
return checkList(biome, biomes);
}
19
Source : CraftBlock.java
with GNU General Public License v3.0
from CardboardPowered
with GNU General Public License v3.0
from CardboardPowered
public static net.minecraft.world.biome.Biome biomeToBiomeBase(net.minecraft.util.registry.Registry<net.minecraft.world.biome.Biome> registry, Biome bio) {
return (null == bio) ? null : registry.get(CraftNamespacedKey.toMinecraft(bio.getKey()));
}
18
Source : LocationObject.java
with GNU General Public License v3.0
from Trigary
with GNU General Public License v3.0
from Trigary
/**
* Specifies information about a location in any world.
*/
public clreplaced LocationObject extends SharedObject {
private RangeObject x;
private RangeObject y;
private RangeObject z;
private Biome biome;
private StructureType feature;
private Dimension dimension;
/**
* @return the x coordinate component or null, if none is specified
*/
@Nullable
@Contract(pure = true)
public RangeObject getX() {
return x;
}
/**
* @return the y coordinate component or null, if none is specified
*/
@Nullable
@Contract(pure = true)
public RangeObject getY() {
return y;
}
/**
* @return the z coordinate component or null, if none is specified
*/
@Nullable
@Contract(pure = true)
public RangeObject getZ() {
return z;
}
/**
* @return the biome or null, if none is specified
*/
@Nullable
@Contract(pure = true)
public Biome getBiome() {
return biome;
}
/**
* @return the feature or null, if none is specified
*/
@Nullable
@Contract(pure = true)
public StructureType getFeature() {
return feature;
}
/**
* @return the dimension or null, if none is specified
*/
@Nullable
@Contract(pure = true)
public Dimension getDimension() {
return dimension;
}
/**
* @param x the x coordinate component or null, if it should be cleared
* @return the current location object for chaining
*/
@NotNull
public LocationObject setX(@Nullable RangeObject x) {
this.x = x;
return this;
}
/**
* @param y the y coordinate component or null, if it should be cleared
* @return the current location object for chaining
*/
@NotNull
public LocationObject setY(@Nullable RangeObject y) {
this.y = y;
return this;
}
/**
* @param z the z coordinate component or null, if it should be cleared
* @return the current location object for chaining
*/
@NotNull
public LocationObject setZ(@Nullable RangeObject z) {
this.z = z;
return this;
}
/**
* @param biome the biome, or null if it should be cleared
* @return the current location object for chaining
*/
@NotNull
public LocationObject setBiome(@Nullable Biome biome) {
this.biome = biome;
return this;
}
/**
* @param feature the feature, or null if it should be cleared
* @return the current location object for chaining
*/
@NotNull
public LocationObject setFeature(@Nullable StructureType feature) {
this.feature = feature;
return this;
}
/**
* @param dimension the dimension, or null if it should be cleared
* @return the current location object for chaining
*/
@NotNull
public LocationObject setDimension(@Nullable Dimension dimension) {
this.dimension = dimension;
return this;
}
/**
* @return the JSON representation of the location object
*/
@NotNull
@Contract(pure = true)
@Override
public JsonObject toJson() {
JsonBuilder builder = new JsonBuilder();
if (x != null || y != null || z != null) {
builder.add("position", new JsonBuilder().add("x", x).add("y", y).add("z", z).build());
}
if (feature != null) {
builder.add("feature", "minecraft:" + feature.getName());
}
return builder.add("biome", biome).add("dimension", dimension).build();
}
}
18
Source : LocationObject.java
with GNU General Public License v3.0
from Trigary
with GNU General Public License v3.0
from Trigary
/**
* @param biome the biome, or null if it should be cleared
* @return the current location object for chaining
*/
@NotNull
public LocationObject setBiome(@Nullable Biome biome) {
this.biome = biome;
return this;
}
18
Source : Property.java
with MIT License
from rutgerkok
with MIT License
from rutgerkok
/**
* Gets the default value explicitly specified for a given biome in a world.
* May return {@link Float#NaN}, in which case the call is driven to
* {@link #getBiomeDefault(Biome)}.
*
* @param world
* The world.
* @param biome
* The biome.
* @return The default value.
*/
@Nullable
protected T getBiomeInWorldDefault(WorldRef world, Biome biome) {
List<T> worldValues = allWorldValues.get(world);
if (worldValues == null || worldValues.size() == 1) {
return null;
}
return worldValues.get(biome.ordinal());
}
18
Source : Property.java
with MIT License
from rutgerkok
with MIT License
from rutgerkok
/**
* Gets the default value explicitly specified for a given biome. May return
* {@code null}, in which case the call is driven to
* {@link #getWorldDefault(WorldRef)}.
*
* @param biome
* The biome.
* @return The default value.
*/
@Nullable
protected T getBiomeDefault(Biome biome) {
List<T> defaultValues = this.defaultValues;
if (defaultValues.size() == 1) {
return null;
}
return defaultValues.get(biome.ordinal());
}
18
Source : FloatProperty.java
with MIT License
from rutgerkok
with MIT License
from rutgerkok
/**
* Gets the default value explicitly specified for a given biome in a world.
* May return {@link Float#NaN}, in which case the call is driven to
* {@link #getBiomeDefault(Biome)}.
*
* @param world
* The world.
* @param biome
* The biome.
* @return The default value.
*/
protected float getBiomeInWorldDefault(WorldRef world, Biome biome) {
float[] worldValues = allWorldValues.get(world);
if (worldValues == null || worldValues.length == 1) {
return Float.NaN;
}
return worldValues[biome.ordinal()];
}
18
Source : FloatProperty.java
with MIT License
from rutgerkok
with MIT License
from rutgerkok
/**
* Gets the property.
*
* @param world
* The world.
* @param biome
* The biome.
* @return The value of the property.
*/
public final float get(WorldRef world, Biome biome) {
float value = getBiomeInWorldDefault(world, biome);
if (!Float.isNaN(value)) {
return value;
}
value = getBiomeDefault(biome);
if (!Float.isNaN(value)) {
return value;
}
return get(world);
}
18
Source : NMSAdapter_v1_16_R3.java
with GNU General Public License v3.0
from OmerBenGera
with GNU General Public License v3.0
from OmerBenGera
@Override
public void setBiome(ChunkGenerator.BiomeGrid biomeGrid, Biome biome) {
BiomeStorage biomeStorage = BIOME_STORAGE.get(biomeGrid);
BiomeBase[] biomeBases = BIOME_BASE_ARRAY.get(biomeStorage);
BiomeBase biomeBase = CraftBlock.biomeToBiomeBase((IRegistry<BiomeBase>) biomeStorage.g, biome);
if (biomeBases == null)
return;
Arrays.fill(biomeBases, biomeBase);
}
18
Source : SuperiorSkyblockAPI.java
with GNU General Public License v3.0
from OmerBenGera
with GNU General Public License v3.0
from OmerBenGera
/**
* Create a new island.
* @param superiorPlayer The new owner for the island.
* @param schemName The schematic that should be used.
* @param bonusWorth A starting worth for the island.
* @param bonusLevel A starting level for the island.
* @param biome A starting biome for the island.
* @param islandName The name of the new island.
* @param offset Should the island have an offset for it's values? If disabled, the bonus will be given.
*/
public static void createIsland(SuperiorPlayer superiorPlayer, String schemName, BigDecimal bonusWorth, BigDecimal bonusLevel, Biome biome, String islandName, boolean offset) {
plugin.getGrid().createIsland(superiorPlayer, schemName, bonusWorth, bonusLevel, biome, islandName, offset);
}
18
Source : SuperiorSkyblockAPI.java
with GNU General Public License v3.0
from OmerBenGera
with GNU General Public License v3.0
from OmerBenGera
/**
* Create a new island.
* @param superiorPlayer The new owner for the island.
* @param schemName The schematic that should be used.
* @param bonus A starting worth for the island.
* @param biome A starting biome for the island.
* @param islandName The name of the new island.
* @param offset Should the island have an offset for it's values? If disabled, the bonus will be given.
*/
public static void createIsland(SuperiorPlayer superiorPlayer, String schemName, BigDecimal bonus, Biome biome, String islandName, boolean offset) {
plugin.getGrid().createIsland(superiorPlayer, schemName, bonus, biome, islandName, offset);
}
18
Source : SuperiorSkyblockAPI.java
with GNU General Public License v3.0
from OmerBenGera
with GNU General Public License v3.0
from OmerBenGera
/*
* Island Methods
*/
/**
* Create a new island.
*
* @param superiorPlayer owner of the island
* @param schemName the schematic of the island to be pasted
* @param bonus The default island bonus level
* @param biome The default island biome
* @param islandName The island name
*/
public static void createIsland(SuperiorPlayer superiorPlayer, String schemName, BigDecimal bonus, Biome biome, String islandName) {
plugin.getGrid().createIsland(superiorPlayer, schemName, bonus, biome, islandName);
}
18
Source : WorldImpl.java
with GNU General Public License v3.0
from Multitallented
with GNU General Public License v3.0
from Multitallented
@Override
public void setBiome(int i, int i1, Biome biome) {
}
18
Source : BlockImpl.java
with GNU General Public License v3.0
from Multitallented
with GNU General Public License v3.0
from Multitallented
@Override
public void setBiome(Biome biome) {
this.biome = biome;
}
18
Source : DumpCommand.java
with GNU General Public License v3.0
from Mohist-Community
with GNU General Public License v3.0
from Mohist-Community
private void dumpBiomes(CommandSender sender, String mode) {
StringBuilder sb = new StringBuilder();
for (Biome biome : Biome.values()) {
sb.append(biome.toString()).append("\n");
}
dump(sender, "biomes", sb, mode);
}
18
Source : BukkitInjector.java
with GNU Lesser General Public License v3.0
from Luohuayu
with GNU Lesser General Public License v3.0
from Luohuayu
public static void injectBiomes() {
for1: for (Map.Entry<ResourceLocation, net.minecraft.world.biome.Biome> entry : ForgeRegistries.BIOMES.getEntries()) {
String biomeName = entry.getKey().getResourcePath().toUpperCase(java.util.Locale.ENGLISH);
for (Biome biome : Biome.values()) {
if (biome.toString().equals(biomeName))
continue for1;
}
EnumHelper.addEnum(Biome.clreplaced, biomeName, new Clreplaced[] {}, new Object[] {});
}
}
18
Source : DimLights.java
with GNU General Public License v3.0
from DerangedMango
with GNU General Public License v3.0
from DerangedMango
private int[] getColorFromBlock(String domBlock, String[] blockTypes, int[] blockCounts, int lastIndex) {
int alphaIndex = domBlock.toUpperCase().charAt(0);
alphaIndex -= 65;
Biome biome = player.getWorld().getBiome(player.getLocation().getBlockX(), player.getLocation().getBlockZ());
for (int i = alphaArr[alphaIndex]; i < blockConfigArr.length; i++) {
if (domBlock.equalsIgnoreCase(blockConfigArr[i].getName())) {
if (blockConfigArr[i].getBiome().equalsIgnoreCase(biome.toString())) {
// plugin.getLogger().info("Found perfect match: " + domBlock + ", " + biome.toString());
return new int[] { blockConfigArr[i].getHue(), blockConfigArr[i].getSat() };
} else if (blockConfigArr[i].getBiome().equalsIgnoreCase("DEFAULT")) {
// plugin.getLogger().info("Found default match: " + domBlock + ", default setting");
return new int[] { blockConfigArr[i].getHue(), blockConfigArr[i].getSat() };
}
}
}
// plugin.getLogger().info("No config set up for this block");
return new int[] { 44379, 71 };
}
17
Source : Commands.java
with MIT License
from SuperRonanCraft
with MIT License
from SuperRonanCraft
public void addBiomes(List<String> list, String[] args) {
try {
for (Biome b : Biome.values()) if (b.name().toUpperCase().replaceAll("minecraft:", "").startsWith(args[args.length - 1].toUpperCase()))
list.add(b.name().replaceAll("minecraft:", ""));
} catch (NoSuchMethodError e) {
// Not in 1.14.X
}
}
17
Source : StructureLocation.java
with MIT License
from ryandw11
with MIT License
from ryandw11
public boolean hasBiome(Biome b) {
if (biomes.isEmpty())
return true;
for (String biome : biomes) {
if (b.toString().toLowerCase().equals(biome.toLowerCase()))
return true;
}
return false;
}
17
Source : Property.java
with MIT License
from rutgerkok
with MIT License
from rutgerkok
/**
* Sets the property. Biome-specific values override world-specific values.
*
* @param biome
* The biome.
* @param value
* The new value.
* @throws UnsupportedOperationException
* If the property cannot be changed to the given value for whatever
* reason.
* @since 0.1
*/
// List is guarded
@SuppressWarnings("unchecked")
public void setBiomeDefault(Biome biome, T value) {
Objects.requireNonNull(biome, "biome");
Objects.requireNonNull(value, "value");
synchronized (mutationLock) {
if (defaultValues.size() == 1) {
// Make biome-specific default values possible
T globalDefault = defaultValues.get(0);
defaultValues = (List<T>) Arrays.asList(new Object[Biome.values().length + 1]);
// Restore all-default value, always stored in last slot
defaultValues.set(defaultValues.size() - 1, globalDefault);
}
defaultValues.set(biome.ordinal(), value);
}
}
17
Source : FloatProperty.java
with MIT License
from rutgerkok
with MIT License
from rutgerkok
/**
* Sets the property. Biome-specific values override world-specific values.
*
* @param biome
* The biome.
* @param value
* The new value.
* @throws UnsupportedOperationException
* If the property cannot be changed to the given value for whatever
* reason.
* @since 0.1
*/
public void setBiomeDefault(Biome biome, float value) {
Objects.requireNonNull(biome, "biome");
checkForNaN(value);
synchronized (mutationLock) {
if (defaultValues.length == 1) {
// Make biome-specific default values possible
float globalDefault = defaultValues[0];
defaultValues = new float[Biome.values().length + 1];
Arrays.fill(defaultValues, Float.NaN);
// Restore all-default value, always stored in last slot
defaultValues[defaultValues.length - 1] = globalDefault;
}
defaultValues[biome.ordinal()] = value;
}
}
17
Source : NMSBlocks_v1_8_R3.java
with GNU General Public License v3.0
from OmerBenGera
with GNU General Public License v3.0
from OmerBenGera
@Override
public void setChunkBiome(ChunkPosition chunkPosition, Biome biome, List<Player> playersToUpdate) {
ChunkCoordIntPair chunkCoords = new ChunkCoordIntPair(chunkPosition.getX(), chunkPosition.getZ());
runActionOnChunk(chunkPosition.getWorld(), chunkCoords, true, chunk -> {
byte biomeBase = (byte) CraftBlock.biomeToBiomeBase(biome).id;
Arrays.fill(chunk.getBiomeIndex(), biomeBase);
});
}
17
Source : EventsCaller.java
with GNU General Public License v3.0
from OmerBenGera
with GNU General Public License v3.0
from OmerBenGera
public static EventResult<Biome> callIslandBiomeChangeEvent(SuperiorPlayer superiorPlayer, Island island, Biome biome) {
if (plugin.getSettings().disabledEvents.contains("islandbiomechangeevent"))
return EventResult.of(false, biome);
IslandBiomeChangeEvent islandBiomeChangeEvent = new IslandBiomeChangeEvent(superiorPlayer, island, biome);
Bukkit.getPluginManager().callEvent(islandBiomeChangeEvent);
return EventResult.of(islandBiomeChangeEvent.isCancelled(), islandBiomeChangeEvent.getBiome());
}
17
Source : MenuIslandCreation.java
with GNU General Public License v3.0
from OmerBenGera
with GNU General Public License v3.0
from OmerBenGera
private static void clickSchematic(String schematic, MenuIslandCreation menu, boolean rightClick, boolean fromInventory) {
// Checking for preview of islands.
if (rightClick) {
Location previewLocation = plugin.getSettings().islandPreviewLocations.get(schematic);
if (previewLocation != null) {
plugin.getGrid().startIslandPreview(menu.superiorPlayer, schematic, menu.islandName);
return;
}
}
String permission = (String) menu.getData(schematic + "-permission", "");
if (menu.superiorPlayer.hasPermission(permission)) {
BigDecimal bonusWorth = BigDecimal.valueOf((double) menu.getData(schematic + "-bonus-worth", 0D));
BigDecimal bonusLevel = BigDecimal.valueOf((double) menu.getData(schematic + "-bonus-level", 0D));
boolean offset = (boolean) menu.getData(schematic + "-offset", false);
Biome biome = Biome.valueOf((String) menu.getData(schematic + "-biome", "PLAINS"));
SoundWrapper sound = (SoundWrapper) menu.getData(schematic + "-has-access-item-sound");
if (sound != null)
sound.playSound(menu.superiorPlayer.asPlayer());
// noinspection unchecked
List<String> commands = (List<String>) menu.getData(schematic + "-has-access-item-commands");
if (commands != null)
commands.forEach(command -> Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command.replace("%player%", menu.superiorPlayer.getName())));
if (fromInventory) {
menu.previousMove = false;
menu.superiorPlayer.asPlayer().closeInventory();
}
Locale.ISLAND_CREATE_PROCCESS_REQUEST.send(menu.superiorPlayer);
plugin.getGrid().createIsland(menu.superiorPlayer, schematic, bonusWorth, bonusLevel, biome, menu.islandName, offset);
} else {
SoundWrapper sound = (SoundWrapper) menu.getData(schematic + "-no-access-item-sound");
if (sound != null)
sound.playSound(menu.superiorPlayer.asPlayer());
// noinspection unchecked
List<String> commands = (List<String>) menu.getData(schematic + "-no-access-item-commands");
if (commands != null)
commands.forEach(command -> Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command.replace("%player%", menu.superiorPlayer.getName())));
}
}
17
Source : GridHandler.java
with GNU General Public License v3.0
from OmerBenGera
with GNU General Public License v3.0
from OmerBenGera
@Override
public void createIsland(SuperiorPlayer superiorPlayer, String schemName, BigDecimal bonus, Biome biome, String islandName) {
createIsland(superiorPlayer, schemName, bonus, biome, islandName, false);
}
17
Source : WorldGenerator.java
with GNU General Public License v3.0
from OmerBenGera
with GNU General Public License v3.0
from OmerBenGera
@SuppressWarnings("deprecation")
public final clreplaced WorldGenerator extends ChunkGenerator {
private static final SuperiorSkyblockPlugin plugin = SuperiorSkyblockPlugin.getPlugin();
private static final Biome NETHER_BIOME = getNetherBiome();
@Override
public Location getFixedSpawnLocation(World world, Random random) {
return new Location(world, 0, 100, 0);
}
public byte[][] generateBlockSections(World world, Random random, int chunkX, int chunkZ, BiomeGrid biomes) {
byte[][] blockSections = new byte[world.getMaxHeight() / 16][];
if (world.getEnvironment() == World.Environment.NORMAL) {
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
biomes.setBiome(x, z, Biome.PLAINS);
}
}
if (chunkX == 0 && chunkZ == 0) {
setBlock(blockSections, 0, 99, 0, 7);
}
}
return blockSections;
}
public ChunkData generateChunkData(World world, Random random, int chunkX, int chunkZ, BiomeGrid biomes) {
ChunkData chunkData = createChunkData(world);
switch(world.getEnvironment()) {
case NETHER:
{
if (NETHER_BIOME != null)
plugin.getNMSAdapter().setBiome(biomes, NETHER_BIOME);
break;
}
case NORMAL:
{
plugin.getNMSAdapter().setBiome(biomes, Biome.PLAINS);
if (chunkX == 0 && chunkZ == 0) {
chunkData.setBlock(0, 99, 0, Material.BEDROCK);
}
break;
}
}
return chunkData;
}
@Override
public List<BlockPopulator> getDefaultPopulators(World world) {
return new ArrayList<>();
}
@SuppressWarnings("SameParameterValue")
private void setBlock(byte[][] blocks, int x, int y, int z, int blockId) {
if (blocks[y >> 4] == null)
blocks[y >> 4] = new byte[4096];
blocks[y >> 4][((y & 0xF) << 8) | (z << 4) | x] = (byte) blockId;
}
private static Biome getNetherBiome() {
try {
return Biome.valueOf("NETHER_WASTES");
} catch (Throwable ex) {
return null;
}
}
}
See More Examples