Skip to content

Commit

Permalink
🐛 smh more bug fixes with the 0 0 0 thing
Browse files Browse the repository at this point in the history
  • Loading branch information
fantomitechno committed Jan 3, 2024
1 parent 5da3b22 commit c0d27e6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G
org.gradle.parallel = true

# Mod Properties
version = 0.1.4
version = 0.1.5
# Notes: when debugging, use rc's, so it would become: 0.X.X-rc.X
maven_group = dev.renoux
archives_base_name = enderrelay
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,19 @@ public InteractionResult use(BlockState state, Level world, BlockPos pos, Player
if (name.equals(Items.COMPASS.getName(itemStack))) {
name = Component.literal(compassPos.getX() + "/" + compassPos.getY() + "/" + compassPos.getZ());
}

if (name.equals(Component.literal("null"))) {
player.sendSystemMessage(Component.translatable("block.enderrelay.not_this_name_please"));
return InteractionResult.CONSUME;
}
player.sendSystemMessage(Component.translatable("block.enderrelay.set_teleport", name));
blentity.load(compassPos, name);
blentity.setChanged();
} else {
ServerPlayer serverPlayer = (ServerPlayer) player;
EnderRelayBlockEntity blentity = (EnderRelayBlockEntity) world.getBlockEntity(pos);
if (serverPlayer.isCrouching()) {
if (blentity.getName() != null)
if (blentity.getName().equals(Component.literal("null")))
serverPlayer.displayClientMessage(Component.translatable("block.enderrelay.teleport_to", blentity.getName()), true);
else
serverPlayer.displayClientMessage(Component.translatable("block.enderrelay.nowhere"), true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public EnderRelayBlockEntity(BlockPos blockPos, BlockState blockState) {
@Override
protected void saveAdditional(CompoundTag compoundTag) {
super.saveAdditional(compoundTag);
if (!this.teleportPlace.equals(new BlockPos(0, 0, 0))) {
if (!this.name.equals(Component.literal("null"))) {
compoundTag.put("teleportPlace", NbtUtils.writeBlockPos(this.teleportPlace));
compoundTag.putString("name", Component.Serializer.toJson(this.name));
}
Expand All @@ -98,7 +98,7 @@ public void load(BlockPos pos, Component name) {
}

public static void teleportPlayer(Level world, BlockPos pos, BlockState state, ServerPlayer player, EnderRelayBlockEntity blockEntity) {
if (blockEntity.teleportPlace.equals(new BlockPos(0, 0, 0))) {
if (blockEntity.name.equals(Component.literal("null"))) {
player.displayClientMessage(Component.translatable("block.enderrelay.nowhere"), true);
return;
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/assets/enderrelay/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"block.enderrelay.obstructed": "Your lodestone is obstructed or destroyed",
"block.enderrelay.nowhere": "This Ender Relay is leading nowhere",
"block.enderrelay.teleport_to": "This Ender Relay is teleporting you to %s",
"item.minecraft.lodestone_compass.nowhere": "This Lodestone Compass is leading nowhere"
"item.minecraft.lodestone_compass.nowhere": "This Lodestone Compass is leading nowhere",
"block.enderrelay.not_this_name_please": "A compass named \"null\" can broke the mod, please don't use that :/"
}

0 comments on commit c0d27e6

Please sign in to comment.