aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/chrisoft/trashyaddon/commands/BlockDataCommand.java
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2024-09-06 23:02:34 -0400
committerGravatar Chris Xiong <chirs241097@gmail.com> 2024-09-06 23:02:34 -0400
commit263695053d997e75ec4a10f0de3ea0cb8a0de80c (patch)
treea3d331738b56e0661731511cb46297d51e6ae9cd /src/main/java/org/chrisoft/trashyaddon/commands/BlockDataCommand.java
parent04b4941e65693f8d6b55f924781d7dd7cd26b1d5 (diff)
downloadmeteor-trashy-addon-dev.tar.xz
1.21 ... maybe (still testing)HEADdev
Special thanks to Xenapte for the 1.20.6 patch.
Diffstat (limited to 'src/main/java/org/chrisoft/trashyaddon/commands/BlockDataCommand.java')
-rw-r--r--src/main/java/org/chrisoft/trashyaddon/commands/BlockDataCommand.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/main/java/org/chrisoft/trashyaddon/commands/BlockDataCommand.java b/src/main/java/org/chrisoft/trashyaddon/commands/BlockDataCommand.java
index 71915bc..11fa8a3 100644
--- a/src/main/java/org/chrisoft/trashyaddon/commands/BlockDataCommand.java
+++ b/src/main/java/org/chrisoft/trashyaddon/commands/BlockDataCommand.java
@@ -9,14 +9,16 @@ import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.RaycastContext;
import net.minecraft.command.CommandSource;
-import net.minecraft.nbt.NbtCompound;
+import net.minecraft.component.DataComponentTypes;
+import net.minecraft.component.type.NbtComponent;
import net.minecraft.text.Text;
-import net.minecraft.util.math.Box;
import net.minecraft.client.MinecraftClient;
import net.minecraft.entity.Entity;
+import net.minecraft.nbt.NbtCompound;
import net.minecraft.util.math.Vec3d;
import static com.mojang.brigadier.Command.SINGLE_SUCCESS;
+
public class BlockDataCommand extends Command {
private final MinecraftClient mc = MinecraftClient.getInstance();
public BlockDataCommand() {
@@ -28,8 +30,8 @@ public class BlockDataCommand extends Command {
builder.executes(context -> {
double RANGE = 5;
Entity player = mc.cameraEntity;
- Vec3d rot = player.getRotationVec(mc.getTickDelta());
- Vec3d min = player.getCameraPosVec(mc.getTickDelta());
+ Vec3d rot = player.getRotationVec(1.f);
+ Vec3d min = player.getCameraPosVec(1.f);
Vec3d max = min.add(rot.multiply(RANGE));
RaycastContext rc = new RaycastContext(min, max, RaycastContext.ShapeType.OUTLINE, RaycastContext.FluidHandling.NONE, player);
BlockHitResult bh = mc.world.raycast(rc);
@@ -51,7 +53,7 @@ public class BlockDataCommand extends Command {
error("block has no block entity");
return SINGLE_SUCCESS;
}
- NbtCompound bd = be.createNbt();
+ NbtCompound bd = be.createNbt(mc.world.getRegistryManager());
info(NbtHelper.toPrettyPrintedText(bd));
return SINGLE_SUCCESS;