fix flora issue

This commit is contained in:
dfsek 2021-06-24 23:48:28 -07:00
parent 9fa660409d
commit ff4cbda294
3 changed files with 4 additions and 4 deletions

View File

@ -14,7 +14,7 @@ public class Cell implements BufferedItem {
@Override @Override
public void paste(Vector3 origin, World world) { public void paste(Vector3 origin, World world) {
items.forEach(item -> item.paste(origin, world)); items.forEach(item -> item.paste(origin.clone(), world));
} }
public void add(BufferedItem item) { public void add(BufferedItem item) {

View File

@ -35,7 +35,7 @@ public class StructureBuffer implements Buffer {
@Override @Override
public Buffer addItem(BufferedItem item, Vector3 location) { public Buffer addItem(BufferedItem item, Vector3 location) {
bufferedItemMap.computeIfAbsent(location, l -> new Cell()).add(item); bufferedItemMap.computeIfAbsent(location.clone(), l -> new Cell()).add(item);
return this; return this;
} }
@ -50,7 +50,7 @@ public class StructureBuffer implements Buffer {
@Override @Override
public Buffer setMark(String mark, Vector3 location) { public Buffer setMark(String mark, Vector3 location) {
bufferedItemMap.computeIfAbsent(location, l -> new Cell()).setMark(mark); bufferedItemMap.computeIfAbsent(location.clone(), l -> new Cell()).setMark(mark);
return this; return this;
} }

View File

@ -68,7 +68,7 @@ public class TerraFlora implements Flora {
if(y > 255 || y < 0) continue; if(y > 255 || y < 0) continue;
current = current.add(0, search.equals(Search.UP) ? 1 : -1, 0); current = current.add(0, search.equals(Search.UP) ? 1 : -1, 0);
if((spawnBlacklist != spawnable.contains(chunk.getBlockData(current.getBlockX(), current.getBlockY(), current.getBlockZ()).getBlockType())) && isIrrigated(current.add(0, irrigableOffset, 0), chunk) && valid(size, current.clone(), chunk)) { if((spawnBlacklist != spawnable.contains(chunk.getBlockData(current.getBlockX(), current.getBlockY(), current.getBlockZ()).getBlockType())) && isIrrigated(current.add(0, irrigableOffset, 0), chunk) && valid(size, current.clone(), chunk)) {
blocks.add(current); blocks.add(current.clone());
if(maxPlacements > 0 && blocks.size() >= maxPlacements) break; if(maxPlacements > 0 && blocks.size() >= maxPlacements) break;
} }
} }