From 85f9f5534a05bdaace9962c7ac6e38d2312de27d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Vo=C3=9F?= Date: Wed, 20 Jan 2021 23:25:17 +0100 Subject: [PATCH] Add a description to the Reflectors #8 --- .../cech12/solarcooker/block/ReflectorBlock.java | 13 +++++++++++++ .../resources/assets/solarcooker/lang/de_de.json | 4 +++- .../resources/assets/solarcooker/lang/en_us.json | 4 +++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/main/java/cech12/solarcooker/block/ReflectorBlock.java b/src/main/java/cech12/solarcooker/block/ReflectorBlock.java index ad3010b..1fa8be4 100644 --- a/src/main/java/cech12/solarcooker/block/ReflectorBlock.java +++ b/src/main/java/cech12/solarcooker/block/ReflectorBlock.java @@ -3,16 +3,23 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.HorizontalBlock; +import net.minecraft.client.util.ITooltipFlag; import net.minecraft.item.BlockItemUseContext; +import net.minecraft.item.ItemStack; import net.minecraft.state.StateContainer; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.TranslationTextComponent; import net.minecraft.world.IBlockReader; import net.minecraftforge.common.ToolType; import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.util.List; public class ReflectorBlock extends HorizontalBlock { @@ -30,6 +37,12 @@ public boolean isToolEffective(BlockState state, ToolType tool) { return tool == ToolType.AXE; } + @Override + public void addInformation(@Nonnull ItemStack stack, @Nullable IBlockReader worldIn, @Nonnull List tooltip, @Nonnull ITooltipFlag flagIn) { + super.addInformation(stack, worldIn, tooltip, flagIn); + tooltip.add(new TranslationTextComponent("item.solarcooker.reflector.description").func_240701_a_(TextFormatting.BLUE)); + } + @Override @Nonnull public VoxelShape getShape(@Nonnull BlockState state, @Nonnull IBlockReader worldIn, @Nonnull BlockPos pos, @Nonnull ISelectionContext context) { diff --git a/src/main/resources/assets/solarcooker/lang/de_de.json b/src/main/resources/assets/solarcooker/lang/de_de.json index d7d0e09..dd1afe3 100644 --- a/src/main/resources/assets/solarcooker/lang/de_de.json +++ b/src/main/resources/assets/solarcooker/lang/de_de.json @@ -1,4 +1,6 @@ { "block.solarcooker.solar_cooker": "Solarkocher", - "block.solarcooker.reflector": "Reflektor" + "block.solarcooker.reflector": "Reflektor", + + "item.solarcooker.reflector.description": "Links und rechts neben einem Solarkocher können bis zu vier Reflektoren platziert werden, um den Lichteinfall zu verbessern und die Kochzeit zu reduzieren." } \ No newline at end of file diff --git a/src/main/resources/assets/solarcooker/lang/en_us.json b/src/main/resources/assets/solarcooker/lang/en_us.json index 56c9206..eced7ea 100644 --- a/src/main/resources/assets/solarcooker/lang/en_us.json +++ b/src/main/resources/assets/solarcooker/lang/en_us.json @@ -1,4 +1,6 @@ { "block.solarcooker.solar_cooker": "Solar Cooker", - "block.solarcooker.reflector": "Reflector" + "block.solarcooker.reflector": "Reflector", + + "item.solarcooker.reflector.description": "Up to four Reflectors can be placed to the left and right side of a Solar Cooker to improve the incidence of light and reduce cooking time." } \ No newline at end of file