mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-01 23:47:21 +00:00
fix walls not being rotated
This commit is contained in:
parent
be3e8ebd51
commit
29007fdbfa
@ -22,6 +22,7 @@ import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.engine.object.annotations.Desc;
|
||||
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.collection.KMap;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@ -30,9 +31,12 @@ import org.bukkit.Axis;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.data.*;
|
||||
import org.bukkit.block.data.type.Wall;
|
||||
import org.bukkit.block.structure.StructureRotation;
|
||||
import org.bukkit.util.BlockVector;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Snippet("object-rotator")
|
||||
@Accessors(chain = true)
|
||||
@ -41,6 +45,8 @@ import java.util.List;
|
||||
@Desc("Configures rotation for iris")
|
||||
@Data
|
||||
public class IrisObjectRotation {
|
||||
private static final List<BlockFace> WALL_FACES = List.of(BlockFace.NORTH, BlockFace.SOUTH, BlockFace.EAST, BlockFace.WEST);
|
||||
|
||||
@Desc("If this rotator is enabled or not")
|
||||
private boolean enabled = true;
|
||||
|
||||
@ -282,6 +288,22 @@ public class IrisObjectRotation {
|
||||
for (BlockFace i : faces) {
|
||||
g.setFace(i, true);
|
||||
}
|
||||
} else if (d instanceof Wall wall) {
|
||||
KMap<BlockFace, Wall.Height> faces = new KMap<>();
|
||||
|
||||
for (BlockFace i : WALL_FACES) {
|
||||
Wall.Height h = wall.getHeight(i);
|
||||
BlockVector bv = new BlockVector(i.getModX(), i.getModY(), i.getModZ());
|
||||
bv = rotate(bv.clone(), spinx, spiny, spinz);
|
||||
BlockFace r = getFace(bv);
|
||||
if (WALL_FACES.contains(r)) {
|
||||
faces.put(r, h);
|
||||
}
|
||||
}
|
||||
|
||||
for (BlockFace i : WALL_FACES) {
|
||||
wall.setHeight(i, faces.getOrDefault(i, Wall.Height.NONE));
|
||||
}
|
||||
} else if (d.getMaterial().equals(Material.NETHER_PORTAL) && d instanceof Orientable g) {
|
||||
//TODO: Fucks up logs
|
||||
BlockFace f = faceForAxis(g.getAxis());
|
||||
|
Loading…
x
Reference in New Issue
Block a user