mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Fixed schematic importing for sponge
This commit is contained in:
parent
b77b615dd4
commit
d780733915
@ -46,7 +46,7 @@ import com.intellectualcrafters.plot.object.PlotBlock;
|
|||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||||
import com.intellectualcrafters.plot.object.schematic.PlotItem;
|
import com.intellectualcrafters.plot.object.schematic.PlotItem;
|
||||||
import com.plotsquared.bukkit.object.schematic.StateWrapper;
|
import com.plotsquared.object.schematic.StateWrapper;
|
||||||
|
|
||||||
public abstract class SchematicHandler {
|
public abstract class SchematicHandler {
|
||||||
public static SchematicHandler manager;
|
public static SchematicHandler manager;
|
||||||
@ -442,6 +442,7 @@ public abstract class SchematicHandler {
|
|||||||
try {
|
try {
|
||||||
List<Tag> blockStates = ListTag.class.cast(tagMap.get("TileEntities")).getValue();
|
List<Tag> blockStates = ListTag.class.cast(tagMap.get("TileEntities")).getValue();
|
||||||
for (Tag stateTag : blockStates) {
|
for (Tag stateTag : blockStates) {
|
||||||
|
try {
|
||||||
CompoundTag ct = ((CompoundTag) stateTag);
|
CompoundTag ct = ((CompoundTag) stateTag);
|
||||||
Map<String, Tag> state = ct.getValue();
|
Map<String, Tag> state = ct.getValue();
|
||||||
short x = IntTag.class.cast(state.get("x")).getValue().shortValue();
|
short x = IntTag.class.cast(state.get("x")).getValue().shortValue();
|
||||||
@ -449,6 +450,10 @@ public abstract class SchematicHandler {
|
|||||||
short z = IntTag.class.cast(state.get("z")).getValue().shortValue();
|
short z = IntTag.class.cast(state.get("z")).getValue().shortValue();
|
||||||
new StateWrapper(ct).restoreTag(x, y, z, schem);
|
new StateWrapper(ct).restoreTag(x, y, z, schem);
|
||||||
}
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -44,7 +44,7 @@ import com.intellectualcrafters.plot.object.Location;
|
|||||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||||
import com.intellectualcrafters.plot.util.SchematicHandler;
|
import com.intellectualcrafters.plot.util.SchematicHandler;
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.plotsquared.bukkit.object.schematic.StateWrapper;
|
import com.plotsquared.object.schematic.StateWrapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schematic Handler
|
* Schematic Handler
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package com.plotsquared.bukkit.object.schematic;
|
package com.plotsquared.object.schematic;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -92,6 +92,14 @@ public class StateWrapper {
|
|||||||
return tags;
|
return tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<String, Tag> serializeItem(org.spongepowered.api.item.inventory.ItemStack item) {
|
||||||
|
Map<String, Tag> data = new HashMap<String, Tag>();
|
||||||
|
|
||||||
|
// FIXME serialize sponge item
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
public Map<String, Tag> serializeItem(ItemStack item) {
|
public Map<String, Tag> serializeItem(ItemStack item) {
|
||||||
Map<String, Tag> data = new HashMap<String, Tag>();
|
Map<String, Tag> data = new HashMap<String, Tag>();
|
||||||
data.put("id", new ShortTag("id", (short) item.getTypeId()));
|
data.put("id", new ShortTag("id", (short) item.getTypeId()));
|
Loading…
Reference in New Issue
Block a user