geforkt von Mirrors/FastAsyncWorldEdit
Merging upstream changes
Dieser Commit ist enthalten in:
Ursprung
85bfd16d7c
Commit
0d88a6bce2
@ -225,7 +225,7 @@ public final class Spigot_v1_13_R2 extends CachedBukkitAdapter implements Bukkit
|
|||||||
if (te != null) {
|
if (te != null) {
|
||||||
NBTTagCompound tag = new NBTTagCompound();
|
NBTTagCompound tag = new NBTTagCompound();
|
||||||
readTileEntityIntoTag(te, tag); // Load data
|
readTileEntityIntoTag(te, tag); // Load data
|
||||||
return new BaseBlock(state, (CompoundTag) toNative(tag));
|
return state.toBaseBlock((CompoundTag) toNative(tag));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -402,17 +402,19 @@ public final class Spigot_v1_13_R2 extends CachedBukkitAdapter implements Bukkit
|
|||||||
}
|
}
|
||||||
return new CompoundTag(values);
|
return new CompoundTag(values);
|
||||||
} else if (foreign instanceof NBTTagByte) {
|
} else if (foreign instanceof NBTTagByte) {
|
||||||
return new ByteTag(((NBTTagByte) foreign).asByte()); // getByte
|
return new ByteTag(((NBTTagByte) foreign).asByte());
|
||||||
} else if (foreign instanceof NBTTagByteArray) {
|
} else if (foreign instanceof NBTTagByteArray) {
|
||||||
return new ByteArrayTag(((NBTTagByteArray) foreign).c()); // data
|
return new ByteArrayTag(((NBTTagByteArray) foreign).c()); // data
|
||||||
} else if (foreign instanceof NBTTagDouble) {
|
} else if (foreign instanceof NBTTagDouble) {
|
||||||
return new DoubleTag(((NBTTagDouble) foreign).asDouble()); // getDouble
|
return new DoubleTag(((NBTTagDouble) foreign).asDouble()); // getDouble
|
||||||
} else if (foreign instanceof NBTTagFloat) {
|
} else if (foreign instanceof NBTTagFloat) {
|
||||||
return new FloatTag(((NBTTagFloat) foreign).asFloat()); // getFloat
|
return new FloatTag(((NBTTagFloat) foreign).asFloat());
|
||||||
} else if (foreign instanceof NBTTagInt) {
|
} else if (foreign instanceof NBTTagInt) {
|
||||||
return new IntTag(((NBTTagInt) foreign).asInt()); // getInt
|
return new IntTag(((NBTTagInt) foreign).asInt());
|
||||||
} else if (foreign instanceof NBTTagIntArray) {
|
} else if (foreign instanceof NBTTagIntArray) {
|
||||||
return new IntArrayTag(((NBTTagIntArray) foreign).d()); // data
|
return new IntArrayTag(((NBTTagIntArray) foreign).d()); // data
|
||||||
|
} else if (foreign instanceof NBTTagLongArray) {
|
||||||
|
return new LongArrayTag(((NBTTagLongArray) foreign).d()); // data
|
||||||
} else if (foreign instanceof NBTTagList) {
|
} else if (foreign instanceof NBTTagList) {
|
||||||
try {
|
try {
|
||||||
return toNativeList((NBTTagList) foreign);
|
return toNativeList((NBTTagList) foreign);
|
||||||
@ -421,11 +423,11 @@ public final class Spigot_v1_13_R2 extends CachedBukkitAdapter implements Bukkit
|
|||||||
return new ListTag(ByteTag.class, new ArrayList<ByteTag>());
|
return new ListTag(ByteTag.class, new ArrayList<ByteTag>());
|
||||||
}
|
}
|
||||||
} else if (foreign instanceof NBTTagLong) {
|
} else if (foreign instanceof NBTTagLong) {
|
||||||
return new LongTag(((NBTTagLong) foreign).asLong()); // getLong
|
return new LongTag(((NBTTagLong) foreign).asLong());
|
||||||
} else if (foreign instanceof NBTTagShort) {
|
} else if (foreign instanceof NBTTagShort) {
|
||||||
return new ShortTag(((NBTTagShort) foreign).asShort()); // getShort
|
return new ShortTag(((NBTTagShort) foreign).asShort());
|
||||||
} else if (foreign instanceof NBTTagString) {
|
} else if (foreign instanceof NBTTagString) {
|
||||||
return new StringTag(foreign.asString()); // data
|
return new StringTag(foreign.asString());
|
||||||
} else if (foreign instanceof NBTTagEnd) {
|
} else if (foreign instanceof NBTTagEnd) {
|
||||||
return new EndTag();
|
return new EndTag();
|
||||||
} else {
|
} else {
|
||||||
@ -445,7 +447,7 @@ public final class Spigot_v1_13_R2 extends CachedBukkitAdapter implements Bukkit
|
|||||||
*/
|
*/
|
||||||
public ListTag toNativeList(NBTTagList foreign) throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
|
public ListTag toNativeList(NBTTagList foreign) throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
|
||||||
List<Tag> values = new ArrayList<>();
|
List<Tag> values = new ArrayList<>();
|
||||||
int type = foreign.getTypeId();
|
int type = foreign.d();
|
||||||
|
|
||||||
List foreignList;
|
List foreignList;
|
||||||
foreignList = (List) nbtListTagListField.get(foreign);
|
foreignList = (List) nbtListTagListField.get(foreign);
|
||||||
@ -488,9 +490,11 @@ public final class Spigot_v1_13_R2 extends CachedBukkitAdapter implements Bukkit
|
|||||||
return new NBTTagInt(((IntTag) foreign).getValue());
|
return new NBTTagInt(((IntTag) foreign).getValue());
|
||||||
} else if (foreign instanceof IntArrayTag) {
|
} else if (foreign instanceof IntArrayTag) {
|
||||||
return new NBTTagIntArray(((IntArrayTag) foreign).getValue());
|
return new NBTTagIntArray(((IntArrayTag) foreign).getValue());
|
||||||
|
} else if (foreign instanceof LongArrayTag) {
|
||||||
|
return new NBTTagLongArray(((LongArrayTag) foreign).getValue());
|
||||||
} else if (foreign instanceof ListTag) {
|
} else if (foreign instanceof ListTag) {
|
||||||
NBTTagList tag = new NBTTagList();
|
NBTTagList tag = new NBTTagList();
|
||||||
ListTag<?> foreignList = (ListTag) foreign;
|
ListTag foreignList = (ListTag) foreign;
|
||||||
for (Tag t : foreignList.getValue()) {
|
for (Tag t : foreignList.getValue()) {
|
||||||
tag.add(fromNative(t));
|
tag.add(fromNative(t));
|
||||||
}
|
}
|
||||||
|
@ -19,24 +19,22 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.bukkit;
|
package com.sk89q.worldedit.bukkit;
|
||||||
|
|
||||||
import com.sk89q.worldedit.entity.metadata.Metadatable;
|
|
||||||
import com.sk89q.worldedit.session.SessionKey;
|
|
||||||
import com.sk89q.worldedit.util.auth.AuthorizationException;
|
|
||||||
import com.sk89q.worldedit.extension.platform.Actor;
|
|
||||||
import com.sk89q.worldedit.internal.cui.CUIEvent;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkArgument;
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
public class BukkitCommandSender implements Actor, Metadatable {
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
|
import com.sk89q.worldedit.internal.cui.CUIEvent;
|
||||||
|
import com.sk89q.worldedit.session.SessionKey;
|
||||||
|
import com.sk89q.worldedit.util.auth.AuthorizationException;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
public class BukkitCommandSender implements Actor {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* One time generated ID.
|
* One time generated ID.
|
||||||
@ -45,7 +43,6 @@ public class BukkitCommandSender implements Actor, Metadatable {
|
|||||||
|
|
||||||
private CommandSender sender;
|
private CommandSender sender;
|
||||||
private WorldEditPlugin plugin;
|
private WorldEditPlugin plugin;
|
||||||
private ConcurrentHashMap<String, Object> meta;
|
|
||||||
|
|
||||||
public BukkitCommandSender(WorldEditPlugin plugin, CommandSender sender) {
|
public BukkitCommandSender(WorldEditPlugin plugin, CommandSender sender) {
|
||||||
checkNotNull(plugin);
|
checkNotNull(plugin);
|
||||||
@ -56,12 +53,6 @@ public class BukkitCommandSender implements Actor, Metadatable {
|
|||||||
this.sender = sender;
|
this.sender = sender;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public synchronized Map<String, Object> getMetaMap() {
|
|
||||||
if (meta == null) meta = new ConcurrentHashMap<>();
|
|
||||||
return meta;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UUID getUniqueId() {
|
public UUID getUniqueId() {
|
||||||
return DEFAULT_ID;
|
return DEFAULT_ID;
|
||||||
|
@ -37,7 +37,7 @@ import javax.annotation.Nullable;
|
|||||||
/**
|
/**
|
||||||
* An adapter to adapt a Bukkit entity into a WorldEdit one.
|
* An adapter to adapt a Bukkit entity into a WorldEdit one.
|
||||||
*/
|
*/
|
||||||
public class BukkitEntity implements Entity {
|
class BukkitEntity implements Entity {
|
||||||
|
|
||||||
private final WeakReference<org.bukkit.entity.Entity> entityRef;
|
private final WeakReference<org.bukkit.entity.Entity> entityRef;
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ public class BukkitEntity implements Entity {
|
|||||||
*
|
*
|
||||||
* @param entity the entity
|
* @param entity the entity
|
||||||
*/
|
*/
|
||||||
public BukkitEntity(org.bukkit.entity.Entity entity) {
|
BukkitEntity(org.bukkit.entity.Entity entity) {
|
||||||
checkNotNull(entity);
|
checkNotNull(entity);
|
||||||
this.entityRef = new WeakReference<>(entity);
|
this.entityRef = new WeakReference<>(entity);
|
||||||
}
|
}
|
||||||
|
@ -18,16 +18,12 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.bukkit;
|
package com.sk89q.worldedit.bukkit;
|
||||||
|
|
||||||
import com.boydti.fawe.Fawe;
|
|
||||||
import com.sk89q.worldedit.*;
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||||
import com.sk89q.worldedit.blocks.LazyBlock;
|
|
||||||
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
|
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
|
||||||
import com.sk89q.worldedit.entity.BaseEntity;
|
import com.sk89q.worldedit.entity.BaseEntity;
|
||||||
import com.sk89q.worldedit.history.change.BlockChange;
|
import com.sk89q.worldedit.history.change.BlockChange;
|
||||||
@ -50,15 +46,19 @@ import org.bukkit.block.Block;
|
|||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.block.Chest;
|
import org.bukkit.block.Chest;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.DoubleChestInventory;
|
import org.bukkit.inventory.DoubleChestInventory;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.EnumMap;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
public class BukkitWorld extends AbstractWorld {
|
public class BukkitWorld extends AbstractWorld {
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ public class BukkitWorld extends AbstractWorld {
|
|||||||
List<com.sk89q.worldedit.entity.Entity> entities = new ArrayList<>();
|
List<com.sk89q.worldedit.entity.Entity> entities = new ArrayList<>();
|
||||||
for (Entity ent : ents) {
|
for (Entity ent : ents) {
|
||||||
if (region.contains(BukkitAdapter.asBlockVector(ent.getLocation()))) {
|
if (region.contains(BukkitAdapter.asBlockVector(ent.getLocation()))) {
|
||||||
addEntities(ent, entities);
|
entities.add(BukkitAdapter.adapt(ent));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return entities;
|
return entities;
|
||||||
@ -100,43 +100,11 @@ public class BukkitWorld extends AbstractWorld {
|
|||||||
public List<com.sk89q.worldedit.entity.Entity> getEntities() {
|
public List<com.sk89q.worldedit.entity.Entity> getEntities() {
|
||||||
List<com.sk89q.worldedit.entity.Entity> list = new ArrayList<>();
|
List<com.sk89q.worldedit.entity.Entity> list = new ArrayList<>();
|
||||||
for (Entity entity : getWorld().getEntities()) {
|
for (Entity entity : getWorld().getEntities()) {
|
||||||
addEntities(entity, list);
|
list.add(BukkitAdapter.adapt(entity));
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static com.sk89q.worldedit.entity.Entity adapt(Entity ent) {
|
|
||||||
if (ent == null) return null;
|
|
||||||
return BukkitAdapter.adapt(ent);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addEntities(Entity ent, Collection<com.sk89q.worldedit.entity.Entity> ents) {
|
|
||||||
ents.add(BukkitAdapter.adapt(ent));
|
|
||||||
if (ent instanceof Player) {
|
|
||||||
final Player plr = (Player) ent;
|
|
||||||
com.sk89q.worldedit.entity.Entity left = adapt(((Player) ent).getShoulderEntityLeft());
|
|
||||||
com.sk89q.worldedit.entity.Entity right = adapt(((Player) ent).getShoulderEntityRight());
|
|
||||||
if (left != null) {
|
|
||||||
ents.add(new DelegateEntity(left) {
|
|
||||||
@Override
|
|
||||||
public boolean remove() {
|
|
||||||
plr.setShoulderEntityLeft(null);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (right != null) {
|
|
||||||
ents.add(new DelegateEntity(right) {
|
|
||||||
@Override
|
|
||||||
public boolean remove() {
|
|
||||||
plr.setShoulderEntityRight(null);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public com.sk89q.worldedit.entity.Entity createEntity(com.sk89q.worldedit.util.Location location, BaseEntity entity) {
|
public com.sk89q.worldedit.entity.Entity createEntity(com.sk89q.worldedit.util.Location location, BaseEntity entity) {
|
||||||
@ -196,7 +164,7 @@ public class BukkitWorld extends AbstractWorld {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean regenerate(Region region, EditSession editSession) {
|
public boolean regenerate(Region region, EditSession editSession) {
|
||||||
com.sk89q.worldedit.world.block.BlockStateHolder[] history = new com.sk89q.worldedit.world.block.BlockState[16 * 16 * (getMaxY() + 1)];
|
BaseBlock[] history = new BaseBlock[16 * 16 * (getMaxY() + 1)];
|
||||||
|
|
||||||
for (BlockVector2 chunk : region.getChunks()) {
|
for (BlockVector2 chunk : region.getChunks()) {
|
||||||
BlockVector3 min = BlockVector3.at(chunk.getBlockX() * 16, 0, chunk.getBlockZ() * 16);
|
BlockVector3 min = BlockVector3.at(chunk.getBlockX() * 16, 0, chunk.getBlockZ() * 16);
|
||||||
@ -455,10 +423,7 @@ public class BukkitWorld extends AbstractWorld {
|
|||||||
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
|
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
|
||||||
if (adapter != null) {
|
if (adapter != null) {
|
||||||
try {
|
try {
|
||||||
int x = position.getBlockX();
|
return adapter.setBlock(BukkitAdapter.adapt(getWorld(), position), block, notifyAndLight);
|
||||||
int y = position.getBlockY();
|
|
||||||
int z = position.getBlockZ();
|
|
||||||
return adapter.setBlock(getWorld().getChunkAt(x >> 4, z >> 4), x, y, z, block, true);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (block instanceof BaseBlock && ((BaseBlock)block).getNbtData() != null) {
|
if (block instanceof BaseBlock && ((BaseBlock)block).getNbtData() != null) {
|
||||||
logger.warning("Tried to set a corrupt tile entity at " + position.toString());
|
logger.warning("Tried to set a corrupt tile entity at " + position.toString());
|
||||||
|
@ -300,7 +300,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
|||||||
for (int cx = scx; cx <= ecx; cx++) {
|
for (int cx = scx; cx <= ecx; cx++) {
|
||||||
final int finalCX = cx;
|
final int finalCX = cx;
|
||||||
final int finalCZ = cz;
|
final int finalCZ = cz;
|
||||||
TaskManager.IMP.getPublicForkJoinPool().submit((Runnable) () -> {
|
TaskManager.IMP.getPublicForkJoinPool().submit(() -> {
|
||||||
try {
|
try {
|
||||||
FaweChunk toSend = getSnapshot(finalCX, finalCZ);
|
FaweChunk toSend = getSnapshot(finalCX, finalCZ);
|
||||||
toSend.setLoc(HeightMapMCAGenerator.this, finalCX + OX, finalCZ + OZ);
|
toSend.setLoc(HeightMapMCAGenerator.this, finalCX + OX, finalCZ + OZ);
|
||||||
|
@ -1,21 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* 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.jnbt;
|
package com.sk89q.jnbt;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.NoSuchElementException;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The {@code TAG_List} tag.
|
* The {@code TAG_List} tag.
|
||||||
*/
|
*/
|
||||||
public final class ListTag<T extends Tag> extends Tag {
|
public final class ListTag extends Tag {
|
||||||
|
|
||||||
private final Class<T> type;
|
private final Class<? extends Tag> type;
|
||||||
private final List<T> value;
|
private final List<Tag> value;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the tag with an empty name.
|
* Creates the tag with an empty name.
|
||||||
@ -23,20 +40,11 @@ public final class ListTag<T extends Tag> extends Tag {
|
|||||||
* @param type the type of tag
|
* @param type the type of tag
|
||||||
* @param value the value of the tag
|
* @param value the value of the tag
|
||||||
*/
|
*/
|
||||||
public ListTag(Class<T> type, List<T> value) {
|
public ListTag(Class<? extends Tag> type, List<? extends Tag> value) {
|
||||||
super();
|
super();
|
||||||
checkNotNull(value);
|
checkNotNull(value);
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.value = value;
|
this.value = Collections.unmodifiableList(value);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Object> getRaw() {
|
|
||||||
ArrayList<Object> raw = new ArrayList<>();
|
|
||||||
for (Tag t : value) {
|
|
||||||
raw.add(t.getRaw());
|
|
||||||
}
|
|
||||||
return raw;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -44,12 +52,12 @@ public final class ListTag<T extends Tag> extends Tag {
|
|||||||
*
|
*
|
||||||
* @return The type of item in this list.
|
* @return The type of item in this list.
|
||||||
*/
|
*/
|
||||||
public Class<T> getType() {
|
public Class<? extends Tag> getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<T> getValue() {
|
public List<Tag> getValue() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,11 +79,10 @@ public final class ListTag<T extends Tag> extends Tag {
|
|||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public Tag getIfExists(int index) {
|
public Tag getIfExists(int index) {
|
||||||
try {
|
if (index >= value.size()) {
|
||||||
return value.get(index);
|
|
||||||
} catch (NoSuchElementException e) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
return value.get(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -19,23 +19,23 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit;
|
package com.sk89q.worldedit;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import com.sk89q.worldedit.util.logging.LogFormat;
|
import com.sk89q.worldedit.util.logging.LogFormat;
|
||||||
import com.sk89q.worldedit.world.block.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
import com.sk89q.worldedit.world.item.ItemType;
|
|
||||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
|
||||||
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
||||||
import com.sk89q.worldedit.world.snapshot.SnapshotRepository;
|
import com.sk89q.worldedit.world.snapshot.SnapshotRepository;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents WorldEdit's configuration.
|
* Represents WorldEdit's configuration.
|
||||||
*/
|
*/
|
||||||
public abstract class LocalConfiguration {
|
public abstract class LocalConfiguration {
|
||||||
protected static final String[] defaultDisallowedBlocks = new String[] {};
|
|
||||||
|
|
||||||
public boolean profile = false;
|
public boolean profile = false;
|
||||||
public Set<String> disallowedBlocks = new HashSet<>();
|
public Set<String> disallowedBlocks = new HashSet<>();
|
||||||
@ -49,12 +49,12 @@ public abstract class LocalConfiguration {
|
|||||||
public SnapshotRepository snapshotRepo = null;
|
public SnapshotRepository snapshotRepo = null;
|
||||||
public int maxRadius = -1;
|
public int maxRadius = -1;
|
||||||
public int maxSuperPickaxeSize = 5;
|
public int maxSuperPickaxeSize = 5;
|
||||||
public int maxBrushRadius = 100;
|
public int maxBrushRadius = 6;
|
||||||
public boolean logCommands = false;
|
public boolean logCommands = false;
|
||||||
public String logFile = "";
|
public String logFile = "";
|
||||||
public String logFormat = LogFormat.DEFAULT_FORMAT;
|
public String logFormat = LogFormat.DEFAULT_FORMAT;
|
||||||
public boolean registerHelp = true; // what is the point of this, it's not even used
|
public boolean registerHelp = true; // what is the point of this, it's not even used
|
||||||
public String wandItem = ItemTypes.WOODEN_AXE.getId();
|
public String wandItem = "minecraft:wooden_axe";
|
||||||
public boolean superPickaxeDrop = true;
|
public boolean superPickaxeDrop = true;
|
||||||
public boolean superPickaxeManyDrop = true;
|
public boolean superPickaxeManyDrop = true;
|
||||||
public boolean noDoubleSlash = false;
|
public boolean noDoubleSlash = false;
|
||||||
@ -62,7 +62,7 @@ public abstract class LocalConfiguration {
|
|||||||
public boolean useInventoryOverride = false;
|
public boolean useInventoryOverride = false;
|
||||||
public boolean useInventoryCreativeOverride = false;
|
public boolean useInventoryCreativeOverride = false;
|
||||||
public boolean navigationUseGlass = true;
|
public boolean navigationUseGlass = true;
|
||||||
public String navigationWand = ItemTypes.COMPASS.getId();
|
public String navigationWand = "minecraft:compass";
|
||||||
public int navigationWandMaxDistance = 50;
|
public int navigationWandMaxDistance = 50;
|
||||||
public int scriptTimeout = 3000;
|
public int scriptTimeout = 3000;
|
||||||
public Set<String> allowedDataCycleBlocks = new HashSet<>();
|
public Set<String> allowedDataCycleBlocks = new HashSet<>();
|
||||||
@ -74,6 +74,73 @@ public abstract class LocalConfiguration {
|
|||||||
public boolean allowSymlinks = false;
|
public boolean allowSymlinks = false;
|
||||||
public boolean serverSideCUI = true;
|
public boolean serverSideCUI = true;
|
||||||
|
|
||||||
|
protected String[] getDefaultDisallowedBlocks() {
|
||||||
|
List<BlockType> blockTypes = Lists.newArrayList(
|
||||||
|
BlockTypes.OAK_SAPLING,
|
||||||
|
BlockTypes.JUNGLE_SAPLING,
|
||||||
|
BlockTypes.DARK_OAK_SAPLING,
|
||||||
|
BlockTypes.SPRUCE_SAPLING,
|
||||||
|
BlockTypes.BIRCH_SAPLING,
|
||||||
|
BlockTypes.ACACIA_SAPLING,
|
||||||
|
BlockTypes.BLACK_BED,
|
||||||
|
BlockTypes.BLUE_BED,
|
||||||
|
BlockTypes.BROWN_BED,
|
||||||
|
BlockTypes.CYAN_BED,
|
||||||
|
BlockTypes.GRAY_BED,
|
||||||
|
BlockTypes.GREEN_BED,
|
||||||
|
BlockTypes.LIGHT_BLUE_BED,
|
||||||
|
BlockTypes.LIGHT_GRAY_BED,
|
||||||
|
BlockTypes.LIME_BED,
|
||||||
|
BlockTypes.MAGENTA_BED,
|
||||||
|
BlockTypes.ORANGE_BED,
|
||||||
|
BlockTypes.PINK_BED,
|
||||||
|
BlockTypes.PURPLE_BED,
|
||||||
|
BlockTypes.RED_BED,
|
||||||
|
BlockTypes.WHITE_BED,
|
||||||
|
BlockTypes.YELLOW_BED,
|
||||||
|
BlockTypes.POWERED_RAIL,
|
||||||
|
BlockTypes.DETECTOR_RAIL,
|
||||||
|
BlockTypes.GRASS,
|
||||||
|
BlockTypes.DEAD_BUSH,
|
||||||
|
BlockTypes.MOVING_PISTON,
|
||||||
|
BlockTypes.PISTON_HEAD,
|
||||||
|
BlockTypes.SUNFLOWER,
|
||||||
|
BlockTypes.ROSE_BUSH,
|
||||||
|
BlockTypes.DANDELION,
|
||||||
|
BlockTypes.POPPY,
|
||||||
|
BlockTypes.BROWN_MUSHROOM,
|
||||||
|
BlockTypes.RED_MUSHROOM,
|
||||||
|
BlockTypes.TNT,
|
||||||
|
BlockTypes.TORCH,
|
||||||
|
BlockTypes.FIRE,
|
||||||
|
BlockTypes.REDSTONE_WIRE,
|
||||||
|
BlockTypes.WHEAT,
|
||||||
|
BlockTypes.POTATOES,
|
||||||
|
BlockTypes.CARROTS,
|
||||||
|
BlockTypes.MELON_STEM,
|
||||||
|
BlockTypes.PUMPKIN_STEM,
|
||||||
|
BlockTypes.BEETROOTS,
|
||||||
|
BlockTypes.RAIL,
|
||||||
|
BlockTypes.LEVER,
|
||||||
|
BlockTypes.REDSTONE_TORCH,
|
||||||
|
BlockTypes.REDSTONE_WALL_TORCH,
|
||||||
|
BlockTypes.REPEATER,
|
||||||
|
BlockTypes.COMPARATOR,
|
||||||
|
BlockTypes.STONE_BUTTON,
|
||||||
|
BlockTypes.BIRCH_BUTTON,
|
||||||
|
BlockTypes.ACACIA_BUTTON,
|
||||||
|
BlockTypes.DARK_OAK_BUTTON,
|
||||||
|
BlockTypes.JUNGLE_BUTTON,
|
||||||
|
BlockTypes.OAK_BUTTON,
|
||||||
|
BlockTypes.SPRUCE_BUTTON,
|
||||||
|
BlockTypes.CACTUS,
|
||||||
|
BlockTypes.SUGAR_CANE,
|
||||||
|
// ores and stuff
|
||||||
|
BlockTypes.BEDROCK
|
||||||
|
);
|
||||||
|
return blockTypes.stream().filter(Objects::nonNull).map(BlockType::getId).toArray(String[]::new);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load the configuration.
|
* Load the configuration.
|
||||||
*/
|
*/
|
||||||
@ -87,4 +154,24 @@ public abstract class LocalConfiguration {
|
|||||||
public File getWorkingDirectory() {
|
public File getWorkingDirectory() {
|
||||||
return new File(".");
|
return new File(".");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String convertLegacyItem(String legacy) {
|
||||||
|
String item = legacy;
|
||||||
|
try {
|
||||||
|
String[] splitter = item.split(":", 2);
|
||||||
|
int id = 0;
|
||||||
|
byte data = 0;
|
||||||
|
if (splitter.length == 1) {
|
||||||
|
id = Integer.parseInt(item);
|
||||||
|
} else {
|
||||||
|
id = Integer.parseInt(splitter[0]);
|
||||||
|
data = Byte.parseByte(splitter[1]);
|
||||||
|
}
|
||||||
|
item = LegacyMapper.getInstance().getItemFromLegacy(id, data).getId();
|
||||||
|
} catch (Throwable e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -53,9 +53,9 @@ public class GeneralCommands {
|
|||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
aliases = { "/limit" },
|
aliases = { "/limit" },
|
||||||
usage = "<limit>",
|
usage = "[limit]",
|
||||||
desc = "Modify block change limit",
|
desc = "Modify block change limit",
|
||||||
min = 1,
|
min = 0,
|
||||||
max = 1
|
max = 1
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.limit")
|
@CommandPermissions("worldedit.limit")
|
||||||
@ -64,7 +64,7 @@ public class GeneralCommands {
|
|||||||
LocalConfiguration config = worldEdit.getConfiguration();
|
LocalConfiguration config = worldEdit.getConfiguration();
|
||||||
boolean mayDisable = player.hasPermission("worldedit.limit.unrestricted");
|
boolean mayDisable = player.hasPermission("worldedit.limit.unrestricted");
|
||||||
|
|
||||||
int limit = Math.max(-1, args.getInteger(0));
|
int limit = args.argsLength() == 0 ? config.defaultChangeLimit : Math.max(-1, args.getInteger(0));
|
||||||
if (!mayDisable && config.maxChangeLimit > -1) {
|
if (!mayDisable && config.maxChangeLimit > -1) {
|
||||||
if (limit > config.maxChangeLimit) {
|
if (limit > config.maxChangeLimit) {
|
||||||
player.printError("Your maximum allowable limit is " + config.maxChangeLimit + ".");
|
player.printError("Your maximum allowable limit is " + config.maxChangeLimit + ".");
|
||||||
@ -164,7 +164,7 @@ public class GeneralCommands {
|
|||||||
boolean blocksOnly = args.hasFlag('b');
|
boolean blocksOnly = args.hasFlag('b');
|
||||||
boolean itemsOnly = args.hasFlag('i');
|
boolean itemsOnly = args.hasFlag('i');
|
||||||
|
|
||||||
ItemType type = ItemTypes.parse(query);
|
ItemType type = ItemTypes.get(query);
|
||||||
|
|
||||||
if (type != null) {
|
if (type != null) {
|
||||||
actor.print(type.getId() + " (" + type.getName() + ")");
|
actor.print(type.getId() + " (" + type.getName() + ")");
|
||||||
|
@ -19,10 +19,7 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.entity;
|
package com.sk89q.worldedit.entity;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
|
||||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||||
import com.sk89q.worldedit.extension.platform.Actor;
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||||
@ -32,9 +29,12 @@ import com.sk89q.worldedit.util.Direction;
|
|||||||
import com.sk89q.worldedit.util.HandSide;
|
import com.sk89q.worldedit.util.HandSide;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
import com.sk89q.worldedit.world.gamemode.GameMode;
|
import com.sk89q.worldedit.world.gamemode.GameMode;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a player
|
* Represents a player
|
||||||
*/
|
*/
|
||||||
|
@ -1,67 +0,0 @@
|
|||||||
package com.sk89q.worldedit.entity.metadata;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public interface Metadatable {
|
|
||||||
Map<String, Object> getMetaMap();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set some session only metadata for the player
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @param value
|
|
||||||
* @return previous value
|
|
||||||
*/
|
|
||||||
default void setMeta(String key, Object value) {
|
|
||||||
getMetaMap().put(key, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
default <T> T getAndSetMeta(String key, T value) {
|
|
||||||
return (T) getMetaMap().put(key, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
default boolean hasMeta() {
|
|
||||||
return !getMetaMap().isEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the metadata for a key.
|
|
||||||
*
|
|
||||||
* @param <V>
|
|
||||||
* @param key
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
default <V> V getMeta(String key) {
|
|
||||||
if (getMetaMap() != null) {
|
|
||||||
return (V) getMetaMap().get(key);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the metadata for a specific key (or return the default provided)
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @param def
|
|
||||||
* @param <V>
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
default <V> V getMeta(String key, V def) {
|
|
||||||
if (getMetaMap() != null) {
|
|
||||||
V value = (V) getMetaMap().get(key);
|
|
||||||
return value == null ? def : value;
|
|
||||||
}
|
|
||||||
return def;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Delete the metadata for a key.
|
|
||||||
* - metadata is session only
|
|
||||||
* - deleting other plugin's metadata may cause issues
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
*/
|
|
||||||
default <V> V deleteMeta(String key) {
|
|
||||||
return getMetaMap() == null ? null : (V) getMetaMap().remove(key);
|
|
||||||
}
|
|
||||||
}
|
|
@ -19,12 +19,10 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.extension.factory.parser;
|
package com.sk89q.worldedit.extension.factory.parser;
|
||||||
|
|
||||||
import com.boydti.fawe.util.MathMan;
|
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.blocks.BaseItem;
|
import com.sk89q.worldedit.blocks.BaseItem;
|
||||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||||
import com.sk89q.worldedit.extension.platform.Capability;
|
|
||||||
import com.sk89q.worldedit.internal.registry.InputParser;
|
import com.sk89q.worldedit.internal.registry.InputParser;
|
||||||
import com.sk89q.worldedit.world.item.ItemType;
|
import com.sk89q.worldedit.world.item.ItemType;
|
||||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||||
@ -46,17 +44,8 @@ public class DefaultItemParser extends InputParser<BaseItem> {
|
|||||||
ItemType type;
|
ItemType type;
|
||||||
if (split.length == 1) {
|
if (split.length == 1) {
|
||||||
type = LegacyMapper.getInstance().getItemFromLegacy(Integer.parseInt(split[0]));
|
type = LegacyMapper.getInstance().getItemFromLegacy(Integer.parseInt(split[0]));
|
||||||
} else if (MathMan.isInteger(split[0])) {
|
|
||||||
type = LegacyMapper.getInstance().getItemFromLegacy(Integer.parseInt(split[0]), Integer.parseInt(split[1]));
|
|
||||||
} else {
|
} else {
|
||||||
type = ItemTypes.parse(input);
|
type = LegacyMapper.getInstance().getItemFromLegacy(Integer.parseInt(split[0]), Integer.parseInt(split[1]));
|
||||||
if (type != null) {
|
|
||||||
Integer legacy = LegacyMapper.getInstance().getLegacyCombined(type);
|
|
||||||
if (legacy != null) {
|
|
||||||
ItemType newType = LegacyMapper.getInstance().getItemFromLegacy(legacy >> 4, Integer.parseInt(split[1]));
|
|
||||||
if (newType != null) type = newType;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
item = new BaseItem(type);
|
item = new BaseItem(type);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
|
@ -30,11 +30,13 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkState;
|
||||||
|
|
||||||
public class AbstractProperty<T> implements Property<T> {
|
public class AbstractProperty<T> implements Property<T> {
|
||||||
|
|
||||||
private final PropertyKey key;
|
private final PropertyKey key;
|
||||||
private final String name;
|
private String name;
|
||||||
private final List<T> values;
|
private List<T> values;
|
||||||
|
|
||||||
private final int bitMask;
|
private final int bitMask;
|
||||||
private final int bitMaskInverse;
|
private final int bitMaskInverse;
|
||||||
@ -75,6 +77,7 @@ public class AbstractProperty<T> implements Property<T> {
|
|||||||
return bitMask;
|
return bitMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//todo remove the following to allow for upstream compatibility.
|
||||||
public <C extends AbstractProperty<T>> C withOffset(int bitOffset) {
|
public <C extends AbstractProperty<T>> C withOffset(int bitOffset) {
|
||||||
return (C) new AbstractProperty<>(name, values, bitOffset);
|
return (C) new AbstractProperty<>(name, values, bitOffset);
|
||||||
}
|
}
|
||||||
@ -116,6 +119,14 @@ public class AbstractProperty<T> implements Property<T> {
|
|||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal method for name setting post-deserialise. Do not use.
|
||||||
|
*/
|
||||||
|
public void setName(final String name) {
|
||||||
|
checkState(this.name == null, "name already set");
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return getClass().getSimpleName() + "{name=" + name + "}";
|
return getClass().getSimpleName() + "{name=" + name + "}";
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.session;
|
package com.sk89q.worldedit.session;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
@ -27,9 +29,6 @@ import com.sk89q.worldedit.math.transform.Transform;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the clipboard and the current transform on the clipboard.
|
* Holds the clipboard and the current transform on the clipboard.
|
||||||
*/
|
*/
|
||||||
@ -47,8 +46,6 @@ public class ClipboardHolder {
|
|||||||
this.clipboard = clipboard;
|
this.clipboard = clipboard;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ClipboardHolder() {}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the clipboard.
|
* Get the clipboard.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -25,15 +25,12 @@ import com.sk89q.worldedit.LocalConfiguration;
|
|||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
import com.sk89q.worldedit.session.SessionManager;
|
import com.sk89q.worldedit.session.SessionManager;
|
||||||
import com.sk89q.worldedit.util.report.Unreported;
|
import com.sk89q.worldedit.util.report.Unreported;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
|
||||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
|
||||||
import com.sk89q.worldedit.world.snapshot.SnapshotRepository;
|
import com.sk89q.worldedit.world.snapshot.SnapshotRepository;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A less simple implementation of {@link LocalConfiguration}
|
* A less simple implementation of {@link LocalConfiguration}
|
||||||
@ -53,12 +50,12 @@ public class YAMLConfiguration extends LocalConfiguration {
|
|||||||
public void load() {
|
public void load() {
|
||||||
try {
|
try {
|
||||||
config.load();
|
config.load();
|
||||||
} catch (Throwable e) {
|
} catch (IOException e) {
|
||||||
logger.log(Level.WARNING, "Error loading WorldEdit configuration", e);
|
logger.log(Level.WARNING, "Error loading WorldEdit configuration", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
profile = config.getBoolean("debug", profile);
|
profile = config.getBoolean("debug", profile);
|
||||||
wandItem = ItemTypes.parse(config.getString("wand-item", wandItem)).getId();
|
wandItem = convertLegacyItem(config.getString("wand-item", wandItem));
|
||||||
|
|
||||||
defaultChangeLimit = Math.max(-1, config.getInt(
|
defaultChangeLimit = Math.max(-1, config.getInt(
|
||||||
"limits.max-blocks-changed.default", defaultChangeLimit));
|
"limits.max-blocks-changed.default", defaultChangeLimit));
|
||||||
@ -81,8 +78,7 @@ public class YAMLConfiguration extends LocalConfiguration {
|
|||||||
butcherDefaultRadius = Math.max(-1, config.getInt("limits.butcher-radius.default", butcherDefaultRadius));
|
butcherDefaultRadius = Math.max(-1, config.getInt("limits.butcher-radius.default", butcherDefaultRadius));
|
||||||
butcherMaxRadius = Math.max(-1, config.getInt("limits.butcher-radius.maximum", butcherMaxRadius));
|
butcherMaxRadius = Math.max(-1, config.getInt("limits.butcher-radius.maximum", butcherMaxRadius));
|
||||||
|
|
||||||
disallowedBlocks =
|
disallowedBlocks = new HashSet<>(config.getStringList("limits.disallowed-blocks", Lists.newArrayList(getDefaultDisallowedBlocks())));
|
||||||
new HashSet<>(config.getStringList("limits.disallowed-blocks", Lists.newArrayList(defaultDisallowedBlocks)));
|
|
||||||
allowedDataCycleBlocks =
|
allowedDataCycleBlocks =
|
||||||
new HashSet<>(config.getStringList("limits.allowed-data-cycle-blocks", null));
|
new HashSet<>(config.getStringList("limits.allowed-data-cycle-blocks", null));
|
||||||
|
|
||||||
@ -104,7 +100,7 @@ public class YAMLConfiguration extends LocalConfiguration {
|
|||||||
useInventoryCreativeOverride = config.getBoolean("use-inventory.creative-mode-overrides",
|
useInventoryCreativeOverride = config.getBoolean("use-inventory.creative-mode-overrides",
|
||||||
useInventoryCreativeOverride);
|
useInventoryCreativeOverride);
|
||||||
|
|
||||||
navigationWand = ItemTypes.parse(config.getString("navigation-wand.item", navigationWand)).getId();
|
navigationWand = convertLegacyItem(config.getString("navigation-wand.item", navigationWand));
|
||||||
navigationWandMaxDistance = config.getInt("navigation-wand.max-distance", navigationWandMaxDistance);
|
navigationWandMaxDistance = config.getInt("navigation-wand.max-distance", navigationWandMaxDistance);
|
||||||
navigationUseGlass = config.getBoolean("navigation.use-glass", navigationUseGlass);
|
navigationUseGlass = config.getBoolean("navigation.use-glass", navigationUseGlass);
|
||||||
|
|
||||||
|
@ -230,7 +230,11 @@ public class BaseBlock implements BlockStateHolder<BaseBlock>, TileEntityBlock {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return getOrdinal();
|
int ret = toImmutableState().hashCode() << 3;
|
||||||
|
if (hasNbtData()) {
|
||||||
|
ret += getNbtData().hashCode();
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -116,7 +116,8 @@ public interface BlockStateHolder<T extends BlockStateHolder<T>> extends FawePat
|
|||||||
Map<Property<?>, Object> getStates();
|
Map<Property<?>, Object> getStates();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated use masks - not try to this fuzzy/non fuzzy state nonsense
|
* Checks if the type is the same, and if the matched states are the same.
|
||||||
|
*
|
||||||
* @param o other block
|
* @param o other block
|
||||||
* @return true if equal
|
* @return true if equal
|
||||||
*/
|
*/
|
||||||
@ -148,7 +149,9 @@ public interface BlockStateHolder<T extends BlockStateHolder<T>> extends FawePat
|
|||||||
if (getStates().isEmpty()) {
|
if (getStates().isEmpty()) {
|
||||||
return this.getBlockType().getId();
|
return this.getBlockType().getId();
|
||||||
} else {
|
} else {
|
||||||
String properties = getStates().entrySet().stream().map(entry -> entry.getKey().getName() + "=" + entry.getValue().toString().toLowerCase()).collect(Collectors.joining(","));
|
String properties =
|
||||||
|
getStates().entrySet().stream().map(entry -> entry.getKey().getName() + "=" + entry.getValue().toString().toLowerCase()).collect(Collectors.joining(
|
||||||
|
","));
|
||||||
return this.getBlockType().getId() + "[" + properties + "]";
|
return this.getBlockType().getId() + "[" + properties + "]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
package com.sk89q.worldedit.world.block;
|
|
||||||
|
|
||||||
public class BlockStateRegistry {
|
|
||||||
|
|
||||||
}
|
|
@ -703,10 +703,6 @@ public class BlockTypes{
|
|||||||
return blockType;
|
return blockType;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static BlockType[] values() {
|
|
||||||
return sortedRegistry.toArray(new BlockType[sortedRegistry.size()]);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void init(BlockType type, String id, int internalId, ArrayList<BlockState> states) {
|
private static void init(BlockType type, String id, int internalId, ArrayList<BlockState> states) {
|
||||||
try {
|
try {
|
||||||
type.setSettings(new Settings(type, id, internalId, states));
|
type.setSettings(new Settings(type, id, internalId, states));
|
||||||
|
@ -266,10 +266,9 @@ public class AnvilChunk implements Chunk {
|
|||||||
if (state.getMaterial().hasContainer()) {
|
if (state.getMaterial().hasContainer()) {
|
||||||
CompoundTag tileEntity = getBlockTileEntity(position);
|
CompoundTag tileEntity = getBlockTileEntity(position);
|
||||||
if (tileEntity != null) {
|
if (tileEntity != null) {
|
||||||
return new BaseBlock(state, tileEntity);
|
return state.toBaseBlock(tileEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return state.toBaseBlock();
|
return state.toBaseBlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,6 @@ import com.sk89q.jnbt.NBTUtils;
|
|||||||
import com.sk89q.jnbt.Tag;
|
import com.sk89q.jnbt.Tag;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
|
||||||
import com.sk89q.worldedit.world.DataException;
|
import com.sk89q.worldedit.world.DataException;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
@ -189,7 +188,9 @@ public class OldChunk implements Chunk {
|
|||||||
}
|
}
|
||||||
if (state.getBlockType().getMaterial().hasContainer()) {
|
if (state.getBlockType().getMaterial().hasContainer()) {
|
||||||
CompoundTag tileEntity = getBlockTileEntity(position);
|
CompoundTag tileEntity = getBlockTileEntity(position);
|
||||||
if (tileEntity != null) return new BaseBlock(state, tileEntity);
|
if (tileEntity != null) {
|
||||||
|
return state.toBaseBlock(tileEntity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return state.toBaseBlock();
|
return state.toBaseBlock();
|
||||||
}
|
}
|
||||||
|
@ -23,113 +23,105 @@ import javax.annotation.Nullable;
|
|||||||
|
|
||||||
public class EntityTypes {
|
public class EntityTypes {
|
||||||
|
|
||||||
public static final EntityType AREA_EFFECT_CLOUD = register("minecraft:area_effect_cloud");
|
@Nullable public static final EntityType AREA_EFFECT_CLOUD = get("minecraft:area_effect_cloud");
|
||||||
public static final EntityType ARMOR_STAND = register("minecraft:armor_stand");
|
@Nullable public static final EntityType ARMOR_STAND = get("minecraft:armor_stand");
|
||||||
public static final EntityType ARROW = register("minecraft:arrow");
|
@Nullable public static final EntityType ARROW = get("minecraft:arrow");
|
||||||
public static final EntityType BAT = register("minecraft:bat");
|
@Nullable public static final EntityType BAT = get("minecraft:bat");
|
||||||
public static final EntityType BLAZE = register("minecraft:blaze");
|
@Nullable public static final EntityType BLAZE = get("minecraft:blaze");
|
||||||
public static final EntityType BOAT = register("minecraft:boat");
|
@Nullable public static final EntityType BOAT = get("minecraft:boat");
|
||||||
public static final EntityType CAVE_SPIDER = register("minecraft:cave_spider");
|
@Nullable public static final EntityType CAVE_SPIDER = get("minecraft:cave_spider");
|
||||||
public static final EntityType CHEST_MINECART = register("minecraft:chest_minecart");
|
@Nullable public static final EntityType CHEST_MINECART = get("minecraft:chest_minecart");
|
||||||
public static final EntityType CHICKEN = register("minecraft:chicken");
|
@Nullable public static final EntityType CHICKEN = get("minecraft:chicken");
|
||||||
public static final EntityType COD = register("minecraft:cod");
|
@Nullable public static final EntityType COD = get("minecraft:cod");
|
||||||
public static final EntityType COMMAND_BLOCK_MINECART = register("minecraft:command_block_minecart");
|
@Nullable public static final EntityType COMMAND_BLOCK_MINECART = get("minecraft:command_block_minecart");
|
||||||
public static final EntityType COW = register("minecraft:cow");
|
@Nullable public static final EntityType COW = get("minecraft:cow");
|
||||||
public static final EntityType CREEPER = register("minecraft:creeper");
|
@Nullable public static final EntityType CREEPER = get("minecraft:creeper");
|
||||||
public static final EntityType DOLPHIN = register("minecraft:dolphin");
|
@Nullable public static final EntityType DOLPHIN = get("minecraft:dolphin");
|
||||||
public static final EntityType DONKEY = register("minecraft:donkey");
|
@Nullable public static final EntityType DONKEY = get("minecraft:donkey");
|
||||||
public static final EntityType DRAGON_FIREBALL = register("minecraft:dragon_fireball");
|
@Nullable public static final EntityType DRAGON_FIREBALL = get("minecraft:dragon_fireball");
|
||||||
public static final EntityType DROWNED = register("minecraft:drowned");
|
@Nullable public static final EntityType DROWNED = get("minecraft:drowned");
|
||||||
public static final EntityType EGG = register("minecraft:egg");
|
@Nullable public static final EntityType EGG = get("minecraft:egg");
|
||||||
public static final EntityType ELDER_GUARDIAN = register("minecraft:elder_guardian");
|
@Nullable public static final EntityType ELDER_GUARDIAN = get("minecraft:elder_guardian");
|
||||||
public static final EntityType END_CRYSTAL = register("minecraft:end_crystal");
|
@Nullable public static final EntityType END_CRYSTAL = get("minecraft:end_crystal");
|
||||||
public static final EntityType ENDER_DRAGON = register("minecraft:ender_dragon");
|
@Nullable public static final EntityType ENDER_DRAGON = get("minecraft:ender_dragon");
|
||||||
public static final EntityType ENDER_PEARL = register("minecraft:ender_pearl");
|
@Nullable public static final EntityType ENDER_PEARL = get("minecraft:ender_pearl");
|
||||||
public static final EntityType ENDERMAN = register("minecraft:enderman");
|
@Nullable public static final EntityType ENDERMAN = get("minecraft:enderman");
|
||||||
public static final EntityType ENDERMITE = register("minecraft:endermite");
|
@Nullable public static final EntityType ENDERMITE = get("minecraft:endermite");
|
||||||
public static final EntityType EVOKER = register("minecraft:evoker");
|
@Nullable public static final EntityType EVOKER = get("minecraft:evoker");
|
||||||
public static final EntityType EVOKER_FANGS = register("minecraft:evoker_fangs");
|
@Nullable public static final EntityType EVOKER_FANGS = get("minecraft:evoker_fangs");
|
||||||
public static final EntityType EXPERIENCE_BOTTLE = register("minecraft:experience_bottle");
|
@Nullable public static final EntityType EXPERIENCE_BOTTLE = get("minecraft:experience_bottle");
|
||||||
public static final EntityType EXPERIENCE_ORB = register("minecraft:experience_orb");
|
@Nullable public static final EntityType EXPERIENCE_ORB = get("minecraft:experience_orb");
|
||||||
public static final EntityType EYE_OF_ENDER = register("minecraft:eye_of_ender");
|
@Nullable public static final EntityType EYE_OF_ENDER = get("minecraft:eye_of_ender");
|
||||||
public static final EntityType FALLING_BLOCK = register("minecraft:falling_block");
|
@Nullable public static final EntityType FALLING_BLOCK = get("minecraft:falling_block");
|
||||||
public static final EntityType FIREBALL = register("minecraft:fireball");
|
@Nullable public static final EntityType FIREBALL = get("minecraft:fireball");
|
||||||
public static final EntityType FIREWORK_ROCKET = register("minecraft:firework_rocket");
|
@Nullable public static final EntityType FIREWORK_ROCKET = get("minecraft:firework_rocket");
|
||||||
public static final EntityType FISHING_BOBBER = register("minecraft:fishing_bobber");
|
@Nullable public static final EntityType FISHING_BOBBER = get("minecraft:fishing_bobber");
|
||||||
public static final EntityType FURNACE_MINECART = register("minecraft:furnace_minecart");
|
@Nullable public static final EntityType FURNACE_MINECART = get("minecraft:furnace_minecart");
|
||||||
public static final EntityType GHAST = register("minecraft:ghast");
|
@Nullable public static final EntityType GHAST = get("minecraft:ghast");
|
||||||
public static final EntityType GIANT = register("minecraft:giant");
|
@Nullable public static final EntityType GIANT = get("minecraft:giant");
|
||||||
public static final EntityType GUARDIAN = register("minecraft:guardian");
|
@Nullable public static final EntityType GUARDIAN = get("minecraft:guardian");
|
||||||
public static final EntityType HOPPER_MINECART = register("minecraft:hopper_minecart");
|
@Nullable public static final EntityType HOPPER_MINECART = get("minecraft:hopper_minecart");
|
||||||
public static final EntityType HORSE = register("minecraft:horse");
|
@Nullable public static final EntityType HORSE = get("minecraft:horse");
|
||||||
public static final EntityType HUSK = register("minecraft:husk");
|
@Nullable public static final EntityType HUSK = get("minecraft:husk");
|
||||||
public static final EntityType ILLUSIONER = register("minecraft:illusioner");
|
@Nullable public static final EntityType ILLUSIONER = get("minecraft:illusioner");
|
||||||
public static final EntityType IRON_GOLEM = register("minecraft:iron_golem");
|
@Nullable public static final EntityType IRON_GOLEM = get("minecraft:iron_golem");
|
||||||
public static final EntityType ITEM = register("minecraft:item");
|
@Nullable public static final EntityType ITEM = get("minecraft:item");
|
||||||
public static final EntityType ITEM_FRAME = register("minecraft:item_frame");
|
@Nullable public static final EntityType ITEM_FRAME = get("minecraft:item_frame");
|
||||||
public static final EntityType LEASH_KNOT = register("minecraft:leash_knot");
|
@Nullable public static final EntityType LEASH_KNOT = get("minecraft:leash_knot");
|
||||||
public static final EntityType LIGHTNING_BOLT = register("minecraft:lightning_bolt");
|
@Nullable public static final EntityType LIGHTNING_BOLT = get("minecraft:lightning_bolt");
|
||||||
public static final EntityType LLAMA = register("minecraft:llama");
|
@Nullable public static final EntityType LLAMA = get("minecraft:llama");
|
||||||
public static final EntityType LLAMA_SPIT = register("minecraft:llama_spit");
|
@Nullable public static final EntityType LLAMA_SPIT = get("minecraft:llama_spit");
|
||||||
public static final EntityType MAGMA_CUBE = register("minecraft:magma_cube");
|
@Nullable public static final EntityType MAGMA_CUBE = get("minecraft:magma_cube");
|
||||||
public static final EntityType MINECART = register("minecraft:minecart");
|
@Nullable public static final EntityType MINECART = get("minecraft:minecart");
|
||||||
public static final EntityType MOOSHROOM = register("minecraft:mooshroom");
|
@Nullable public static final EntityType MOOSHROOM = get("minecraft:mooshroom");
|
||||||
public static final EntityType MULE = register("minecraft:mule");
|
@Nullable public static final EntityType MULE = get("minecraft:mule");
|
||||||
public static final EntityType OCELOT = register("minecraft:ocelot");
|
@Nullable public static final EntityType OCELOT = get("minecraft:ocelot");
|
||||||
public static final EntityType PAINTING = register("minecraft:painting");
|
@Nullable public static final EntityType PAINTING = get("minecraft:painting");
|
||||||
public static final EntityType PARROT = register("minecraft:parrot");
|
@Nullable public static final EntityType PARROT = get("minecraft:parrot");
|
||||||
public static final EntityType PHANTOM = register("minecraft:phantom");
|
@Nullable public static final EntityType PHANTOM = get("minecraft:phantom");
|
||||||
public static final EntityType PIG = register("minecraft:pig");
|
@Nullable public static final EntityType PIG = get("minecraft:pig");
|
||||||
public static final EntityType PLAYER = register("minecraft:player");
|
@Nullable public static final EntityType PLAYER = get("minecraft:player");
|
||||||
public static final EntityType POLAR_BEAR = register("minecraft:polar_bear");
|
@Nullable public static final EntityType POLAR_BEAR = get("minecraft:polar_bear");
|
||||||
public static final EntityType POTION = register("minecraft:potion");
|
@Nullable public static final EntityType POTION = get("minecraft:potion");
|
||||||
public static final EntityType PUFFERFISH = register("minecraft:pufferfish");
|
@Nullable public static final EntityType PUFFERFISH = get("minecraft:pufferfish");
|
||||||
public static final EntityType RABBIT = register("minecraft:rabbit");
|
@Nullable public static final EntityType RABBIT = get("minecraft:rabbit");
|
||||||
public static final EntityType SALMON = register("minecraft:salmon");
|
@Nullable public static final EntityType SALMON = get("minecraft:salmon");
|
||||||
public static final EntityType SHEEP = register("minecraft:sheep");
|
@Nullable public static final EntityType SHEEP = get("minecraft:sheep");
|
||||||
public static final EntityType SHULKER = register("minecraft:shulker");
|
@Nullable public static final EntityType SHULKER = get("minecraft:shulker");
|
||||||
public static final EntityType SHULKER_BULLET = register("minecraft:shulker_bullet");
|
@Nullable public static final EntityType SHULKER_BULLET = get("minecraft:shulker_bullet");
|
||||||
public static final EntityType SILVERFISH = register("minecraft:silverfish");
|
@Nullable public static final EntityType SILVERFISH = get("minecraft:silverfish");
|
||||||
public static final EntityType SKELETON = register("minecraft:skeleton");
|
@Nullable public static final EntityType SKELETON = get("minecraft:skeleton");
|
||||||
public static final EntityType SKELETON_HORSE = register("minecraft:skeleton_horse");
|
@Nullable public static final EntityType SKELETON_HORSE = get("minecraft:skeleton_horse");
|
||||||
public static final EntityType SLIME = register("minecraft:slime");
|
@Nullable public static final EntityType SLIME = get("minecraft:slime");
|
||||||
public static final EntityType SMALL_FIREBALL = register("minecraft:small_fireball");
|
@Nullable public static final EntityType SMALL_FIREBALL = get("minecraft:small_fireball");
|
||||||
public static final EntityType SNOW_GOLEM = register("minecraft:snow_golem");
|
@Nullable public static final EntityType SNOW_GOLEM = get("minecraft:snow_golem");
|
||||||
public static final EntityType SNOWBALL = register("minecraft:snowball");
|
@Nullable public static final EntityType SNOWBALL = get("minecraft:snowball");
|
||||||
public static final EntityType SPAWNER_MINECART = register("minecraft:spawner_minecart");
|
@Nullable public static final EntityType SPAWNER_MINECART = get("minecraft:spawner_minecart");
|
||||||
public static final EntityType SPECTRAL_ARROW = register("minecraft:spectral_arrow");
|
@Nullable public static final EntityType SPECTRAL_ARROW = get("minecraft:spectral_arrow");
|
||||||
public static final EntityType SPIDER = register("minecraft:spider");
|
@Nullable public static final EntityType SPIDER = get("minecraft:spider");
|
||||||
public static final EntityType SQUID = register("minecraft:squid");
|
@Nullable public static final EntityType SQUID = get("minecraft:squid");
|
||||||
public static final EntityType STRAY = register("minecraft:stray");
|
@Nullable public static final EntityType STRAY = get("minecraft:stray");
|
||||||
public static final EntityType TNT = register("minecraft:tnt");
|
@Nullable public static final EntityType TNT = get("minecraft:tnt");
|
||||||
public static final EntityType TNT_MINECART = register("minecraft:tnt_minecart");
|
@Nullable public static final EntityType TNT_MINECART = get("minecraft:tnt_minecart");
|
||||||
public static final EntityType TRIDENT = register("minecraft:trident");
|
@Nullable public static final EntityType TRIDENT = get("minecraft:trident");
|
||||||
public static final EntityType TROPICAL_FISH = register("minecraft:tropical_fish");
|
@Nullable public static final EntityType TROPICAL_FISH = get("minecraft:tropical_fish");
|
||||||
public static final EntityType TURTLE = register("minecraft:turtle");
|
@Nullable public static final EntityType TURTLE = get("minecraft:turtle");
|
||||||
public static final EntityType VEX = register("minecraft:vex");
|
@Nullable public static final EntityType VEX = get("minecraft:vex");
|
||||||
public static final EntityType VILLAGER = register("minecraft:villager");
|
@Nullable public static final EntityType VILLAGER = get("minecraft:villager");
|
||||||
public static final EntityType VINDICATOR = register("minecraft:vindicator");
|
@Nullable public static final EntityType VINDICATOR = get("minecraft:vindicator");
|
||||||
public static final EntityType WITCH = register("minecraft:witch");
|
@Nullable public static final EntityType WITCH = get("minecraft:witch");
|
||||||
public static final EntityType WITHER = register("minecraft:wither");
|
@Nullable public static final EntityType WITHER = get("minecraft:wither");
|
||||||
public static final EntityType WITHER_SKELETON = register("minecraft:wither_skeleton");
|
@Nullable public static final EntityType WITHER_SKELETON = get("minecraft:wither_skeleton");
|
||||||
public static final EntityType WITHER_SKULL = register("minecraft:wither_skull");
|
@Nullable public static final EntityType WITHER_SKULL = get("minecraft:wither_skull");
|
||||||
public static final EntityType WOLF = register("minecraft:wolf");
|
@Nullable public static final EntityType WOLF = get("minecraft:wolf");
|
||||||
public static final EntityType ZOMBIE = register("minecraft:zombie");
|
@Nullable public static final EntityType ZOMBIE = get("minecraft:zombie");
|
||||||
public static final EntityType ZOMBIE_HORSE = register("minecraft:zombie_horse");
|
@Nullable public static final EntityType ZOMBIE_HORSE = get("minecraft:zombie_horse");
|
||||||
public static final EntityType ZOMBIE_PIGMAN = register("minecraft:zombie_pigman");
|
@Nullable public static final EntityType ZOMBIE_PIGMAN = get("minecraft:zombie_pigman");
|
||||||
public static final EntityType ZOMBIE_VILLAGER = register("minecraft:zombie_villager");
|
@Nullable public static final EntityType ZOMBIE_VILLAGER = get("minecraft:zombie_villager");
|
||||||
|
|
||||||
private EntityTypes() {
|
private EntityTypes() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static EntityType register(final String id) {
|
|
||||||
return register(new EntityType(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static EntityType register(final EntityType entityType) {
|
|
||||||
return EntityType.REGISTRY.register(entityType.getId(), entityType);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static @Nullable EntityType get(final String id) {
|
public static @Nullable EntityType get(final String id) {
|
||||||
return EntityType.REGISTRY.get(id);
|
return EntityType.REGISTRY.get(id);
|
||||||
}
|
}
|
||||||
|
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren