Blood Magic

Blood Magic

90M Downloads

[World Corruption] Need some way to blacklist tiles from the Teleposer

ReikaKalseki opened this issue ยท 4 comments

commented

I need a way to blacklist TileEntities from the Teleposer, because some of them will corrupt the world when moved, most dangerously with ChromatiCraft pylons (which actually corrupt the data files when moved due to the design of the network that caches everything), but also with anything with network logic (ElectriCraft comes to mind) and with a number of RC tiles (or anything else that caches position-sensitive data).

Until I have some way to do this, I am going to make it impossible to even try - my leading idea is to add "if teleposer block placed adjacent, or if placed adjacent to a teleposer, pop off as an item/set block to air" - but that carries drama potential and I would much rather have a proper fix.

I also strongly suspect many other developers would appreciate this as well.

The best way to do this would be to have some list of classes which can be added to with an API hook and check if list.contains(te.getClass()) here.
https://github.com/WayofTime/BloodMagic/blob/master/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockTeleposer.java#L189

commented

I think what the best method will be is to create a teleposer event that caches the positions, worlds, blocks, meta, and tiles, as well as the object of the caller (who called the swapping function). In theory, it should allow you to cancel the event if one of your blocks is present, or you could be sneaky and update the position of the tile.

I assume when you are talking about your RC tiles that you are dealing with blocks that are not the tile? If that's the case, what about dealing with offset values? It's probably something else, however... :3

I'm a little swamped in school work, so it may take a few days to implement. I'll have it in the next release, however, with the added files in the API.

commented

You are right, a cancelable event works even better, as it allows both blacklisting for tiles that absolutely cannot be teleposed and cleanup/repair for tiles that can mostly be teleposed safely. The pylons fall in the former group, but I can imagine definite use for the latter.

Also, I can PR the code if you like.

commented

I just made a PR to save you time. :)

commented

Thanks~