Skip to content

Commit

Permalink
Fixed missing blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
mosemister committed Jan 28, 2024
1 parent 0fbdfac commit a7d051d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,17 @@ public CompletableFuture<PositionableShipsStructure> fillAir() {
.setDelay(0)
.setDelayUnit(TimeUnit.MINECRAFT_TICKS)
.setRunner((s) -> future.complete(this))
.build(ShipsPlugin.getPlugin())
.buildDelayed(ShipsPlugin.getPlugin())
.run();
}))
.build(ShipsPlugin.getPlugin())
.buildDelayed(ShipsPlugin.getPlugin())
.run();
return future;
}

@Override
public Collection<Vector3<Integer>> getOutsidePositionsRelativeToCenter() {
Collection<Vector3<Integer>> vectors = new HashSet<>(this.getOriginalRelativePositionsToCenter());
Collection<Vector3<Integer>> vectors = new HashSet<>(this.getOriginalRelativeVectorsToCenter());
if (vectors.stream().noneMatch(v -> v.equals(Vector3.valueOf(0, 0, 0)))) {
vectors.add(Vector3.valueOf(0, 0, 0));
}
Expand Down Expand Up @@ -172,7 +172,16 @@ public Bounds<Integer> getBounds() {
}

@Override
public Collection<Vector3<Integer>> getOriginalRelativePositionsToCenter() {
public Collection<Vector3<Integer>> getOriginalRelativeVectorsToWorld() {
return this
.getOriginalRelativeVectorsToCenter()
.parallelStream()
.map(vector -> this.position.getPosition().plus(vector))
.collect(Collectors.toList());
}

@Override
public Collection<Vector3<Integer>> getOriginalRelativeVectorsToCenter() {
return this.vectors;
}

Expand Down Expand Up @@ -261,7 +270,8 @@ public boolean removePositionRelativeToCenter(@NotNull Vector3<Integer> remove)

@Override
public void copyFrom(@NotNull PositionableShipsStructure structure) {
if (structure instanceof AbstractPositionableShipsStructure && this.isEmpty()) {
if (structure instanceof AbstractPositionableShipsStructure && this.isEmpty() && this.position.equals(
structure.getPosition())) {
AbstractPositionableShipsStructure abstractStructure = (AbstractPositionableShipsStructure) structure;
this.cachedBounds = abstractStructure.cachedBounds;
this.vectors.addAll(abstractStructure.vectors);
Expand All @@ -271,7 +281,7 @@ public void copyFrom(@NotNull PositionableShipsStructure structure) {
this.outsideWest.addAll(abstractStructure.outsideWest);
return;
}
structure.getRelativePositionsToCenter().parallelStream().forEach(this::addPositionRelativeToCenter);
structure.getOriginalRelativeVectorsToWorld().parallelStream().forEach(this::addPositionRelativeToWorld);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,14 @@ default Collection<Vector3<Integer>> getRelativePositions() {
return this.getRelativePositionsToCenter();
}

Collection<Vector3<Integer>> getOriginalRelativePositionsToCenter();
@Deprecated(forRemoval = true)
default Collection<Vector3<Integer>> getOriginalRelativePositionsToCenter() {
return getOriginalRelativeVectorsToCenter();
}

Collection<Vector3<Integer>> getOriginalRelativeVectorsToWorld();

Collection<Vector3<Integer>> getOriginalRelativeVectorsToCenter();

@Deprecated(forRemoval = true)
default Collection<Vector3<Integer>> getOriginalRelativePositions() {
Expand Down

0 comments on commit a7d051d

Please sign in to comment.