|
16 | 16 | import com.sk89q.worldedit.function.pattern.RandomPattern;
|
17 | 17 | import com.sk89q.worldedit.math.BlockVector3;
|
18 | 18 | import com.sk89q.worldedit.regions.Region;
|
| 19 | +import com.sk89q.worldedit.regions.RegionIntersection; |
19 | 20 | import com.sk89q.worldedit.session.ClipboardHolder;
|
20 | 21 | import com.sk89q.worldedit.world.World;
|
21 | 22 | import me.untouchedodin0.privatemines.compat.WorldEditAdapter;
|
@@ -137,4 +138,44 @@ public List<BlockVector3> findCornerPoints(Region region, Material cornerMateria
|
137 | 138 | });
|
138 | 139 | return corners;
|
139 | 140 | }
|
| 141 | + |
| 142 | + public static Region walls(com.sk89q.worldedit.regions.CuboidRegion region) { |
| 143 | + BlockVector3 pos1 = region.getPos1(); |
| 144 | + BlockVector3 pos2 = region.getPos2(); |
| 145 | + |
| 146 | + BlockVector3 min = region.getMinimumPoint(); |
| 147 | + BlockVector3 max = region.getMaximumPoint(); |
| 148 | + |
| 149 | + return new RegionIntersection( |
| 150 | + // Project to Z-Y plane |
| 151 | + new com.sk89q.worldedit.regions.CuboidRegion(pos1.withX(min.getX()), pos2.withX(min.getX())), |
| 152 | + new com.sk89q.worldedit.regions.CuboidRegion(pos1.withX(max.getX()), pos2.withX(max.getX())), |
| 153 | + |
| 154 | + // Project to X-Y plane |
| 155 | + new com.sk89q.worldedit.regions.CuboidRegion(pos1.withZ(min.getZ()), pos2.withZ(min.getZ())), |
| 156 | + new com.sk89q.worldedit.regions.CuboidRegion(pos1.withZ(max.getZ()), pos2.withZ(max.getZ())), |
| 157 | + |
| 158 | + // Project to the X-Z plane |
| 159 | + new com.sk89q.worldedit.regions.CuboidRegion(pos1.withY(min.getY()), pos2.withY(min.getY()))); |
| 160 | + } |
| 161 | + |
| 162 | + public static Region walls(CuboidRegion region) { |
| 163 | + BlockVector3 pos1 = BlockVector3.at(region.getStart().getBlockX(), region.getStart().getBlockY(), region.getStart().getBlockZ()); |
| 164 | + BlockVector3 pos2 = BlockVector3.at(region.getEnd().getBlockX(), region.getEnd().getBlockY(), region.getEnd().getBlockZ()); |
| 165 | + |
| 166 | + BlockVector3 min = BlockVector3.at(region.getStart().getBlockX(), region.getStart().getBlockY(), region.getStart().getBlockZ()); |
| 167 | + BlockVector3 max = BlockVector3.at(region.getEnd().getBlockX(), region.getEnd().getBlockY(), region.getEnd().getBlockZ()); |
| 168 | + |
| 169 | + return new RegionIntersection( |
| 170 | + // Project to Z-Y plane |
| 171 | + new com.sk89q.worldedit.regions.CuboidRegion(pos1.withX(min.getX()), pos2.withX(min.getX())), |
| 172 | + new com.sk89q.worldedit.regions.CuboidRegion(pos1.withX(max.getX()), pos2.withX(max.getX())), |
| 173 | + |
| 174 | + // Project to X-Y plane |
| 175 | + new com.sk89q.worldedit.regions.CuboidRegion(pos1.withZ(min.getZ()), pos2.withZ(min.getZ())), |
| 176 | + new com.sk89q.worldedit.regions.CuboidRegion(pos1.withZ(max.getZ()), pos2.withZ(max.getZ())), |
| 177 | + |
| 178 | + // Project to the X-Z plane |
| 179 | + new com.sk89q.worldedit.regions.CuboidRegion(pos1.withY(min.getY()), pos2.withY(min.getY()))); |
| 180 | + } |
140 | 181 | }
|
0 commit comments