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:
Jesse Boyd 2016-04-01 04:23:26 +11:00
parent edd18a7178
commit 4a7112a0a5
13 changed files with 193 additions and 111 deletions

View File

@ -15,17 +15,16 @@ import com.intellectualcrafters.plot.util.PlotChunk;
import com.intellectualcrafters.plot.util.SetQueue; import com.intellectualcrafters.plot.util.SetQueue;
import com.plotsquared.bukkit.util.BukkitUtil; import com.plotsquared.bukkit.util.BukkitUtil;
import com.plotsquared.bukkit.util.block.GenChunk; 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.Chunk;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;
import org.bukkit.generator.BlockPopulator; import org.bukkit.generator.BlockPopulator;
import org.bukkit.generator.ChunkGenerator; 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> { public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrapper<ChunkGenerator> {
private final PlotChunk<Chunk> chunkSetter; 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); this.chunkSetter = new GenChunk(null, null);
@ -174,6 +180,8 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
return this.platformGenerator; return this.platformGenerator;
} }
@Override @Override
public List<BlockPopulator> getDefaultPopulators(World world) { public List<BlockPopulator> getDefaultPopulators(World world) {
try { try {
@ -204,7 +212,17 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); 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 @Override

View File

@ -6,19 +6,20 @@ import com.intellectualcrafters.jnbt.ListTag;
import com.intellectualcrafters.jnbt.ShortTag; import com.intellectualcrafters.jnbt.ShortTag;
import com.intellectualcrafters.jnbt.Tag; import com.intellectualcrafters.jnbt.Tag;
import com.intellectualcrafters.plot.object.schematic.ItemType; 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.MathMan;
import com.intellectualcrafters.plot.util.SchematicHandler.Schematic; import com.plotsquared.bukkit.util.BukkitUtil;
import org.bukkit.block.BlockState;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; 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 { public class StateWrapper {
@ -33,32 +34,52 @@ public class StateWrapper {
this.tag = tag; 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) { if (this.tag == null) {
return false; return false;
} }
switch (tag.getString("id").toLowerCase()) {
case "chest": {
List<Tag> itemsTag = this.tag.getListTag("Items").getValue(); List<Tag> itemsTag = this.tag.getListTag("Items").getValue();
int length = itemsTag.size(); int length = itemsTag.size();
short[] ids = new short[length]; short[] ids = new short[length];
byte[] datas = new byte[length]; byte[] datas = new byte[length];
byte[] amounts = new byte[length]; byte[] amounts = new byte[length];
byte[] slots = new byte[length];
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
Tag itemTag = itemsTag.get(i); Tag itemTag = itemsTag.get(i);
CompoundTag itemComp = (CompoundTag) itemTag; CompoundTag itemComp = (CompoundTag) itemTag;
short id = itemComp.getShort("id"); short id = itemComp.getShort("id");
String idStr = itemComp.getString("id"); String idStr = itemComp.getString("id");
if (idStr != null && !MathMan.isInteger(idStr)) { if (idStr != null && !MathMan.isInteger(idStr)) {
idStr = idStr.split(":")[0].toLowerCase(); idStr = idStr.split(":")[1].toLowerCase();
id = (short) ItemType.getId(idStr); id = (short) ItemType.getId(idStr);
} }
ids[i] = id; ids[i] = id;
datas[i] = (byte) itemComp.getShort("Damage"); datas[i] = (byte) itemComp.getShort("Damage");
amounts[i] = itemComp.getByte("Count"); amounts[i] = itemComp.getByte("Count");
slots[i] = itemComp.getByte("Slot");
} }
if (length != 0) { World world = BukkitUtil.getWorld(worldName);
schematic.addItem(new PlotItem(x, y, z, ids, datas, amounts)); 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; return true;
} else {
}
}
}
return false;
} }
public CompoundTag getTag() { public CompoundTag getTag() {

View File

@ -303,7 +303,7 @@ public class BukkitSchematicHandler extends SchematicHandler {
} }
@Override @Override
public void restoreTag(CompoundTag ct, short x, short y, short z, Schematic schematic) { public void restoreTile(String world, CompoundTag ct, int x, int y, int z) {
new StateWrapper(ct).restoreTag(x, y, z, schematic); new StateWrapper(ct).restoreTag(world, x, y, z);
} }
} }

View File

@ -169,6 +169,7 @@ public class AugmentedUtils {
toReturn = true; toReturn = true;
} }
generator.generateChunk(secondaryMask, area, r); generator.generateChunk(secondaryMask, area, r);
generator.populateChunk(secondaryMask, area, r);
} }
if (lazyChunk.get() != null) { if (lazyChunk.get() != null) {
lazyChunk.get().addToQueue(); lazyChunk.get().addToQueue();

View File

@ -1,5 +1,6 @@
package com.intellectualcrafters.plot.generator; package com.intellectualcrafters.plot.generator;
import com.intellectualcrafters.jnbt.CompoundTag;
import com.intellectualcrafters.plot.object.PlotArea; import com.intellectualcrafters.plot.object.PlotArea;
import com.intellectualcrafters.plot.object.PlotBlock; import com.intellectualcrafters.plot.object.PlotBlock;
import com.intellectualcrafters.plot.object.PlotId; 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.object.PseudoRandom;
import com.intellectualcrafters.plot.util.MathMan; import com.intellectualcrafters.plot.util.MathMan;
import com.intellectualcrafters.plot.util.PlotChunk; import com.intellectualcrafters.plot.util.PlotChunk;
import com.intellectualcrafters.plot.util.SchematicHandler;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map.Entry; 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)]); result.setBlock(x, hpw.PLOT_HEIGHT, z, hpw.TOP_BLOCK[random.random(hpw.TOP_BLOCK.length)]);
if (hpw.PLOT_SCHEMATIC) { 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) { if (map != null) {
for (Entry<Integer, PlotBlock> entry : map.entrySet()) { for (Entry<Integer, PlotBlock> entry : map.entrySet()) {
result.setBlock(x, entry.getKey(), z, entry.getValue()); 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 @Override
public PlotArea getNewPlotArea(String world, String id, PlotId min, PlotId max) { public PlotArea getNewPlotArea(String world, String id, PlotId min, PlotId max) {
return new HybridPlotWorld(world, id, this, min, max); return new HybridPlotWorld(world, id, this, min, max);

View File

@ -1,21 +1,21 @@
package com.intellectualcrafters.plot.generator; package com.intellectualcrafters.plot.generator;
import com.intellectualcrafters.configuration.ConfigurationSection; import com.intellectualcrafters.configuration.ConfigurationSection;
import com.intellectualcrafters.jnbt.CompoundTag;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.BlockLoc;
import com.intellectualcrafters.plot.object.PlotArea; import com.intellectualcrafters.plot.object.PlotArea;
import com.intellectualcrafters.plot.object.PlotBlock; import com.intellectualcrafters.plot.object.PlotBlock;
import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.schematic.PlotItem;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.MathMan; import com.intellectualcrafters.plot.util.MathMan;
import com.intellectualcrafters.plot.util.SchematicHandler; import com.intellectualcrafters.plot.util.SchematicHandler;
import com.intellectualcrafters.plot.util.SchematicHandler.Dimension; import com.intellectualcrafters.plot.util.SchematicHandler.Dimension;
import com.intellectualcrafters.plot.util.SchematicHandler.Schematic; import com.intellectualcrafters.plot.util.SchematicHandler.Schematic;
import java.io.File; import java.io.File;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.Map;
public class HybridPlotWorld extends ClassicPlotWorld { public class HybridPlotWorld extends ClassicPlotWorld {
@ -25,7 +25,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
public short PATH_WIDTH_LOWER; public short PATH_WIDTH_LOWER;
public short PATH_WIDTH_UPPER; public short PATH_WIDTH_UPPER;
public HashMap<Integer, HashMap<Integer, PlotBlock>> G_SCH; 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) { public HybridPlotWorld(String worldName, String id, IndependentPlotGenerator generator, PlotId min, PlotId max) {
super(worldName, id, generator, min, max); super(worldName, id, generator, min, max);
@ -181,10 +181,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
Schematic schematic2 = SchematicHandler.manager.getSchematic(schematic2File); Schematic schematic2 = SchematicHandler.manager.getSchematic(schematic2File);
Schematic schematic3 = SchematicHandler.manager.getSchematic(schem3File); Schematic schematic3 = SchematicHandler.manager.getSchematic(schem3File);
int shift = this.ROAD_WIDTH / 2; int shift = this.ROAD_WIDTH / 2;
int oddshift = 0; int oddshift = (this.ROAD_WIDTH & 1) == 0 ? 0 : 1;
if ((this.ROAD_WIDTH & 1) != 0) {
oddshift = 1;
}
if (schematic3 != null) { if (schematic3 != null) {
this.PLOT_SCHEMATIC = true; this.PLOT_SCHEMATIC = true;
short[] ids = schematic3.getIds(); short[] ids = schematic3.getIds();
@ -215,24 +212,21 @@ public class HybridPlotWorld extends ClassicPlotWorld {
} }
} }
} }
HashSet<PlotItem> items = schematic3.getItems(); HashMap<BlockLoc, CompoundTag> items = schematic3.getTiles();
if (items != null) { if (items.size() > 0) {
this.G_SCH_STATE = new HashMap<>(); this.G_SCH_STATE = new HashMap<>();
for (PlotItem item : items) { for (Map.Entry<BlockLoc, CompoundTag> entry : items.entrySet()) {
item.x += shift + oddshift + centerShiftX; BlockLoc loc = entry.getKey();
item.z += shift + oddshift + centerShiftZ; short x = (short) (loc.x + shift + oddshift + centerShiftX);
item.y += this.PLOT_HEIGHT; short z = (short) (loc.z + shift + oddshift + centerShiftZ);
short x = (short) item.x; short y = (short) (loc.y + this.PLOT_HEIGHT);
short z = (short) item.z;
int pair = MathMan.pair(x, z); int pair = MathMan.pair(x, z);
HashMap<Integer, CompoundTag> existing = this.G_SCH_STATE.get(pair);
HashSet<PlotItem> existing = this.G_SCH_STATE.get(pair);
if (existing == null) { if (existing == null) {
existing = new HashSet<>(); existing = new HashMap<>();
this.G_SCH_STATE.put(pair, existing); this.G_SCH_STATE.put(pair, existing);
} }
existing.add(item); existing.put((int) y, entry.getValue());
} }
} }
} }

View File

@ -30,6 +30,10 @@ public abstract class IndependentPlotGenerator {
*/ */
public abstract void generateChunk(PlotChunk<?> result, PlotArea settings, PseudoRandom random); 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. * Return a new PlotArea object.
* @param world world name * @param world world name

View File

@ -598,7 +598,23 @@ public enum ItemType {
STRAD_DISC("record_strad", 2264), STRAD_DISC("record_strad", 2264),
WARD_DISC("record_ward", 2265), WARD_DISC("record_ward", 2265),
DISC_11("record_11", 2266), 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, Integer> ids = new HashMap<>();
private static final Map<String, Byte> datas = new HashMap<>(); private static final Map<String, Byte> datas = new HashMap<>();

View File

@ -16,6 +16,7 @@ import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.flag.Flag; import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.generator.ClassicPlotWorld; import com.intellectualcrafters.plot.generator.ClassicPlotWorld;
import com.intellectualcrafters.plot.object.BlockLoc;
import com.intellectualcrafters.plot.object.ChunkLoc; import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot; 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.PlotBlock;
import com.intellectualcrafters.plot.object.RegionWrapper; import com.intellectualcrafters.plot.object.RegionWrapper;
import com.intellectualcrafters.plot.object.RunnableVal; import com.intellectualcrafters.plot.object.RunnableVal;
import com.intellectualcrafters.plot.object.schematic.PlotItem;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
@ -41,7 +40,6 @@ import java.nio.channels.ReadableByteChannel;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -349,7 +347,10 @@ public abstract class SchematicHandler {
SetQueue.IMP.addTask(new Runnable() { SetQueue.IMP.addTask(new Runnable() {
@Override @Override
public void run() { 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) { if (whenDone != null) {
whenDone.value = true; whenDone.value = true;
whenDone.run(); 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) { public Schematic getSchematic(CompoundTag tag) {
Map<String, Tag> tagMap = tag.getValue(); Map<String, Tag> tagMap = tag.getValue();
// Slow // Slow
@ -447,7 +419,6 @@ public abstract class SchematicHandler {
Dimension dimensions = new Dimension(width, height, length); Dimension dimensions = new Dimension(width, height, length);
Schematic schem = new Schematic(block, data, dimensions, flags); Schematic schem = new Schematic(block, data, dimensions, flags);
// Slow // Slow
try { try {
List<Tag> blockStates = ListTag.class.cast(tagMap.get("TileEntities")).getValue(); 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 x = IntTag.class.cast(state.get("x")).getValue().shortValue();
short y = IntTag.class.cast(state.get("y")).getValue().shortValue(); short y = IntTag.class.cast(state.get("y")).getValue().shortValue();
short z = IntTag.class.cast(state.get("z")).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) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -469,7 +440,7 @@ public abstract class SchematicHandler {
return schem; 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 * Get a schematic
@ -700,7 +671,7 @@ public abstract class SchematicHandler {
private final byte[] datas; private final byte[] datas;
private final Dimension schematicDimension; private final Dimension schematicDimension;
private Map<String, Tag> flags; 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) { public Schematic(short[] i, byte[] b, Dimension d, Map<String, Tag> flags) {
this.ids = i; this.ids = i;
@ -718,22 +689,23 @@ public abstract class SchematicHandler {
} }
/** /**
* Add an item to the schematic * Add a tile entity
* @param item * @param loc
* @param tag
*/ */
public void addItem(PlotItem item) { public void addTile(BlockLoc loc, CompoundTag tag) {
if (this.items == null) { if (this.tiles == null) {
this.items = new HashSet<>(); this.tiles = new HashMap<>();
} }
this.items.add(item); this.tiles.put(loc, tag);
} }
/** /**
* Get any items associated with this schematic. * Get the tile entities
* @return * @return Map of block location to tag
*/ */
public HashSet<PlotItem> getItems() { public HashMap<BlockLoc, CompoundTag> getTiles() {
return this.items; return this.tiles;
} }
/** /**

View File

@ -80,7 +80,7 @@ import java.util.UUID;
* Created by robin on 01/11/2014 * 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 class SpongeMain implements IPlotMain {
public static SpongeMain THIS; public static SpongeMain THIS;
public PluginContainer plugin; public PluginContainer plugin;

View File

@ -52,6 +52,7 @@ public class SpongeTerrainGen implements GenerationPopulator {
// Fill the result data // Fill the result data
PlotArea area = PS.get().getPlotArea(world.getName(), null); PlotArea area = PS.get().getPlotArea(world.getName(), null);
child.generateChunk(result, area, random); child.generateChunk(result, area, random);
child.populateChunk(result, area, random);
ChunkManager.postProcessChunk(result); ChunkManager.postProcessChunk(result);
return; return;
} catch (Throwable e) { } catch (Throwable e) {

View File

@ -10,7 +10,7 @@ buildscript {
} }
group = 'com.intellectualcrafters' group = 'com.intellectualcrafters'
version = '3.3.3-SNAPSHOT' version = '3.3.3'
description = """PlotSquared""" description = """PlotSquared"""
subprojects { subprojects {

View File

@ -6,7 +6,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<artifactId>PlotSquared</artifactId> <artifactId>PlotSquared</artifactId>
<version>3.3.2</version> <version>3.3.3</version>
<name>PlotSquared</name> <name>PlotSquared</name>
<packaging>jar</packaging> <packaging>jar</packaging>
<build> <build>