Last active
July 21, 2019 03:09
-
-
Save WouterG/02363dafe53bc125f1e358a282a20579 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import net.menoni.rd.RuntimeDebugger; | |
import net.menoni.rd.model.Debugger; | |
import net.minecraft.server.v1_14_R1.*; | |
import org.bukkit.ChatColor; | |
import org.bukkit.Location; | |
import org.bukkit.command.CommandSender; | |
import org.bukkit.craftbukkit.v1_14_R1.CraftWorld; | |
import org.bukkit.entity.Player; | |
public class NBTSchematic implements Debugger { | |
@Override | |
public void debug(RuntimeDebugger plugin, CommandSender cs) { | |
if (!(cs instanceof Player)) { | |
cs.sendMessage("need a player"); | |
return; | |
} | |
Player p = (Player) cs; | |
DefinedStructureManager definedStructureManager = ((CraftWorld) p.getWorld()).getHandle().getDataManager().f(); | |
p.sendMessage("Found defined structure manager: " + definedStructureManager.toString()); | |
DefinedStructure definedStructure = definedStructureManager.a(new MinecraftKey("colonywars", "cathedral")); | |
p.sendMessage("Found defined structure: " + definedStructure.toString()); | |
p.sendMessage(ChatColor.YELLOW + definedStructure.b()); | |
DefinedStructureInfo structureInfo = (new DefinedStructureInfo()).a(EnumBlockMirror.NONE).a(EnumBlockRotation.NONE).a(false).a((ChunkCoordIntPair)null); | |
p.sendMessage("Found defined structure info: " + structureInfo.toString()); | |
definedStructure.a(((CraftWorld)p.getWorld()).getHandle(), getBlockPos(p.getLocation().clone().add(0, -1, 0)), structureInfo); | |
p.sendMessage("done"); | |
} | |
public BlockPosition getBlockPos(Location location) { | |
return new BlockPosition( | |
location.getBlockX(), | |
location.getBlockY(), | |
location.getBlockZ() | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment