From 36dd0535c35cf6723d815a54aed9c639579c6bba Mon Sep 17 00:00:00 2001 From: lars Date: Mon, 14 Jul 2025 16:02:37 +0200 Subject: [PATCH] fixed more orientation errors when placing from other directions --- build.gradle | 4 ++-- .../minecraft/pixelblocks/pixelblock/Pixels.java | 12 +++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index beb9a10..92b2f49 100644 --- a/build.gradle +++ b/build.gradle @@ -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 { diff --git a/src/main/java/eu/mhsl/minecraft/pixelblocks/pixelblock/Pixels.java b/src/main/java/eu/mhsl/minecraft/pixelblocks/pixelblock/Pixels.java index 3499cb8..57cff2e 100644 --- a/src/main/java/eu/mhsl/minecraft/pixelblocks/pixelblock/Pixels.java +++ b/src/main/java/eu/mhsl/minecraft/pixelblocks/pixelblock/Pixels.java @@ -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); } }