couple more compilation issues

This commit is contained in:
Jesse Boyd 2019-07-23 06:58:18 +10:00
parent e53fc8a7f6
commit c05d425f64
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
22 changed files with 274 additions and 151 deletions

View File

@ -126,5 +126,5 @@ public interface IQueueExtent extends Flushable, Trimable, Extent {
boolean isEmpty(); boolean isEmpty();
void sendChunk(int chunkX, int chunkZ); void sendChunk(int chunkX, int chunkZ, int bitMask);
} }

View File

@ -5,7 +5,6 @@ import com.boydti.fawe.object.FawePlayer;
import com.boydti.fawe.object.brush.visualization.cfi.HeightMapMCAGenerator; import com.boydti.fawe.object.brush.visualization.cfi.HeightMapMCAGenerator;
import com.boydti.fawe.object.changeset.CFIChangeSet; import com.boydti.fawe.object.changeset.CFIChangeSet;
import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.util.formatting.text.TextComponent; import com.sk89q.worldedit.util.formatting.text.TextComponent;
import org.enginehub.piston.CommandManager; import org.enginehub.piston.CommandManager;
import org.enginehub.piston.exception.StopExecutionException; import org.enginehub.piston.exception.StopExecutionException;

View File

@ -1,10 +1,7 @@
package com.boydti.fawe.command; package com.boydti.fawe.command;
import static com.boydti.fawe.util.image.ImageUtil.load;
import com.boydti.fawe.Fawe; import com.boydti.fawe.Fawe;
import com.boydti.fawe.FaweAPI; import com.boydti.fawe.FaweAPI;
import com.boydti.fawe.beta.IQueueExtent;
import com.boydti.fawe.beta.SingleFilterBlock; import com.boydti.fawe.beta.SingleFilterBlock;
import com.boydti.fawe.config.BBC; import com.boydti.fawe.config.BBC;
import com.boydti.fawe.config.Commands; import com.boydti.fawe.config.Commands;
@ -21,23 +18,11 @@ import com.boydti.fawe.util.TaskManager;
import com.boydti.fawe.util.TextureUtil; import com.boydti.fawe.util.TextureUtil;
import com.boydti.fawe.util.chat.Message; import com.boydti.fawe.util.chat.Message;
import com.boydti.fawe.util.image.ImageUtil; import com.boydti.fawe.util.image.ImageUtil;
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
import java.nio.file.Path;
import java.util.function.Consumer;
import java.util.stream.IntStream;
import com.sk89q.worldedit.extension.platform.binding.ProvideBindings;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import org.enginehub.piston.annotation.Command;
import org.enginehub.piston.exception.StopExecutionException;
import org.enginehub.piston.inject.InjectedValueAccess;
import com.sk89q.minecraft.util.commands.CommandException; import com.sk89q.minecraft.util.commands.CommandException;
import com.sk89q.worldedit.EmptyClipboardException; import com.sk89q.worldedit.EmptyClipboardException;
import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.command.MethodCommands;
import com.sk89q.worldedit.command.util.CommandPermissions; import com.sk89q.worldedit.command.util.CommandPermissions;
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator; import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.entity.Player;
@ -45,6 +30,7 @@ import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.extension.platform.Capability;
import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.extension.platform.Platform;
import com.sk89q.worldedit.extension.platform.binding.ProvideBindings;
import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats; import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.Mask;
@ -55,11 +41,20 @@ import com.sk89q.worldedit.registry.state.PropertyKey;
import com.sk89q.worldedit.session.ClipboardHolder; import com.sk89q.worldedit.session.ClipboardHolder;
import com.sk89q.worldedit.session.request.Request; import com.sk89q.worldedit.session.request.Request;
import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes;
import org.enginehub.piston.annotation.Command;
import org.enginehub.piston.annotation.CommandContainer;
import org.enginehub.piston.annotation.param.Arg;
import org.enginehub.piston.annotation.param.Switch;
import org.enginehub.piston.exception.StopExecutionException;
import org.enginehub.piston.inject.InjectedValueAccess;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.awt.image.DataBufferInt; import java.awt.image.DataBufferInt;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
@ -67,6 +62,7 @@ import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.net.URL; import java.net.URL;
import java.nio.file.Path;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayDeque; import java.util.ArrayDeque;
@ -74,17 +70,15 @@ import java.util.Date;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.function.Consumer;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.IntStream; import java.util.stream.IntStream;
import javax.imageio.ImageIO;
import org.enginehub.piston.annotation.Command; import static com.boydti.fawe.util.image.ImageUtil.load;
import org.enginehub.piston.annotation.CommandContainer; import static com.sk89q.worldedit.command.MethodCommands.*;
import org.enginehub.piston.annotation.param.Arg;
import org.enginehub.piston.annotation.param.Switch;
import org.enginehub.piston.inject.InjectedValueAccess;
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class) @CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
public class CFICommands extends MethodCommands { public class CFICommands {
private final WorldEdit worldEdit; private final WorldEdit worldEdit;
@ -104,18 +98,6 @@ public class CFICommands extends MethodCommands {
return new File(path.toFile().getParentFile().getParentFile(), worldName + File.separator + "region"); return new File(path.toFile().getParentFile().getParentFile(), worldName + File.separator + "region");
} }
@Command(
name = "",
desc = "CFI command"
)
@CommandPermissions("worldedit.anvil.cfi")
public void cfi(FawePlayer fp, List<String> args) {
CFISettings settings = getSettings(fp);
if (!settings.hasGenerator()) {
}
}
@Command( @Command(
name = "heightmap", name = "heightmap",
desc = "Start CFI with a height map as a base" desc = "Start CFI with a height map as a base"
@ -1046,7 +1028,6 @@ public class CFICommands extends MethodCommands {
.send(fp); .send(fp);
} }
private static CFISettings assertSettings(FawePlayer fp) { private static CFISettings assertSettings(FawePlayer fp) {
CFISettings settings = getSettings(fp); CFISettings settings = getSettings(fp);
if (!settings.hasGenerator()) { if (!settings.hasGenerator()) {

View File

@ -70,7 +70,7 @@ public abstract class CommandProcessor<I, O> implements CommandManager {
public final O /* Need to recompile with FAWE-piston */ execute(InjectedValueAccess context, List<String> args) { public final O /* Need to recompile with FAWE-piston */ execute(InjectedValueAccess context, List<String> args) {
args = preprocess(context, args); args = preprocess(context, args);
if (args != null) { if (args != null) {
I result = (I) (Object) parent.execute(context, args); I result = (I) parent.execute(context, args);
return process(context, args, result); // TODO NOT IMPLEMENTED (recompile piston) return process(context, args, result); // TODO NOT IMPLEMENTED (recompile piston)
} else { } else {
return null; return null;

View File

@ -63,7 +63,7 @@ public class BrushSettings {
if (constructor == null) { if (constructor == null) {
return new BrushSettings(); return new BrushSettings();
} }
BrushSettings bs = (BrushSettings) manager.parseArgs(constructor); BrushSettings bs = (BrushSettings) manager.parse(BrushSettings.class, constructor, player);
bs.constructor.put(SettingType.BRUSH, constructor); bs.constructor.put(SettingType.BRUSH, constructor);
if (settings.containsKey(SettingType.PERMISSIONS.name())) { if (settings.containsKey(SettingType.PERMISSIONS.name())) {
bs.permissions.addAll((Collection<? extends String>) settings.get(SettingType.PERMISSIONS.name())); bs.permissions.addAll((Collection<? extends String>) settings.get(SettingType.PERMISSIONS.name()));

View File

@ -11,6 +11,7 @@ import com.boydti.fawe.util.MathMan;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.command.tool.brush.Brush; import com.sk89q.worldedit.command.tool.brush.Brush;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.mask.Masks; import com.sk89q.worldedit.function.mask.Masks;
@ -75,7 +76,7 @@ public class HeightBrush implements Brush {
HeightMap map = getHeightMap(); HeightMap map = getHeightMap();
map.setSize(size); map.setSize(size);
IQueueExtent queue = editSession.getQueue(); Extent queue = editSession.getExtent();
// Optimized application of height map // Optimized application of height map
if (queue instanceof HeightMapMCAGenerator) { if (queue instanceof HeightMapMCAGenerator) {
HeightMapMCAGenerator hmmg = (HeightMapMCAGenerator) queue; HeightMapMCAGenerator hmmg = (HeightMapMCAGenerator) queue;
@ -85,8 +86,6 @@ public class HeightBrush implements Brush {
hmmg.getMetaData().setMeta("PRECISION_HEIGHT", metaHeight = new byte[hmmg.getArea()]); hmmg.getMetaData().setMeta("PRECISION_HEIGHT", metaHeight = new byte[hmmg.getArea()]);
} }
Vector3 origin = hmmg.getOrigin();
int bx = position.getBlockX(); int bx = position.getBlockX();
int bz = position.getBlockZ(); int bz = position.getBlockZ();

View File

@ -32,7 +32,7 @@ public class ScatterCommand extends ScatterBrush {
String replaced = command.replace("{x}", position.getBlockX() + "") String replaced = command.replace("{x}", position.getBlockX() + "")
.replace("{y}", Integer.toString(position.getBlockY())) .replace("{y}", Integer.toString(position.getBlockY()))
.replace("{z}", Integer.toString(position.getBlockZ())) .replace("{z}", Integer.toString(position.getBlockZ()))
.replace("{world}", editSession.getQueue().getWorldName()) .replace("{world}", editSession.getWorld().getName())
.replace("{size}", Integer.toString(radius)); .replace("{size}", Integer.toString(radius));
FawePlayer fp = editSession.getPlayer(); FawePlayer fp = editSession.getPlayer();

View File

@ -2,7 +2,6 @@ package com.boydti.fawe.object.change;
import com.boydti.fawe.Fawe; import com.boydti.fawe.Fawe;
import com.boydti.fawe.beta.IQueueExtent; import com.boydti.fawe.beta.IQueueExtent;
import com.boydti.fawe.object.HasIQueueExtent;
import com.boydti.fawe.util.ExtentTraverser; import com.boydti.fawe.util.ExtentTraverser;
import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.IntTag; import com.sk89q.jnbt.IntTag;

View File

@ -3,26 +3,34 @@ package com.boydti.fawe.object.extent;
import com.boydti.fawe.config.BBC; import com.boydti.fawe.config.BBC;
import com.boydti.fawe.object.FaweLimit; import com.boydti.fawe.object.FaweLimit;
import com.boydti.fawe.object.exception.FaweException; import com.boydti.fawe.object.exception.FaweException;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
import com.sk89q.worldedit.function.generator.GenBase;
import com.sk89q.worldedit.function.generator.Resource;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.operation.Operation;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.session.ClipboardHolder;
import com.sk89q.worldedit.util.Countable;
import com.sk89q.worldedit.util.Location; 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.BiomeType;
import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Set;
public class NullExtent extends FaweRegionExtent { public class NullExtent extends FaweRegionExtent {
@ -53,26 +61,27 @@ public class NullExtent extends FaweRegionExtent {
@Override @Override
public BiomeType getBiome(final BlockVector2 arg0) { public BiomeType getBiome(final BlockVector2 arg0) {
if(reason != null) {
throw reason; throw reason;
} }
return null;
@Override
public BiomeType getBiomeType(int x, int z) {
throw reason;
} }
@Override @Override
public BlockState getBlock(final BlockVector3 arg0) { public BlockState getBlock(final BlockVector3 arg0) {
if(reason != null) {
throw reason; throw reason;
} }
return null;
}
@Override @Override
public BlockState getBlock(int x, int y, int z) { public BlockState getBlock(int x, int y, int z) {
if(reason != null) {
throw reason; throw reason;
} }
return null;
@Override
public BaseBlock getFullBlock(BlockVector3 position) {
throw reason;
} }
@Override @Override
@ -85,44 +94,73 @@ public class NullExtent extends FaweRegionExtent {
@Override @Override
public boolean setBiome(final BlockVector2 arg0, final BiomeType arg1) { public boolean setBiome(final BlockVector2 arg0, final BiomeType arg1) {
if(reason != null) {
throw reason; throw reason;
} }
return false;
@Override
public boolean setBiome(int x, int y, int z, BiomeType biome) {
throw reason;
} }
@Override @Override
public boolean setBlock(final BlockVector3 arg0, final BlockStateHolder arg1) throws WorldEditException { public boolean setBlock(final BlockVector3 arg0, final BlockStateHolder arg1) throws WorldEditException {
if(reason != null) {
throw reason; throw reason;
} }
return false;
}
@Override @Override
public boolean setBlock(int x, int y, int z, BlockStateHolder block) throws WorldEditException { public boolean setBlock(int x, int y, int z, BlockStateHolder block) throws WorldEditException {
if(reason != null) {
throw reason; throw reason;
} }
return false;
@Nullable
@Override
public Entity createEntity(final Location arg0, final BaseEntity arg1) {
throw reason;
} }
@Override @Override
public Entity createEntity(final Location arg0, final BaseEntity arg1) { public boolean isQueueEnabled() {
if(reason != null) {
throw reason; throw reason;
} }
return null;
@Override
public void enableQueue() {
throw reason;
}
@Override
public void disableQueue() {
throw reason;
}
@Override
public boolean isWorld() {
throw reason;
}
@Override
public boolean regenerateChunk(int x, int z, @Nullable BiomeType type, @Nullable Long seed) {
throw reason;
}
@Override
public int getHighestTerrainBlock(int x, int z, int minY, int maxY) {
throw reason;
}
@Override
public int getHighestTerrainBlock(int x, int z, int minY, int maxY, Mask filter) {
throw reason;
} }
@Override @Override
public List<? extends Entity> getEntities() { public List<? extends Entity> getEntities() {
return new ArrayList<>(); throw reason;
} }
@Override @Override
public List<? extends Entity> getEntities(final Region arg0) { public List<? extends Entity> getEntities(final Region arg0) {
return new ArrayList<>(); throw reason;
} }
@Override @Override
@ -137,57 +175,157 @@ public class NullExtent extends FaweRegionExtent {
@Override @Override
public boolean contains(int x, int z) { public boolean contains(int x, int z) {
if(reason != null) {
throw reason; throw reason;
} }
return false;
}
@Override @Override
public boolean contains(int x, int y, int z) { public boolean contains(int x, int y, int z) {
if(reason != null) {
throw reason; throw reason;
} }
return false;
}
@Override @Override
public Collection<Region> getRegions() { public Collection<Region> getRegions() {
return Collections.emptyList(); throw reason;
} }
@Nullable @Nullable
@Override @Override
public Operation commit() { public Operation commit() {
return null; throw reason;
}
@Override
public boolean cancel() {
throw reason;
}
@Override
public int getMaxY() {
throw reason;
}
@Override
public BlockArrayClipboard lazyCopy(Region region) {
throw reason;
}
@Override
public int countBlocks(Region region, Set<BaseBlock> searchBlocks) {
throw reason;
}
@Override
public int countBlocks(Region region, Mask searchMask) {
throw reason;
}
@Override
public <B extends BlockStateHolder<B>> int setBlocks(Region region, B block) throws MaxChangedBlocksException {
throw reason;
}
@Override
public int setBlocks(Region region, Pattern pattern) throws MaxChangedBlocksException {
throw reason;
}
@Override
public <B extends BlockStateHolder<B>> int replaceBlocks(Region region, Set<BaseBlock> filter, B replacement) throws MaxChangedBlocksException {
throw reason;
}
@Override
public int replaceBlocks(Region region, Set<BaseBlock> filter, Pattern pattern) throws MaxChangedBlocksException {
throw reason;
}
@Override
public int replaceBlocks(Region region, Mask mask, Pattern pattern) throws MaxChangedBlocksException {
throw reason;
}
@Override
public int center(Region region, Pattern pattern) throws MaxChangedBlocksException {
throw reason;
}
@Override
public int setBlocks(Set<BlockVector3> vset, Pattern pattern) {
throw reason;
}
@Override
public World getWorld() {
throw reason;
} }
@Override @Override
public int getNearestSurfaceLayer(int x, int z, int y, int minY, int maxY) { public int getNearestSurfaceLayer(int x, int z, int y, int minY, int maxY) {
if(reason != null) {
throw reason; throw reason;
} }
return -1;
@Override
public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY, boolean ignoreAir) {
throw reason;
} }
@Override @Override
public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY) { public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY) {
if(reason != null) {
throw reason; throw reason;
} }
return -1;
}
@Override @Override
public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY, int failedMin, int failedMax) { public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY, int failedMin, int failedMax) {
if(reason != null) {
throw reason; throw reason;
} }
return -1;
}
@Override @Override
public Extent getExtent() { public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY, int failedMin, int failedMax, Mask mask) {
return this; throw reason;
}
@Override
public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY, int failedMin, int failedMax, boolean ignoreAir) {
throw reason;
}
@Override
public void addCaves(Region region) throws WorldEditException {
throw reason;
}
@Override
public void generate(Region region, GenBase gen) throws WorldEditException {
throw reason;
}
@Override
public void addSchems(Region region, Mask mask, List<ClipboardHolder> clipboards, int rarity, boolean rotate) throws WorldEditException {
throw reason;
}
@Override
public void spawnResource(Region region, Resource gen, int rarity, int frequency) throws WorldEditException {
throw reason;
}
@Override
public void addOre(Region region, Mask mask, Pattern material, int size, int frequency, int rarity, int minY, int maxY) throws WorldEditException {
throw reason;
}
@Override
public void addOres(Region region, Mask mask) throws WorldEditException {
throw reason;
}
@Override
public List<Countable<BlockType>> getBlockDistribution(Region region) {
throw reason;
}
@Override
public List<Countable<BlockState>> getBlockDistributionWithData(Region region) {
throw reason;
} }
} }

View File

@ -1,6 +1,5 @@
package com.boydti.fawe.object.schematic; package com.boydti.fawe.object.schematic;
import com.boydti.fawe.object.HasIQueueExtent;
import com.boydti.fawe.object.clipboard.FaweClipboard; import com.boydti.fawe.object.clipboard.FaweClipboard;
import com.boydti.fawe.object.clipboard.ReadOnlyClipboard; import com.boydti.fawe.object.clipboard.ReadOnlyClipboard;
import com.boydti.fawe.util.EditSessionBuilder; import com.boydti.fawe.util.EditSessionBuilder;
@ -266,7 +265,7 @@ public class Schematic {
extent.setBlock(xx, mutable.getBlockY() + rely, zz, block); extent.setBlock(xx, mutable.getBlockY() + rely, zz, block);
return false; return false;
} }
}, (HasIQueueExtent) (null)); });
Operations.completeBlindly(visitor); Operations.completeBlindly(visitor);
} }
// Entity offset is the paste location subtract the clipboard origin (entity's location is already relative to the world origin) // Entity offset is the paste location subtract the clipboard origin (entity's location is already relative to the world origin)

View File

@ -1,14 +1,10 @@
package com.boydti.fawe.object.visitor; package com.boydti.fawe.object.visitor;
import com.boydti.fawe.object.HasIQueueExtent;
import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.function.RegionFunction;
import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.visitor.RecursiveVisitor; import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import java.util.Arrays;
import java.util.Collection;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
@ -31,11 +27,11 @@ public class AboveVisitor extends RecursiveVisitor {
* @param baseY the base Y * @param baseY the base Y
*/ */
public AboveVisitor(Mask mask, RegionFunction function, int baseY) { public AboveVisitor(Mask mask, RegionFunction function, int baseY) {
this(mask, function, baseY, Integer.MAX_VALUE, null); this(mask, function, baseY, Integer.MAX_VALUE);
} }
public AboveVisitor(Mask mask, RegionFunction function, int baseY, int depth, HasIQueueExtent hasIQueueExtent) { public AboveVisitor(Mask mask, RegionFunction function, int baseY, int depth) {
super(mask, function, depth, hasIQueueExtent); super(mask, function, depth);
checkNotNull(mask); checkNotNull(mask);
this.baseY = baseY; this.baseY = baseY;

View File

@ -121,7 +121,7 @@ public class FaweLocalBlockQueue extends LocalBlockQueue {
@Override @Override
public void refreshChunk(int x, int z) { public void refreshChunk(int x, int z) {
IMP.sendChunk(x, z); IMP.sendChunk(x, z, 0);
} }
@Override @Override

View File

@ -59,7 +59,6 @@ import java.lang.reflect.Method;
import java.lang.reflect.Parameter; import java.lang.reflect.Parameter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
import java.util.List; import java.util.List;
@SuppressWarnings("UseOfSystemOutOrSystemErr") @SuppressWarnings("UseOfSystemOutOrSystemErr")

View File

@ -124,11 +124,13 @@ import org.enginehub.piston.annotation.param.Switch;
import org.enginehub.piston.inject.InjectedValueAccess; import org.enginehub.piston.inject.InjectedValueAccess;
import org.enginehub.piston.inject.Key; import org.enginehub.piston.inject.Key;
import static com.sk89q.worldedit.command.MethodCommands.*;
/** /**
* Commands to set brush shape. * Commands to set brush shape.
*/ */
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class) @CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
public class BrushCommands extends MethodCommands { public class BrushCommands {
private final WorldEdit worldEdit; private final WorldEdit worldEdit;
@ -298,8 +300,8 @@ public class BrushCommands extends MethodCommands {
} }
@Command( @Command(
name = "sspl", name = "surfacespline",
aliases = {"sspline", "surfacespline"}, aliases = {"sspline", "sspl"},
desc = "Draws a spline (curved line) on the surface", desc = "Draws a spline (curved line) on the surface",
descFooter = "Create a spline on the surface\n" + descFooter = "Create a spline on the surface\n" +
"Video: https://www.youtube.com/watch?v=zSN-2jJxXlM" "Video: https://www.youtube.com/watch?v=zSN-2jJxXlM"
@ -549,8 +551,8 @@ public class BrushCommands extends MethodCommands {
} }
@Command( @Command(
name = "scmd", name = "scattercommand",
aliases = {"scattercmd", "scattercommand", "scommand"}, aliases = {"scattercmd", "scmd", "scommand"},
desc = "Run commands at random points on a surface", desc = "Run commands at random points on a surface",
descFooter = descFooter =
"Run commands at random points on a surface\n" + "Run commands at random points on a surface\n" +

View File

@ -48,18 +48,20 @@ import org.enginehub.piston.annotation.Command;
import org.enginehub.piston.annotation.param.Arg; import org.enginehub.piston.annotation.param.Arg;
import org.enginehub.piston.annotation.param.Switch; import org.enginehub.piston.annotation.param.Switch;
@Command(aliases = {"masks"}, //@Command(aliases = {"masks"},
desc = "Help for the various masks. [More Info](https://git.io/v9r4K)", // desc = "Help for the various masks. [More Info](https://git.io/v9r4K)",
descFooter = "Masks determine if a block can be placed\n" + // descFooter = "Masks determine if a block can be placed\n" +
" - Use [brackets] for arguments\n" + // " - Use [brackets] for arguments\n" +
" - Use , to OR multiple\n" + // " - Use , to OR multiple\n" +
" - Use & to AND multiple\n" + // " - Use & to AND multiple\n" +
"e.g. >[stone,dirt],#light[0][5],$jungle\n" + // "e.g. >[stone,dirt],#light[0][5],$jungle\n" +
"More Info: https://git.io/v9r4K" // "More Info: https://git.io/v9r4K"
) //)
public class MaskCommands extends MethodCommands { public class MaskCommands extends MethodCommands {
private final WorldEdit worldEdit;
public MaskCommands(WorldEdit worldEdit) { public MaskCommands(WorldEdit worldEdit) {
super(worldEdit); this.worldEdit = worldEdit;
} }
@Command( @Command(

View File

@ -15,7 +15,7 @@ import java.util.Optional;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
public class MethodCommands { public class MethodCommands {
public Command getCommand() { public static Command getCommand() {
try { try {
StackTraceElement[] stack = new Exception().getStackTrace(); StackTraceElement[] stack = new Exception().getStackTrace();
for (StackTraceElement elem : stack) { for (StackTraceElement elem : stack) {
@ -33,7 +33,7 @@ public class MethodCommands {
return null; return null;
} }
public String getArguments(InjectedValueAccess context) { public static String getArguments(InjectedValueAccess context) {
if (context == null) return null; if (context == null) return null;
Optional<Arguments> arguments = context.injectedValue(Key.of(Arguments.class)); Optional<Arguments> arguments = context.injectedValue(Key.of(Arguments.class));
if (arguments.isPresent()) { if (arguments.isPresent()) {
@ -42,7 +42,7 @@ public class MethodCommands {
return null; return null;
} }
public String[] getPermissions(InjectedValueAccess context) { public static String[] getPermissions(InjectedValueAccess context) {
CommandPermissions cmdPerms = context.injectedValue(Key.of(CommandPermissions.class)).orElse(null); CommandPermissions cmdPerms = context.injectedValue(Key.of(CommandPermissions.class)).orElse(null);
if (cmdPerms != null) { if (cmdPerms != null) {
return cmdPerms.value(); return cmdPerms.value();

View File

@ -23,6 +23,9 @@ import static com.google.common.base.Preconditions.checkNotNull;
import com.boydti.fawe.Fawe; import com.boydti.fawe.Fawe;
import com.boydti.fawe.command.AnvilCommands; import com.boydti.fawe.command.AnvilCommands;
import com.boydti.fawe.command.AnvilCommandsRegistration;
import com.boydti.fawe.command.CFICommand;
import com.boydti.fawe.command.CFICommands;
import com.boydti.fawe.config.BBC; import com.boydti.fawe.config.BBC;
import com.boydti.fawe.config.Settings; import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.FawePlayer; import com.boydti.fawe.object.FawePlayer;
@ -33,7 +36,6 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.common.reflect.TypeToken; import com.google.common.reflect.TypeToken;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.IncompleteRegionException;
import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
@ -105,7 +107,6 @@ import com.sk89q.worldedit.extension.platform.binding.CommandBindings;
import com.sk89q.worldedit.extension.platform.binding.ConsumeBindings; import com.sk89q.worldedit.extension.platform.binding.ConsumeBindings;
import com.sk89q.worldedit.extension.platform.binding.ProvideBindings; import com.sk89q.worldedit.extension.platform.binding.ProvideBindings;
import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.internal.annotation.Selection;
import com.sk89q.worldedit.internal.command.CommandArgParser; import com.sk89q.worldedit.internal.command.CommandArgParser;
import com.sk89q.worldedit.internal.command.CommandLoggingHandler; import com.sk89q.worldedit.internal.command.CommandLoggingHandler;
import com.sk89q.worldedit.internal.command.CommandRegistrationHandler; import com.sk89q.worldedit.internal.command.CommandRegistrationHandler;
@ -161,7 +162,6 @@ import org.enginehub.piston.part.SubCommandPart;
import org.enginehub.piston.suggestion.Suggestion; import org.enginehub.piston.suggestion.Suggestion;
import org.enginehub.piston.util.HelpGenerator; import org.enginehub.piston.util.HelpGenerator;
import org.enginehub.piston.util.ValueProvider; import org.enginehub.piston.util.ValueProvider;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -250,9 +250,8 @@ public final class PlatformCommandManager {
RegionFactoryConverter.register(commandManager); RegionFactoryConverter.register(commandManager);
} }
public void register(Object classWithMethods) { public void registerAlwaysInjectedValues() {
globalInjectedValues.injectValue(Key.of(InjectedValueAccess.class), Optional::of); globalInjectedValues.injectValue(Key.of(InjectedValueAccess.class), Optional::of);
// TODO NOT IMPLEMENTED - register the following using a custom processor / annotations
register(new AnnotatedBindings(worldEdit)); register(new AnnotatedBindings(worldEdit));
register(new CommandBindings(worldEdit)); register(new CommandBindings(worldEdit));
register(new ConsumeBindings(worldEdit)); register(new ConsumeBindings(worldEdit));
@ -260,6 +259,10 @@ public final class PlatformCommandManager {
register(new ProvideBindings(worldEdit)); register(new ProvideBindings(worldEdit));
} }
public void register(Object classWithMethods) {
// TODO NOT IMPLEMENTED - register the following using a custom processor / annotations
}
private <CI> void registerSubCommands(String name, List<String> aliases, String desc, private <CI> void registerSubCommands(String name, List<String> aliases, String desc,
CommandRegistration<CI> registration, CI instance) { CommandRegistration<CI> registration, CI instance) {
registerSubCommands(name, aliases, desc, registration, instance, m -> {}); registerSubCommands(name, aliases, desc, registration, instance, m -> {});
@ -384,6 +387,11 @@ public final class PlatformCommandManager {
GenerationCommandsRegistration.builder(), GenerationCommandsRegistration.builder(),
new GenerationCommands(worldEdit) new GenerationCommands(worldEdit)
); );
this.registration.register(
new CFICommand(commandManager),
CFICommands.builder(),
new CFICommands(worldEdit)
);
this.registration.register( this.registration.register(
commandManager, commandManager,
HistoryCommandsRegistration.builder(), HistoryCommandsRegistration.builder(),

View File

@ -22,7 +22,6 @@ package com.sk89q.worldedit.function.visitor;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import com.boydti.fawe.config.BBC; import com.boydti.fawe.config.BBC;
import com.boydti.fawe.example.MappedIQueueExtent;
import com.boydti.fawe.object.collection.BlockVectorSet; import com.boydti.fawe.object.collection.BlockVectorSet;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.function.RegionFunction;
@ -37,8 +36,6 @@ import java.util.Collection;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import static com.google.common.base.Preconditions.checkNotNull;
/** /**
* Performs a breadth-first search starting from points added with * Performs a breadth-first search starting from points added with
* {@link #visit(BlockVector3)}. The search continues * {@link #visit(BlockVector3)}. The search continues

View File

@ -19,8 +19,6 @@
package com.sk89q.worldedit.function.visitor; package com.sk89q.worldedit.function.visitor;
import com.boydti.fawe.object.HasIQueueExtent;
import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.function.RegionFunction;
import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
@ -39,11 +37,11 @@ public class NonRisingVisitor extends RecursiveVisitor {
* @param function the function * @param function the function
*/ */
public NonRisingVisitor(Mask mask, RegionFunction function) { public NonRisingVisitor(Mask mask, RegionFunction function) {
this(mask, function, Integer.MAX_VALUE, null); this(mask, function, Integer.MAX_VALUE);
} }
public NonRisingVisitor(Mask mask, RegionFunction function, int depth, HasIQueueExtent hasIQueueExtent) { public NonRisingVisitor(Mask mask, RegionFunction function, int depth) {
super(mask, function, depth, hasIQueueExtent); super(mask, function, depth);
setDirections( setDirections(
BlockVector3.UNIT_X, BlockVector3.UNIT_X,
BlockVector3.UNIT_MINUS_X, BlockVector3.UNIT_MINUS_X,

View File

@ -19,8 +19,6 @@
package com.sk89q.worldedit.internal.annotation; package com.sk89q.worldedit.internal.annotation;
import com.sk89q.worldedit.util.command.binding.PrimitiveBindings;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;

View File

@ -41,6 +41,7 @@ import com.sk89q.worldedit.world.weather.WeatherType;
import com.sk89q.worldedit.world.weather.WeatherTypes; import com.sk89q.worldedit.world.weather.WeatherTypes;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.function.Supplier;
/** /**
* An abstract implementation of {@link World}. * An abstract implementation of {@link World}.
@ -105,7 +106,7 @@ public interface SimpleWorld extends World {
@Override @Override
default boolean queueBlockBreakEffect(Platform server, BlockVector3 position, BlockType blockType, double priority) { default boolean queueBlockBreakEffect(Platform server, BlockVector3 position, BlockType blockType, double priority) {
Fawe.get().getQueueHandler().sync(() -> playEffect(position, 2001, blockType.getLegacyCombinedId() >> 4)); Fawe.get().getQueueHandler().sync((Supplier<Boolean>) () -> playEffect(position, 2001, blockType.getLegacyCombinedId() >> 4));
return true; return true;
} }

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.world; package com.sk89q.worldedit.world;
import com.boydti.fawe.object.extent.LightingExtent;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
@ -127,7 +128,13 @@ public interface World extends Extent {
* @param position the position * @param position the position
* @return the light level (0-15) * @return the light level (0-15)
*/ */
int getBlockLightLevel(BlockVector3 position); default int getBlockLightLevel(BlockVector3 position) {
if (this instanceof LightingExtent) {
LightingExtent extent = (LightingExtent) this;
return extent.getBlockLight(position.getX(), position.getY(), position.getZ());
}
return getBlock(position).getMaterial().getLightValue();
}
/** /**
* Clear a chest's contents. * Clear a chest's contents.