From 901aabf55b2e55bb7956577b2f306b000a89a231 Mon Sep 17 00:00:00 2001 From: MidnightTale Date: Tue, 11 Apr 2023 19:33:51 +0700 Subject: [PATCH] improve debug and misspell --- src/main/java/xyz/hynse/bbsdfia/Bbsdfia.java | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/main/java/xyz/hynse/bbsdfia/Bbsdfia.java b/src/main/java/xyz/hynse/bbsdfia/Bbsdfia.java index e229c26..dfbd6f0 100644 --- a/src/main/java/xyz/hynse/bbsdfia/Bbsdfia.java +++ b/src/main/java/xyz/hynse/bbsdfia/Bbsdfia.java @@ -52,17 +52,14 @@ public class Bbsdfia extends JavaPlugin implements Listener { if (movingTo != null && movingTo.getType() == Material.END_PORTAL) { // Spawn a new falling block entity in the end - Location location = new Location(Bukkit.getWorld("world_the_end"), 100, 50, 0); - System.out.println("Debug location:" + location); - System.out.println("Debug vel:" + vel); - System.out.println("Debug entity:" + entity); - System.out.println("Debug movingTo:" + movingTo); - System.out.println("Debug vel:" + vel); - System.out.println("Debug vel:" + vel); - FallingBlock fallingBlock = location.getWorld().spawnFallingBlock(location, Material.STONE.createBlockData()); - System.out.println("Debung falling:" + fallingBlock); + System.out.println("§6[DEBUG] §7Spawning new falling block at " + location); + System.out.println("§6[DEBUG] §7Original entity: " + entity); + System.out.println("§6[DEBUG] §7Moving towards: " + movingTo); + System.out.println("§6[DEBUG] §7Original velocity: " + vel); + FallingBlock fallingBlock = location.getWorld().spawnFallingBlock(location, Material.STONE.createBlockData()); + System.out.println("§6[DEBUG] §7New falling block entity: " + fallingBlock); // Copy the velocity of the original entity and invert the y component Vector dummyVel = vel.clone(); @@ -73,7 +70,7 @@ public class Bbsdfia extends JavaPlugin implements Listener { // Add a constant upward velocity to simulate gravity dummyVel.add(new Vector(0, 0.3, 0)); - System.out.println("Debung dummyVel:" + dummyVel); + System.out.println("§6[DEBUG] §7Modified velocity: " + dummyVel); // Set the velocity of the new entity to the modified velocity fallingBlock.setVelocity(dummyVel); @@ -81,6 +78,7 @@ public class Bbsdfia extends JavaPlugin implements Listener { } } + // This function returns the block that the entity is moving towards Block getBlockMovingTo(Location loc, Vector vel) { // Initialize variables to keep track of the maximum absolute velocity and its direction