Editor fixes

This commit is contained in:
Anuken
2020-05-04 10:57:57 -04:00
parent 90505a8e19
commit ea2adbd63b
5 changed files with 42 additions and 5 deletions

View File

@@ -491,12 +491,13 @@ public class Tile implements Position, QuadTreeObject{
//remove this tile's dangling entities
if(entity.block().isMultiblock()){
int cx = entity.tileX(), cy = entity.tileY();
int size = entity.block().size;
int offsetx = -(size - 1) / 2;
int offsety = -(size - 1) / 2;
for(int dx = 0; dx < size; dx++){
for(int dy = 0; dy < size; dy++){
Tile other = world.tile(x + dx + offsetx, y + dy + offsety);
Tile other = world.tile(cx + dx + offsetx, cy + dy + offsety);
if(other != null){
//reset entity and block *manually* - thus, preChanged() will not be called anywhere else, for multiblocks
if(other != this){ //do not remove own entity so it can be processed in changed()