Translation for Fusion Coil tooltip

This commit is contained in:
drcrazy 2020-11-12 15:28:00 +03:00
parent 6f21bc9fd5
commit aa7caec935
2 changed files with 20 additions and 18 deletions

View file

@ -36,18 +36,19 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.sound.BlockSoundGroup; import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.sound.SoundCategory; import net.minecraft.sound.SoundCategory;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.Formatting;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
import net.minecraft.world.World; import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;
import reborncore.api.ToolManager; import reborncore.api.ToolManager;
import techreborn.init.ModSounds; import techreborn.init.ModSounds;
import org.jetbrains.annotations.Nullable;
import java.util.List; import java.util.List;
public class BlockFusionCoil extends Block { 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)); super(FabricBlockSettings.of(Material.METAL).strength(2f, 2f).sounds(BlockSoundGroup.METAL));
} }
@SuppressWarnings("deprecation")
@Override @Override
public ActionResult onUse(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, public ActionResult onUse(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn,
Hand hand, BlockHitResult hitResult) { Hand hand, BlockHitResult hitResult) {
ItemStack tool = playerIn.getStackInHand(Hand.MAIN_HAND); ItemStack tool = playerIn.getStackInHand(Hand.MAIN_HAND);
if (!tool.isEmpty() && ToolManager.INSTANCE.canHandleTool(tool)) { if (tool.isEmpty()) return ActionResult.PASS;
if (ToolManager.INSTANCE.handleTool(tool, pos, worldIn, playerIn, hitResult.getSide(), false)) { if (!ToolManager.INSTANCE.canHandleTool(tool)) return ActionResult.PASS;
if (playerIn.isSneaking()) {
ItemStack drop = new ItemStack(this); if (ToolManager.INSTANCE.handleTool(tool, pos, worldIn, playerIn, hitResult.getSide(), false)) {
dropStack(worldIn, pos, drop); if (!playerIn.isSneaking()) return ActionResult.PASS;
worldIn.playSound(null, playerIn.getX(), playerIn.getY(), playerIn.getZ(), ModSounds.BLOCK_DISMANTLE, ItemStack drop = new ItemStack(this);
SoundCategory.BLOCKS, 0.6F, 1F); dropStack(worldIn, pos, drop);
if (!worldIn.isClient) { worldIn.playSound(null, playerIn.getX(), playerIn.getY(), playerIn.getZ(), ModSounds.BLOCK_DISMANTLE,
worldIn.setBlockState(pos, Blocks.AIR.getDefaultState(), 2); SoundCategory.BLOCKS, 0.6F, 1F);
} if (!worldIn.isClient) {
return ActionResult.SUCCESS; worldIn.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
}
} }
return ActionResult.SUCCESS;
} }
return ActionResult.PASS; return ActionResult.PASS;
} }
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
@Override @Override
public void appendTooltip(ItemStack stack, @Nullable BlockView worldIn, List<Text> tooltip, public void appendTooltip(ItemStack stack, @Nullable BlockView worldIn, List<Text> tooltip, TooltipContext flagIn) {
TooltipContext flagIn) {
super.appendTooltip(stack, worldIn, tooltip, flagIn); super.appendTooltip(stack, worldIn, tooltip, flagIn);
// TODO: Translate tooltip.add(new TranslatableText("techreborn.tooltip.fusion_coil").formatted(Formatting.BLUE));
tooltip.add(new LiteralText("Right click Fusion Control computer to auto place"));
} }
} }

View file

@ -835,6 +835,7 @@
"techreborn.tooltip.more_info": "Hold Shift for more info", "techreborn.tooltip.more_info": "Hold Shift for more info",
"techreborn.tooltip.stack_info": "Hold Shift for stack info", "techreborn.tooltip.stack_info": "Hold Shift for stack info",
"techreborn.tooltip.omnitool_motto" : "Swiss Army Knife", "techreborn.tooltip.omnitool_motto" : "Swiss Army Knife",
"techreborn.tooltip.fusion_coil" : "Right click Fusion Control computer to auto place",
"_comment23": "ManualUI", "_comment23": "ManualUI",
"techreborn.manual.wiki": "Online wiki", "techreborn.manual.wiki": "Online wiki",