mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-06 20:56:41 +00:00
Merge current FAWE master (227d6d91
) into new-vector-system
Signed-off-by: Byron Marohn <combustible@live.com>
This commit is contained in:
@ -24,9 +24,6 @@ import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseItem;
|
||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||
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.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
@ -36,6 +33,8 @@ import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.Direction;
|
||||
import com.sk89q.worldedit.util.TreeGenerator;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.weather.WeatherType;
|
||||
|
||||
/**
|
||||
|
@ -84,7 +84,4 @@ public class BaseBiome {
|
||||
public int hashCode() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -19,13 +19,13 @@
|
||||
|
||||
package com.sk89q.worldedit.world.biome;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.sk89q.worldedit.world.registry.BiomeRegistry;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* Returns the name of a biome using a given {@code BiomeRegistry}.
|
||||
*/
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.world.block;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BlockMaterial;
|
||||
@ -99,7 +101,7 @@ public interface BlockType extends FawePattern, Comparable<BlockTypes> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the properties of this BlockType in a key->property mapping.
|
||||
* Gets the properties of this BlockType in a {@code key->property} mapping.
|
||||
*
|
||||
* @return The properties map
|
||||
*/
|
||||
@ -138,7 +140,9 @@ public interface BlockType extends FawePattern, Comparable<BlockTypes> {
|
||||
*/
|
||||
@Deprecated
|
||||
default <V> Property<V> getProperty(String name) {
|
||||
return getPropertyMap().get(name);
|
||||
Property<V> property = getPropertyMap().get(name);
|
||||
checkArgument(property != null, "%s has no property named %s", this, name);
|
||||
return property;
|
||||
}
|
||||
|
||||
default boolean hasProperty(PropertyKey key) {
|
||||
@ -146,7 +150,9 @@ public interface BlockType extends FawePattern, Comparable<BlockTypes> {
|
||||
}
|
||||
|
||||
default <V> Property<V> getProperty(PropertyKey key) {
|
||||
return getPropertyMap().get(key.getId());
|
||||
Property<V> property = getPropertyMap().get(key.getId());
|
||||
checkArgument(property != null, "%s has no property named %s", this, key.getId());
|
||||
return property;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -163,6 +169,13 @@ public interface BlockType extends FawePattern, Comparable<BlockTypes> {
|
||||
*/
|
||||
List<BlockState> getAllStates();
|
||||
|
||||
/**
|
||||
* Gets a state of this BlockType with the given properties.
|
||||
*
|
||||
* @return The state, if it exists
|
||||
*/
|
||||
BlockState getState(Map<Property<?>, Object> key);
|
||||
|
||||
/**
|
||||
* Gets whether this block type has an item representation.
|
||||
*
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.world.block;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.command.SuggestInputParseException;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
@ -219,19 +221,24 @@ public enum BlockTypes implements BlockType {
|
||||
DARK_PRISMARINE_SLAB,
|
||||
DARK_PRISMARINE_STAIRS,
|
||||
DAYLIGHT_DETECTOR,
|
||||
DEAD_BRAIN_CORAL,
|
||||
DEAD_BRAIN_CORAL_BLOCK,
|
||||
DEAD_BRAIN_CORAL_FAN,
|
||||
DEAD_BRAIN_CORAL_WALL_FAN,
|
||||
DEAD_BUBBLE_CORAL,
|
||||
DEAD_BUBBLE_CORAL_BLOCK,
|
||||
DEAD_BUBBLE_CORAL_FAN,
|
||||
DEAD_BUBBLE_CORAL_WALL_FAN,
|
||||
DEAD_BUSH,
|
||||
DEAD_FIRE_CORAL,
|
||||
DEAD_FIRE_CORAL_BLOCK,
|
||||
DEAD_FIRE_CORAL_FAN,
|
||||
DEAD_FIRE_CORAL_WALL_FAN,
|
||||
DEAD_HORN_CORAL,
|
||||
DEAD_HORN_CORAL_BLOCK,
|
||||
DEAD_HORN_CORAL_FAN,
|
||||
DEAD_HORN_CORAL_WALL_FAN,
|
||||
DEAD_TUBE_CORAL,
|
||||
DEAD_TUBE_CORAL_BLOCK,
|
||||
DEAD_TUBE_CORAL_FAN,
|
||||
DEAD_TUBE_CORAL_WALL_FAN,
|
||||
@ -654,11 +661,6 @@ public enum BlockTypes implements BlockType {
|
||||
YELLOW_WOOL,
|
||||
ZOMBIE_HEAD,
|
||||
ZOMBIE_WALL_HEAD,
|
||||
DEAD_BRAIN_CORAL,
|
||||
DEAD_BUBBLE_CORAL,
|
||||
DEAD_FIRE_CORAL,
|
||||
DEAD_HORN_CORAL,
|
||||
DEAD_TUBE_CORAL,
|
||||
|
||||
;
|
||||
|
||||
@ -825,6 +827,24 @@ public enum BlockTypes implements BlockType {
|
||||
return IntStream.of(settings.stateOrdinals).filter(i -> i != -1).mapToObj(i -> states[i]).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public BlockState getState(Map<Property<?>, Object> key) {
|
||||
int id = getInternalId();
|
||||
for (Map.Entry<Property<?>, Object> iter : key.entrySet()) {
|
||||
Property<?> prop = iter.getKey();
|
||||
Object value = iter.getValue();
|
||||
|
||||
/*
|
||||
* TODO:
|
||||
* This is likely wrong. The only place this seems to currently (Dec 23 2018)
|
||||
* be invoked is via ForgeWorld, and value is a String when invoked there...
|
||||
*/
|
||||
AbstractProperty btp = settings.propertiesMap.get(prop.getName());
|
||||
checkArgument(btp != null, "%s has no property named %s", this, prop.getName());
|
||||
id = btp.modify(id, btp.getValueFor((String)value));
|
||||
}
|
||||
return withStateId(id);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public int getMaxStateId() {
|
||||
return settings.permutations;
|
||||
|
@ -245,15 +245,20 @@ public enum ItemTypes implements ItemType {
|
||||
DARK_PRISMARINE_SLAB,
|
||||
DARK_PRISMARINE_STAIRS,
|
||||
DAYLIGHT_DETECTOR,
|
||||
DEAD_BRAIN_CORAL,
|
||||
DEAD_BRAIN_CORAL_BLOCK,
|
||||
DEAD_BRAIN_CORAL_FAN,
|
||||
DEAD_BUBBLE_CORAL,
|
||||
DEAD_BUBBLE_CORAL_BLOCK,
|
||||
DEAD_BUBBLE_CORAL_FAN,
|
||||
DEAD_BUSH,
|
||||
DEAD_FIRE_CORAL,
|
||||
DEAD_FIRE_CORAL_BLOCK,
|
||||
DEAD_FIRE_CORAL_FAN,
|
||||
DEAD_HORN_CORAL,
|
||||
DEAD_HORN_CORAL_BLOCK,
|
||||
DEAD_HORN_CORAL_FAN,
|
||||
DEAD_TUBE_CORAL,
|
||||
DEAD_TUBE_CORAL_BLOCK,
|
||||
DEAD_TUBE_CORAL_FAN,
|
||||
DEBUG_STICK,
|
||||
|
@ -22,9 +22,10 @@ package com.sk89q.worldedit.world.registry;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.biome.BiomeData;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Provides information on biomes.
|
||||
*/
|
||||
@ -54,4 +55,5 @@ public interface BiomeRegistry {
|
||||
*/
|
||||
@Nullable
|
||||
BiomeData getData(BaseBiome biome);
|
||||
|
||||
}
|
||||
|
@ -46,4 +46,4 @@ public class BundledBlockRegistry implements BlockRegistry {
|
||||
return Collections.emptyMap(); // Oof
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -22,10 +22,11 @@ package com.sk89q.worldedit.world.registry;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.biome.BiomeData;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* A biome registry that knows nothing.
|
||||
*/
|
||||
|
@ -22,7 +22,14 @@
|
||||
package com.sk89q.worldedit.world.snapshot;
|
||||
|
||||
import com.sk89q.worldedit.world.DataException;
|
||||
import com.sk89q.worldedit.world.storage.*;
|
||||
import com.sk89q.worldedit.world.storage.ChunkStore;
|
||||
import com.sk89q.worldedit.world.storage.FileLegacyChunkStore;
|
||||
import com.sk89q.worldedit.world.storage.FileMcRegionChunkStore;
|
||||
import com.sk89q.worldedit.world.storage.TrueZipLegacyChunkStore;
|
||||
import com.sk89q.worldedit.world.storage.TrueZipMcRegionChunkStore;
|
||||
import com.sk89q.worldedit.world.storage.ZippedLegacyChunkStore;
|
||||
import com.sk89q.worldedit.world.storage.ZippedMcRegionChunkStore;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Calendar;
|
||||
|
@ -19,10 +19,11 @@
|
||||
|
||||
package com.sk89q.worldedit.world.snapshot;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.File;
|
||||
import java.util.Calendar;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* A name parser attempts to make sense of a filename for a snapshot.
|
||||
*/
|
||||
|
@ -23,7 +23,6 @@ package com.sk89q.worldedit.world.snapshot;
|
||||
|
||||
import com.sk89q.worldedit.world.storage.MissingWorldException;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.File;
|
||||
import java.io.FilenameFilter;
|
||||
import java.util.ArrayList;
|
||||
@ -31,6 +30,8 @@ import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* A repository contains zero or more snapshots.
|
||||
*/
|
||||
|
@ -29,6 +29,7 @@ import com.sk89q.worldedit.world.DataException;
|
||||
import com.sk89q.worldedit.world.chunk.Chunk;
|
||||
import com.sk89q.worldedit.world.storage.ChunkStore;
|
||||
import com.sk89q.worldedit.world.storage.MissingChunkException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
|
@ -45,8 +45,8 @@ public abstract class ChunkStore implements Closeable {
|
||||
public static final int DATA_VERSION_MC_1_13 = 1519;
|
||||
|
||||
/**
|
||||
* >> to chunk
|
||||
* << from chunk
|
||||
* {@code >>} - to chunk
|
||||
* {@code <<} - from chunk
|
||||
*/
|
||||
public static final int CHUNK_SHIFTS = 4;
|
||||
|
||||
|
@ -29,6 +29,7 @@ import com.sk89q.worldedit.world.World;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Map;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
/**
|
||||
|
@ -19,12 +19,12 @@
|
||||
|
||||
package com.sk89q.worldedit.world.storage;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.jnbt.ListTag;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* Utility methods for working with NBT data used in Minecraft.
|
||||
*/
|
||||
|
@ -24,11 +24,11 @@ import com.sk89q.worldedit.world.DataException;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Enumeration;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipException;
|
||||
import java.util.zip.ZipFile;
|
||||
import java.util.Enumeration;
|
||||
|
||||
/**
|
||||
* Represents the chunk store used by Minecraft alpha but zipped.
|
||||
|
@ -26,11 +26,11 @@ import com.sk89q.worldedit.world.DataException;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Enumeration;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipException;
|
||||
import java.util.zip.ZipFile;
|
||||
import java.util.Enumeration;
|
||||
|
||||
/**
|
||||
* Represents the chunk store used by Minecraft alpha but zipped.
|
||||
|
Reference in New Issue
Block a user