mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-02-16 02:20:44 +00:00
fix redstone not rotating
This commit is contained in:
@@ -28,13 +28,13 @@ import lombok.Data;
|
|||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
import org.bukkit.Axis;
|
import org.bukkit.Axis;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.data.*;
|
import org.bukkit.block.data.*;
|
||||||
|
import org.bukkit.block.data.type.RedstoneWire;
|
||||||
import org.bukkit.block.data.type.Wall;
|
import org.bukkit.block.data.type.Wall;
|
||||||
import org.bukkit.block.structure.StructureRotation;
|
|
||||||
import org.bukkit.util.BlockVector;
|
import org.bukkit.util.BlockVector;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -259,14 +259,14 @@ public class IrisObjectRotation {
|
|||||||
|
|
||||||
g.setRotation(face);
|
g.setRotation(face);
|
||||||
|
|
||||||
} else if (d instanceof Orientable) {
|
} else if (d instanceof Orientable g) {
|
||||||
BlockFace f = getFace(((Orientable) d).getAxis());
|
BlockFace f = getFace(g.getAxis());
|
||||||
BlockVector bv = new BlockVector(f.getModX(), f.getModY(), f.getModZ());
|
BlockVector bv = new BlockVector(f.getModX(), f.getModY(), f.getModZ());
|
||||||
bv = rotate(bv.clone(), spinx, spiny, spinz);
|
bv = rotate(bv.clone(), spinx, spiny, spinz);
|
||||||
Axis a = getAxis(bv);
|
Axis a = getAxis(bv);
|
||||||
|
|
||||||
if (!a.equals(((Orientable) d).getAxis()) && ((Orientable) d).getAxes().contains(a)) {
|
if (!a.equals(g.getAxis()) && g.getAxes().contains(a)) {
|
||||||
((Orientable) d).setAxis(a);
|
g.setAxis(a);
|
||||||
}
|
}
|
||||||
} else if (d instanceof MultipleFacing g) {
|
} else if (d instanceof MultipleFacing g) {
|
||||||
List<BlockFace> faces = new KList<>();
|
List<BlockFace> faces = new KList<>();
|
||||||
@@ -304,14 +304,22 @@ public class IrisObjectRotation {
|
|||||||
for (BlockFace i : WALL_FACES) {
|
for (BlockFace i : WALL_FACES) {
|
||||||
wall.setHeight(i, faces.getOrDefault(i, Wall.Height.NONE));
|
wall.setHeight(i, faces.getOrDefault(i, Wall.Height.NONE));
|
||||||
}
|
}
|
||||||
} else if (d.getMaterial().equals(Material.NETHER_PORTAL) && d instanceof Orientable g) {
|
} else if (d instanceof RedstoneWire wire) {
|
||||||
//TODO: Fucks up logs
|
Map<BlockFace, RedstoneWire.Connection> faces = new HashMap<>();
|
||||||
BlockFace f = faceForAxis(g.getAxis());
|
|
||||||
BlockVector bv = new BlockVector(f.getModX(), f.getModY(), f.getModZ());
|
var allowed = wire.getAllowedFaces();
|
||||||
bv = rotate(bv.clone(), spinx, spiny, spinz);
|
for (BlockFace i : allowed) {
|
||||||
BlockFace t = getFace(bv);
|
RedstoneWire.Connection connection = wire.getFace(i);
|
||||||
Axis a = !g.getAxes().contains(Axis.Y) ? axisFor(t) : axisFor2D(t);
|
BlockVector bv = new BlockVector(i.getModX(), i.getModY(), i.getModZ());
|
||||||
((Orientable) d).setAxis(a);
|
bv = rotate(bv.clone(), spinx, spiny, spinz);
|
||||||
|
BlockFace r = getFace(bv);
|
||||||
|
if (allowed.contains(r))
|
||||||
|
faces.put(r, connection);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (BlockFace i : allowed) {
|
||||||
|
wire.setFace(i, faces.getOrDefault(i, RedstoneWire.Connection.NONE));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Iris.reportError(e);
|
Iris.reportError(e);
|
||||||
|
|||||||
Reference in New Issue
Block a user