mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 07:06:44 +01:00
Fix rotation (#2200)
* Fix rotation * Clean up some events and utility classes. Try to use as general type declarations as possible. Add configurable override for the unsafe block checker. * Treat tridents as a projectile * Fix rotation and merged with current breaking branch
This commit is contained in:
parent
f25581c3f1
commit
6292bff7c9
@ -27,7 +27,7 @@ import java.util.HashMap;
|
|||||||
|
|
||||||
public class HybridPlotWorld extends ClassicPlotWorld {
|
public class HybridPlotWorld extends ClassicPlotWorld {
|
||||||
|
|
||||||
private static AffineTransform transform = new AffineTransform().rotateY(-90);
|
private static AffineTransform transform = new AffineTransform().rotateY(90);
|
||||||
public boolean ROAD_SCHEMATIC_ENABLED;
|
public boolean ROAD_SCHEMATIC_ENABLED;
|
||||||
public boolean PLOT_SCHEMATIC = false;
|
public boolean PLOT_SCHEMATIC = false;
|
||||||
public short PATH_WIDTH_LOWER;
|
public short PATH_WIDTH_LOWER;
|
||||||
@ -36,7 +36,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|||||||
private Location SIGN_LOCATION;
|
private Location SIGN_LOCATION;
|
||||||
|
|
||||||
public HybridPlotWorld(String worldName, String id, IndependentPlotGenerator generator,
|
public HybridPlotWorld(String worldName, String id, IndependentPlotGenerator generator,
|
||||||
PlotId min, PlotId max) {
|
PlotId min, PlotId max) {
|
||||||
super(worldName, id, generator, min, max);
|
super(worldName, id, generator, min, max);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,10 +69,10 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|||||||
|
|
||||||
if (direction != null) {
|
if (direction != null) {
|
||||||
Vector3 vector = transform.apply(direction.toVector())
|
Vector3 vector = transform.apply(direction.toVector())
|
||||||
.subtract(transform.apply(Vector3.ZERO)).normalize();
|
.subtract(transform.apply(Vector3.ZERO)).normalize();
|
||||||
Direction newDirection = Direction.findClosest(vector,
|
Direction newDirection = Direction.findClosest(vector,
|
||||||
Direction.Flag.CARDINAL | Direction.Flag.ORDINAL
|
Direction.Flag.CARDINAL | Direction.Flag.ORDINAL
|
||||||
| Direction.Flag.SECONDARY_ORDINAL);
|
| Direction.Flag.SECONDARY_ORDINAL);
|
||||||
|
|
||||||
if (newDirection != null) {
|
if (newDirection != null) {
|
||||||
CompoundTagBuilder builder = tag.createBuilder();
|
CompoundTagBuilder builder = tag.createBuilder();
|
||||||
@ -96,7 +96,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|||||||
} else {
|
} else {
|
||||||
bot.setY(0);
|
bot.setY(0);
|
||||||
Location loc =
|
Location loc =
|
||||||
bot.add(SIGN_LOCATION.getX(), SIGN_LOCATION.getY(), SIGN_LOCATION.getZ());
|
bot.add(SIGN_LOCATION.getX(), SIGN_LOCATION.getY(), SIGN_LOCATION.getZ());
|
||||||
return loc;
|
return loc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -134,11 +134,11 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|||||||
public void setupSchematics() throws SchematicHandler.UnsupportedFormatException {
|
public void setupSchematics() throws SchematicHandler.UnsupportedFormatException {
|
||||||
this.G_SCH = new HashMap<>();
|
this.G_SCH = new HashMap<>();
|
||||||
File schematic1File = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(),
|
File schematic1File = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(),
|
||||||
"schematics/GEN_ROAD_SCHEMATIC/" + this.worldname + "/sideroad.schematic");
|
"schematics/GEN_ROAD_SCHEMATIC/" + this.worldname + "/sideroad.schematic");
|
||||||
File schematic2File = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(),
|
File schematic2File = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(),
|
||||||
"schematics/GEN_ROAD_SCHEMATIC/" + this.worldname + "/intersection.schematic");
|
"schematics/GEN_ROAD_SCHEMATIC/" + this.worldname + "/intersection.schematic");
|
||||||
File schem3File = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(),
|
File schem3File = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(),
|
||||||
"schematics/GEN_ROAD_SCHEMATIC/" + this.worldname + "/plot.schematic");
|
"schematics/GEN_ROAD_SCHEMATIC/" + this.worldname + "/plot.schematic");
|
||||||
Schematic schematic1 = SchematicHandler.manager.getSchematic(schematic1File);
|
Schematic schematic1 = SchematicHandler.manager.getSchematic(schematic1File);
|
||||||
Schematic schematic2 = SchematicHandler.manager.getSchematic(schematic2File);
|
Schematic schematic2 = SchematicHandler.manager.getSchematic(schematic2File);
|
||||||
Schematic schematic3 = SchematicHandler.manager.getSchematic(schem3File);
|
Schematic schematic3 = SchematicHandler.manager.getSchematic(schem3File);
|
||||||
@ -177,8 +177,8 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|||||||
BaseBlock id = blockArrayClipboard3.getFullBlock(BlockVector3.at(x, y, z));
|
BaseBlock id = blockArrayClipboard3.getFullBlock(BlockVector3.at(x, y, z));
|
||||||
if (!id.getBlockType().getMaterial().isAir()) {
|
if (!id.getBlockType().getMaterial().isAir()) {
|
||||||
addOverlayBlock((short) (x + shift + oddshift + centerShiftX),
|
addOverlayBlock((short) (x + shift + oddshift + centerShiftX),
|
||||||
(short) (y + startY), (short) (z + shift + oddshift + centerShiftZ),
|
(short) (y + startY), (short) (z + shift + oddshift + centerShiftZ),
|
||||||
id, false, h3);
|
id, false, h3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -241,9 +241,9 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|||||||
BaseBlock id = blockArrayClipboard1.getFullBlock(BlockVector3.at(x, y, z));
|
BaseBlock id = blockArrayClipboard1.getFullBlock(BlockVector3.at(x, y, z));
|
||||||
if (!id.getBlockType().getMaterial().isAir()) {
|
if (!id.getBlockType().getMaterial().isAir()) {
|
||||||
addOverlayBlock((short) (x - shift), (short) (y + startY),
|
addOverlayBlock((short) (x - shift), (short) (y + startY),
|
||||||
(short) (z + shift + oddshift), id, false, h1);
|
(short) (z + shift + oddshift), id, false, h1);
|
||||||
addOverlayBlock((short) (z + shift + oddshift), (short) (y + startY),
|
addOverlayBlock((short) (z + shift + oddshift), (short) (y + startY),
|
||||||
(short) (shift - x), id, true, h1);
|
(short) (shift - x), id, true, h1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -254,7 +254,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|||||||
BaseBlock id = blockArrayClipboard2.getFullBlock(BlockVector3.at(x, y, z));
|
BaseBlock id = blockArrayClipboard2.getFullBlock(BlockVector3.at(x, y, z));
|
||||||
if (!id.getBlockType().getMaterial().isAir()) {
|
if (!id.getBlockType().getMaterial().isAir()) {
|
||||||
addOverlayBlock((short) (x - shift), (short) (y + startY),
|
addOverlayBlock((short) (x - shift), (short) (y + startY),
|
||||||
(short) (z - shift), id, false, h2);
|
(short) (z - shift), id, false, h2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -262,7 +262,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addOverlayBlock(short x, short y, short z, BaseBlock id, boolean rotate,
|
public void addOverlayBlock(short x, short y, short z, BaseBlock id, boolean rotate,
|
||||||
int height) {
|
int height) {
|
||||||
if (z < 0) {
|
if (z < 0) {
|
||||||
z += this.SIZE;
|
z += this.SIZE;
|
||||||
} else if (z >= this.SIZE) {
|
} else if (z >= this.SIZE) {
|
||||||
|
Loading…
Reference in New Issue
Block a user