mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-05 20:36:42 +00:00
Fixed a bunch of extends and removed slottableblockbag
This commit is contained in:
@ -12,7 +12,7 @@ import com.sk89q.worldedit.extent.PassthroughExtent;
|
||||
public class MemoryCheckingExtent extends PassthroughExtent {
|
||||
private final Player player;
|
||||
|
||||
public MemoryCheckingExtent(final Player player, final Extent extent) {
|
||||
public MemoryCheckingExtent(Player player, Extent extent) {
|
||||
super(extent);
|
||||
this.player = player;
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.boydti.fawe.object.extent;
|
||||
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
@ -10,7 +9,7 @@ import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@ -32,24 +31,21 @@ public class MultiTransform extends RandomTransform {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(int x, int y, int z, BlockStateHolder block) throws WorldEditException {
|
||||
boolean result = false;
|
||||
for (AbstractDelegateExtent extent : extents) result |= extent.setBlock(x, y, z, block);
|
||||
return result;
|
||||
public <T extends BlockStateHolder<T>> boolean setBlock(int x, int y, int z, T block) throws WorldEditException {
|
||||
return Arrays.stream(extents).map(extent -> extent.setBlock(x, y, z, block))
|
||||
.reduce(false, (a, b) -> a || b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException {
|
||||
boolean result = false;
|
||||
for (AbstractDelegateExtent extent : extents) result |= extent.setBlock(location, block);
|
||||
return result;
|
||||
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 location, T block) throws WorldEditException {
|
||||
return Arrays.stream(extents).map(extent -> extent.setBlock(location, block))
|
||||
.reduce(false, (a, b) -> a || b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(BlockVector2 position, BiomeType biome) {
|
||||
boolean result = false;
|
||||
for (AbstractDelegateExtent extent : extents) result |= extent.setBiome(position, biome);
|
||||
return result;
|
||||
return Arrays.stream(extents).map(extent -> extent.setBiome(position, biome))
|
||||
.reduce(false, (a, b) -> a || b);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -20,17 +20,15 @@ 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.world.World;
|
||||
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;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class NullExtent extends FaweRegionExtent {
|
||||
|
||||
@ -60,7 +58,7 @@ public class NullExtent extends FaweRegionExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeType getBiome(final BlockVector2 arg0) {
|
||||
public BiomeType getBiome(BlockVector2 arg0) {
|
||||
throw reason;
|
||||
}
|
||||
|
||||
@ -70,7 +68,7 @@ public class NullExtent extends FaweRegionExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getBlock(final BlockVector3 arg0) {
|
||||
public BlockState getBlock(BlockVector3 arg0) {
|
||||
throw reason;
|
||||
}
|
||||
|
||||
@ -93,7 +91,7 @@ public class NullExtent extends FaweRegionExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(final BlockVector2 arg0, final BiomeType arg1) {
|
||||
public boolean setBiome(BlockVector2 arg0, BiomeType arg1) {
|
||||
throw reason;
|
||||
}
|
||||
|
||||
@ -103,18 +101,18 @@ public class NullExtent extends FaweRegionExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(final BlockVector3 arg0, final BlockStateHolder arg1) throws WorldEditException {
|
||||
public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 arg0, B arg1) throws WorldEditException {
|
||||
throw reason;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(int x, int y, int z, BlockStateHolder block) throws WorldEditException {
|
||||
public <B extends BlockStateHolder<B>> boolean setBlock(int x, int y, int z, B block) throws WorldEditException {
|
||||
throw reason;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Entity createEntity(final Location arg0, final BaseEntity arg1) {
|
||||
public Entity createEntity(Location arg0, BaseEntity arg1) {
|
||||
throw reason;
|
||||
}
|
||||
|
||||
@ -159,7 +157,7 @@ public class NullExtent extends FaweRegionExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Entity> getEntities(final Region arg0) {
|
||||
public List<? extends Entity> getEntities(Region arg0) {
|
||||
throw reason;
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ public class PatternTransform extends ResettableExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException {
|
||||
public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 location, B block) throws WorldEditException {
|
||||
return pattern.apply(getExtent(), location, location);
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
||||
private final FaweLimit limit;
|
||||
private final AbstractDelegateExtent extent;
|
||||
|
||||
public ProcessedWEExtent(final Extent parent, FaweLimit limit) {
|
||||
public ProcessedWEExtent(Extent parent, FaweLimit limit) {
|
||||
super(parent);
|
||||
this.limit = limit;
|
||||
this.extent = (AbstractDelegateExtent) parent;
|
||||
@ -32,7 +32,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity createEntity(final Location location, final BaseEntity entity) {
|
||||
public Entity createEntity(Location location, BaseEntity entity) {
|
||||
if (entity == null) {
|
||||
return null;
|
||||
}
|
||||
@ -64,7 +64,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <B extends BlockStateHolder<B>> boolean setBlock(final BlockVector3 location, final B block) throws WorldEditException {
|
||||
public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 location, B block) throws WorldEditException {
|
||||
return setBlock(location.getBlockX(), location.getBlockY(), location.getBlockZ(), block);
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
||||
|
||||
@Override
|
||||
public <B extends BlockStateHolder<B>> boolean setBlock(int x, int y, int z, B block) throws WorldEditException {
|
||||
boolean hasNbt = block instanceof BaseBlock && ((BaseBlock)block).hasNbtData();
|
||||
boolean hasNbt = block instanceof BaseBlock && block.hasNbtData();
|
||||
if (hasNbt) {
|
||||
if (!limit.MAX_BLOCKSTATES()) {
|
||||
WEManager.IMP.cancelEdit(this, FaweException.MAX_TILES);
|
||||
@ -97,7 +97,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(final BlockVector2 position, final BiomeType biome) {
|
||||
public boolean setBiome(BlockVector2 position, BiomeType biome) {
|
||||
if (!limit.MAX_CHANGES()) {
|
||||
WEManager.IMP.cancelEditSafe(this, FaweException.MAX_CHANGES);
|
||||
return false;
|
||||
|
@ -33,7 +33,7 @@ public class RandomOffsetTransform extends ResettableExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(BlockVector3 pos, BlockStateHolder block) throws WorldEditException {
|
||||
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 pos, T block) throws WorldEditException {
|
||||
int x = pos.getBlockX() + random.nextInt(1 + (dx << 1)) - dx;
|
||||
int y = pos.getBlockY() + random.nextInt(1 + (dy << 1)) - dy;
|
||||
int z = pos.getBlockZ() + random.nextInt(1 + (dz << 1)) - dz;
|
||||
@ -41,7 +41,7 @@ public class RandomOffsetTransform extends ResettableExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(int x, int y, int z, BlockStateHolder block) throws WorldEditException {
|
||||
public <T extends BlockStateHolder<T>> boolean setBlock(int x, int y, int z, T block) throws WorldEditException {
|
||||
x = x + random.nextInt(1 + (dx << 1)) - dx;
|
||||
y = y + random.nextInt(1 + (dy << 1)) - dy;
|
||||
z = z + random.nextInt(1 + (dz << 1)) - dz;
|
||||
|
@ -60,7 +60,7 @@ public class ScaleTransform extends ResettableExtent {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException {
|
||||
public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 location, B block) throws WorldEditException {
|
||||
boolean result = false;
|
||||
MutableBlockVector3 pos = new MutableBlockVector3(getPos(location));
|
||||
double sx = pos.getX();
|
||||
@ -96,7 +96,7 @@ public class ScaleTransform extends ResettableExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(int x1, int y1, int z1, BlockStateHolder block) throws WorldEditException {
|
||||
public <B extends BlockStateHolder<B>> boolean setBlock(int x1, int y1, int z1, B block) throws WorldEditException {
|
||||
boolean result = false;
|
||||
MutableBlockVector3 pos = new MutableBlockVector3(getPos(x1, y1, z1));
|
||||
double sx = pos.getX();
|
||||
|
@ -1,8 +1,6 @@
|
||||
package com.boydti.fawe.object.extent;
|
||||
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
@ -13,7 +11,6 @@ import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public abstract class SelectTransform extends ResettableExtent {
|
||||
@ -34,12 +31,12 @@ public abstract class SelectTransform extends ResettableExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(int x, int y, int z, BlockStateHolder block) throws WorldEditException {
|
||||
public <T extends BlockStateHolder<T>> boolean setBlock(int x, int y, int z, T block) throws WorldEditException {
|
||||
return getExtent(x, y, z).setBlock(x, y, z, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(BlockVector3 position, BlockStateHolder block) throws WorldEditException {
|
||||
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 position, T block) throws WorldEditException {
|
||||
return getExtent(position).setBlock(position, block);
|
||||
}
|
||||
|
||||
|
@ -1,16 +1,14 @@
|
||||
package com.boydti.fawe.object.extent;
|
||||
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public class SourceMaskExtent extends TemporalExtent {
|
||||
private Mask mask;
|
||||
private MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||
@ -42,13 +40,13 @@ public class SourceMaskExtent extends TemporalExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException {
|
||||
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 location, T block) throws WorldEditException {
|
||||
set(location.getBlockX(), location.getBlockY(), location.getBlockZ(), block);
|
||||
return mask.test(location) && super.setBlock(location, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(int x, int y, int z, BlockStateHolder block) throws WorldEditException {
|
||||
public <T extends BlockStateHolder<T>> boolean setBlock(int x, int y, int z, T block) throws WorldEditException {
|
||||
set(x, y, z, block);
|
||||
mutable.mutX(x);
|
||||
mutable.mutY(y);
|
||||
|
Reference in New Issue
Block a user