Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to get the CuboidClipboard or a working Clipboard from Schematic? #313

Closed
diogotcorreia opened this issue Sep 24, 2016 · 8 comments

Comments

@diogotcorreia
Copy link

diogotcorreia commented Sep 24, 2016

Hi, I need to get the Clipboard/CuboidClipboard from FAWE Schematic which I get from this:
ClipboardFormat.SCHEMATIC.load(file)

I already tried to get it from the private clipboard variable (using reflection), but it returns an empty clipboard... (the size is right, but everything is air)

Then I tried to use CuboidClipboard directly using the WorldEdit API, and it works, but it leaves a lot of shadow bugs. I tried the nms method which is called on FAWE asnyc queue:
nmsWorld.x(new BlockPosition(x, y, z));

Any ideas how to get the Clipboard from the Schematic...? I need to scan it and remove some blocks.

@diogotcorreia
Copy link
Author

Also, using the FAWE light API, I get this error on async or sync:

java.lang.NullPointerException
at com.boydti.fawe.bukkit.v1_8.BukkitQueue18R3.relight(BukkitQueue18R3.java:614) ~[?:?]
at net.islandcraftgames.api.minigames.LightUtils.relight(LightUtils.java:26) ~[?:?]

Using this:
NMSMappedFaweQueue<?, ?, ?, ?> nmsQueue = (NMSMappedFaweQueue<?, ?, ?, ?>) SetQueue.IMP.getNewQueue(world.getName(), true, false); for (int x = bottomBlockX; x <= topBlockX; x++) for (int z = bottomBlockZ; z <= topBlockZ; z++) for (int y = bottomBlockY; y <= topBlockY; y++) nmsQueue.relight(x, y, z);

@boy0001
Copy link
Owner

boy0001 commented Sep 24, 2016

You could have used:

Clipboard clipboard ClipboardFormat.SCHEMATIC.getReader(new FileInputStream(file)).read(null);

However I have added a getClipboard() method to the Schematic class.

I already tried to get it from the private clipboard variable (using reflection), but it returns an empty clipboard... (the size is air, but everything is air)

What do you mean by the size being air? Anywho, the clipboard has to work since //schem load and //paste use the same code. btw, getting a block in a position outside the schematic will return air. Try iterating over the region, or ensure you have the right offset when using getBlock(...)

With regard to lighting, you can mess around with changing the mode in the config (lighting-mode: 2 is best)

@diogotcorreia
Copy link
Author

diogotcorreia commented Sep 24, 2016

You could have used:

Clipboard clipboard ClipboardFormat.SCHEMATIC.getReader(new FileInputStream(file)).read(null);

Changed to that. Same thing.

However I have added a getClipboard() method to the Schematic class.

That would be good, but if I don't have to use the Schematic class, is useless...

What do you mean by the size being air?

Edited the post... Sorry for that :/ (Meant to be the size being right)

btw, getting a block in a position outside the schematic will return air.

So what are the schematic coordinates? I just did a debug here, so you can see what's going on.

Here is the debug link (not the whole debug, because that would be like 1000 lines).

So I do a loop on the clipboard to get all the blocks:

for (int x = 0; x <= cc.getDimensions().getBlockX(); x++) for (int y = 0; y <= cc.getDimensions().getBlockY(); y++) for (int z = 0; z <= cc.getDimensions().getBlockZ(); z++)

Then, I use this to debug where c is the clipboard, e is a custom event and e.getBlock() the vector with the current x, y and z.

System.out.println("clipboard dimemsions = " + c.getDimensions() + ", position = " + e.getBlock().toString() + ", id = " + c.getBlock(e.getBlock()));

The schematic is not empty and it works well with the WorldEdit CuboidClipboard. Also, I'm running all of this 20 ticks after the schematic being loaded, so I'm sure everything is loaded. Also, the paste method was working right with the Schematic class. (I'm not pasting now because I don't need to)

If you need more details, ask them. I need this solved ASAP.

@boy0001
Copy link
Owner

boy0001 commented Sep 25, 2016

Want to show me the code?

@diogotcorreia
Copy link
Author

I use this method to scan the schematics folder.

Then, I listen to the event I fire there using this.

Also, I have a sub-class (GameMap) inside my SchematicManager class. I removed some methods, but that isn't related to the schematic.

@diogotcorreia
Copy link
Author

Btw, I just updated it, but now I'm getting this at startup:

08:52:21 INFO: ====== NO NMS BLOCK PLACER FOUND ======
08:52:21 INFO: FAWE couldn't find a fast block placer
08:52:21 INFO: Bukkit version: git-Spigot-db6de12-18fbb24 (MC: 1.8.8)
08:52:21 INFO: NMS label: 18
08:52:21 INFO: Fallback placer: class com.boydti.fawe.bukkit.v0.BukkitQueue_All

08:52:21 INFO: Download the version of FAWE for your platform
08:52:21 INFO: - http://ci.athion.net/job/FastAsyncWorldEdit/lastSuccessfulBuild/artifact/target

I downloaded the 1.8 version and it stopped working.

@diogotcorreia
Copy link
Author

Bump

@diogotcorreia
Copy link
Author

diogotcorreia commented Oct 1, 2016

Also, I get an error:

http://pastebin.com/4ts4RQFe

(The error happens exactly before the things I posted above.

@boy0001 boy0001 closed this as completed Apr 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants