fixed more orientation errors when placing from other directions
This commit is contained in:
@ -22,7 +22,7 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly "io.papermc.paper:paper-api:1.21-R0.1-SNAPSHOT"
|
||||
compileOnly "io.papermc.paper:paper-api:1.21.7-R0.1-SNAPSHOT"
|
||||
implementation "co.aikar:taskchain-bukkit:3.7.2"
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ processResources {
|
||||
}
|
||||
|
||||
tasks.register('copyJarToTestServer', Exec) {
|
||||
commandLine 'cp', 'build/libs/PixelBlocks-1.0-SNAPSHOT-all.jar', '/home/elias/Dokumente/mcTestServer/plugins/pixelblocks.jar'
|
||||
commandLine 'cp', 'build/libs/PixelBlocks-1.0-SNAPSHOT-all.jar', '/home/lars/Documents/Minecraft/Server/pixelblocks/plugins/PixelBlocks-1.0-SNAPSHOT-all.jar'
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package eu.mhsl.minecraft.pixelblocks.pixelblock;
|
||||
|
||||
import eu.mhsl.minecraft.pixelblocks.Main;
|
||||
import eu.mhsl.minecraft.pixelblocks.utils.Direction;
|
||||
import eu.mhsl.minecraft.pixelblocks.utils.ListUtil;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.NamespacedKey;
|
||||
@ -76,6 +77,15 @@ public class Pixels {
|
||||
}
|
||||
|
||||
private void setEntityRotation(Entity entity, @Nullable Directional direction) {
|
||||
Direction blockDirection = parentBlock.getFacingDirection();
|
||||
float angle = switch (blockDirection) {
|
||||
case Direction.north -> 180;
|
||||
case Direction.south -> 0;
|
||||
case Direction.west -> 90;
|
||||
case Direction.east -> -90;
|
||||
};
|
||||
entity.setRotation(entity.getYaw()+angle, entity.getPitch());
|
||||
|
||||
if(!(direction instanceof EnderChest || direction instanceof Chest)) return;
|
||||
BlockFace blockFace = direction.getFacing();
|
||||
float yaw = switch (blockFace) {
|
||||
@ -91,6 +101,6 @@ public class Pixels {
|
||||
case DOWN -> -90;
|
||||
default -> 0;
|
||||
};
|
||||
entity.setRotation(yaw, pitch);
|
||||
entity.setRotation(entity.getYaw()+yaw, entity.getPitch()+pitch);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user