mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
Various
Add some 1.9 blocks to chest content with schematic paste Restructure tileentity placement from schematic (will soon add signs etc) Prepare for release 3.3.3
This commit is contained in:
parent
edd18a7178
commit
4a7112a0a5
@ -15,17 +15,16 @@ import com.intellectualcrafters.plot.util.PlotChunk;
|
||||
import com.intellectualcrafters.plot.util.SetQueue;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
import com.plotsquared.bukkit.util.block.GenChunk;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.generator.BlockPopulator;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrapper<ChunkGenerator> {
|
||||
|
||||
private final PlotChunk<Chunk> chunkSetter;
|
||||
@ -57,6 +56,13 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
|
||||
}
|
||||
}
|
||||
}
|
||||
random.state = c.getX() << 16 | c.getZ() & 0xFFFF;
|
||||
PlotArea area = PS.get().getPlotArea(world.getName(), null);
|
||||
SetQueue.ChunkWrapper wrap = SetQueue.IMP.new ChunkWrapper(area.worldname, c.getX(), c.getZ());
|
||||
PlotChunk<?> chunk = SetQueue.IMP.queue.getChunk(wrap);
|
||||
if (plotGenerator.populateChunk(chunk, area, random)) {
|
||||
chunk.addToQueue();
|
||||
}
|
||||
}
|
||||
});
|
||||
this.chunkSetter = new GenChunk(null, null);
|
||||
@ -174,6 +180,8 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
|
||||
return this.platformGenerator;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<BlockPopulator> getDefaultPopulators(World world) {
|
||||
try {
|
||||
@ -204,7 +212,17 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return this.populators;
|
||||
if (world == null) {
|
||||
return populators;
|
||||
}
|
||||
ArrayList<BlockPopulator> toAdd = new ArrayList<BlockPopulator>();
|
||||
List<BlockPopulator> existing = world.getPopulators();
|
||||
for (BlockPopulator populator : populators) {
|
||||
if (!existing.contains(populator)) {
|
||||
toAdd.add(populator);
|
||||
}
|
||||
}
|
||||
return toAdd;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -6,19 +6,20 @@ import com.intellectualcrafters.jnbt.ListTag;
|
||||
import com.intellectualcrafters.jnbt.ShortTag;
|
||||
import com.intellectualcrafters.jnbt.Tag;
|
||||
import com.intellectualcrafters.plot.object.schematic.ItemType;
|
||||
import com.intellectualcrafters.plot.object.schematic.PlotItem;
|
||||
import com.intellectualcrafters.plot.util.MathMan;
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler.Schematic;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class StateWrapper {
|
||||
|
||||
@ -33,32 +34,52 @@ public class StateWrapper {
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
public boolean restoreTag(short x, short y, short z, Schematic schematic) {
|
||||
public boolean restoreTag(String worldName, int x, int y, int z) {
|
||||
if (this.tag == null) {
|
||||
return false;
|
||||
}
|
||||
List<Tag> itemsTag = this.tag.getListTag("Items").getValue();
|
||||
int length = itemsTag.size();
|
||||
short[] ids = new short[length];
|
||||
byte[] datas = new byte[length];
|
||||
byte[] amounts = new byte[length];
|
||||
for (int i = 0; i < length; i++) {
|
||||
Tag itemTag = itemsTag.get(i);
|
||||
CompoundTag itemComp = (CompoundTag) itemTag;
|
||||
short id = itemComp.getShort("id");
|
||||
String idStr = itemComp.getString("id");
|
||||
if (idStr != null && !MathMan.isInteger(idStr)) {
|
||||
idStr = idStr.split(":")[0].toLowerCase();
|
||||
id = (short) ItemType.getId(idStr);
|
||||
switch (tag.getString("id").toLowerCase()) {
|
||||
case "chest": {
|
||||
List<Tag> itemsTag = this.tag.getListTag("Items").getValue();
|
||||
int length = itemsTag.size();
|
||||
short[] ids = new short[length];
|
||||
byte[] datas = new byte[length];
|
||||
byte[] amounts = new byte[length];
|
||||
byte[] slots = new byte[length];
|
||||
for (int i = 0; i < length; i++) {
|
||||
Tag itemTag = itemsTag.get(i);
|
||||
CompoundTag itemComp = (CompoundTag) itemTag;
|
||||
short id = itemComp.getShort("id");
|
||||
String idStr = itemComp.getString("id");
|
||||
if (idStr != null && !MathMan.isInteger(idStr)) {
|
||||
idStr = idStr.split(":")[1].toLowerCase();
|
||||
id = (short) ItemType.getId(idStr);
|
||||
}
|
||||
ids[i] = id;
|
||||
datas[i] = (byte) itemComp.getShort("Damage");
|
||||
amounts[i] = itemComp.getByte("Count");
|
||||
slots[i] = itemComp.getByte("Slot");
|
||||
}
|
||||
World world = BukkitUtil.getWorld(worldName);
|
||||
Block block = world.getBlockAt(x, y, z);
|
||||
if (block == null) {
|
||||
return false;
|
||||
}
|
||||
BlockState state = block.getState();
|
||||
if (state instanceof InventoryHolder) {
|
||||
InventoryHolder holder = (InventoryHolder) state;
|
||||
Inventory inv = holder.getInventory();
|
||||
for (int i = 0; i < ids.length; i++) {
|
||||
ItemStack item = new ItemStack(ids[i], amounts[i], datas[i]);
|
||||
inv.addItem(item);
|
||||
}
|
||||
state.update(true);
|
||||
return true;
|
||||
} else {
|
||||
}
|
||||
}
|
||||
ids[i] = id;
|
||||
datas[i] = (byte) itemComp.getShort("Damage");
|
||||
amounts[i] = itemComp.getByte("Count");
|
||||
}
|
||||
if (length != 0) {
|
||||
schematic.addItem(new PlotItem(x, y, z, ids, datas, amounts));
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public CompoundTag getTag() {
|
||||
|
@ -303,7 +303,7 @@ public class BukkitSchematicHandler extends SchematicHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreTag(CompoundTag ct, short x, short y, short z, Schematic schematic) {
|
||||
new StateWrapper(ct).restoreTag(x, y, z, schematic);
|
||||
public void restoreTile(String world, CompoundTag ct, int x, int y, int z) {
|
||||
new StateWrapper(ct).restoreTag(world, x, y, z);
|
||||
}
|
||||
}
|
||||
|
@ -169,6 +169,7 @@ public class AugmentedUtils {
|
||||
toReturn = true;
|
||||
}
|
||||
generator.generateChunk(secondaryMask, area, r);
|
||||
generator.populateChunk(secondaryMask, area, r);
|
||||
}
|
||||
if (lazyChunk.get() != null) {
|
||||
lazyChunk.get().addToQueue();
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.intellectualcrafters.plot.generator;
|
||||
|
||||
import com.intellectualcrafters.jnbt.CompoundTag;
|
||||
import com.intellectualcrafters.plot.object.PlotArea;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
@ -7,7 +8,7 @@ import com.intellectualcrafters.plot.object.PlotManager;
|
||||
import com.intellectualcrafters.plot.object.PseudoRandom;
|
||||
import com.intellectualcrafters.plot.util.MathMan;
|
||||
import com.intellectualcrafters.plot.util.PlotChunk;
|
||||
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
@ -167,7 +168,8 @@ public class HybridGen extends IndependentPlotGenerator {
|
||||
}
|
||||
result.setBlock(x, hpw.PLOT_HEIGHT, z, hpw.TOP_BLOCK[random.random(hpw.TOP_BLOCK.length)]);
|
||||
if (hpw.PLOT_SCHEMATIC) {
|
||||
HashMap<Integer, PlotBlock> map = sch.get(MathMan.pair(rx[x], rz[z]));
|
||||
int pair = MathMan.pair(rx[x], rz[z]);
|
||||
HashMap<Integer, PlotBlock> map = sch.get(pair);
|
||||
if (map != null) {
|
||||
for (Entry<Integer, PlotBlock> entry : map.entrySet()) {
|
||||
result.setBlock(x, entry.getKey(), z, entry.getValue());
|
||||
@ -180,6 +182,59 @@ public class HybridGen extends IndependentPlotGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean populateChunk(PlotChunk<?> result, PlotArea settings, PseudoRandom random) {
|
||||
HybridPlotWorld hpw = (HybridPlotWorld) settings;
|
||||
if (hpw.G_SCH_STATE != null) {
|
||||
int cx = result.getX();
|
||||
int cz = result.getZ();
|
||||
int p1x = cx << 4;
|
||||
int p1z = cz << 4;
|
||||
int bx = p1x - hpw.ROAD_OFFSET_X;
|
||||
int bz = p1z - hpw.ROAD_OFFSET_Z;
|
||||
short rbx;
|
||||
if (bx < 0) {
|
||||
rbx = (short) (hpw.SIZE + (bx % hpw.SIZE));
|
||||
} else {
|
||||
rbx = (short) (bx % hpw.SIZE);
|
||||
}
|
||||
short rbz;
|
||||
if (bz < 0) {
|
||||
rbz = (short) (hpw.SIZE + (bz % hpw.SIZE));
|
||||
} else {
|
||||
rbz = (short) (bz % hpw.SIZE);
|
||||
}
|
||||
short[] rx = new short[16];
|
||||
for (short i = 0; i < 16; i++) {
|
||||
short v = (short) (rbx + i);
|
||||
if (v >= hpw.SIZE) {
|
||||
v -= hpw.SIZE;
|
||||
}
|
||||
rx[i] = v;
|
||||
}
|
||||
short[] rz = new short[16];
|
||||
for (short i = 0; i < 16; i++) {
|
||||
short v = (short) (rbz + i);
|
||||
if (v >= hpw.SIZE) {
|
||||
v -= hpw.SIZE;
|
||||
}
|
||||
rz[i] = v;
|
||||
}
|
||||
for (short x = 0; x < 16; x++) {
|
||||
for (short z = 0; z < 16; z++) {
|
||||
int pair = MathMan.pair(rx[x], rz[z]);
|
||||
HashMap<Integer, CompoundTag> map = hpw.G_SCH_STATE.get(pair);
|
||||
if (map != null) {
|
||||
for (Entry<Integer, CompoundTag> entry : map.entrySet()) {
|
||||
SchematicHandler.manager.restoreTile(hpw.worldname, entry.getValue(), p1x + x, entry.getKey(), p1z + z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlotArea getNewPlotArea(String world, String id, PlotId min, PlotId max) {
|
||||
return new HybridPlotWorld(world, id, this, min, max);
|
||||
|
@ -1,21 +1,21 @@
|
||||
package com.intellectualcrafters.plot.generator;
|
||||
|
||||
import com.intellectualcrafters.configuration.ConfigurationSection;
|
||||
import com.intellectualcrafters.jnbt.CompoundTag;
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.object.BlockLoc;
|
||||
import com.intellectualcrafters.plot.object.PlotArea;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.object.schematic.PlotItem;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.MathMan;
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler;
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler.Dimension;
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler.Schematic;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
|
||||
public class HybridPlotWorld extends ClassicPlotWorld {
|
||||
|
||||
@ -25,7 +25,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
||||
public short PATH_WIDTH_LOWER;
|
||||
public short PATH_WIDTH_UPPER;
|
||||
public HashMap<Integer, HashMap<Integer, PlotBlock>> G_SCH;
|
||||
public HashMap<Integer, HashSet<PlotItem>> G_SCH_STATE;
|
||||
public HashMap<Integer, HashMap<Integer, CompoundTag>> G_SCH_STATE;
|
||||
|
||||
public HybridPlotWorld(String worldName, String id, IndependentPlotGenerator generator, PlotId min, PlotId max) {
|
||||
super(worldName, id, generator, min, max);
|
||||
@ -181,10 +181,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
||||
Schematic schematic2 = SchematicHandler.manager.getSchematic(schematic2File);
|
||||
Schematic schematic3 = SchematicHandler.manager.getSchematic(schem3File);
|
||||
int shift = this.ROAD_WIDTH / 2;
|
||||
int oddshift = 0;
|
||||
if ((this.ROAD_WIDTH & 1) != 0) {
|
||||
oddshift = 1;
|
||||
}
|
||||
int oddshift = (this.ROAD_WIDTH & 1) == 0 ? 0 : 1;
|
||||
if (schematic3 != null) {
|
||||
this.PLOT_SCHEMATIC = true;
|
||||
short[] ids = schematic3.getIds();
|
||||
@ -215,24 +212,21 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
||||
}
|
||||
}
|
||||
}
|
||||
HashSet<PlotItem> items = schematic3.getItems();
|
||||
if (items != null) {
|
||||
HashMap<BlockLoc, CompoundTag> items = schematic3.getTiles();
|
||||
if (items.size() > 0) {
|
||||
this.G_SCH_STATE = new HashMap<>();
|
||||
for (PlotItem item : items) {
|
||||
item.x += shift + oddshift + centerShiftX;
|
||||
item.z += shift + oddshift + centerShiftZ;
|
||||
item.y += this.PLOT_HEIGHT;
|
||||
short x = (short) item.x;
|
||||
short z = (short) item.z;
|
||||
for (Map.Entry<BlockLoc, CompoundTag> entry : items.entrySet()) {
|
||||
BlockLoc loc = entry.getKey();
|
||||
short x = (short) (loc.x + shift + oddshift + centerShiftX);
|
||||
short z = (short) (loc.z + shift + oddshift + centerShiftZ);
|
||||
short y = (short) (loc.y + this.PLOT_HEIGHT);
|
||||
int pair = MathMan.pair(x, z);
|
||||
|
||||
|
||||
HashSet<PlotItem> existing = this.G_SCH_STATE.get(pair);
|
||||
HashMap<Integer, CompoundTag> existing = this.G_SCH_STATE.get(pair);
|
||||
if (existing == null) {
|
||||
existing = new HashSet<>();
|
||||
existing = new HashMap<>();
|
||||
this.G_SCH_STATE.put(pair, existing);
|
||||
}
|
||||
existing.add(item);
|
||||
existing.put((int) y, entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,10 @@ public abstract class IndependentPlotGenerator {
|
||||
*/
|
||||
public abstract void generateChunk(PlotChunk<?> result, PlotArea settings, PseudoRandom random);
|
||||
|
||||
public boolean populateChunk(PlotChunk<?> result, PlotArea settings, PseudoRandom random) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a new PlotArea object.
|
||||
* @param world world name
|
||||
|
@ -598,7 +598,23 @@ public enum ItemType {
|
||||
STRAD_DISC("record_strad", 2264),
|
||||
WARD_DISC("record_ward", 2265),
|
||||
DISC_11("record_11", 2266),
|
||||
WAIT_DISC("record_wait", 2267);
|
||||
WAIT_DISC("record_wait", 2267),
|
||||
END_ROD("end_rod",198),
|
||||
CHORUS_PLANT("chorus_plant",199),
|
||||
CHORUS_FLOWER("chorus_flower",200),
|
||||
PURPUR_BLOCK("purpur_block",201),
|
||||
PURPUR_PILLAR("purpur_pillar",202),
|
||||
PURPUR_STAIRS("purpur_stairs",203),
|
||||
PURPUR_DOUBLE_SLAB("purpur_double_slab",204),
|
||||
PURPUR_SLAB("purpur_slab",205),
|
||||
END_BRICKS("end_bricks",206),
|
||||
BEETROOTS("beetroots",207),
|
||||
GRASS_PATH("grass_path",208),
|
||||
END_GATEWAY("end_gateway",209),
|
||||
REPEATING_COMMAND_BLOCK("repeating_command_block",210),
|
||||
CHAIN_COMMAND_BLOCK("chain_command_block",211),
|
||||
FROSTED_ICE("frosted_ice",212),
|
||||
STRUCTURE_BLOCK("structure_block",255);
|
||||
|
||||
private static final Map<String, Integer> ids = new HashMap<>();
|
||||
private static final Map<String, Byte> datas = new HashMap<>();
|
||||
|
@ -16,6 +16,7 @@ import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.config.Settings;
|
||||
import com.intellectualcrafters.plot.flag.Flag;
|
||||
import com.intellectualcrafters.plot.generator.ClassicPlotWorld;
|
||||
import com.intellectualcrafters.plot.object.BlockLoc;
|
||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
@ -23,8 +24,6 @@ import com.intellectualcrafters.plot.object.PlotArea;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||
import com.intellectualcrafters.plot.object.schematic.PlotItem;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@ -41,7 +40,6 @@ import java.nio.channels.ReadableByteChannel;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -349,7 +347,10 @@ public abstract class SchematicHandler {
|
||||
SetQueue.IMP.addTask(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
pasteStates(schematic, plot, xOffset, zOffset);
|
||||
for (Map.Entry<BlockLoc, CompoundTag> entry : schematic.getTiles().entrySet()) {
|
||||
BlockLoc loc = entry.getKey();
|
||||
restoreTile(plot.getArea().worldname, entry.getValue(), p1x + xOffset + loc.x, loc.y + y_offset_actual, p1z + zOffset + loc.z);
|
||||
}
|
||||
if (whenDone != null) {
|
||||
whenDone.value = true;
|
||||
whenDone.run();
|
||||
@ -367,35 +368,6 @@ public abstract class SchematicHandler {
|
||||
});
|
||||
}
|
||||
|
||||
public boolean pasteStates(Schematic schematic, Plot plot, int xOffset, int zOffset) {
|
||||
if (schematic == null) {
|
||||
PS.debug("Schematic == null :|");
|
||||
return false;
|
||||
}
|
||||
HashSet<PlotItem> items = schematic.getItems();
|
||||
if (items == null) {
|
||||
return false;
|
||||
}
|
||||
RegionWrapper region = plot.getLargestRegion();
|
||||
Location location = new Location(plot.getArea().worldname, region.minX + xOffset, 1, region.minZ + zOffset);
|
||||
int sy = MainUtil.getHeighestBlock(plot.getArea().worldname, location.getX() + 1, location.getZ() + 1);
|
||||
Dimension demensions = schematic.getSchematicDimension();
|
||||
int height = demensions.getY();
|
||||
if (height < 255) {
|
||||
location = location.add(0, sy - 1, 0);
|
||||
}
|
||||
int x = location.getX() + xOffset;
|
||||
int y = location.getY();
|
||||
int z = location.getZ() + zOffset;
|
||||
for (PlotItem item : items) {
|
||||
item.x += x;
|
||||
item.y += y;
|
||||
item.z += z;
|
||||
WorldUtil.IMP.addItems(plot.getArea().worldname, item);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public Schematic getSchematic(CompoundTag tag) {
|
||||
Map<String, Tag> tagMap = tag.getValue();
|
||||
// Slow
|
||||
@ -447,7 +419,6 @@ public abstract class SchematicHandler {
|
||||
|
||||
Dimension dimensions = new Dimension(width, height, length);
|
||||
Schematic schem = new Schematic(block, data, dimensions, flags);
|
||||
|
||||
// Slow
|
||||
try {
|
||||
List<Tag> blockStates = ListTag.class.cast(tagMap.get("TileEntities")).getValue();
|
||||
@ -458,7 +429,7 @@ public abstract class SchematicHandler {
|
||||
short x = IntTag.class.cast(state.get("x")).getValue().shortValue();
|
||||
short y = IntTag.class.cast(state.get("y")).getValue().shortValue();
|
||||
short z = IntTag.class.cast(state.get("z")).getValue().shortValue();
|
||||
manager.restoreTag(ct, x, y, z, schem);
|
||||
schem.addTile(new BlockLoc(x, y, z), ct);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -469,7 +440,7 @@ public abstract class SchematicHandler {
|
||||
return schem;
|
||||
}
|
||||
|
||||
public abstract void restoreTag(CompoundTag ct, short x, short y, short z, Schematic schematic);
|
||||
public abstract void restoreTile(String world, CompoundTag tag, int x, int y, int z);
|
||||
|
||||
/**
|
||||
* Get a schematic
|
||||
@ -700,7 +671,7 @@ public abstract class SchematicHandler {
|
||||
private final byte[] datas;
|
||||
private final Dimension schematicDimension;
|
||||
private Map<String, Tag> flags;
|
||||
private HashSet<PlotItem> items;
|
||||
private HashMap<BlockLoc, CompoundTag> tiles;
|
||||
|
||||
public Schematic(short[] i, byte[] b, Dimension d, Map<String, Tag> flags) {
|
||||
this.ids = i;
|
||||
@ -718,22 +689,23 @@ public abstract class SchematicHandler {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an item to the schematic
|
||||
* @param item
|
||||
* Add a tile entity
|
||||
* @param loc
|
||||
* @param tag
|
||||
*/
|
||||
public void addItem(PlotItem item) {
|
||||
if (this.items == null) {
|
||||
this.items = new HashSet<>();
|
||||
public void addTile(BlockLoc loc, CompoundTag tag) {
|
||||
if (this.tiles == null) {
|
||||
this.tiles = new HashMap<>();
|
||||
}
|
||||
this.items.add(item);
|
||||
this.tiles.put(loc, tag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get any items associated with this schematic.
|
||||
* @return
|
||||
* Get the tile entities
|
||||
* @return Map of block location to tag
|
||||
*/
|
||||
public HashSet<PlotItem> getItems() {
|
||||
return this.items;
|
||||
public HashMap<BlockLoc, CompoundTag> getTiles() {
|
||||
return this.tiles;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -80,7 +80,7 @@ import java.util.UUID;
|
||||
* Created by robin on 01/11/2014
|
||||
*/
|
||||
|
||||
@Plugin(id = "com.plotsquared", name = "PlotSquared", description = "Easy, yet powerful Plot World generation and management.", url = "https://github.com/IntellectualSites/PlotSquared", version = "3.3.2")
|
||||
@Plugin(id = "com.plotsquared", name = "PlotSquared", description = "Easy, yet powerful Plot World generation and management.", url = "https://github.com/IntellectualSites/PlotSquared", version = "3.3.3")
|
||||
public class SpongeMain implements IPlotMain {
|
||||
public static SpongeMain THIS;
|
||||
public PluginContainer plugin;
|
||||
|
@ -52,6 +52,7 @@ public class SpongeTerrainGen implements GenerationPopulator {
|
||||
// Fill the result data
|
||||
PlotArea area = PS.get().getPlotArea(world.getName(), null);
|
||||
child.generateChunk(result, area, random);
|
||||
child.populateChunk(result, area, random);
|
||||
ChunkManager.postProcessChunk(result);
|
||||
return;
|
||||
} catch (Throwable e) {
|
||||
|
@ -10,7 +10,7 @@ buildscript {
|
||||
}
|
||||
|
||||
group = 'com.intellectualcrafters'
|
||||
version = '3.3.3-SNAPSHOT'
|
||||
version = '3.3.3'
|
||||
description = """PlotSquared"""
|
||||
|
||||
subprojects {
|
||||
|
Loading…
Reference in New Issue
Block a user