mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-12 08:18:35 +00:00
Added a category system and refactored registries
This commit is contained in:
@ -19,20 +19,18 @@
|
||||
|
||||
package com.sk89q.worldedit.session;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.math.transform.Identity;
|
||||
import com.sk89q.worldedit.math.transform.Transform;
|
||||
import com.sk89q.worldedit.world.registry.WorldData;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* Holds the clipboard and the current transform on the clipboard.
|
||||
*/
|
||||
public class ClipboardHolder {
|
||||
|
||||
private final WorldData worldData;
|
||||
private final Clipboard clipboard;
|
||||
private Transform transform = new Identity();
|
||||
|
||||
@ -40,22 +38,10 @@ public class ClipboardHolder {
|
||||
* Create a new instance with the given clipboard.
|
||||
*
|
||||
* @param clipboard the clipboard
|
||||
* @param worldData the mapping of blocks, entities, and so on
|
||||
*/
|
||||
public ClipboardHolder(Clipboard clipboard, WorldData worldData) {
|
||||
public ClipboardHolder(Clipboard clipboard) {
|
||||
checkNotNull(clipboard);
|
||||
checkNotNull(worldData);
|
||||
this.clipboard = clipboard;
|
||||
this.worldData = worldData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the mapping used for blocks, entities, and so on.
|
||||
*
|
||||
* @return the mapping
|
||||
*/
|
||||
public WorldData getWorldData() {
|
||||
return worldData;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -94,8 +80,8 @@ public class ClipboardHolder {
|
||||
*
|
||||
* @return a builder
|
||||
*/
|
||||
public PasteBuilder createPaste(Extent targetExtent, WorldData targetWorldData) {
|
||||
return new PasteBuilder(this, targetExtent, targetWorldData);
|
||||
public PasteBuilder createPaste(Extent targetExtent) {
|
||||
return new PasteBuilder(this, targetExtent);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -20,6 +20,8 @@
|
||||
package com.sk89q.worldedit.session;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.extent.transform.BlockTransformExtent;
|
||||
@ -27,7 +29,7 @@ import com.sk89q.worldedit.function.mask.ExistingBlockMask;
|
||||
import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
import com.sk89q.worldedit.math.transform.Transform;
|
||||
import com.sk89q.worldedit.world.registry.WorldData;
|
||||
import com.sk89q.worldedit.world.registry.Registries;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
@ -37,10 +39,8 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
public class PasteBuilder {
|
||||
|
||||
private final Clipboard clipboard;
|
||||
private final WorldData worldData;
|
||||
private final Transform transform;
|
||||
private final Extent targetExtent;
|
||||
private final WorldData targetWorldData;
|
||||
|
||||
private Vector to = new Vector();
|
||||
private boolean ignoreAirBlocks;
|
||||
@ -50,17 +50,13 @@ public class PasteBuilder {
|
||||
*
|
||||
* @param holder the clipboard holder
|
||||
* @param targetExtent an extent
|
||||
* @param targetWorldData world data of the target
|
||||
*/
|
||||
PasteBuilder(ClipboardHolder holder, Extent targetExtent, WorldData targetWorldData) {
|
||||
PasteBuilder(ClipboardHolder holder, Extent targetExtent) {
|
||||
checkNotNull(holder);
|
||||
checkNotNull(targetExtent);
|
||||
checkNotNull(targetWorldData);
|
||||
this.clipboard = holder.getClipboard();
|
||||
this.worldData = holder.getWorldData();
|
||||
this.transform = holder.getTransform();
|
||||
this.targetExtent = targetExtent;
|
||||
this.targetWorldData = targetWorldData;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -90,7 +86,7 @@ public class PasteBuilder {
|
||||
* @return the operation
|
||||
*/
|
||||
public Operation build() {
|
||||
BlockTransformExtent extent = new BlockTransformExtent(clipboard, transform, targetWorldData.getBlockRegistry());
|
||||
BlockTransformExtent extent = new BlockTransformExtent(clipboard, transform);
|
||||
ForwardExtentCopy copy = new ForwardExtentCopy(extent, clipboard.getRegion(), clipboard.getOrigin(), targetExtent, to);
|
||||
copy.setTransform(transform);
|
||||
if (ignoreAirBlocks) {
|
||||
|
Reference in New Issue
Block a user