Merge remote-tracking branch 'refs/remotes/sk89q/master'

# Conflicts:

#	worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitAdapter.java
#	worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLProcessor.java
#	worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BlockType.java

#	worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolCommands.java

#	worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockReplacer.java

#	worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/LongRangeBuildTool.java

#	worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java

#	worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java

#	worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemType.java
Dieser Commit ist enthalten in:
Jesse Boyd 2018-08-14 01:36:00 +10:00
Commit 76a55b7712
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 59F1DE6293AF6E1F
18 geänderte Dateien mit 85 neuen und 74 gelöschten Zeilen

Datei anzeigen

@ -33,6 +33,8 @@ import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.entity.EntityType;
import com.sk89q.worldedit.world.entity.EntityTypes;
import com.sk89q.worldedit.world.gamemode.GameMode;
import com.sk89q.worldedit.world.gamemode.GameModes;
import com.sk89q.worldedit.world.item.ItemType;
@ -218,7 +220,7 @@ public class BukkitAdapter {
if (!itemType.getId().startsWith("minecraft:")) {
throw new IllegalArgumentException("Bukkit only supports Minecraft items");
}
return Material.getMaterial(itemType.getId().replace("minecraft:", "").toUpperCase());
return Material.getMaterial(itemType.getId().substring(10).toUpperCase());
}
/**
@ -247,6 +249,23 @@ public class BukkitAdapter {
return GameModes.get(gameMode.name().toLowerCase());
}
/**
* Create a WorldEdit EntityType from a Bukkit one.
*
* @param entityType Bukkit EntityType
* @return WorldEdit EntityType
*/
public static EntityType adapt(org.bukkit.entity.EntityType entityType) {
return EntityTypes.get(entityType.getName().toLowerCase());
}
public static org.bukkit.entity.EntityType adapt(EntityType entityType) {
if (!entityType.getId().startsWith("minecraft:")) {
throw new IllegalArgumentException("Bukkit only supports vanilla entities");
}
return org.bukkit.entity.EntityType.fromName(entityType.getId().substring(10).toLowerCase());
}
/**
* Converts a Material to a BlockType
*

Datei anzeigen

@ -32,7 +32,7 @@ import java.util.Map;
/**
* Represents a sign block.
*/
public class SignBlock extends BaseBlock implements TileEntityBlock {
public class SignBlock extends BaseBlock {
private String[] text;

Datei anzeigen

@ -31,7 +31,7 @@ import java.util.Map;
/**
* A skull block.
*/
public class SkullBlock extends BaseBlock implements TileEntityBlock {
public class SkullBlock extends BaseBlock {
private String owner = ""; // notchian

Datei anzeigen

@ -83,7 +83,7 @@ public class YAMLProcessor extends YAMLNode {
super(new LinkedHashMap<>(), writeDefaults);
this.format = format;
DumperOptions options = new FancyDumperOptions();
DumperOptions options = new DumperOptions();
options.setIndent(4);
options.setDefaultFlowStyle(format.getStyle());
Representer representer = new FancyRepresenter();
@ -289,19 +289,6 @@ public class YAMLProcessor extends YAMLNode {
return new YAMLNode(new LinkedHashMap<>(), writeDefaults);
}
// This will be included in snakeyaml 1.10, but until then we have to do it manually.
private class FancyDumperOptions extends DumperOptions {
// @Override
// public DumperOptions.ScalarStyle calculateScalarStyle(ScalarAnalysis analysis,
// DumperOptions.ScalarStyle style) {
// if (format == YAMLFormat.EXTENDED && (analysis.scalar.contains("\n") || analysis.scalar.contains("\r"))) {
// return ScalarStyle.LITERAL;
// } else {
// return super.calculateScalarStyle(analysis, style);
// }
// }
}
private static class FancyRepresenter extends Representer {
private FancyRepresenter() {
this.nullRepresenter = o -> representScalar(Tag.NULL, "");

Datei anzeigen

@ -46,6 +46,10 @@ import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.TreeGenerator;
import com.sk89q.worldedit.util.command.parametric.Optional;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.function.pattern.BlockPattern;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.TreeGenerator;
@Command(aliases = {"brush", "br", "tool"}, desc = "Bind functions to held items: [More Info](https://goo.gl/xPnPxj)")
public class ToolCommands {
@ -133,13 +137,13 @@ public class ToolCommands {
max = 2
)
@CommandPermissions("worldedit.tool.flood-fill")
public void floodFill(Player player, EditSession editSession, LocalSession session, Pattern pattern, double range) throws WorldEditException {
public void floodFill(Player player, EditSession editSession, LocalSession session, Pattern pattern, int range) throws WorldEditException {
LocalConfiguration config = we.getConfiguration();
if (range > config.maxSuperPickaxeSize) {
BBC.TOOL_RANGE_ERROR.send(player, config.maxSuperPickaxeSize);
return;
}
session.setTool(new FloodFillTool((int) range, pattern), player);
session.setTool(new FloodFillTool(range, pattern), player);
BBC.TOOL_FLOOD_FILL.send(player, player.getItemInHand(HandSide.MAIN_HAND).getType().getName());
}
@ -184,4 +188,4 @@ public class ToolCommands {
}
}
}

Datei anzeigen

@ -25,10 +25,18 @@ import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extension.platform.Platform;
import com.sk89q.worldedit.extent.inventory.BlockBag;
import com.sk89q.worldedit.function.pattern.BlockPattern;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.world.block.BlockStateHolder;
/**
* A mode that replaces one block.

Datei anzeigen

@ -23,6 +23,7 @@ import com.boydti.fawe.config.BBC;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extension.platform.Platform;
@ -30,6 +31,7 @@ import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockTypes;
/**
* A tool that can place (or remove) blocks at a distance.
@ -39,7 +41,7 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
private Pattern primary;
private Pattern secondary;
public LongRangeBuildTool(Pattern primary, Pattern secondary) {
public LongRangeBuildTool(Pattern secondary, Pattern primary) {
super("worldedit.tool.lrbuild");
this.primary = primary;
this.secondary = secondary;
@ -55,7 +57,9 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
Location pos = getTargetFace(player);
if (pos == null) return false;
EditSession eS = session.createEditSession(player);
if (secondary instanceof BlockStateHolder && ((BlockStateHolder) secondary).getBlockType().getMaterial().isAir()) {
BlockStateHolder applied = secondary.apply(pos.toVector());
if (applied.getBlockType().getMaterial().isAir()) {
eS.setBlock(pos.toVector(), secondary);
} else {
eS.setBlock(pos.getDirection(), secondary);
@ -68,7 +72,8 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
Location pos = getTargetFace(player);
if (pos == null) return false;
EditSession eS = session.createEditSession(player);
if (primary instanceof BlockStateHolder && ((BlockStateHolder) primary).getBlockType().getMaterial().isAir()) {
BlockStateHolder applied = primary.apply(pos.toVector());
if (applied.getBlockType().getMaterial().isAir()) {
eS.setBlock(pos.toVector(), primary);
} else {
eS.setBlock(pos.getDirection(), primary);

Datei anzeigen

@ -21,10 +21,8 @@ package com.sk89q.worldedit.extent.reorder;
import com.google.common.collect.Iterators;
import com.sk89q.worldedit.BlockVector;
import com.sk89q.worldedit.PlayerDirection;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.blocks.BlockType;
import com.sk89q.worldedit.blocks.Blocks;
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
import com.sk89q.worldedit.extent.Extent;
@ -181,12 +179,12 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder
}
// current = current.add(attachment.vector()).toBlockVector();
if (!blocks.contains(current)) {
// We ran outside the remaining set => assume we can place blocks on this
break;
}
//
// if (!blocks.contains(current)) {
// // We ran outside the remaining set => assume we can place blocks on this
// break;
// }
//
if (walked.contains(current)) {
// Cycle detected => This will most likely go wrong, but there's nothing we can do about it.
break;

Datei anzeigen

@ -59,4 +59,9 @@ public abstract class Category<T> {
this.set.clear();
this.empty = true;
}
@Override
public String toString() {
return getId();
}
}

Datei anzeigen

@ -48,6 +48,11 @@ public class EntityType {
return getId();
}
@Override
public String toString() {
return getId();
}
@Override
public int hashCode() {
return this.id.hashCode();

Datei anzeigen

@ -44,6 +44,11 @@ public class FluidType {
return this.id;
}
@Override
public String toString() {
return getId();
}
@Override
public int hashCode() {
return this.id.hashCode();

Datei anzeigen

@ -44,6 +44,11 @@ public class GameMode {
return getId();
}
@Override
public String toString() {
return getId();
}
@Override
public int hashCode() {
return this.id.hashCode();

Datei anzeigen

@ -59,7 +59,7 @@ public interface ItemType {
* @return The block representation
*/
@Nullable
default BlockType getBlockType() {
default BlockTypes getBlockType() {
return BlockTypes.get(getId());
}

Datei anzeigen

@ -44,6 +44,11 @@ public class WeatherType {
return getId();
}
@Override
public String toString() {
return getId();
}
@Override
public int hashCode() {
return this.id.hashCode();

Datei anzeigen

@ -386,7 +386,7 @@ public class ForgeWorld extends AbstractWorld {
TileEntity tile = getWorld().getTileEntity(pos);
if (tile != null) {
return new TileEntityBaseBlock(getBlock(position), tile);
return getBlock(position).toBaseBlock(NBTConverter.fromNative(TileEntityUtils.copyNbtData(tile)));
} else {
return getBlock(position).toBaseBlock();
}

Datei anzeigen

@ -1,40 +0,0 @@
/*
* WorldEdit, a Minecraft world manipulation toolkit
* Copyright (C) sk89q <http://www.sk89q.com>
* 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 <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldedit.forge;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.blocks.TileEntityBlock;
import com.sk89q.worldedit.world.block.BlockState;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
public class TileEntityBaseBlock extends BaseBlock implements TileEntityBlock {
public TileEntityBaseBlock(BlockState state, TileEntity tile) {
super(state, NBTConverter.fromNative(copyNbtData(tile)));
}
private static NBTTagCompound copyNbtData(TileEntity tile) {
NBTTagCompound tag = new NBTTagCompound();
tile.writeToNBT(tag);
return tag;
}
}

Datei anzeigen

@ -140,4 +140,9 @@ final class TileEntityUtils {
return genericTE;
}
public static NBTTagCompound copyNbtData(TileEntity tile) {
NBTTagCompound tag = new NBTTagCompound();
tile.writeToNBT(tag);
return tag;
}
}

Datei anzeigen

@ -6,7 +6,7 @@
"mcversion": "${mcVersion}",
"url": "http://wiki.sk89q.com/wiki/WorldEdit",
"updateUrl": "",
"authors": [ "sk89q", "wizjany", "TomyLobo", "kenzierocks" ],
"authors": [ "sk89q", "wizjany", "TomyLobo", "kenzierocks", "Me4502" ],
"credits": "",
"logoFile": "",
"screenshots": [],