Skip to content

Commit

Permalink
fix: Barrier display and getBlockName
Browse files Browse the repository at this point in the history
  • Loading branch information
notdevcody committed Jul 9, 2024
1 parent 4941a14 commit ebbcec7
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class BarrierDisplayComponent extends ResizableComponent {
@Override
public void render(Vector2D mouse) {
String lookingAtBlock = WorldInteraction.getLookingAtBlock();
boolean lookingAtBarrier = lookingAtBlock != null && lookingAtBlock.equals("minecraft:barrier");
boolean lookingAtBarrier = lookingAtBlock != null && lookingAtBlock.contains("minecraft:barrier");

Color color = lookingAtBarrier ? Theme.warnText : Theme.defaultText;
if (selected) color = selectedColor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public String getBlockName(Vector3D blockPos) {

return Registries.BLOCK.getKey(
MinecraftClient.getInstance().world.getBlockState(blockpos).getBlock()
).toString();
).get().getValue().toString();
}

@Override
Expand Down Expand Up @@ -114,7 +114,7 @@ public String getLookingAtBlock() {
if (hitResult.getType() == HitResult.Type.BLOCK && MinecraftClient.getInstance().world != null) {
return Registries.BLOCK.getKey(
MinecraftClient.getInstance().world.getBlockState(((BlockHitResult) hitResult).getBlockPos()).getBlock()
).toString();
).get().getValue().toTranslationKey();
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public String getBlockName(Vector3D blockPos) {

return Registries.BLOCK.getKey(
MinecraftClient.getInstance().world.getBlockState(blockpos).getBlock()
).toString();
).get().getValue().toString();
}

@Override
Expand Down Expand Up @@ -115,7 +115,7 @@ public String getLookingAtBlock() {
if (hitResult.getType() == HitResult.Type.BLOCK && MinecraftClient.getInstance().world != null) {
return Registries.BLOCK.getKey(
MinecraftClient.getInstance().world.getBlockState(((BlockHitResult) hitResult).getBlockPos()).getBlock()
).toString();
).get().getValue().toTranslationKey();
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public String getBlockName(Vector3D blockPos) {

return Registries.BLOCK.getKey(
MinecraftClient.getInstance().world.getBlockState(blockpos).getBlock()
).toString();
).get().getValue().toString();
}

@Override
Expand Down Expand Up @@ -115,7 +115,7 @@ public String getLookingAtBlock() {
if (hitResult.getType() == HitResult.Type.BLOCK && MinecraftClient.getInstance().world != null) {
return Registries.BLOCK.getKey(
MinecraftClient.getInstance().world.getBlockState(((BlockHitResult) hitResult).getBlockPos()).getBlock()
).toString();
).get().getValue().toTranslationKey();
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public String getBlockName(Vector3D blockPos) {

return Registries.BLOCK.getKey(
MinecraftClient.getInstance().world.getBlockState(blockpos).getBlock()
).toString();
).get().getValue().toString();
}

@Override
Expand Down Expand Up @@ -115,7 +115,7 @@ public String getLookingAtBlock() {
if (hitResult.getType() == HitResult.Type.BLOCK && MinecraftClient.getInstance().world != null) {
return Registries.BLOCK.getKey(
MinecraftClient.getInstance().world.getBlockState(((BlockHitResult) hitResult).getBlockPos()).getBlock()
).toString();
).get().getValue().toTranslationKey();
}
return null;
}
Expand Down

0 comments on commit ebbcec7

Please sign in to comment.