Skip to content

Instantly share code, notes, and snippets.

@tehbeard
Created July 14, 2013 15:35
Show Gist options
  • Save tehbeard/5994636 to your computer and use it in GitHub Desktop.
Save tehbeard/5994636 to your computer and use it in GitHub Desktop.
public class PasteCommand extends CommandBase {
private final SchematicFile schFile;
public PasteCommand(SchematicFile schFile) {
this.schFile = schFile;
}
@Override
public String getCommandName() {
return "paste";
}
@Override
public void processCommand(ICommandSender icommandsender, String[] args) {
if(!(icommandsender instanceof EntityPlayer)){return;}
EntityPlayerMP player = (EntityPlayerMP) icommandsender;
PasteToWorld paste = new PasteToWorld(player.worldObj);
//PasteAsSand paste = new PasteAsSand(player.worldObj);
paste.setWorldVec(new SchVector((int)Math.floor(player.posX),(int) Math.floor(player.posY),(int) Math.floor(player.posZ)));
paste.setRotations(Integer.parseInt(args[0]));
new SchematicFactory().loadWorkers(new VectorOffsetWorker(new SchVector(-1,-1,-1))).loadSchematic(schFile).produce(paste);
Set<ItemData> data = GameData.buildWorldItemData(null);
player.addChatMessage("pasted");
}
@Override
public String getCommandUsage(ICommandSender icommandsender) {
return "/paste [rotation]";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment