mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-02 11:26:42 +00:00
Current Progress #3
This commit is contained in:
@ -1,22 +1,10 @@
|
||||
package com.sk89q.worldedit.function.pattern;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* @deprecated Just use BaseBlock directly
|
||||
*/
|
||||
@ -29,11 +17,6 @@ public class BlockPattern implements Pattern {
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockStateHolder apply(Vector position) {
|
||||
return block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the block.
|
||||
*
|
||||
@ -52,13 +35,10 @@ public class BlockPattern implements Pattern {
|
||||
checkNotNull(block);
|
||||
this.block = block;
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
@Override
|
||||
public BlockStateHolder apply(BlockVector3 position) {
|
||||
return block;
|
||||
}
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
@ -1,14 +1,9 @@
|
||||
package com.sk89q.worldedit.function.pattern;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.MutableBlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
@ -22,13 +17,9 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
public class ClipboardPattern extends AbstractPattern {
|
||||
|
||||
private final Clipboard clipboard;
|
||||
<<<<<<< HEAD
|
||||
private final int sx, sy, sz;
|
||||
private final Vector min;
|
||||
private MutableBlockVector mutable = new MutableBlockVector();
|
||||
=======
|
||||
private final BlockVector3 size;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
private final BlockVector3 min;
|
||||
// private final BlockVector3 size;
|
||||
|
||||
/**
|
||||
* Create a new clipboard pattern.
|
||||
@ -38,7 +29,7 @@ public class ClipboardPattern extends AbstractPattern {
|
||||
public ClipboardPattern(Clipboard clipboard) {
|
||||
checkNotNull(clipboard);
|
||||
this.clipboard = clipboard;
|
||||
Vector size = clipboard.getMaximumPoint().subtract(clipboard.getMinimumPoint()).add(1, 1, 1);
|
||||
BlockVector3 size = clipboard.getMaximumPoint().subtract(clipboard.getMinimumPoint()).add(1, 1, 1);
|
||||
this.sx = size.getBlockX();
|
||||
this.sy = size.getBlockY();
|
||||
this.sz = size.getBlockZ();
|
||||
@ -46,26 +37,23 @@ public class ClipboardPattern extends AbstractPattern {
|
||||
}
|
||||
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public BlockStateHolder apply(Vector position) {
|
||||
//<<<<<<< HEAD
|
||||
public BlockStateHolder apply(BlockVector3 position) {
|
||||
int xp = position.getBlockX() % sx;
|
||||
int yp = position.getBlockY() % sy;
|
||||
int zp = position.getBlockZ() % sz;
|
||||
if (xp < 0) xp += sx;
|
||||
if (yp < 0) yp += sy;
|
||||
if (zp < 0) zp += sz;
|
||||
mutable.mutX((min.getX() + xp));
|
||||
mutable.mutY((min.getY() + yp));
|
||||
mutable.mutZ((min.getZ() + zp));
|
||||
return clipboard.getBlock(mutable);
|
||||
=======
|
||||
public BlockStateHolder apply(BlockVector3 position) {
|
||||
int xp = Math.abs(position.getBlockX()) % size.getBlockX();
|
||||
int yp = Math.abs(position.getBlockY()) % size.getBlockY();
|
||||
int zp = Math.abs(position.getBlockZ()) % size.getBlockZ();
|
||||
|
||||
return clipboard.getFullBlock(clipboard.getMinimumPoint().add(xp, yp, zp));
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
return clipboard.getBlock(new BlockVector3(min.getX() + xp, min.getY() + yp, min.getZ() + zp));
|
||||
//=======
|
||||
// public BlockStateHolder apply(BlockVector3 position) {
|
||||
// int xp = Math.abs(position.getBlockX()) % size.getBlockX();
|
||||
// int yp = Math.abs(position.getBlockY()) % size.getBlockY();
|
||||
// int zp = Math.abs(position.getBlockZ()) % size.getBlockZ();
|
||||
//
|
||||
// return clipboard.getFullBlock(clipboard.getMinimumPoint().add(xp, yp, zp));
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
package com.sk89q.worldedit.function.pattern;
|
||||
|
||||
import com.sk89q.minecraft.util.commands.Link;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.command.UtilityCommands;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.NullExtent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
|
||||
@ -17,7 +17,7 @@ import com.sk89q.worldedit.world.block.BlockState;
|
||||
public interface FawePattern extends Pattern {
|
||||
|
||||
@Deprecated
|
||||
default BlockStateHolder apply(Vector position) {
|
||||
default BlockStateHolder apply(BlockVector3 position) {
|
||||
throw new UnsupportedOperationException("Please use apply(extent, get, set)");
|
||||
}
|
||||
|
||||
@ -27,6 +27,6 @@ public interface FawePattern extends Pattern {
|
||||
* @return a block
|
||||
*/
|
||||
@Override
|
||||
boolean apply(Extent extent, Vector get, Vector set) throws WorldEditException;
|
||||
boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException;
|
||||
}
|
||||
|
||||
|
@ -1,19 +1,15 @@
|
||||
package com.sk89q.worldedit.function.pattern;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.boydti.fawe.object.collection.RandomCollection;
|
||||
import com.boydti.fawe.object.random.SimpleRandom;
|
||||
import com.boydti.fawe.object.random.TrueRandom;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
import java.util.HashMap;
|
||||
@ -60,24 +56,24 @@ public class RandomPattern extends AbstractPattern {
|
||||
this.patterns.add(pattern);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
//<<<<<<< HEAD
|
||||
public Set<Pattern> getPatterns() {
|
||||
return patterns;
|
||||
=======
|
||||
@Override
|
||||
public BlockStateHolder apply(BlockVector3 position) {
|
||||
double r = random.nextDouble();
|
||||
double offset = 0;
|
||||
|
||||
for (Chance chance : patterns) {
|
||||
if (r <= (offset + chance.getChance()) / max) {
|
||||
return chance.getPattern().apply(position);
|
||||
}
|
||||
offset += chance.getChance();
|
||||
}
|
||||
|
||||
throw new RuntimeException("ProportionalFillPattern");
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//=======
|
||||
// @Override
|
||||
// public BlockStateHolder apply(BlockVector3 position) {
|
||||
// double r = random.nextDouble();
|
||||
// double offset = 0;
|
||||
//
|
||||
// for (Chance chance : patterns) {
|
||||
// if (r <= (offset + chance.getChance()) / max) {
|
||||
// return chance.getPattern().apply(position);
|
||||
// }
|
||||
// offset += chance.getChance();
|
||||
// }
|
||||
//
|
||||
// throw new RuntimeException("ProportionalFillPattern");
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
public RandomCollection<Pattern> getCollection() {
|
||||
@ -85,12 +81,12 @@ public class RandomPattern extends AbstractPattern {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockStateHolder apply(Vector get) {
|
||||
public BlockStateHolder apply(BlockVector3 get) {
|
||||
return collection.next(get.getBlockX(), get.getBlockY(), get.getBlockZ()).apply(get);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Extent extent, Vector set, Vector get) throws WorldEditException {
|
||||
public boolean apply(Extent extent, BlockVector3 set, BlockVector3 get) throws WorldEditException {
|
||||
return collection.next(get.getBlockX(), get.getBlockY(), get.getBlockZ()).apply(extent, set, get);
|
||||
}
|
||||
|
||||
|
@ -19,14 +19,10 @@
|
||||
|
||||
package com.sk89q.worldedit.function.pattern;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
@ -97,10 +93,10 @@ public class RepeatingExtentPattern extends AbstractPattern {
|
||||
int x = base.getBlockX() % size.getBlockX();
|
||||
int y = base.getBlockY() % size.getBlockY();
|
||||
int z = base.getBlockZ() % size.getBlockZ();
|
||||
<<<<<<< HEAD
|
||||
return extent.getBlock(new Vector(x, y, z));
|
||||
=======
|
||||
//<<<<<<< HEAD
|
||||
// return extent.getBlock(new Vector(x, y, z));
|
||||
//=======
|
||||
return extent.getFullBlock(new BlockVector3(x, y, z));
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user