mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-06 20:56:41 +00:00
merge with upstream (broken)
This commit is contained in:
@ -18,7 +18,7 @@ import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment;
|
||||
import com.sk89q.worldedit.session.request.RequestSelection;
|
||||
import com.sk89q.worldedit.util.command.binding.Switch;
|
||||
import com.sk89q.worldedit.util.command.parametric.Optional;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
@ -414,7 +414,7 @@ public class MaskCommands extends MethodCommands {
|
||||
min = 1,
|
||||
max = 1
|
||||
)
|
||||
public Mask biome(Extent extent, BaseBiome biome) throws ExpressionException {
|
||||
public Mask biome(Extent extent, BiomeType biome) throws ExpressionException {
|
||||
return new BiomeMask(extent, biome);
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.util.command.binding.Range;
|
||||
import com.sk89q.worldedit.util.command.parametric.Optional;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import java.awt.Color;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
@ -268,7 +268,7 @@ public class PatternCommands extends MethodCommands {
|
||||
min = 1,
|
||||
max = 1
|
||||
)
|
||||
public Pattern biome(Actor actor, LocalSession session, Extent extent, BaseBiome biome) {
|
||||
public Pattern biome(Actor actor, LocalSession session, Extent extent, BiomeType biome) {
|
||||
return new BiomePattern(extent, biome);
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
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;
|
||||
|
||||
|
@ -55,7 +55,7 @@ public class ExpressionMaskParser extends InputParser<Mask> {
|
||||
if (context.getActor() instanceof SessionOwner) {
|
||||
SessionOwner owner = (SessionOwner) context.getActor();
|
||||
IntSupplier timeout = () -> WorldEdit.getInstance().getSessionManager().get(owner).getTimeout();
|
||||
return new ExpressionMask(exp, timeout);
|
||||
// TODO timeout
|
||||
}
|
||||
return new ExpressionMask(exp);
|
||||
} catch (ExpressionException e) {
|
||||
|
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* 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.function.operation;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.util.LocatedBlock;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SetLocatedBlocks implements Operation {
|
||||
|
||||
private final Extent extent;
|
||||
private final Iterable<LocatedBlock> blocks;
|
||||
|
||||
public SetLocatedBlocks(Extent extent, Iterable<LocatedBlock> blocks) {
|
||||
this.extent = checkNotNull(extent);
|
||||
this.blocks = checkNotNull(blocks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Operation resume(RunContext run) throws WorldEditException {
|
||||
for (LocatedBlock block : blocks) {
|
||||
extent.setBlock(block.getLocation(), block.getBlock());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addStatusMessages(List<String> messages) {
|
||||
}
|
||||
|
||||
}
|
@ -79,17 +79,17 @@ public abstract class ArbitraryBiomeShape {
|
||||
*
|
||||
* @param x X coordinate to be queried
|
||||
* @param z Z coordinate to be queried
|
||||
* @param defaultBaseBiome The default biome for the current column.
|
||||
* @param defaultBiomeType The default biome for the current column.
|
||||
* @return material to place or null to not place anything.
|
||||
*/
|
||||
protected abstract BiomeType getBiome(int x, int z, BiomeType defaultBaseBiome);
|
||||
protected abstract BiomeType getBiome(int x, int z, BiomeType defaultBiomeType);
|
||||
|
||||
private BiomeType getBiomeCached(int x, int z, BiomeType baseBiome) {
|
||||
private BiomeType getBiomeCached(int x, int z, BiomeType BiomeType) {
|
||||
final int index = (z - cacheOffsetZ) + (x - cacheOffsetX) * cacheSizeZ;
|
||||
|
||||
final BiomeType cacheEntry = cache[index];
|
||||
if (cacheEntry == null) {// unknown, fetch material
|
||||
final BiomeType material = getBiome(x, z, baseBiome);
|
||||
final BiomeType material = getBiome(x, z, BiomeType);
|
||||
if (material == null) {
|
||||
// outside
|
||||
cache[index] = BiomeTypes.THE_VOID;
|
||||
@ -108,13 +108,13 @@ public abstract class ArbitraryBiomeShape {
|
||||
return cacheEntry;
|
||||
}
|
||||
|
||||
private boolean isInsideCached(int x, int z, BiomeType baseBiome) {
|
||||
private boolean isInsideCached(int x, int z, BiomeType BiomeType) {
|
||||
final int index = (z - cacheOffsetZ) + (x - cacheOffsetX) * cacheSizeZ;
|
||||
|
||||
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 getBiomeCached(x, z, BiomeType) != null;
|
||||
}
|
||||
|
||||
return cacheEntry != BiomeTypes.THE_VOID;
|
||||
@ -124,11 +124,11 @@ public abstract class ArbitraryBiomeShape {
|
||||
* Generates the shape.
|
||||
*
|
||||
* @param editSession The EditSession to use.
|
||||
* @param baseBiome The default biome type.
|
||||
* @param BiomeType The default biome type.
|
||||
* @param hollow Specifies whether to generate a hollow shape.
|
||||
* @return number of affected blocks.
|
||||
*/
|
||||
public int generate(EditSession editSession, BiomeType baseBiome, boolean hollow) {
|
||||
public int generate(EditSession editSession, BiomeType BiomeType, boolean hollow) {
|
||||
int affected = 0;
|
||||
|
||||
for (BlockVector2 position : getExtent()) {
|
||||
@ -136,7 +136,7 @@ public abstract class ArbitraryBiomeShape {
|
||||
int z = position.getBlockZ();
|
||||
|
||||
if (!hollow) {
|
||||
final BiomeType material = getBiome(x, z, baseBiome);
|
||||
final BiomeType material = getBiome(x, z, BiomeType);
|
||||
if (material != null && material != BiomeTypes.THE_VOID) {
|
||||
editSession.getWorld().setBiome(position, material);
|
||||
++affected;
|
||||
@ -145,26 +145,26 @@ public abstract class ArbitraryBiomeShape {
|
||||
continue;
|
||||
}
|
||||
|
||||
final BiomeType material = getBiomeCached(x, z, baseBiome);
|
||||
final BiomeType material = getBiomeCached(x, z, BiomeType);
|
||||
if (material == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean draw = false;
|
||||
do {
|
||||
if (!isInsideCached(x + 1, z, baseBiome)) {
|
||||
if (!isInsideCached(x + 1, z, BiomeType)) {
|
||||
draw = true;
|
||||
break;
|
||||
}
|
||||
if (!isInsideCached(x - 1, z, baseBiome)) {
|
||||
if (!isInsideCached(x - 1, z, BiomeType)) {
|
||||
draw = true;
|
||||
break;
|
||||
}
|
||||
if (!isInsideCached(x, z + 1, baseBiome)) {
|
||||
if (!isInsideCached(x, z + 1, BiomeType)) {
|
||||
draw = true;
|
||||
break;
|
||||
}
|
||||
if (!isInsideCached(x, z - 1, baseBiome)) {
|
||||
if (!isInsideCached(x, z - 1, BiomeType)) {
|
||||
draw = true;
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user