mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-02 11:26:42 +00:00
Current progress with update
This commit is contained in:
@ -1,10 +1,17 @@
|
||||
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;
|
||||
|
||||
|
||||
@ -45,4 +52,13 @@ 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,10 +1,16 @@
|
||||
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;
|
||||
|
||||
|
||||
@ -16,9 +22,13 @@ 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
|
||||
|
||||
/**
|
||||
* Create a new clipboard pattern.
|
||||
@ -36,6 +46,7 @@ public class ClipboardPattern extends AbstractPattern {
|
||||
}
|
||||
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public BlockStateHolder apply(Vector position) {
|
||||
int xp = position.getBlockX() % sx;
|
||||
int yp = position.getBlockY() % sy;
|
||||
@ -47,6 +58,14 @@ public class ClipboardPattern extends AbstractPattern {
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
|
@ -20,8 +20,6 @@
|
||||
package com.sk89q.worldedit.function.pattern;
|
||||
|
||||
import com.sk89q.minecraft.util.commands.Link;
|
||||
import com.sk89q.worldedit.MutableBlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
@ -29,6 +27,7 @@ import com.sk89q.worldedit.command.UtilityCommands;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.NullExtent;
|
||||
import com.sk89q.worldedit.internal.expression.runtime.Return;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
|
||||
@ -41,13 +40,13 @@ import com.sk89q.worldedit.world.block.BlockState;
|
||||
public interface Pattern extends com.sk89q.worldedit.patterns.Pattern{
|
||||
|
||||
@Override
|
||||
default BaseBlock next(Vector position) {
|
||||
default BaseBlock next(BlockVector3 position) {
|
||||
return new BaseBlock(apply(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
default BaseBlock next(int x, int y, int z) {
|
||||
return new BaseBlock(apply(new Vector(x, y, z)));
|
||||
return new BaseBlock(apply(new BlockVector3(x, y, z)));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -56,10 +55,9 @@ public interface Pattern extends com.sk89q.worldedit.patterns.Pattern{
|
||||
* @param position the position
|
||||
* @return a block
|
||||
*/
|
||||
@Deprecated
|
||||
BlockStateHolder apply(Vector position);
|
||||
BlockStateHolder apply(BlockVector3 position);
|
||||
|
||||
default boolean apply(Extent extent, Vector get, Vector set) throws WorldEditException {
|
||||
default boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException {
|
||||
return extent.setBlock(set, apply(get));
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
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;
|
||||
@ -8,6 +9,11 @@ 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;
|
||||
@ -54,8 +60,24 @@ public class RandomPattern extends AbstractPattern {
|
||||
this.patterns.add(pattern);
|
||||
}
|
||||
|
||||
<<<<<<< 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
|
||||
}
|
||||
|
||||
public RandomCollection<Pattern> getCollection() {
|
||||
|
@ -19,7 +19,14 @@
|
||||
|
||||
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;
|
||||
@ -32,7 +39,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
public class RepeatingExtentPattern extends AbstractPattern {
|
||||
|
||||
private Extent extent;
|
||||
private Vector offset;
|
||||
private BlockVector3 offset;
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
@ -40,7 +47,7 @@ public class RepeatingExtentPattern extends AbstractPattern {
|
||||
* @param extent the extent
|
||||
* @param offset the offset
|
||||
*/
|
||||
public RepeatingExtentPattern(Extent extent, Vector offset) {
|
||||
public RepeatingExtentPattern(Extent extent, BlockVector3 offset) {
|
||||
setExtent(extent);
|
||||
setOffset(offset);
|
||||
}
|
||||
@ -69,7 +76,7 @@ public class RepeatingExtentPattern extends AbstractPattern {
|
||||
*
|
||||
* @return the offset
|
||||
*/
|
||||
public Vector getOffset() {
|
||||
public BlockVector3 getOffset() {
|
||||
return offset;
|
||||
}
|
||||
|
||||
@ -78,18 +85,22 @@ public class RepeatingExtentPattern extends AbstractPattern {
|
||||
*
|
||||
* @param offset the offset
|
||||
*/
|
||||
public void setOffset(Vector offset) {
|
||||
public void setOffset(BlockVector3 offset) {
|
||||
checkNotNull(offset);
|
||||
this.offset = offset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockStateHolder apply(Vector position) {
|
||||
Vector base = position.add(offset);
|
||||
Vector size = extent.getMaximumPoint().subtract(extent.getMinimumPoint()).add(1, 1, 1);
|
||||
public BlockStateHolder apply(BlockVector3 position) {
|
||||
BlockVector3 base = position.add(offset);
|
||||
BlockVector3 size = extent.getMaximumPoint().subtract(extent.getMinimumPoint()).add(1, 1, 1);
|
||||
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));
|
||||
=======
|
||||
return extent.getFullBlock(new BlockVector3(x, y, z));
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user