mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
Upstream merge
This commit is contained in:
parent
b2e3d40be2
commit
1577ef61d4
@ -22,10 +22,7 @@ package com.sk89q.worldedit.entity;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.jnbt.ListTag;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.NbtValued;
|
||||
import com.sk89q.worldedit.world.entity.EntityType;
|
||||
|
@ -26,6 +26,7 @@ import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
import com.sk89q.worldedit.internal.registry.AbstractFactory;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -20,8 +20,14 @@
|
||||
package com.sk89q.worldedit.internal.block;
|
||||
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.registry.BlockRegistry;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.BitSet;
|
||||
import java.util.OptionalInt;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
|
||||
public final class BlockStateIdAccess {
|
||||
|
||||
@ -29,7 +35,7 @@ public final class BlockStateIdAccess {
|
||||
private static final int EXPECTED_BLOCK_COUNT = 2 << 13;
|
||||
private static final Int2ObjectOpenHashMap<BlockState> TO_STATE =
|
||||
new Int2ObjectOpenHashMap<>(EXPECTED_BLOCK_COUNT);
|
||||
|
||||
|
||||
static {
|
||||
TO_STATE.defaultReturnValue(null);
|
||||
}
|
||||
@ -38,9 +44,9 @@ public final class BlockStateIdAccess {
|
||||
int getInternalId(BlockState blockState);
|
||||
void setInternalId(BlockState blockState, int internalId);
|
||||
}
|
||||
|
||||
|
||||
private static BlockStateInternalId blockStateInternalId;
|
||||
|
||||
|
||||
public static void setBlockStateInternalId(BlockStateInternalId blockStateInternalId) {
|
||||
BlockStateIdAccess.blockStateInternalId = blockStateInternalId;
|
||||
}
|
||||
@ -55,14 +61,14 @@ public final class BlockStateIdAccess {
|
||||
public static boolean isValidInternalId(int internalId) {
|
||||
return internalId != INVALID_ID;
|
||||
}
|
||||
|
||||
public static int getBlockStateId(BlockState holder) {
|
||||
return holder.getOrdinal();
|
||||
//return blockStateInternalId.getInternalId(holder);
|
||||
}
|
||||
/*
|
||||
|
||||
public static @Nullable BlockState getBlockStateById(int id) {
|
||||
return TO_STATE.get(id);
|
||||
return BlockState.getFromOrdinal(id);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -70,8 +76,9 @@ public final class BlockStateIdAccess {
|
||||
* {@link BlockRegistry#getInternalBlockStateId(BlockState)} will return
|
||||
* {@link OptionalInt#empty()}. In those cases, we will use our own ID system,
|
||||
* since it's useful for other entries as well.
|
||||
*
|
||||
* @return an unused ID in WorldEdit's ID tracker
|
||||
/
|
||||
*/
|
||||
private static int provideUnusedWorldEditId() {
|
||||
return usedIds.nextClearBit(0);
|
||||
}
|
||||
@ -97,12 +104,7 @@ public final class BlockStateIdAccess {
|
||||
usedIds.clear();
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
private BlockStateIdAccess() {
|
||||
}
|
||||
|
||||
public static @Nullable BlockState getBlockStateById(int id) {
|
||||
return BlockState.getFromOrdinal(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class Registry<V extends Keyed> implements Iterable<V> {
|
||||
|
@ -58,7 +58,7 @@ public class BlockMap<V> extends AbstractMap<BlockVector3, V> {
|
||||
========================= */
|
||||
|
||||
public static <V> BlockMap<V> create() {
|
||||
return create(() -> new Int2ObjectOpenHashMap<>(64, 1f));
|
||||
return create(() -> new Int2ObjectOpenHashMap<>(64, 0.9f));
|
||||
}
|
||||
|
||||
public static BlockMap<BaseBlock> createForBaseBlock() {
|
||||
@ -118,7 +118,7 @@ public class BlockMap<V> extends AbstractMap<BlockVector3, V> {
|
||||
return BlockVector3.at(x, y, z);
|
||||
}
|
||||
|
||||
private final Long2ObjectMap<Int2ObjectMap<V>> maps = new Long2ObjectOpenHashMap<>(4, 1f);
|
||||
private final Long2ObjectMap<Int2ObjectMap<V>> maps = new Long2ObjectOpenHashMap<>(4, 0.75f);
|
||||
private final Supplier<Int2ObjectMap<V>> subMapSupplier;
|
||||
private Set<Entry<BlockVector3, V>> entrySet;
|
||||
private Collection<V> values;
|
||||
|
@ -33,9 +33,9 @@ import it.unimi.dsi.fastutil.objects.AbstractObjectSet;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectIterator;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectSet;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.function.BiFunction;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Int-to-BaseBlock map, but with optimizations for common cases.
|
||||
@ -52,8 +52,7 @@ class Int2BaseBlockMap extends AbstractInt2ObjectMap<BaseBlock> {
|
||||
private static int optimizedInternalId(BaseBlock block) {
|
||||
if (block.hasNbtData()) {
|
||||
return BlockStateIdAccess.invalidId();
|
||||
}
|
||||
|
||||
}
|
||||
return BlockStateIdAccess.getBlockStateId(block.toImmutableState());
|
||||
}
|
||||
|
||||
@ -68,8 +67,8 @@ class Int2BaseBlockMap extends AbstractInt2ObjectMap<BaseBlock> {
|
||||
return state.toBaseBlock();
|
||||
}
|
||||
|
||||
private final Int2IntMap commonMap = new Int2IntOpenHashMap(64, 1f);
|
||||
private final Int2ObjectMap<BaseBlock> uncommonMap = new Int2ObjectOpenHashMap<>(1, 1f);
|
||||
private final Int2IntMap commonMap = new Int2IntOpenHashMap(64, 0.9f);
|
||||
private final Int2ObjectMap<BaseBlock> uncommonMap = new Int2ObjectOpenHashMap<>(1, 0.75f);
|
||||
|
||||
{
|
||||
commonMap.defaultReturnValue(BlockStateIdAccess.invalidId());
|
||||
|
@ -19,11 +19,9 @@
|
||||
|
||||
package com.sk89q.worldedit.util.formatting;
|
||||
|
||||
import com.boydti.fawe.util.StringMan;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import org.enginehub.piston.config.Config;
|
||||
import org.enginehub.piston.config.ConfigHolder;
|
||||
@ -31,8 +29,6 @@ import org.enginehub.piston.config.TextConfig;
|
||||
import org.enginehub.piston.util.TextHelper;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
|
@ -20,24 +20,20 @@
|
||||
package com.sk89q.worldedit.util.formatting.component;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
import static com.sk89q.worldedit.internal.command.CommandUtil.getSubCommands;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
|
||||
import com.sk89q.worldedit.util.formatting.text.event.HoverEvent;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextDecoration;
|
||||
import java.util.List;
|
||||
import org.enginehub.piston.Command;
|
||||
import org.enginehub.piston.CommandParameters;
|
||||
import org.enginehub.piston.NoInputCommandParameters;
|
||||
import org.enginehub.piston.config.ColorConfig;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
import org.enginehub.piston.part.CommandPart;
|
||||
import org.enginehub.piston.util.HelpGenerator;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import javax.annotation.Nullable;
|
||||
import org.enginehub.piston.util.HelpGenerator;
|
||||
import static com.sk89q.worldedit.internal.command.CommandUtil.getSubCommands;
|
||||
|
||||
/**
|
||||
* A box to describe usage of a command.
|
||||
|
@ -54,7 +54,7 @@ public final class ActorCallbackPaste {
|
||||
AsyncCommandBuilder.wrap(task, sender)
|
||||
.registerWithSupervisor(supervisor, "Submitting content to a pastebin service.")
|
||||
.sendMessageAfterDelay("(Please wait... sending output to pastebin...)")
|
||||
.onSuccess((String) null, url -> sender.print(TextComponent.of(String.format(successMessage, url))))
|
||||
.onSuccess((String) null, url -> sender.print(String.format(successMessage, url)))
|
||||
.onFailure("Failed to submit paste", null)
|
||||
.buildAndExec(Pasters.getExecutor());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user