+ * The origin will be placed at the region's lowest minimum point.
*
* @param region the bounding region
*/
public BlockArrayClipboard(Region region) {
checkNotNull(region);
- checkNotNull(offset);
this.region = region.clone();
+ this.origin = region.getMinimumPoint();
Vector dimensions = getDimensions();
blocks = new BaseBlock[dimensions.getBlockX()][dimensions.getBlockY()][dimensions.getBlockZ()];
@@ -66,22 +68,17 @@ public class BlockArrayClipboard implements Clipboard {
}
@Override
- public Vector getOffset() {
- return offset;
+ public Vector getOrigin() {
+ return origin;
}
@Override
- public void setOffset(Vector offset) {
- checkNotNull(offset);
- this.offset = offset;
+ public void setOrigin(Vector origin) {
+ this.origin = origin;
}
- /**
- * Get the dimensions of the copy, which is at minimum (1, 1, 1).
- *
- * @return the dimensions
- */
- private Vector getDimensions() {
+ @Override
+ public Vector getDimensions() {
return region.getMaximumPoint().subtract(region.getMinimumPoint()).add(1, 1, 1);
}
diff --git a/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java b/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java
index a8e4f27b6..e68d5b2c0 100644
--- a/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java
+++ b/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java
@@ -38,21 +38,24 @@ public interface Clipboard extends Extent {
Region getRegion();
/**
- * Get the offset at which the area was copied from.
- *
- * The offset is not utilized by clipboards but it can be used
- * to store, for example, the relative location from which the copy
- * was made.
+ * Get the dimensions of the copy, which is at minimum (1, 1, 1).
*
- * @return the offset
+ * @return the dimensions
*/
- Vector getOffset();
+ Vector getDimensions();
/**
- * Set the offset at which the area was copied from.
+ * Get the origin point from which the copy was made from.
*
- * @param offset the offset
+ * @return the origin
*/
- void setOffset(Vector offset);
+ Vector getOrigin();
+
+ /**
+ * Set the origin point from which the copy was made from.
+ *
+ * @param origin the origin
+ */
+ void setOrigin(Vector origin);
}
diff --git a/src/main/java/com/sk89q/worldedit/function/block/ExtentBlockCopy.java b/src/main/java/com/sk89q/worldedit/function/block/ExtentBlockCopy.java
index b8d50bcc0..f7bdf8e11 100644
--- a/src/main/java/com/sk89q/worldedit/function/block/ExtentBlockCopy.java
+++ b/src/main/java/com/sk89q/worldedit/function/block/ExtentBlockCopy.java
@@ -64,7 +64,9 @@ public class ExtentBlockCopy implements RegionFunction {
@Override
public boolean apply(Vector position) throws WorldEditException {
BaseBlock block = source.getBlock(position);
- return destination.setBlock(transform.apply(position.subtract(from)).add(to), block);
+ Vector orig = position.subtract(from);
+ Vector transformed = transform.apply(orig);
+ return destination.setBlock(transformed.add(to), block);
}
}
diff --git a/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java b/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java
index 2c3c5aee8..ce0f80248 100644
--- a/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java
+++ b/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java
@@ -48,6 +48,7 @@ public class ForwardExtentCopy implements Operation {
private final Extent source;
private final Extent destination;
private final Region region;
+ private final Vector from;
private final Vector to;
private int repetitions = 1;
private Mask sourceMask = Masks.alwaysTrue();
@@ -58,21 +59,38 @@ public class ForwardExtentCopy implements Operation {
private int affected;
/**
- * Create a new copy.
+ * Create a new copy using the region's lowest minimum point as the
+ * "from" position.
*
* @param source the source extent
* @param region the region to copy
* @param destination the destination extent
- * @param to the destination position, starting from the the lowest X, Y, Z
+ * @param to the destination position
+ * @see #ForwardExtentCopy(Extent, Region, Vector, Extent, Vector) the main constructor
*/
public ForwardExtentCopy(Extent source, Region region, Extent destination, Vector to) {
+ this(source, region, region.getMinimumPoint(), destination, to);
+ }
+
+ /**
+ * Create a new copy.
+ *
+ * @param source the source extent
+ * @param region the region to copy
+ * @param from the source position
+ * @param destination the destination extent
+ * @param to the destination position
+ */
+ public ForwardExtentCopy(Extent source, Region region, Vector from, Extent destination, Vector to) {
checkNotNull(source);
checkNotNull(region);
+ checkNotNull(from);
checkNotNull(destination);
checkNotNull(to);
this.source = source;
this.destination = destination;
this.region = region;
+ this.from = from;
this.to = to;
}
@@ -182,7 +200,7 @@ public class ForwardExtentCopy implements Operation {
currentTransform = transform;
}
- ExtentBlockCopy copy = new ExtentBlockCopy(source, region.getMinimumPoint(), destination, to, currentTransform);
+ ExtentBlockCopy copy = new ExtentBlockCopy(source, from, destination, to, currentTransform);
RegionMaskingFilter filter = new RegionMaskingFilter(sourceMask, copy);
RegionFunction function = sourceFunction != null ? new CombinedRegionFunction(filter, sourceFunction) : filter;
RegionVisitor visitor = new RegionVisitor(region, function);
diff --git a/src/main/java/com/sk89q/worldedit/session/ClipboardHolder.java b/src/main/java/com/sk89q/worldedit/session/ClipboardHolder.java
new file mode 100644
index 000000000..b2b10561f
--- /dev/null
+++ b/src/main/java/com/sk89q/worldedit/session/ClipboardHolder.java
@@ -0,0 +1,77 @@
+/*
+ * WorldEdit, a Minecraft world manipulation toolkit
+ * Copyright (C) sk89q
+ * Copyright (C) WorldEdit team and contributors
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.sk89q.worldedit.session;
+
+import com.sk89q.worldedit.extent.clipboard.Clipboard;
+import com.sk89q.worldedit.math.transform.Identity;
+import com.sk89q.worldedit.math.transform.Transform;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Holds the clipboard and the current transform on the clipboard.
+ */
+public class ClipboardHolder {
+
+ private final Clipboard clipboard;
+ private Transform transform = new Identity();
+
+ /**
+ * Create a new instance with the given clipboard.
+ *
+ * @param clipboard the clipboard
+ */
+ public ClipboardHolder(Clipboard clipboard) {
+ checkNotNull(clipboard);
+ this.clipboard = clipboard;
+ }
+
+ /**
+ * Get the clipboard.
+ *
+ * If there is a transformation applied, the returned clipboard will
+ * not contain its effect.
+ *
+ * @return the clipboard
+ */
+ public Clipboard getClipboard() {
+ return clipboard;
+ }
+
+ /**
+ * Set the transform.
+ *
+ * @param transform the transform
+ */
+ public void setTransform(Transform transform) {
+ checkNotNull(transform);
+ this.transform = transform;
+ }
+
+ /**
+ * Get the transform.
+ *
+ * @return the transform
+ */
+ public Transform getTransform() {
+ return transform;
+ }
+
+}
From d3aa6c86a8376d50d6376d0f355fba35692d1c2b Mon Sep 17 00:00:00 2001
From: sk89q
Date: Wed, 2 Jul 2014 12:55:18 -0700
Subject: [PATCH 12/56] Added -m for //cut and //copy to set a source mask.
---
.../worldedit/command/ClipboardCommands.java | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java b/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java
index ebdf04df0..ad7edfa6a 100644
--- a/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java
+++ b/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java
@@ -33,6 +33,7 @@ import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.function.block.BlockReplace;
import com.sk89q.worldedit.function.mask.ExistingBlockMask;
+import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
import com.sk89q.worldedit.function.operation.Operations;
import com.sk89q.worldedit.function.pattern.Pattern;
@@ -69,22 +70,27 @@ public class ClipboardCommands {
@Command(
aliases = { "/copy" },
- flags = "e",
+ flags = "em",
desc = "Copy the selection to the clipboard",
help = "Copy the selection to the clipboard\n" +
"Flags:\n" +
" -e controls whether entities are copied\n" +
+ " -m sets a source mask so that excluded blocks become air\n" +
"WARNING: Pasting entities cannot yet be undone!",
min = 0,
max = 0
)
@CommandPermissions("worldedit.clipboard.copy")
public void copy(Player player, LocalSession session, EditSession editSession,
- @Selection Region region, @Switch('e') boolean copyEntities) throws WorldEditException {
+ @Selection Region region, @Switch('e') boolean copyEntities,
+ @Switch('m') Mask mask) throws WorldEditException {
BlockArrayClipboard clipboard = new BlockArrayClipboard(region);
clipboard.setOrigin(session.getPlacementPosition(player));
ForwardExtentCopy copy = new ForwardExtentCopy(editSession, region, clipboard, region.getMinimumPoint());
+ if (mask != null) {
+ copy.setSourceMask(mask);
+ }
Operations.completeLegacy(copy);
session.replaceClipboard(clipboard);
@@ -93,25 +99,30 @@ public class ClipboardCommands {
@Command(
aliases = { "/cut" },
+ flags = "em",
usage = "[leave-id]",
desc = "Cut the selection to the clipboard",
help = "Copy the selection to the clipboard\n" +
"Flags:\n" +
" -e controls whether entities are copied\n" +
+ " -m sets a source mask so that excluded blocks become air\n" +
"WARNING: Cutting and pasting entities cannot yet be undone!",
- flags = "e",
min = 0,
max = 1
)
@CommandPermissions("worldedit.clipboard.cut")
@Logging(REGION)
public void cut(Player player, LocalSession session, EditSession editSession,
- @Selection Region region, @Optional("air") Pattern leavePattern, @Switch('e') boolean copyEntities) throws WorldEditException {
+ @Selection Region region, @Optional("air") Pattern leavePattern, @Switch('e') boolean copyEntities,
+ @Switch('m') Mask mask) throws WorldEditException {
BlockArrayClipboard clipboard = new BlockArrayClipboard(region);
clipboard.setOrigin(session.getPlacementPosition(player));
ForwardExtentCopy copy = new ForwardExtentCopy(editSession, region, clipboard, region.getMinimumPoint());
copy.setSourceFunction(new BlockReplace(editSession, leavePattern));
+ if (mask != null) {
+ copy.setSourceMask(mask);
+ }
Operations.completeLegacy(copy);
session.replaceClipboard(clipboard);
From 7463fdef79b457ec4948277f6c621e2b1eca04b1 Mon Sep 17 00:00:00 2001
From: sk89q
Date: Tue, 8 Jul 2014 17:39:33 -0700
Subject: [PATCH 13/56] BlockRegistry, MaskRegistry, PatternRegistry ->
*Factory
'Registry' will need to be used for the block, entity, item,
and so on registries.
---
.../java/com/sk89q/worldedit/WorldEdit.java | 60 +++++++++----------
.../BlockFactory.java} | 10 ++--
.../DefaultBlockParser.java | 2 +-
.../DefaultMaskParser.java | 4 +-
.../HashTagPatternParser.java | 2 +-
.../MaskFactory.java} | 10 ++--
.../PatternFactory.java} | 10 ++--
.../RandomPatternParser.java | 4 +-
.../SingleBlockPatternParser.java | 4 +-
.../extension/input/ParserContext.java | 4 +-
.../internal/command/WorldEditBinding.java | 6 +-
...ractRegistry.java => AbstractFactory.java} | 10 ++--
.../internal/registry/InputParser.java | 2 +-
13 files changed, 64 insertions(+), 64 deletions(-)
rename src/main/java/com/sk89q/worldedit/extension/{registry/BlockRegistry.java => factory/BlockFactory.java} (88%)
rename src/main/java/com/sk89q/worldedit/extension/{registry => factory}/DefaultBlockParser.java (99%)
rename src/main/java/com/sk89q/worldedit/extension/{registry => factory}/DefaultMaskParser.java (97%)
rename src/main/java/com/sk89q/worldedit/extension/{registry => factory}/HashTagPatternParser.java (98%)
rename src/main/java/com/sk89q/worldedit/extension/{registry/MaskRegistry.java => factory/MaskFactory.java} (82%)
rename src/main/java/com/sk89q/worldedit/extension/{registry/PatternRegistry.java => factory/PatternFactory.java} (83%)
rename src/main/java/com/sk89q/worldedit/extension/{registry => factory}/RandomPatternParser.java (95%)
rename src/main/java/com/sk89q/worldedit/extension/{registry => factory}/SingleBlockPatternParser.java (91%)
rename src/main/java/com/sk89q/worldedit/internal/registry/{AbstractRegistry.java => AbstractFactory.java} (88%)
diff --git a/src/main/java/com/sk89q/worldedit/WorldEdit.java b/src/main/java/com/sk89q/worldedit/WorldEdit.java
index 1a0d25a5e..2b451409d 100644
--- a/src/main/java/com/sk89q/worldedit/WorldEdit.java
+++ b/src/main/java/com/sk89q/worldedit/WorldEdit.java
@@ -27,13 +27,13 @@ import com.sk89q.worldedit.event.extent.EditSessionEvent;
import com.sk89q.worldedit.event.platform.BlockInteractEvent;
import com.sk89q.worldedit.event.platform.InputType;
import com.sk89q.worldedit.event.platform.PlayerInputEvent;
+import com.sk89q.worldedit.extension.factory.BlockFactory;
+import com.sk89q.worldedit.extension.factory.MaskFactory;
+import com.sk89q.worldedit.extension.factory.PatternFactory;
import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extension.platform.Platform;
import com.sk89q.worldedit.extension.platform.PlatformManager;
-import com.sk89q.worldedit.extension.registry.BlockRegistry;
-import com.sk89q.worldedit.extension.registry.MaskRegistry;
-import com.sk89q.worldedit.extension.registry.PatternRegistry;
import com.sk89q.worldedit.extent.inventory.BlockBag;
import com.sk89q.worldedit.function.mask.Masks;
import com.sk89q.worldedit.function.pattern.Patterns;
@@ -84,9 +84,9 @@ public class WorldEdit {
private final EditSessionFactory editSessionFactory = new EditSessionFactory.EditSessionFactoryImpl(eventBus);
private final SessionManager sessions = new SessionManager(this);
- private final BlockRegistry blockRegistry = new BlockRegistry(this);
- private final MaskRegistry maskRegistry = new MaskRegistry(this);
- private final PatternRegistry patternRegistry = new PatternRegistry(this);
+ private final BlockFactory blockFactory = new BlockFactory(this);
+ private final MaskFactory maskFactory = new MaskFactory(this);
+ private final PatternFactory patternFactory = new PatternFactory(this);
static {
WorldEditPrefixHandler.register("com.sk89q.worldedit");
@@ -132,33 +132,33 @@ public class WorldEdit {
}
/**
- * Get the block registry from which new {@link BaseBlock}s can be
+ * Get the block factory from which new {@link BaseBlock}s can be
* constructed.
*
- * @return the block registry
+ * @return the block factory
*/
- public BlockRegistry getBlockRegistry() {
- return blockRegistry;
+ public BlockFactory getBlockFactory() {
+ return blockFactory;
}
/**
- * Get the mask registry from which new {@link com.sk89q.worldedit.function.mask.Mask}s
+ * Get the mask factory from which new {@link com.sk89q.worldedit.function.mask.Mask}s
* can be constructed.
*
- * @return the mask registry
+ * @return the mask factory
*/
- public MaskRegistry getMaskRegistry() {
- return maskRegistry;
+ public MaskFactory getMaskFactory() {
+ return maskFactory;
}
/**
- * Get the pattern registry from which new {@link com.sk89q.worldedit.function.pattern.Pattern}s
+ * Get the pattern factory from which new {@link com.sk89q.worldedit.function.pattern.Pattern}s
* can be constructed.
*
- * @return the pattern registry
+ * @return the pattern factory
*/
- public PatternRegistry getPatternRegistry() {
- return patternRegistry;
+ public PatternFactory getPatternFactory() {
+ return patternFactory;
}
/**
@@ -211,7 +211,7 @@ public class WorldEdit {
}
/**
- * @deprecated Use {@link #getBlockRegistry()} and {@link BlockRegistry#parseFromInput(String, ParserContext)}
+ * @deprecated Use {@link #getBlockFactory()} and {@link BlockFactory#parseFromInput(String, ParserContext)}
*/
@SuppressWarnings("deprecation")
@Deprecated
@@ -220,7 +220,7 @@ public class WorldEdit {
}
/**
- * @deprecated Use {@link #getBlockRegistry()} and {@link BlockRegistry#parseFromInput(String, ParserContext)}
+ * @deprecated Use {@link #getBlockFactory()} and {@link BlockFactory#parseFromInput(String, ParserContext)}
*/
@SuppressWarnings("deprecation")
@Deprecated
@@ -231,11 +231,11 @@ public class WorldEdit {
context.setSession(getSession(player));
context.setRestricted(!allAllowed);
context.setPreferringWildcard(allowNoData);
- return getBlockRegistry().parseFromInput(arg, context);
+ return getBlockFactory().parseFromInput(arg, context);
}
/**
- * @deprecated Use {@link #getBlockRegistry()} and {@link BlockRegistry#parseFromInput(String, ParserContext)}
+ * @deprecated Use {@link #getBlockFactory()} and {@link BlockFactory#parseFromInput(String, ParserContext)}
*/
@SuppressWarnings("deprecation")
@Deprecated
@@ -244,7 +244,7 @@ public class WorldEdit {
}
/**
- * @deprecated Use {@link #getBlockRegistry()} and {@link BlockRegistry#parseFromListInput(String, ParserContext)}
+ * @deprecated Use {@link #getBlockFactory()} and {@link BlockFactory#parseFromListInput(String, ParserContext)}
*/
@Deprecated
@SuppressWarnings("deprecation")
@@ -258,7 +258,7 @@ public class WorldEdit {
}
/**
- * @deprecated Use {@link #getBlockRegistry()} and {@link BlockRegistry#parseFromInput(String, ParserContext)}
+ * @deprecated Use {@link #getBlockFactory()} and {@link BlockFactory#parseFromInput(String, ParserContext)}
*/
@Deprecated
@SuppressWarnings("deprecation")
@@ -267,7 +267,7 @@ public class WorldEdit {
}
/**
- * @deprecated Use {@link #getBlockRegistry()} and {@link BlockRegistry#parseFromListInput(String, ParserContext)}
+ * @deprecated Use {@link #getBlockFactory()} and {@link BlockFactory#parseFromListInput(String, ParserContext)}
*/
@Deprecated
@SuppressWarnings("deprecation")
@@ -276,7 +276,7 @@ public class WorldEdit {
}
/**
- * @deprecated Use {@link #getBlockRegistry()} and {@link BlockRegistry#parseFromListInput(String, ParserContext)}
+ * @deprecated Use {@link #getBlockFactory()} and {@link BlockFactory#parseFromListInput(String, ParserContext)}
*/
@Deprecated
@SuppressWarnings("deprecation")
@@ -290,7 +290,7 @@ public class WorldEdit {
}
/**
- * @deprecated Use {@link #getPatternRegistry()} and {@link BlockRegistry#parseFromInput(String, ParserContext)}
+ * @deprecated Use {@link #getPatternFactory()} and {@link BlockFactory#parseFromInput(String, ParserContext)}
*/
@Deprecated
@SuppressWarnings("deprecation")
@@ -299,11 +299,11 @@ public class WorldEdit {
context.setActor(player);
context.setWorld(player.getWorld());
context.setSession(getSession(player));
- return Patterns.wrap(getPatternRegistry().parseFromInput(input, context));
+ return Patterns.wrap(getPatternFactory().parseFromInput(input, context));
}
/**
- * @deprecated Use {@link #getMaskRegistry()} ()} and {@link MaskRegistry#parseFromInput(String, ParserContext)}
+ * @deprecated Use {@link #getMaskFactory()} ()} and {@link MaskFactory#parseFromInput(String, ParserContext)}
*/
@Deprecated
@SuppressWarnings("deprecation")
@@ -312,7 +312,7 @@ public class WorldEdit {
context.setActor(player);
context.setWorld(player.getWorld());
context.setSession(session);
- return Masks.wrap(getMaskRegistry().parseFromInput(input, context));
+ return Masks.wrap(getMaskFactory().parseFromInput(input, context));
}
/**
diff --git a/src/main/java/com/sk89q/worldedit/extension/registry/BlockRegistry.java b/src/main/java/com/sk89q/worldedit/extension/factory/BlockFactory.java
similarity index 88%
rename from src/main/java/com/sk89q/worldedit/extension/registry/BlockRegistry.java
rename to src/main/java/com/sk89q/worldedit/extension/factory/BlockFactory.java
index 2bd118015..2cb5c9d1d 100644
--- a/src/main/java/com/sk89q/worldedit/extension/registry/BlockRegistry.java
+++ b/src/main/java/com/sk89q/worldedit/extension/factory/BlockFactory.java
@@ -17,13 +17,13 @@
* along with this program. If not, see .
*/
-package com.sk89q.worldedit.extension.registry;
+package com.sk89q.worldedit.extension.factory;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.extension.input.InputParseException;
-import com.sk89q.worldedit.internal.registry.AbstractRegistry;
+import com.sk89q.worldedit.internal.registry.AbstractFactory;
import java.util.HashSet;
import java.util.Set;
@@ -33,16 +33,16 @@ import java.util.Set;
* new blocks from input.
*
* Instances of this class can be taken from
- * {@link WorldEdit#getBlockRegistry()}.
+ * {@link WorldEdit#getBlockFactory()}.
*/
-public class BlockRegistry extends AbstractRegistry {
+public class BlockFactory extends AbstractFactory {
/**
* Create a new instance.
*
* @param worldEdit the WorldEdit instance.
*/
- public BlockRegistry(WorldEdit worldEdit) {
+ public BlockFactory(WorldEdit worldEdit) {
super(worldEdit);
parsers.add(new DefaultBlockParser(worldEdit));
diff --git a/src/main/java/com/sk89q/worldedit/extension/registry/DefaultBlockParser.java b/src/main/java/com/sk89q/worldedit/extension/factory/DefaultBlockParser.java
similarity index 99%
rename from src/main/java/com/sk89q/worldedit/extension/registry/DefaultBlockParser.java
rename to src/main/java/com/sk89q/worldedit/extension/factory/DefaultBlockParser.java
index fe7a63b09..3ecbc15fb 100644
--- a/src/main/java/com/sk89q/worldedit/extension/registry/DefaultBlockParser.java
+++ b/src/main/java/com/sk89q/worldedit/extension/factory/DefaultBlockParser.java
@@ -17,7 +17,7 @@
* along with this program. If not, see .
*/
-package com.sk89q.worldedit.extension.registry;
+package com.sk89q.worldedit.extension.factory;
import com.sk89q.worldedit.*;
import com.sk89q.worldedit.blocks.*;
diff --git a/src/main/java/com/sk89q/worldedit/extension/registry/DefaultMaskParser.java b/src/main/java/com/sk89q/worldedit/extension/factory/DefaultMaskParser.java
similarity index 97%
rename from src/main/java/com/sk89q/worldedit/extension/registry/DefaultMaskParser.java
rename to src/main/java/com/sk89q/worldedit/extension/factory/DefaultMaskParser.java
index 304a49b60..9b6dfdf94 100644
--- a/src/main/java/com/sk89q/worldedit/extension/registry/DefaultMaskParser.java
+++ b/src/main/java/com/sk89q/worldedit/extension/factory/DefaultMaskParser.java
@@ -17,7 +17,7 @@
* along with this program. If not, see .
*/
-package com.sk89q.worldedit.extension.registry;
+package com.sk89q.worldedit.extension.factory;
import com.sk89q.worldedit.*;
import com.sk89q.worldedit.extension.input.InputParseException;
@@ -135,7 +135,7 @@ class DefaultMaskParser extends InputParser {
ParserContext tempContext = new ParserContext(context);
tempContext.setRestricted(false);
tempContext.setPreferringWildcard(true);
- return new BlockMask(extent, worldEdit.getBlockRegistry().parseFromListInput(component, tempContext));
+ return new BlockMask(extent, worldEdit.getBlockFactory().parseFromListInput(component, tempContext));
}
}
diff --git a/src/main/java/com/sk89q/worldedit/extension/registry/HashTagPatternParser.java b/src/main/java/com/sk89q/worldedit/extension/factory/HashTagPatternParser.java
similarity index 98%
rename from src/main/java/com/sk89q/worldedit/extension/registry/HashTagPatternParser.java
rename to src/main/java/com/sk89q/worldedit/extension/factory/HashTagPatternParser.java
index 63da1c402..1c7a0d646 100644
--- a/src/main/java/com/sk89q/worldedit/extension/registry/HashTagPatternParser.java
+++ b/src/main/java/com/sk89q/worldedit/extension/factory/HashTagPatternParser.java
@@ -17,7 +17,7 @@
* along with this program. If not, see .
*/
-package com.sk89q.worldedit.extension.registry;
+package com.sk89q.worldedit.extension.factory;
import com.sk89q.worldedit.EmptyClipboardException;
import com.sk89q.worldedit.LocalSession;
diff --git a/src/main/java/com/sk89q/worldedit/extension/registry/MaskRegistry.java b/src/main/java/com/sk89q/worldedit/extension/factory/MaskFactory.java
similarity index 82%
rename from src/main/java/com/sk89q/worldedit/extension/registry/MaskRegistry.java
rename to src/main/java/com/sk89q/worldedit/extension/factory/MaskFactory.java
index fa4fb9e58..309992bcb 100644
--- a/src/main/java/com/sk89q/worldedit/extension/registry/MaskRegistry.java
+++ b/src/main/java/com/sk89q/worldedit/extension/factory/MaskFactory.java
@@ -17,27 +17,27 @@
* along with this program. If not, see .
*/
-package com.sk89q.worldedit.extension.registry;
+package com.sk89q.worldedit.extension.factory;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.function.mask.Mask;
-import com.sk89q.worldedit.internal.registry.AbstractRegistry;
+import com.sk89q.worldedit.internal.registry.AbstractFactory;
/**
* A registry of known {@link Mask}s. Provides methods to instantiate
* new masks from input.
*
* Instances of this class can be taken from
- * {@link WorldEdit#getMaskRegistry()}.
+ * {@link WorldEdit#getMaskFactory()}.
*/
-public final class MaskRegistry extends AbstractRegistry {
+public final class MaskFactory extends AbstractFactory {
/**
* Create a new mask registry.
*
* @param worldEdit the WorldEdit instance
*/
- public MaskRegistry(WorldEdit worldEdit) {
+ public MaskFactory(WorldEdit worldEdit) {
super(worldEdit);
parsers.add(new DefaultMaskParser(worldEdit));
diff --git a/src/main/java/com/sk89q/worldedit/extension/registry/PatternRegistry.java b/src/main/java/com/sk89q/worldedit/extension/factory/PatternFactory.java
similarity index 83%
rename from src/main/java/com/sk89q/worldedit/extension/registry/PatternRegistry.java
rename to src/main/java/com/sk89q/worldedit/extension/factory/PatternFactory.java
index daab33cac..e19891148 100644
--- a/src/main/java/com/sk89q/worldedit/extension/registry/PatternRegistry.java
+++ b/src/main/java/com/sk89q/worldedit/extension/factory/PatternFactory.java
@@ -17,27 +17,27 @@
* along with this program. If not, see .
*/
-package com.sk89q.worldedit.extension.registry;
+package com.sk89q.worldedit.extension.factory;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.function.pattern.Pattern;
-import com.sk89q.worldedit.internal.registry.AbstractRegistry;
+import com.sk89q.worldedit.internal.registry.AbstractFactory;
/**
* A registry of known {@link Pattern}s. Provides methods to instantiate
* new patterns from input.
*
* Instances of this class can be taken from
- * {@link WorldEdit#getPatternRegistry()}.
+ * {@link WorldEdit#getPatternFactory()}.
*/
-public final class PatternRegistry extends AbstractRegistry {
+public final class PatternFactory extends AbstractFactory {
/**
* Create a new instance.
*
* @param worldEdit the WorldEdit instance
*/
- public PatternRegistry(WorldEdit worldEdit) {
+ public PatternFactory(WorldEdit worldEdit) {
super(worldEdit);
parsers.add(new HashTagPatternParser(worldEdit));
diff --git a/src/main/java/com/sk89q/worldedit/extension/registry/RandomPatternParser.java b/src/main/java/com/sk89q/worldedit/extension/factory/RandomPatternParser.java
similarity index 95%
rename from src/main/java/com/sk89q/worldedit/extension/registry/RandomPatternParser.java
rename to src/main/java/com/sk89q/worldedit/extension/factory/RandomPatternParser.java
index d07f94e03..a850b98ff 100644
--- a/src/main/java/com/sk89q/worldedit/extension/registry/RandomPatternParser.java
+++ b/src/main/java/com/sk89q/worldedit/extension/factory/RandomPatternParser.java
@@ -17,7 +17,7 @@
* along with this program. If not, see .
*/
-package com.sk89q.worldedit.extension.registry;
+package com.sk89q.worldedit.extension.factory;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.blocks.BaseBlock;
@@ -36,7 +36,7 @@ class RandomPatternParser extends InputParser {
@Override
public Pattern parseFromInput(String input, ParserContext context) throws InputParseException {
- BlockRegistry blockRegistry = worldEdit.getBlockRegistry();
+ BlockFactory blockRegistry = worldEdit.getBlockFactory();
RandomPattern randomPattern = new RandomPattern();
for (String token : input.split(",")) {
diff --git a/src/main/java/com/sk89q/worldedit/extension/registry/SingleBlockPatternParser.java b/src/main/java/com/sk89q/worldedit/extension/factory/SingleBlockPatternParser.java
similarity index 91%
rename from src/main/java/com/sk89q/worldedit/extension/registry/SingleBlockPatternParser.java
rename to src/main/java/com/sk89q/worldedit/extension/factory/SingleBlockPatternParser.java
index a1a11fa10..17833cf97 100644
--- a/src/main/java/com/sk89q/worldedit/extension/registry/SingleBlockPatternParser.java
+++ b/src/main/java/com/sk89q/worldedit/extension/factory/SingleBlockPatternParser.java
@@ -17,7 +17,7 @@
* along with this program. If not, see .
*/
-package com.sk89q.worldedit.extension.registry;
+package com.sk89q.worldedit.extension.factory;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.input.ParserContext;
@@ -37,7 +37,7 @@ class SingleBlockPatternParser extends InputParser {
String[] items = input.split(",");
if (items.length == 1) {
- return new BlockPattern(worldEdit.getBlockRegistry().parseFromInput(items[0], context));
+ return new BlockPattern(worldEdit.getBlockFactory().parseFromInput(items[0], context));
} else {
return null;
}
diff --git a/src/main/java/com/sk89q/worldedit/extension/input/ParserContext.java b/src/main/java/com/sk89q/worldedit/extension/input/ParserContext.java
index 9d2b56f19..383ee280e 100644
--- a/src/main/java/com/sk89q/worldedit/extension/input/ParserContext.java
+++ b/src/main/java/com/sk89q/worldedit/extension/input/ParserContext.java
@@ -20,8 +20,8 @@
package com.sk89q.worldedit.extension.input;
import com.sk89q.worldedit.LocalSession;
+import com.sk89q.worldedit.extension.factory.MaskFactory;
import com.sk89q.worldedit.extension.platform.Actor;
-import com.sk89q.worldedit.extension.registry.MaskRegistry;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.world.World;
@@ -29,7 +29,7 @@ import javax.annotation.Nullable;
/**
* Contains contextual information that may be useful when constructing
- * objects from a registry (such as {@link MaskRegistry}).
+ * objects from a registry (such as {@link MaskFactory}).
*
* By default, {@link #isRestricted()} will return true.
*/
diff --git a/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java b/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java
index 019c1cc72..7a6aa4ad3 100644
--- a/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java
+++ b/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java
@@ -178,7 +178,7 @@ public class WorldEditBinding extends BindingHelper {
}
parserContext.setSession(worldEdit.getSessionManager().get(actor));
try {
- return worldEdit.getBlockRegistry().parseFromInput(context.next(), parserContext);
+ return worldEdit.getBlockFactory().parseFromInput(context.next(), parserContext);
} catch (NoMatchException e) {
throw new ParameterException(e.getMessage(), e);
}
@@ -207,7 +207,7 @@ public class WorldEditBinding extends BindingHelper {
}
parserContext.setSession(worldEdit.getSessionManager().get(actor));
try {
- return worldEdit.getPatternRegistry().parseFromInput(context.next(), parserContext);
+ return worldEdit.getPatternFactory().parseFromInput(context.next(), parserContext);
} catch (NoMatchException e) {
throw new ParameterException(e.getMessage(), e);
}
@@ -236,7 +236,7 @@ public class WorldEditBinding extends BindingHelper {
}
parserContext.setSession(worldEdit.getSessionManager().get(actor));
try {
- return worldEdit.getMaskRegistry().parseFromInput(context.next(), parserContext);
+ return worldEdit.getMaskFactory().parseFromInput(context.next(), parserContext);
} catch (NoMatchException e) {
throw new ParameterException(e.getMessage(), e);
}
diff --git a/src/main/java/com/sk89q/worldedit/internal/registry/AbstractRegistry.java b/src/main/java/com/sk89q/worldedit/internal/registry/AbstractFactory.java
similarity index 88%
rename from src/main/java/com/sk89q/worldedit/internal/registry/AbstractRegistry.java
rename to src/main/java/com/sk89q/worldedit/internal/registry/AbstractFactory.java
index b466b5bb9..95563fcc0 100644
--- a/src/main/java/com/sk89q/worldedit/internal/registry/AbstractRegistry.java
+++ b/src/main/java/com/sk89q/worldedit/internal/registry/AbstractFactory.java
@@ -30,22 +30,22 @@ import java.util.List;
import static com.google.common.base.Preconditions.checkNotNull;
/**
- * An abstract implementation of a registry for internal usage.
+ * An abstract implementation of a factory for internal usage.
*
- * @param the element that the registry returns
+ * @param the element that the factory returns
*/
@SuppressWarnings("ProtectedField")
-public abstract class AbstractRegistry {
+public abstract class AbstractFactory {
protected final WorldEdit worldEdit;
protected final List> parsers = new ArrayList>();
/**
- * Create a new registry.
+ * Create a new factory.
*
* @param worldEdit the WorldEdit instance
*/
- protected AbstractRegistry(WorldEdit worldEdit) {
+ protected AbstractFactory(WorldEdit worldEdit) {
checkNotNull(worldEdit);
this.worldEdit = worldEdit;
}
diff --git a/src/main/java/com/sk89q/worldedit/internal/registry/InputParser.java b/src/main/java/com/sk89q/worldedit/internal/registry/InputParser.java
index afe702852..059c95ba4 100644
--- a/src/main/java/com/sk89q/worldedit/internal/registry/InputParser.java
+++ b/src/main/java/com/sk89q/worldedit/internal/registry/InputParser.java
@@ -24,7 +24,7 @@ import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.extension.input.InputParseException;
/**
- * Input parser interface for {@link AbstractRegistry}.
+ * Input parser interface for {@link AbstractFactory}.
*
* @param the element
*/
From 6ef4f7b7cccc80f3e22b1b86b438367157819fcb Mon Sep 17 00:00:00 2001
From: sk89q
Date: Tue, 8 Jul 2014 20:08:43 -0700
Subject: [PATCH 14/56] Moved legacy block classes to the legacy source root.
---
.../sk89q/worldedit/blocks/ChestBlock.java | 0
.../worldedit/blocks/ContainerBlock.java | 284 ++++++-------
.../worldedit/blocks/DispenserBlock.java | 218 +++++-----
.../sk89q/worldedit/blocks/FurnaceBlock.java | 334 +++++++--------
.../com/sk89q/worldedit/blocks/LazyBlock.java | 0
.../worldedit/blocks/MobSpawnerBlock.java | 0
.../com/sk89q/worldedit/blocks/NoteBlock.java | 246 +++++------
.../com/sk89q/worldedit/blocks/SignBlock.java | 0
.../sk89q/worldedit/blocks/SkullBlock.java | 388 +++++++++---------
9 files changed, 735 insertions(+), 735 deletions(-)
rename src/{main => legacy}/java/com/sk89q/worldedit/blocks/ChestBlock.java (100%)
rename src/{main => legacy}/java/com/sk89q/worldedit/blocks/ContainerBlock.java (97%)
rename src/{main => legacy}/java/com/sk89q/worldedit/blocks/DispenserBlock.java (96%)
rename src/{main => legacy}/java/com/sk89q/worldedit/blocks/FurnaceBlock.java (96%)
rename src/{main => legacy}/java/com/sk89q/worldedit/blocks/LazyBlock.java (100%)
rename src/{main => legacy}/java/com/sk89q/worldedit/blocks/MobSpawnerBlock.java (100%)
rename src/{main => legacy}/java/com/sk89q/worldedit/blocks/NoteBlock.java (96%)
rename src/{main => legacy}/java/com/sk89q/worldedit/blocks/SignBlock.java (100%)
rename src/{main => legacy}/java/com/sk89q/worldedit/blocks/SkullBlock.java (96%)
diff --git a/src/main/java/com/sk89q/worldedit/blocks/ChestBlock.java b/src/legacy/java/com/sk89q/worldedit/blocks/ChestBlock.java
similarity index 100%
rename from src/main/java/com/sk89q/worldedit/blocks/ChestBlock.java
rename to src/legacy/java/com/sk89q/worldedit/blocks/ChestBlock.java
diff --git a/src/main/java/com/sk89q/worldedit/blocks/ContainerBlock.java b/src/legacy/java/com/sk89q/worldedit/blocks/ContainerBlock.java
similarity index 97%
rename from src/main/java/com/sk89q/worldedit/blocks/ContainerBlock.java
rename to src/legacy/java/com/sk89q/worldedit/blocks/ContainerBlock.java
index 9e0d69fb1..aae973c44 100644
--- a/src/main/java/com/sk89q/worldedit/blocks/ContainerBlock.java
+++ b/src/legacy/java/com/sk89q/worldedit/blocks/ContainerBlock.java
@@ -1,142 +1,142 @@
-/*
- * WorldEdit, a Minecraft world manipulation toolkit
- * Copyright (C) sk89q
- * Copyright (C) WorldEdit team and contributors
- *
- * This program is free software: you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see .
- */
-
-package com.sk89q.worldedit.blocks;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.sk89q.jnbt.ByteTag;
-import com.sk89q.jnbt.CompoundTag;
-import com.sk89q.jnbt.ListTag;
-import com.sk89q.jnbt.NBTUtils;
-import com.sk89q.jnbt.ShortTag;
-import com.sk89q.jnbt.Tag;
-import com.sk89q.worldedit.world.DataException;
-
-/**
- * Represents a block that stores items.
- *
- * @author sk89q
- */
-public abstract class ContainerBlock extends BaseBlock implements TileEntityBlock {
-
- private BaseItemStack[] items;
-
- public ContainerBlock(int type, int inventorySize) {
- super(type);
- this.items = new BaseItemStack[inventorySize];
- }
-
- public ContainerBlock(int type, int data, int inventorySize) {
- super(type, data);
- this.items = new BaseItemStack[inventorySize];
- }
-
- /**
- * Get the list of items.
- *
- * @return
- */
- public BaseItemStack[] getItems() {
- return this.items;
- }
-
- /**
- * Set the list of items.
- *
- * @param items
- */
- public void setItems(BaseItemStack[] items) {
- this.items = items;
- }
-
- @Override
- public boolean hasNbtData() {
- return true;
- }
-
- public Map serializeItem(BaseItemStack item) {
- Map data = new HashMap();
- data.put("id", new ShortTag("id", (short) item.getType()));
- data.put("Damage", new ShortTag("Damage", item.getData()));
- data.put("Count", new ByteTag("Count", (byte) item.getAmount()));
- if (item.getEnchantments().size() > 0) {
- List enchantmentList = new ArrayList();
- for(Map.Entry entry : item.getEnchantments().entrySet()) {
- Map enchantment = new HashMap();
- enchantment.put("id", new ShortTag("id", entry.getKey().shortValue()));
- enchantment.put("lvl", new ShortTag("lvl", entry.getValue().shortValue()));
- enchantmentList.add(new CompoundTag(null, enchantment));
- }
-
- Map auxData = new HashMap();
- auxData.put("ench", new ListTag("ench", CompoundTag.class, enchantmentList));
- data.put("tag", new CompoundTag("tag", auxData));
- }
- return data;
- }
-
- public BaseItemStack deserializeItem(Map data) throws DataException {
- short id = NBTUtils.getChildTag(data, "id", ShortTag.class).getValue();
- short damage = NBTUtils.getChildTag(data, "Damage", ShortTag.class).getValue();
- byte count = NBTUtils.getChildTag(data, "Count", ByteTag.class).getValue();
-
- BaseItemStack stack = new BaseItemStack(id, count, damage);
-
- if (data.containsKey("tag")) {
- Map auxData = NBTUtils.getChildTag(data, "tag", CompoundTag.class).getValue();
- ListTag ench = (ListTag)auxData.get("ench");
- for(Tag e : ench.getValue()) {
- Map vars = ((CompoundTag) e).getValue();
- short enchId = NBTUtils.getChildTag(vars, "id", ShortTag.class).getValue();
- short enchLevel = NBTUtils.getChildTag(vars, "lvl", ShortTag.class).getValue();
- stack.getEnchantments().put((int) enchId, (int) enchLevel);
- }
- }
- return stack;
- }
-
- public BaseItemStack[] deserializeInventory(List items) throws DataException {
- BaseItemStack[] stacks = new BaseItemStack[items.size()];
- for (CompoundTag tag : items) {
- Map item = tag.getValue();
- BaseItemStack stack = deserializeItem(item);
- byte slot = NBTUtils.getChildTag(item, "Slot", ByteTag.class).getValue();
- if (slot >= 0 && slot < stacks.length) {
- stacks[slot] = stack;
- }
- }
- return stacks;
- }
-
- public List serializeInventory(BaseItemStack[] items) {
- List tags = new ArrayList();
- for (int i = 0; i < items.length; ++i) {
- if (items[i] != null) {
- Map tagData = serializeItem(items[i]);
- tagData.put("Slot", new ByteTag("Slot", (byte) i));
- tags.add(new CompoundTag("", tagData));
- }
- }
- return tags;
- }
-}
+/*
+ * WorldEdit, a Minecraft world manipulation toolkit
+ * Copyright (C) sk89q
+ * Copyright (C) WorldEdit team and contributors
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.sk89q.worldedit.blocks;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.sk89q.jnbt.ByteTag;
+import com.sk89q.jnbt.CompoundTag;
+import com.sk89q.jnbt.ListTag;
+import com.sk89q.jnbt.NBTUtils;
+import com.sk89q.jnbt.ShortTag;
+import com.sk89q.jnbt.Tag;
+import com.sk89q.worldedit.world.DataException;
+
+/**
+ * Represents a block that stores items.
+ *
+ * @author sk89q
+ */
+public abstract class ContainerBlock extends BaseBlock implements TileEntityBlock {
+
+ private BaseItemStack[] items;
+
+ public ContainerBlock(int type, int inventorySize) {
+ super(type);
+ this.items = new BaseItemStack[inventorySize];
+ }
+
+ public ContainerBlock(int type, int data, int inventorySize) {
+ super(type, data);
+ this.items = new BaseItemStack[inventorySize];
+ }
+
+ /**
+ * Get the list of items.
+ *
+ * @return
+ */
+ public BaseItemStack[] getItems() {
+ return this.items;
+ }
+
+ /**
+ * Set the list of items.
+ *
+ * @param items
+ */
+ public void setItems(BaseItemStack[] items) {
+ this.items = items;
+ }
+
+ @Override
+ public boolean hasNbtData() {
+ return true;
+ }
+
+ public Map serializeItem(BaseItemStack item) {
+ Map data = new HashMap();
+ data.put("id", new ShortTag("id", (short) item.getType()));
+ data.put("Damage", new ShortTag("Damage", item.getData()));
+ data.put("Count", new ByteTag("Count", (byte) item.getAmount()));
+ if (item.getEnchantments().size() > 0) {
+ List enchantmentList = new ArrayList();
+ for(Map.Entry entry : item.getEnchantments().entrySet()) {
+ Map enchantment = new HashMap();
+ enchantment.put("id", new ShortTag("id", entry.getKey().shortValue()));
+ enchantment.put("lvl", new ShortTag("lvl", entry.getValue().shortValue()));
+ enchantmentList.add(new CompoundTag(null, enchantment));
+ }
+
+ Map auxData = new HashMap();
+ auxData.put("ench", new ListTag("ench", CompoundTag.class, enchantmentList));
+ data.put("tag", new CompoundTag("tag", auxData));
+ }
+ return data;
+ }
+
+ public BaseItemStack deserializeItem(Map data) throws DataException {
+ short id = NBTUtils.getChildTag(data, "id", ShortTag.class).getValue();
+ short damage = NBTUtils.getChildTag(data, "Damage", ShortTag.class).getValue();
+ byte count = NBTUtils.getChildTag(data, "Count", ByteTag.class).getValue();
+
+ BaseItemStack stack = new BaseItemStack(id, count, damage);
+
+ if (data.containsKey("tag")) {
+ Map auxData = NBTUtils.getChildTag(data, "tag", CompoundTag.class).getValue();
+ ListTag ench = (ListTag)auxData.get("ench");
+ for(Tag e : ench.getValue()) {
+ Map vars = ((CompoundTag) e).getValue();
+ short enchId = NBTUtils.getChildTag(vars, "id", ShortTag.class).getValue();
+ short enchLevel = NBTUtils.getChildTag(vars, "lvl", ShortTag.class).getValue();
+ stack.getEnchantments().put((int) enchId, (int) enchLevel);
+ }
+ }
+ return stack;
+ }
+
+ public BaseItemStack[] deserializeInventory(List items) throws DataException {
+ BaseItemStack[] stacks = new BaseItemStack[items.size()];
+ for (CompoundTag tag : items) {
+ Map item = tag.getValue();
+ BaseItemStack stack = deserializeItem(item);
+ byte slot = NBTUtils.getChildTag(item, "Slot", ByteTag.class).getValue();
+ if (slot >= 0 && slot < stacks.length) {
+ stacks[slot] = stack;
+ }
+ }
+ return stacks;
+ }
+
+ public List serializeInventory(BaseItemStack[] items) {
+ List tags = new ArrayList();
+ for (int i = 0; i < items.length; ++i) {
+ if (items[i] != null) {
+ Map tagData = serializeItem(items[i]);
+ tagData.put("Slot", new ByteTag("Slot", (byte) i));
+ tags.add(new CompoundTag("", tagData));
+ }
+ }
+ return tags;
+ }
+}
diff --git a/src/main/java/com/sk89q/worldedit/blocks/DispenserBlock.java b/src/legacy/java/com/sk89q/worldedit/blocks/DispenserBlock.java
similarity index 96%
rename from src/main/java/com/sk89q/worldedit/blocks/DispenserBlock.java
rename to src/legacy/java/com/sk89q/worldedit/blocks/DispenserBlock.java
index ea1392924..c13c7f163 100644
--- a/src/main/java/com/sk89q/worldedit/blocks/DispenserBlock.java
+++ b/src/legacy/java/com/sk89q/worldedit/blocks/DispenserBlock.java
@@ -1,109 +1,109 @@
-/*
- * WorldEdit, a Minecraft world manipulation toolkit
- * Copyright (C) sk89q
- * Copyright (C) WorldEdit team and contributors
- *
- * This program is free software: you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see .
- */
-
-package com.sk89q.worldedit.blocks;
-
-import com.sk89q.jnbt.CompoundTag;
-import com.sk89q.jnbt.ListTag;
-import com.sk89q.jnbt.NBTUtils;
-import com.sk89q.jnbt.StringTag;
-import com.sk89q.jnbt.Tag;
-import com.sk89q.worldedit.world.DataException;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Represents dispensers.
- *
- * @author sk89q
- */
-public class DispenserBlock extends ContainerBlock {
-
- /**
- * Construct an empty dispenser block.
- */
- public DispenserBlock() {
- super(BlockID.DISPENSER, 9);
- }
-
- /**
- * Construct an empty dispenser block.
- *
- * @param data data value (orientation)
- */
- public DispenserBlock(int data) {
- super(BlockID.DISPENSER, data, 9);
- }
-
- /**
- * Construct a dispenser block with the given orientation and inventory.
- *
- * @param data data value (orientation)
- * @param items array of items in the inventory
- */
- public DispenserBlock(int data, BaseItemStack[] items) {
- super(BlockID.DISPENSER, data, 9);
- this.setItems(items);
- }
-
- @Override
- public String getNbtId() {
- return "Trap";
- }
-
- @Override
- public CompoundTag getNbtData() {
- Map values = new HashMap();
- values.put("Items", new ListTag("Items", CompoundTag.class,
- serializeInventory(getItems())));
- return new CompoundTag(getNbtId(), values);
- }
-
- @Override
- public void setNbtData(CompoundTag rootTag) {
- try {
- if (rootTag == null) {
- return;
- }
-
- Map values = rootTag.getValue();
-
- Tag t = values.get("id");
- if (!(t instanceof StringTag) || !((StringTag) t).getValue().equals("Trap")) {
- throw new DataException("'Trap' tile entity expected");
- }
-
- List items = new ArrayList();
- for (Tag tag : NBTUtils.getChildTag(values, "Items", ListTag.class).getValue()) {
- if (!(tag instanceof CompoundTag)) {
- throw new DataException("CompoundTag expected as child tag of Trap Items");
- }
-
- items.add((CompoundTag) tag);
- }
-
- setItems(deserializeInventory(items));
- } catch (DataException e) {
- throw new RuntimeException(e);
- }
- }
-}
+/*
+ * WorldEdit, a Minecraft world manipulation toolkit
+ * Copyright (C) sk89q
+ * Copyright (C) WorldEdit team and contributors
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.sk89q.worldedit.blocks;
+
+import com.sk89q.jnbt.CompoundTag;
+import com.sk89q.jnbt.ListTag;
+import com.sk89q.jnbt.NBTUtils;
+import com.sk89q.jnbt.StringTag;
+import com.sk89q.jnbt.Tag;
+import com.sk89q.worldedit.world.DataException;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Represents dispensers.
+ *
+ * @author sk89q
+ */
+public class DispenserBlock extends ContainerBlock {
+
+ /**
+ * Construct an empty dispenser block.
+ */
+ public DispenserBlock() {
+ super(BlockID.DISPENSER, 9);
+ }
+
+ /**
+ * Construct an empty dispenser block.
+ *
+ * @param data data value (orientation)
+ */
+ public DispenserBlock(int data) {
+ super(BlockID.DISPENSER, data, 9);
+ }
+
+ /**
+ * Construct a dispenser block with the given orientation and inventory.
+ *
+ * @param data data value (orientation)
+ * @param items array of items in the inventory
+ */
+ public DispenserBlock(int data, BaseItemStack[] items) {
+ super(BlockID.DISPENSER, data, 9);
+ this.setItems(items);
+ }
+
+ @Override
+ public String getNbtId() {
+ return "Trap";
+ }
+
+ @Override
+ public CompoundTag getNbtData() {
+ Map values = new HashMap();
+ values.put("Items", new ListTag("Items", CompoundTag.class,
+ serializeInventory(getItems())));
+ return new CompoundTag(getNbtId(), values);
+ }
+
+ @Override
+ public void setNbtData(CompoundTag rootTag) {
+ try {
+ if (rootTag == null) {
+ return;
+ }
+
+ Map values = rootTag.getValue();
+
+ Tag t = values.get("id");
+ if (!(t instanceof StringTag) || !((StringTag) t).getValue().equals("Trap")) {
+ throw new DataException("'Trap' tile entity expected");
+ }
+
+ List items = new ArrayList();
+ for (Tag tag : NBTUtils.getChildTag(values, "Items", ListTag.class).getValue()) {
+ if (!(tag instanceof CompoundTag)) {
+ throw new DataException("CompoundTag expected as child tag of Trap Items");
+ }
+
+ items.add((CompoundTag) tag);
+ }
+
+ setItems(deserializeInventory(items));
+ } catch (DataException e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
diff --git a/src/main/java/com/sk89q/worldedit/blocks/FurnaceBlock.java b/src/legacy/java/com/sk89q/worldedit/blocks/FurnaceBlock.java
similarity index 96%
rename from src/main/java/com/sk89q/worldedit/blocks/FurnaceBlock.java
rename to src/legacy/java/com/sk89q/worldedit/blocks/FurnaceBlock.java
index 24e241dbd..07b38c78b 100644
--- a/src/main/java/com/sk89q/worldedit/blocks/FurnaceBlock.java
+++ b/src/legacy/java/com/sk89q/worldedit/blocks/FurnaceBlock.java
@@ -1,167 +1,167 @@
-/*
- * WorldEdit, a Minecraft world manipulation toolkit
- * Copyright (C) sk89q
- * Copyright (C) WorldEdit team and contributors
- *
- * This program is free software: you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see .
- */
-
-package com.sk89q.worldedit.blocks;
-
-import com.sk89q.jnbt.CompoundTag;
-import com.sk89q.jnbt.ListTag;
-import com.sk89q.jnbt.NBTUtils;
-import com.sk89q.jnbt.ShortTag;
-import com.sk89q.jnbt.StringTag;
-import com.sk89q.jnbt.Tag;
-import com.sk89q.worldedit.world.DataException;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Represents a furnace block.
- *
- * @author sk89q
- */
-public class FurnaceBlock extends ContainerBlock {
-
- private short burnTime;
- private short cookTime;
-
- /**
- * Construct an empty furnace block with the default orientation.
- *
- * @param type type ID
- */
- public FurnaceBlock(int type) {
- super(type, 2);
- }
-
- /**
- * Construct an empty furnace block with a given orientation.
- *
- * @param type type ID
- * @param data orientation
- */
- public FurnaceBlock(int type, int data) {
- super(type, data, 2);
- }
-
- /**
- * Construct an furnace block with a given orientation and inventory.
- *
- * @param type type ID
- * @param data orientation
- * @param items inventory items
- */
- public FurnaceBlock(int type, int data, BaseItemStack[] items) {
- super(type, data, 2);
- setItems(items);
- }
-
- /**
- * Get the burn time.
- *
- * @return the burn time
- */
- public short getBurnTime() {
- return burnTime;
- }
-
- /**
- * Set the burn time.
- *
- * @param burnTime the burn time
- */
- public void setBurnTime(short burnTime) {
- this.burnTime = burnTime;
- }
-
- /**
- * Get the cook time.
- *
- * @return the cook time
- */
- public short getCookTime() {
- return cookTime;
- }
-
- /**
- * Set the cook time.
- *
- * @param cookTime the cook time to set
- */
- public void setCookTime(short cookTime) {
- this.cookTime = cookTime;
- }
-
- @Override
- public String getNbtId() {
- return "Furnace";
- }
-
- @Override
- public CompoundTag getNbtData() {
- Map values = new HashMap();
- values.put("Items", new ListTag("Items", CompoundTag.class,
- serializeInventory(getItems())));
- values.put("BurnTime", new ShortTag("BurnTime", burnTime));
- values.put("CookTime", new ShortTag("CookTime", cookTime));
- return new CompoundTag(getNbtId(), values);
- }
-
- @Override
- public void setNbtData(CompoundTag rootTag) {
- if (rootTag == null) {
- return;
- }
-
- try {
- Map values = rootTag.getValue();
-
- Tag t = values.get("id");
- if (!(t instanceof StringTag)
- || !((StringTag) t).getValue().equals("Furnace")) {
- throw new RuntimeException("'Furnace' tile entity expected");
- }
-
- ListTag items = NBTUtils.getChildTag(values, "Items", ListTag.class);
-
- List compound = new ArrayList();
-
- for (Tag tag : items.getValue()) {
- if (!(tag instanceof CompoundTag)) {
- throw new RuntimeException("CompoundTag expected as child tag of Furnace Items");
- }
- compound.add((CompoundTag) tag);
- }
- setItems(deserializeInventory(compound));
-
- t = values.get("BurnTime");
- if (t instanceof ShortTag) {
- burnTime = ((ShortTag) t).getValue();
- }
-
- t = values.get("CookTime");
- if (t instanceof ShortTag) {
- cookTime = ((ShortTag) t).getValue();
- }
- } catch (DataException e) {
- throw new RuntimeException(e);
- }
- }
-}
+/*
+ * WorldEdit, a Minecraft world manipulation toolkit
+ * Copyright (C) sk89q
+ * Copyright (C) WorldEdit team and contributors
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.sk89q.worldedit.blocks;
+
+import com.sk89q.jnbt.CompoundTag;
+import com.sk89q.jnbt.ListTag;
+import com.sk89q.jnbt.NBTUtils;
+import com.sk89q.jnbt.ShortTag;
+import com.sk89q.jnbt.StringTag;
+import com.sk89q.jnbt.Tag;
+import com.sk89q.worldedit.world.DataException;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Represents a furnace block.
+ *
+ * @author sk89q
+ */
+public class FurnaceBlock extends ContainerBlock {
+
+ private short burnTime;
+ private short cookTime;
+
+ /**
+ * Construct an empty furnace block with the default orientation.
+ *
+ * @param type type ID
+ */
+ public FurnaceBlock(int type) {
+ super(type, 2);
+ }
+
+ /**
+ * Construct an empty furnace block with a given orientation.
+ *
+ * @param type type ID
+ * @param data orientation
+ */
+ public FurnaceBlock(int type, int data) {
+ super(type, data, 2);
+ }
+
+ /**
+ * Construct an furnace block with a given orientation and inventory.
+ *
+ * @param type type ID
+ * @param data orientation
+ * @param items inventory items
+ */
+ public FurnaceBlock(int type, int data, BaseItemStack[] items) {
+ super(type, data, 2);
+ setItems(items);
+ }
+
+ /**
+ * Get the burn time.
+ *
+ * @return the burn time
+ */
+ public short getBurnTime() {
+ return burnTime;
+ }
+
+ /**
+ * Set the burn time.
+ *
+ * @param burnTime the burn time
+ */
+ public void setBurnTime(short burnTime) {
+ this.burnTime = burnTime;
+ }
+
+ /**
+ * Get the cook time.
+ *
+ * @return the cook time
+ */
+ public short getCookTime() {
+ return cookTime;
+ }
+
+ /**
+ * Set the cook time.
+ *
+ * @param cookTime the cook time to set
+ */
+ public void setCookTime(short cookTime) {
+ this.cookTime = cookTime;
+ }
+
+ @Override
+ public String getNbtId() {
+ return "Furnace";
+ }
+
+ @Override
+ public CompoundTag getNbtData() {
+ Map values = new HashMap();
+ values.put("Items", new ListTag("Items", CompoundTag.class,
+ serializeInventory(getItems())));
+ values.put("BurnTime", new ShortTag("BurnTime", burnTime));
+ values.put("CookTime", new ShortTag("CookTime", cookTime));
+ return new CompoundTag(getNbtId(), values);
+ }
+
+ @Override
+ public void setNbtData(CompoundTag rootTag) {
+ if (rootTag == null) {
+ return;
+ }
+
+ try {
+ Map values = rootTag.getValue();
+
+ Tag t = values.get("id");
+ if (!(t instanceof StringTag)
+ || !((StringTag) t).getValue().equals("Furnace")) {
+ throw new RuntimeException("'Furnace' tile entity expected");
+ }
+
+ ListTag items = NBTUtils.getChildTag(values, "Items", ListTag.class);
+
+ List compound = new ArrayList();
+
+ for (Tag tag : items.getValue()) {
+ if (!(tag instanceof CompoundTag)) {
+ throw new RuntimeException("CompoundTag expected as child tag of Furnace Items");
+ }
+ compound.add((CompoundTag) tag);
+ }
+ setItems(deserializeInventory(compound));
+
+ t = values.get("BurnTime");
+ if (t instanceof ShortTag) {
+ burnTime = ((ShortTag) t).getValue();
+ }
+
+ t = values.get("CookTime");
+ if (t instanceof ShortTag) {
+ cookTime = ((ShortTag) t).getValue();
+ }
+ } catch (DataException e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
diff --git a/src/main/java/com/sk89q/worldedit/blocks/LazyBlock.java b/src/legacy/java/com/sk89q/worldedit/blocks/LazyBlock.java
similarity index 100%
rename from src/main/java/com/sk89q/worldedit/blocks/LazyBlock.java
rename to src/legacy/java/com/sk89q/worldedit/blocks/LazyBlock.java
diff --git a/src/main/java/com/sk89q/worldedit/blocks/MobSpawnerBlock.java b/src/legacy/java/com/sk89q/worldedit/blocks/MobSpawnerBlock.java
similarity index 100%
rename from src/main/java/com/sk89q/worldedit/blocks/MobSpawnerBlock.java
rename to src/legacy/java/com/sk89q/worldedit/blocks/MobSpawnerBlock.java
diff --git a/src/main/java/com/sk89q/worldedit/blocks/NoteBlock.java b/src/legacy/java/com/sk89q/worldedit/blocks/NoteBlock.java
similarity index 96%
rename from src/main/java/com/sk89q/worldedit/blocks/NoteBlock.java
rename to src/legacy/java/com/sk89q/worldedit/blocks/NoteBlock.java
index 32e1cdb18..0f5c819e3 100644
--- a/src/main/java/com/sk89q/worldedit/blocks/NoteBlock.java
+++ b/src/legacy/java/com/sk89q/worldedit/blocks/NoteBlock.java
@@ -1,123 +1,123 @@
-/*
- * WorldEdit, a Minecraft world manipulation toolkit
- * Copyright (C) sk89q
- * Copyright (C) WorldEdit team and contributors
- *
- * This program is free software: you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see .
- */
-
-package com.sk89q.worldedit.blocks;
-
-import com.sk89q.jnbt.ByteTag;
-import com.sk89q.jnbt.CompoundTag;
-import com.sk89q.jnbt.StringTag;
-import com.sk89q.jnbt.Tag;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * A note block.
- *
- * @author sk89q
- */
-public class NoteBlock extends BaseBlock implements TileEntityBlock {
-
- private byte note;
-
- /**
- * Construct the note block with a data value of 0.
- */
- public NoteBlock() {
- super(BlockID.NOTE_BLOCK);
- this.note = 0;
- }
-
- /**
- * Construct the note block with a given data value.
- *
- * @param data data value
- */
- public NoteBlock(int data) {
- super(BlockID.NOTE_BLOCK, data);
- this.note = 0;
- }
-
- /**
- * Construct the note block with a given data value and note.
- *
- * @param data data value
- * @param note note
- */
- public NoteBlock(int data, byte note) {
- super(BlockID.NOTE_BLOCK, data);
- this.note = note;
- }
-
- /**
- * Get the note.
- *
- * @return the note
- */
- public byte getNote() {
- return note;
- }
-
- /**
- * Set the note.
- *
- * @param note the note to set
- */
- public void setNote(byte note) {
- this.note = note;
- }
-
- @Override
- public boolean hasNbtData() {
- return true;
- }
-
- @Override
- public String getNbtId() {
- return "Music";
- }
-
- @Override
- public CompoundTag getNbtData() {
- Map values = new HashMap();
- values.put("note", new ByteTag("note", note));
- return new CompoundTag(getNbtId(), values);
- }
-
- @Override
- public void setNbtData(CompoundTag rootTag) {
- if (rootTag == null) {
- return;
- }
-
- Map values = rootTag.getValue();
-
- Tag t;
-
- t = values.get("id");
- if (!(t instanceof StringTag) || !((StringTag) t).getValue().equals("Music")) {
- throw new RuntimeException("'Music' tile entity expected");
- }
-
- t = values.get("note");
- if (t instanceof ByteTag) {
- note = ((ByteTag) t).getValue();
- }
- }
-}
+/*
+ * WorldEdit, a Minecraft world manipulation toolkit
+ * Copyright (C) sk89q
+ * Copyright (C) WorldEdit team and contributors
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.sk89q.worldedit.blocks;
+
+import com.sk89q.jnbt.ByteTag;
+import com.sk89q.jnbt.CompoundTag;
+import com.sk89q.jnbt.StringTag;
+import com.sk89q.jnbt.Tag;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * A note block.
+ *
+ * @author sk89q
+ */
+public class NoteBlock extends BaseBlock implements TileEntityBlock {
+
+ private byte note;
+
+ /**
+ * Construct the note block with a data value of 0.
+ */
+ public NoteBlock() {
+ super(BlockID.NOTE_BLOCK);
+ this.note = 0;
+ }
+
+ /**
+ * Construct the note block with a given data value.
+ *
+ * @param data data value
+ */
+ public NoteBlock(int data) {
+ super(BlockID.NOTE_BLOCK, data);
+ this.note = 0;
+ }
+
+ /**
+ * Construct the note block with a given data value and note.
+ *
+ * @param data data value
+ * @param note note
+ */
+ public NoteBlock(int data, byte note) {
+ super(BlockID.NOTE_BLOCK, data);
+ this.note = note;
+ }
+
+ /**
+ * Get the note.
+ *
+ * @return the note
+ */
+ public byte getNote() {
+ return note;
+ }
+
+ /**
+ * Set the note.
+ *
+ * @param note the note to set
+ */
+ public void setNote(byte note) {
+ this.note = note;
+ }
+
+ @Override
+ public boolean hasNbtData() {
+ return true;
+ }
+
+ @Override
+ public String getNbtId() {
+ return "Music";
+ }
+
+ @Override
+ public CompoundTag getNbtData() {
+ Map values = new HashMap();
+ values.put("note", new ByteTag("note", note));
+ return new CompoundTag(getNbtId(), values);
+ }
+
+ @Override
+ public void setNbtData(CompoundTag rootTag) {
+ if (rootTag == null) {
+ return;
+ }
+
+ Map values = rootTag.getValue();
+
+ Tag t;
+
+ t = values.get("id");
+ if (!(t instanceof StringTag) || !((StringTag) t).getValue().equals("Music")) {
+ throw new RuntimeException("'Music' tile entity expected");
+ }
+
+ t = values.get("note");
+ if (t instanceof ByteTag) {
+ note = ((ByteTag) t).getValue();
+ }
+ }
+}
diff --git a/src/main/java/com/sk89q/worldedit/blocks/SignBlock.java b/src/legacy/java/com/sk89q/worldedit/blocks/SignBlock.java
similarity index 100%
rename from src/main/java/com/sk89q/worldedit/blocks/SignBlock.java
rename to src/legacy/java/com/sk89q/worldedit/blocks/SignBlock.java
diff --git a/src/main/java/com/sk89q/worldedit/blocks/SkullBlock.java b/src/legacy/java/com/sk89q/worldedit/blocks/SkullBlock.java
similarity index 96%
rename from src/main/java/com/sk89q/worldedit/blocks/SkullBlock.java
rename to src/legacy/java/com/sk89q/worldedit/blocks/SkullBlock.java
index 981a339ec..ac62da26c 100644
--- a/src/main/java/com/sk89q/worldedit/blocks/SkullBlock.java
+++ b/src/legacy/java/com/sk89q/worldedit/blocks/SkullBlock.java
@@ -1,194 +1,194 @@
-/*
- * WorldEdit, a Minecraft world manipulation toolkit
- * Copyright (C) sk89q
- * Copyright (C) WorldEdit team and contributors
- *
- * This program is free software: you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see .
- */
-
-package com.sk89q.worldedit.blocks;
-
-import com.sk89q.jnbt.ByteTag;
-import com.sk89q.jnbt.CompoundTag;
-import com.sk89q.jnbt.StringTag;
-import com.sk89q.jnbt.Tag;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * A skull block.
- */
-public class SkullBlock extends BaseBlock implements TileEntityBlock {
-
- private String owner = ""; // notchian
- private byte skullType; // stored here for block, in damage value for item
- private byte rot; // only matters if block data == 0x1 (on floor)
-
- /**
- * Construct the skull block with a default type of skelton.
- * @param data data value to set, controls placement
- */
- public SkullBlock(int data) {
- this(data, (byte) 0);
- }
-
- /**
- * Construct the skull block with a given type.
- * 0 - skeleton
- * 1 - wither skelly
- * 2 - zombie
- * 3 - human
- * 4 - creeper
- * @param data data value to set, controls placement
- * @param type type of skull
- */
- public SkullBlock(int data, byte type) {
- this(data, type, (byte) 0);
- }
-
- /**
- * Construct the skull block with a given type and rotation.
- * @param data data value to set, controls placement
- * @param type type of skull
- * @param rot rotation (if on floor)
- */
- public SkullBlock(int data, byte type, byte rot) {
- super(BlockID.HEAD, data);
- if (type < (byte) 0 || type > (byte) 4) {
- this.skullType = (byte) 0;
- } else {
- this.skullType = type;
- }
- this.rot = rot;
- this.owner = "";
- }
-
- /**
- * Construct the skull block with a given rotation and owner.
- * The type is assumed to be player unless owner is null or empty.
- * @param data data value to set, controls placement
- * @param rot rotation of skull
- * @param owner name of player
- */
- public SkullBlock(int data, byte rot, String owner) {
- super(BlockID.HEAD, data);
- this.rot = rot;
- this.setOwner(owner);
- if (owner == null || owner.isEmpty()) this.skullType = (byte) 0;
- }
-
- /**
- * Set the skull's owner. Automatically sets type to player if not empty or null.
- * @param owner player name to set the skull to
- */
- public void setOwner(String owner) {
- if (owner == null) {
- this.owner = "";
- } else {
- if (owner.length() > 16 || owner.isEmpty()) this.owner = "";
- else this.owner = owner;
- }
- if (this.owner != null && !this.owner.isEmpty()) this.skullType = (byte) 3;
- }
-
- /**
- * Get the skull's owner. Returns null if unset.
- * @return player name or null
- */
- public String getOwner() {
- return owner;
- }
-
- /**
- * Get the type of skull.
- * @return the skullType
- */
- public byte getSkullType() {
- return skullType;
- }
-
- /**
- * Set the type of skull;
- * @param skullType the skullType to set
- */
- public void setSkullType(byte skullType) {
- this.skullType = skullType;
- }
-
- /**
- * Get rotation of skull. This only means anything if the block data is 1.
- * @return the rotation
- */
- public byte getRot() {
- return rot;
- }
-
- /**
- * Set the rotation of skull.
- * @param rot the rotation to set
- */
- public void setRot(byte rot) {
- this.rot = rot;
- }
-
- @Override
- public boolean hasNbtData() {
- return true;
- }
-
- @Override
- public String getNbtId() {
- return "Skull";
- }
-
- @Override
- public CompoundTag getNbtData() {
- Map values = new HashMap();
- values.put("SkullType", new ByteTag("SkullType", skullType));
- if (owner == null) owner = "";
- values.put("ExtraType", new StringTag("ExtraType", owner));
- values.put("Rot", new ByteTag("Rot", rot));
- return new CompoundTag(getNbtId(), values);
- }
-
- @Override
- public void setNbtData(CompoundTag rootTag) {
- if (rootTag == null) {
- return;
- }
-
- Map values = rootTag.getValue();
-
- Tag t;
-
- t = values.get("id");
- if (!(t instanceof StringTag) || !((StringTag) t).getValue().equals("Skull")) {
- throw new RuntimeException("'Skull' tile entity expected");
- }
-
- t = values.get("SkullType");
- if (t instanceof ByteTag) {
- skullType = ((ByteTag) t).getValue();
- }
- t = values.get("ExtraType");
- if (t != null && t instanceof StringTag) {
- owner = ((StringTag) t).getValue();
- }
- t = values.get("Rot");
- if (t instanceof ByteTag) {
- rot = ((ByteTag) t).getValue();
- }
- }
-}
+/*
+ * WorldEdit, a Minecraft world manipulation toolkit
+ * Copyright (C) sk89q
+ * Copyright (C) WorldEdit team and contributors
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.sk89q.worldedit.blocks;
+
+import com.sk89q.jnbt.ByteTag;
+import com.sk89q.jnbt.CompoundTag;
+import com.sk89q.jnbt.StringTag;
+import com.sk89q.jnbt.Tag;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * A skull block.
+ */
+public class SkullBlock extends BaseBlock implements TileEntityBlock {
+
+ private String owner = ""; // notchian
+ private byte skullType; // stored here for block, in damage value for item
+ private byte rot; // only matters if block data == 0x1 (on floor)
+
+ /**
+ * Construct the skull block with a default type of skelton.
+ * @param data data value to set, controls placement
+ */
+ public SkullBlock(int data) {
+ this(data, (byte) 0);
+ }
+
+ /**
+ * Construct the skull block with a given type.
+ * 0 - skeleton
+ * 1 - wither skelly
+ * 2 - zombie
+ * 3 - human
+ * 4 - creeper
+ * @param data data value to set, controls placement
+ * @param type type of skull
+ */
+ public SkullBlock(int data, byte type) {
+ this(data, type, (byte) 0);
+ }
+
+ /**
+ * Construct the skull block with a given type and rotation.
+ * @param data data value to set, controls placement
+ * @param type type of skull
+ * @param rot rotation (if on floor)
+ */
+ public SkullBlock(int data, byte type, byte rot) {
+ super(BlockID.HEAD, data);
+ if (type < (byte) 0 || type > (byte) 4) {
+ this.skullType = (byte) 0;
+ } else {
+ this.skullType = type;
+ }
+ this.rot = rot;
+ this.owner = "";
+ }
+
+ /**
+ * Construct the skull block with a given rotation and owner.
+ * The type is assumed to be player unless owner is null or empty.
+ * @param data data value to set, controls placement
+ * @param rot rotation of skull
+ * @param owner name of player
+ */
+ public SkullBlock(int data, byte rot, String owner) {
+ super(BlockID.HEAD, data);
+ this.rot = rot;
+ this.setOwner(owner);
+ if (owner == null || owner.isEmpty()) this.skullType = (byte) 0;
+ }
+
+ /**
+ * Set the skull's owner. Automatically sets type to player if not empty or null.
+ * @param owner player name to set the skull to
+ */
+ public void setOwner(String owner) {
+ if (owner == null) {
+ this.owner = "";
+ } else {
+ if (owner.length() > 16 || owner.isEmpty()) this.owner = "";
+ else this.owner = owner;
+ }
+ if (this.owner != null && !this.owner.isEmpty()) this.skullType = (byte) 3;
+ }
+
+ /**
+ * Get the skull's owner. Returns null if unset.
+ * @return player name or null
+ */
+ public String getOwner() {
+ return owner;
+ }
+
+ /**
+ * Get the type of skull.
+ * @return the skullType
+ */
+ public byte getSkullType() {
+ return skullType;
+ }
+
+ /**
+ * Set the type of skull;
+ * @param skullType the skullType to set
+ */
+ public void setSkullType(byte skullType) {
+ this.skullType = skullType;
+ }
+
+ /**
+ * Get rotation of skull. This only means anything if the block data is 1.
+ * @return the rotation
+ */
+ public byte getRot() {
+ return rot;
+ }
+
+ /**
+ * Set the rotation of skull.
+ * @param rot the rotation to set
+ */
+ public void setRot(byte rot) {
+ this.rot = rot;
+ }
+
+ @Override
+ public boolean hasNbtData() {
+ return true;
+ }
+
+ @Override
+ public String getNbtId() {
+ return "Skull";
+ }
+
+ @Override
+ public CompoundTag getNbtData() {
+ Map values = new HashMap();
+ values.put("SkullType", new ByteTag("SkullType", skullType));
+ if (owner == null) owner = "";
+ values.put("ExtraType", new StringTag("ExtraType", owner));
+ values.put("Rot", new ByteTag("Rot", rot));
+ return new CompoundTag(getNbtId(), values);
+ }
+
+ @Override
+ public void setNbtData(CompoundTag rootTag) {
+ if (rootTag == null) {
+ return;
+ }
+
+ Map values = rootTag.getValue();
+
+ Tag t;
+
+ t = values.get("id");
+ if (!(t instanceof StringTag) || !((StringTag) t).getValue().equals("Skull")) {
+ throw new RuntimeException("'Skull' tile entity expected");
+ }
+
+ t = values.get("SkullType");
+ if (t instanceof ByteTag) {
+ skullType = ((ByteTag) t).getValue();
+ }
+ t = values.get("ExtraType");
+ if (t != null && t instanceof StringTag) {
+ owner = ((StringTag) t).getValue();
+ }
+ t = values.get("Rot");
+ if (t instanceof ByteTag) {
+ rot = ((ByteTag) t).getValue();
+ }
+ }
+}
From 22dceb5614c29bec27d2ff79df82504fd17f1ad6 Mon Sep 17 00:00:00 2001
From: sk89q
Date: Wed, 9 Jul 2014 14:05:52 -0700
Subject: [PATCH 15/56] Added GSON, Trove as dependencies and enabled
minimizeJar for shading.
---
pom.xml | 29 +++++++++++++++++++++++++++++
src/main/build/import-control.xml | 2 ++
2 files changed, 31 insertions(+)
diff --git a/pom.xml b/pom.xml
index 24b512526..f0a66b601 100644
--- a/pom.xml
+++ b/pom.xml
@@ -142,6 +142,22 @@
jar
+
+
+ com.google.code.gson
+ gson
+ 2.2.4
+ true
+
+
+
+
+ net.sf.trove4j
+ trove4j
+ 3.0.3
+ true
+
+
com.google.code.findbugs
@@ -367,12 +383,25 @@
shade
+ true
com.sk89q:jchronic
com.thoughtworks.paranamer:paranamer
+ com.google.code.gson:gson
+ net.sf.trove4j:trove4j
+
+
+ gnu.trove
+ com.sk89q.worldedit.internal.trove
+
+
+ com.google.gson
+ com.sk89q.worldedit.internal.gson
+
+
diff --git a/src/main/build/import-control.xml b/src/main/build/import-control.xml
index 9ef48920d..9bb8d7a3d 100644
--- a/src/main/build/import-control.xml
+++ b/src/main/build/import-control.xml
@@ -10,6 +10,8 @@
+
+
From 56b349ead808cf86357a6b7d4cfbf023a94d582e Mon Sep 17 00:00:00 2001
From: sk89q
Date: Wed, 9 Jul 2014 14:14:17 -0700
Subject: [PATCH 16/56] Add a new block metadata framework and fix //rotate and
//flip.
Remove the previous Mapping interfaces.
---
.../sk89q/worldedit/bukkit/BukkitWorld.java | 105 +-
.../com/sk89q/worldedit/forge/ForgeWorld.java | 55 +-
.../com/sk89q/worldedit/LocalSession.java | 18 +-
.../java/com/sk89q/worldedit/WorldEdit.java | 8 +-
.../sk89q/worldedit/blocks/BlockMaterial.java | 71 +
.../worldedit/command/ClipboardCommands.java | 22 +-
.../command/tool/brush/ClipboardBrush.java | 23 +-
.../transform/BlockTransformExtent.java | 181 +
.../worldedit/internal/LocalWorldAdapter.java | 45 +-
.../com/sk89q/worldedit/math/MathUtils.java | 9 +
.../math/transform/AffineTransform.java | 6 +
.../worldedit/math/transform/Transform.java | 11 +-
.../worldedit/session/ClipboardHolder.java | 26 +-
.../sk89q/worldedit/session/PasteBuilder.java | 102 +
.../worldedit/util/gson/VectorAdapter.java | 49 +
.../com/sk89q/worldedit/world/NullWorld.java | 37 +-
.../java/com/sk89q/worldedit/world/World.java | 22 +-
.../worldedit/world/mapping/Mapping.java | 114 -
.../world/registry/BlockRegistry.java | 69 +
.../world/registry/BundledBlockData.java | 189 +
.../world/registry/LegacyBlockRegistry.java | 63 +
.../world/registry/LegacyWorldData.java | 51 +
.../world/registry/SimpleBlockMaterial.java | 246 +
.../worldedit/world/registry/SimpleState.java | 71 +
.../world/registry/SimpleStateValue.java | 55 +
.../Resolver.java => registry/State.java} | 43 +-
.../worldedit/world/registry/StateValue.java | 56 +
.../WorldData.java} | 29 +-
.../worldedit/world/registry/blocks.json | 5968 +++++++++++++++++
29 files changed, 7425 insertions(+), 319 deletions(-)
create mode 100644 src/main/java/com/sk89q/worldedit/blocks/BlockMaterial.java
create mode 100644 src/main/java/com/sk89q/worldedit/extent/transform/BlockTransformExtent.java
create mode 100644 src/main/java/com/sk89q/worldedit/session/PasteBuilder.java
create mode 100644 src/main/java/com/sk89q/worldedit/util/gson/VectorAdapter.java
delete mode 100644 src/main/java/com/sk89q/worldedit/world/mapping/Mapping.java
create mode 100644 src/main/java/com/sk89q/worldedit/world/registry/BlockRegistry.java
create mode 100644 src/main/java/com/sk89q/worldedit/world/registry/BundledBlockData.java
create mode 100644 src/main/java/com/sk89q/worldedit/world/registry/LegacyBlockRegistry.java
create mode 100644 src/main/java/com/sk89q/worldedit/world/registry/LegacyWorldData.java
create mode 100644 src/main/java/com/sk89q/worldedit/world/registry/SimpleBlockMaterial.java
create mode 100644 src/main/java/com/sk89q/worldedit/world/registry/SimpleState.java
create mode 100644 src/main/java/com/sk89q/worldedit/world/registry/SimpleStateValue.java
rename src/main/java/com/sk89q/worldedit/world/{mapping/Resolver.java => registry/State.java} (51%)
create mode 100644 src/main/java/com/sk89q/worldedit/world/registry/StateValue.java
rename src/main/java/com/sk89q/worldedit/world/{mapping/NullResolver.java => registry/WorldData.java} (64%)
create mode 100644 src/main/resources/com/sk89q/worldedit/world/registry/blocks.json
diff --git a/src/bukkit/java/com/sk89q/worldedit/bukkit/BukkitWorld.java b/src/bukkit/java/com/sk89q/worldedit/bukkit/BukkitWorld.java
index 458aa8477..72a774ede 100644
--- a/src/bukkit/java/com/sk89q/worldedit/bukkit/BukkitWorld.java
+++ b/src/bukkit/java/com/sk89q/worldedit/bukkit/BukkitWorld.java
@@ -19,24 +19,67 @@
package com.sk89q.worldedit.bukkit;
-import com.sk89q.worldedit.*;
+import com.sk89q.worldedit.BiomeType;
+import com.sk89q.worldedit.BlockVector2D;
+import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.EntityType;
+import com.sk89q.worldedit.LocalEntity;
+import com.sk89q.worldedit.LocalWorld;
import com.sk89q.worldedit.Vector;
-import com.sk89q.worldedit.blocks.*;
+import com.sk89q.worldedit.Vector2D;
+import com.sk89q.worldedit.WorldEdit;
+import com.sk89q.worldedit.WorldEditException;
+import com.sk89q.worldedit.blocks.BaseBlock;
+import com.sk89q.worldedit.blocks.BaseItemStack;
+import com.sk89q.worldedit.blocks.BlockID;
import com.sk89q.worldedit.blocks.ContainerBlock;
+import com.sk89q.worldedit.blocks.FurnaceBlock;
+import com.sk89q.worldedit.blocks.LazyBlock;
+import com.sk89q.worldedit.blocks.MobSpawnerBlock;
import com.sk89q.worldedit.blocks.NoteBlock;
+import com.sk89q.worldedit.blocks.SignBlock;
+import com.sk89q.worldedit.blocks.SkullBlock;
import com.sk89q.worldedit.bukkit.entity.BukkitEntity;
-import com.sk89q.worldedit.entity.*;
+import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.TreeGenerator;
-import com.sk89q.worldedit.world.mapping.NullResolver;
-import com.sk89q.worldedit.world.mapping.Resolver;
-import org.bukkit.*;
+import com.sk89q.worldedit.world.registry.LegacyWorldData;
+import com.sk89q.worldedit.world.registry.WorldData;
+import org.bukkit.Bukkit;
+import org.bukkit.Effect;
import org.bukkit.Location;
-import org.bukkit.block.*;
+import org.bukkit.Material;
+import org.bukkit.SkullType;
+import org.bukkit.TreeType;
+import org.bukkit.World;
+import org.bukkit.block.Biome;
+import org.bukkit.block.Block;
+import org.bukkit.block.BlockFace;
+import org.bukkit.block.BlockState;
+import org.bukkit.block.Chest;
+import org.bukkit.block.CreatureSpawner;
+import org.bukkit.block.Furnace;
+import org.bukkit.block.Sign;
+import org.bukkit.block.Skull;
import org.bukkit.enchantments.Enchantment;
-import org.bukkit.entity.*;
+import org.bukkit.entity.Ambient;
+import org.bukkit.entity.Animals;
+import org.bukkit.entity.Boat;
import org.bukkit.entity.Entity;
+import org.bukkit.entity.ExperienceOrb;
+import org.bukkit.entity.FallingBlock;
+import org.bukkit.entity.Golem;
+import org.bukkit.entity.Hanging;
+import org.bukkit.entity.HumanEntity;
+import org.bukkit.entity.Item;
+import org.bukkit.entity.ItemFrame;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Minecart;
+import org.bukkit.entity.Painting;
+import org.bukkit.entity.Projectile;
+import org.bukkit.entity.TNTPrimed;
+import org.bukkit.entity.Tameable;
+import org.bukkit.entity.Villager;
import org.bukkit.inventory.DoubleChestInventory;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
@@ -49,7 +92,14 @@ import java.io.InputStream;
import java.lang.ref.WeakReference;
import java.lang.reflect.Method;
import java.net.URL;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.EnumMap;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -1180,6 +1230,11 @@ public class BukkitWorld extends LocalWorld {
return true;
}
+ @Override
+ public WorldData getWorldData() {
+ return LegacyWorldData.getInstance();
+ }
+
@Override
public void simulateBlockMine(Vector pt) {
getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).breakNaturally();
@@ -1280,38 +1335,6 @@ public class BukkitWorld extends LocalWorld {
return super.setBlock(pt, block, notifyAdjacent);
}
- @Override
- public Resolver getBlockMapping() {
- return new NullResolver();
- }
-
- @Override
- public Resolver getEntityMapping() {
- return new NullResolver();
- }
-
- @Nullable
- @Override
- public T getMetaData(BaseBlock block, Class metaDataClass) {
- return null;
- }
-
- @Nullable
- @Override
- public T getMetaData(com.sk89q.worldedit.entity.Entity entity, Class metaDataClass) {
- if (entity instanceof com.sk89q.worldedit.bukkit.BukkitEntity) {
- return ((com.sk89q.worldedit.bukkit.BukkitEntity) entity).getMetaData(metaDataClass);
- }
-
- return null;
- }
-
- @Nullable
- @Override
- public T getMetaData(BaseEntity entity, Class metaDataClass) {
- return null;
- }
-
/**
* @deprecated Use {@link #setBlock(Vector, BaseBlock, boolean)}
*/
diff --git a/src/forge/java/com/sk89q/worldedit/forge/ForgeWorld.java b/src/forge/java/com/sk89q/worldedit/forge/ForgeWorld.java
index 60f229bf0..5087799a7 100644
--- a/src/forge/java/com/sk89q/worldedit/forge/ForgeWorld.java
+++ b/src/forge/java/com/sk89q/worldedit/forge/ForgeWorld.java
@@ -20,7 +20,13 @@
package com.sk89q.worldedit.forge;
import com.sk89q.jnbt.CompoundTag;
-import com.sk89q.worldedit.*;
+import com.sk89q.worldedit.BiomeType;
+import com.sk89q.worldedit.EditSession;
+import com.sk89q.worldedit.EntityType;
+import com.sk89q.worldedit.MaxChangedBlocksException;
+import com.sk89q.worldedit.Vector;
+import com.sk89q.worldedit.Vector2D;
+import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.blocks.LazyBlock;
@@ -30,14 +36,22 @@ import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
import com.sk89q.worldedit.world.AbstractWorld;
-import com.sk89q.worldedit.world.mapping.NullResolver;
-import com.sk89q.worldedit.world.mapping.Resolver;
+import com.sk89q.worldedit.world.registry.LegacyWorldData;
+import com.sk89q.worldedit.world.registry.WorldData;
import net.minecraft.block.Block;
import net.minecraft.entity.EntityHanging;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.IProjectile;
-import net.minecraft.entity.item.*;
+import net.minecraft.entity.item.EntityBoat;
+import net.minecraft.entity.item.EntityEnderEye;
+import net.minecraft.entity.item.EntityFallingSand;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.item.EntityItemFrame;
+import net.minecraft.entity.item.EntityMinecart;
+import net.minecraft.entity.item.EntityPainting;
+import net.minecraft.entity.item.EntityTNTPrimed;
+import net.minecraft.entity.item.EntityXPOrb;
import net.minecraft.entity.monster.EntityGolem;
import net.minecraft.entity.passive.EntityAmbientCreature;
import net.minecraft.entity.passive.EntityAnimal;
@@ -432,6 +446,11 @@ public class ForgeWorld extends AbstractWorld {
return false;
}
+ @Override
+ public WorldData getWorldData() {
+ return LegacyWorldData.getInstance();
+ }
+
@Override
public boolean isValidBlockType(int id) {
return (id == 0) || (net.minecraft.block.Block.blocksList[id] != null);
@@ -480,34 +499,6 @@ public class ForgeWorld extends AbstractWorld {
}
}
- @Override
- public Resolver getBlockMapping() {
- return new NullResolver();
- }
-
- @Override
- public Resolver getEntityMapping() {
- return new NullResolver();
- }
-
- @Nullable
- @Override
- public T getMetaData(BaseBlock block, Class metaDataClass) {
- return null;
- }
-
- @Nullable
- @Override
- public T getMetaData(Entity entity, Class metaDataClass) {
- return null;
- }
-
- @Nullable
- @Override
- public T getMetaData(BaseEntity entity, Class metaDataClass) {
- return null;
- }
-
@Override
public List getEntities() {
List