From aa7caec9355936e71ec557e55a299ba862d15bdc Mon Sep 17 00:00:00 2001 From: drcrazy Date: Thu, 12 Nov 2020 15:28:00 +0300 Subject: [PATCH] Translation for Fusion Coil tooltip --- .../blocks/generator/BlockFusionCoil.java | 37 ++++++++++--------- .../assets/techreborn/lang/en_us.json | 1 + 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/main/java/techreborn/blocks/generator/BlockFusionCoil.java b/src/main/java/techreborn/blocks/generator/BlockFusionCoil.java index 900226007..c80549a94 100644 --- a/src/main/java/techreborn/blocks/generator/BlockFusionCoil.java +++ b/src/main/java/techreborn/blocks/generator/BlockFusionCoil.java @@ -36,18 +36,19 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.sound.BlockSoundGroup; import net.minecraft.sound.SoundCategory; -import net.minecraft.text.LiteralText; import net.minecraft.text.Text; +import net.minecraft.text.TranslatableText; import net.minecraft.util.ActionResult; +import net.minecraft.util.Formatting; import net.minecraft.util.Hand; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.world.BlockView; import net.minecraft.world.World; +import org.jetbrains.annotations.Nullable; import reborncore.api.ToolManager; import techreborn.init.ModSounds; -import org.jetbrains.annotations.Nullable; import java.util.List; public class BlockFusionCoil extends Block { @@ -56,34 +57,34 @@ public class BlockFusionCoil extends Block { super(FabricBlockSettings.of(Material.METAL).strength(2f, 2f).sounds(BlockSoundGroup.METAL)); } + @SuppressWarnings("deprecation") @Override public ActionResult onUse(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, BlockHitResult hitResult) { ItemStack tool = playerIn.getStackInHand(Hand.MAIN_HAND); - if (!tool.isEmpty() && ToolManager.INSTANCE.canHandleTool(tool)) { - if (ToolManager.INSTANCE.handleTool(tool, pos, worldIn, playerIn, hitResult.getSide(), false)) { - if (playerIn.isSneaking()) { - ItemStack drop = new ItemStack(this); - dropStack(worldIn, pos, drop); - worldIn.playSound(null, playerIn.getX(), playerIn.getY(), playerIn.getZ(), ModSounds.BLOCK_DISMANTLE, - SoundCategory.BLOCKS, 0.6F, 1F); - if (!worldIn.isClient) { - worldIn.setBlockState(pos, Blocks.AIR.getDefaultState(), 2); - } - return ActionResult.SUCCESS; - } + if (tool.isEmpty()) return ActionResult.PASS; + if (!ToolManager.INSTANCE.canHandleTool(tool)) return ActionResult.PASS; + + if (ToolManager.INSTANCE.handleTool(tool, pos, worldIn, playerIn, hitResult.getSide(), false)) { + if (!playerIn.isSneaking()) return ActionResult.PASS; + ItemStack drop = new ItemStack(this); + dropStack(worldIn, pos, drop); + worldIn.playSound(null, playerIn.getX(), playerIn.getY(), playerIn.getZ(), ModSounds.BLOCK_DISMANTLE, + SoundCategory.BLOCKS, 0.6F, 1F); + if (!worldIn.isClient) { + worldIn.setBlockState(pos, Blocks.AIR.getDefaultState(), 2); } + return ActionResult.SUCCESS; } + return ActionResult.PASS; } @Environment(EnvType.CLIENT) @Override - public void appendTooltip(ItemStack stack, @Nullable BlockView worldIn, List tooltip, - TooltipContext flagIn) { + public void appendTooltip(ItemStack stack, @Nullable BlockView worldIn, List tooltip, TooltipContext flagIn) { super.appendTooltip(stack, worldIn, tooltip, flagIn); - // TODO: Translate - tooltip.add(new LiteralText("Right click Fusion Control computer to auto place")); + tooltip.add(new TranslatableText("techreborn.tooltip.fusion_coil").formatted(Formatting.BLUE)); } } \ No newline at end of file diff --git a/src/main/resources/assets/techreborn/lang/en_us.json b/src/main/resources/assets/techreborn/lang/en_us.json index ed88c3db9..e0bbe4b92 100644 --- a/src/main/resources/assets/techreborn/lang/en_us.json +++ b/src/main/resources/assets/techreborn/lang/en_us.json @@ -835,6 +835,7 @@ "techreborn.tooltip.more_info": "Hold Shift for more info", "techreborn.tooltip.stack_info": "Hold Shift for stack info", "techreborn.tooltip.omnitool_motto" : "Swiss Army Knife", + "techreborn.tooltip.fusion_coil" : "Right click Fusion Control computer to auto place", "_comment23": "ManualUI", "techreborn.manual.wiki": "Online wiki",