From 4a6ccd05bb99586f7601868f12cfd9b443859c26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=90=E6=82=A6=E8=A7=A3=E8=AF=B4?= Date: Wed, 25 Sep 2024 22:07:46 +0800 Subject: [PATCH] In-game description --- .../ziyue/tjmetro/mod/block/BlockPlayerDetector.java | 6 ++++++ .../tjmetro/mod/block/BlockRailwaySignTianjinBMT.java | 9 +++++++++ .../java/ziyue/tjmetro/mod/block/BlockRoadblockSign.java | 9 +++++++++ .../mod/block/BlockStationNameEntranceTianjin.java | 8 ++++++++ .../ziyue/tjmetro/mod/block/BlockStationNamePlate.java | 3 +++ .../ziyue/tjmetro/mod/item/ItemPSDAPGTianjinBase.java | 4 ++++ fabric/src/main/resources/assets/tjmetro/lang/en_us.json | 8 +++++++- 7 files changed, 46 insertions(+), 1 deletion(-) diff --git a/fabric/src/main/java/ziyue/tjmetro/mod/block/BlockPlayerDetector.java b/fabric/src/main/java/ziyue/tjmetro/mod/block/BlockPlayerDetector.java index 8fe6816..737bfcd 100644 --- a/fabric/src/main/java/ziyue/tjmetro/mod/block/BlockPlayerDetector.java +++ b/fabric/src/main/java/ziyue/tjmetro/mod/block/BlockPlayerDetector.java @@ -5,6 +5,7 @@ import org.mtr.mapping.tool.HolderBase; import org.mtr.mod.block.IBlock; import ziyue.tjmetro.mod.BlockEntityTypes; +import ziyue.tjmetro.mod.data.IGuiExtension; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -71,6 +72,11 @@ public boolean emitsRedstonePower2(BlockState state) { return true; } + @Override + public void addTooltips(ItemStack stack, @Nullable BlockView world, List tooltip, TooltipContext options) { + IGuiExtension.addHoldShiftTooltip(tooltip, TextHelper.translatable("tooltip.tjmetro.player_detector")); + } + @Override public BlockEntityExtension createBlockEntity(BlockPos blockPos, BlockState blockState) { return new BlockEntity(blockPos, blockState); diff --git a/fabric/src/main/java/ziyue/tjmetro/mod/block/BlockRailwaySignTianjinBMT.java b/fabric/src/main/java/ziyue/tjmetro/mod/block/BlockRailwaySignTianjinBMT.java index 8d08fd8..abfd2f5 100644 --- a/fabric/src/main/java/ziyue/tjmetro/mod/block/BlockRailwaySignTianjinBMT.java +++ b/fabric/src/main/java/ziyue/tjmetro/mod/block/BlockRailwaySignTianjinBMT.java @@ -3,14 +3,17 @@ import org.mtr.mapping.holder.*; import org.mtr.mapping.mapper.BlockEntityExtension; import org.mtr.mapping.mapper.BlockHelper; +import org.mtr.mapping.mapper.TextHelper; import org.mtr.mod.block.IBlock; import ziyue.tjmetro.mod.BlockEntityTypes; import ziyue.tjmetro.mod.BlockList; import ziyue.tjmetro.mod.block.base.BlockRailwaySignBase; import ziyue.tjmetro.mod.block.base.IRailwaySign; +import ziyue.tjmetro.mod.data.IGuiExtension; import javax.annotation.Nonnull; import javax.annotation.Nullable; +import java.util.List; /** * @author ZiYueCommentary @@ -48,6 +51,12 @@ public String getTranslationKey2() { return "block.tjmetro.railway_sign_tianjin_bmt"; } + @Override + public void addTooltips(ItemStack stack, @Nullable BlockView world, List tooltip, TooltipContext options) { + super.addTooltips(stack, world, tooltip, options); + IGuiExtension.addHoldShiftTooltip(tooltip, TextHelper.translatable("tooltip.tjmetro.railway_sign_bmt")); + } + @Override protected BlockPos findEndWithDirection(World world, BlockPos startPos, Direction direction, boolean allowOpposite) { return IRailwaySign.findEndWithDirection(world, startPos, direction, allowOpposite, BlockList.RAILWAY_SIGN_TIANJIN_BMT_MIDDLE.get()); diff --git a/fabric/src/main/java/ziyue/tjmetro/mod/block/BlockRoadblockSign.java b/fabric/src/main/java/ziyue/tjmetro/mod/block/BlockRoadblockSign.java index 7ef0fed..97803d8 100644 --- a/fabric/src/main/java/ziyue/tjmetro/mod/block/BlockRoadblockSign.java +++ b/fabric/src/main/java/ziyue/tjmetro/mod/block/BlockRoadblockSign.java @@ -3,14 +3,18 @@ import org.mtr.mapping.holder.*; import org.mtr.mapping.mapper.BlockEntityExtension; import org.mtr.mapping.mapper.BlockWithEntity; +import org.mtr.mapping.mapper.TextHelper; import org.mtr.mod.block.IBlock; import ziyue.tjmetro.mod.BlockEntityTypes; import ziyue.tjmetro.mod.Registry; import ziyue.tjmetro.mod.TianjinMetro; import ziyue.tjmetro.mod.block.base.BlockEntityRenderable; +import ziyue.tjmetro.mod.data.IGuiExtension; import ziyue.tjmetro.mod.packet.PacketOpenBlockEntityScreen; import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.util.List; /** * Roadblock with signs. @@ -29,6 +33,11 @@ public ActionResult onUse2(BlockState state, World world, BlockPos pos, PlayerEn return IBlockExtension.checkHoldingBrushOrWrench(world, player, () -> Registry.sendPacketToClient(ServerPlayerEntity.cast(player), new PacketOpenBlockEntityScreen(pos))); } + @Override + public void addTooltips(ItemStack stack, @Nullable BlockView world, List tooltip, TooltipContext options) { + IGuiExtension.addHoldShiftTooltip(tooltip, TextHelper.translatable("tooltip.tjmetro.roadblock_sign")); + } + @Override public BlockEntityExtension createBlockEntity(BlockPos blockPos, BlockState blockState) { return new BlockEntity(blockPos, blockState); diff --git a/fabric/src/main/java/ziyue/tjmetro/mod/block/BlockStationNameEntranceTianjin.java b/fabric/src/main/java/ziyue/tjmetro/mod/block/BlockStationNameEntranceTianjin.java index 106691c..a5881ed 100644 --- a/fabric/src/main/java/ziyue/tjmetro/mod/block/BlockStationNameEntranceTianjin.java +++ b/fabric/src/main/java/ziyue/tjmetro/mod/block/BlockStationNameEntranceTianjin.java @@ -3,6 +3,7 @@ import org.mtr.mapping.holder.*; import org.mtr.mapping.mapper.BlockEntityExtension; import org.mtr.mapping.mapper.BlockHelper; +import org.mtr.mapping.mapper.TextHelper; import org.mtr.mapping.tool.HolderBase; import org.mtr.mod.Items; import org.mtr.mod.block.BlockStationNameBase; @@ -11,9 +12,11 @@ import ziyue.tjmetro.mod.ItemList; import ziyue.tjmetro.mod.Registry; import ziyue.tjmetro.mod.block.base.BlockEntityRenderable; +import ziyue.tjmetro.mod.data.IGuiExtension; import ziyue.tjmetro.mod.packet.PacketOpenBlockEntityScreen; import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.List; import java.util.function.Consumer; @@ -82,6 +85,11 @@ public VoxelShape getOutlineShape2(BlockState state, BlockView world, BlockPos p return IBlock.getVoxelShapeByDirection(0, tall ? 0 : 4, 0, 16, tall ? 16 : 12, 1, IBlock.getStatePropertySafe(state, FACING)); } + @Override + public void addTooltips(ItemStack stack, @Nullable BlockView world, List tooltip, TooltipContext options) { + IGuiExtension.addHoldShiftTooltip(tooltip, TextHelper.translatable("tooltip.tjmetro.station_name_entrance_tianjin")); + } + @Override public void addBlockProperties(List> properties) { properties.add(FACING); diff --git a/fabric/src/main/java/ziyue/tjmetro/mod/block/BlockStationNamePlate.java b/fabric/src/main/java/ziyue/tjmetro/mod/block/BlockStationNamePlate.java index f1a1ec7..5748d17 100644 --- a/fabric/src/main/java/ziyue/tjmetro/mod/block/BlockStationNamePlate.java +++ b/fabric/src/main/java/ziyue/tjmetro/mod/block/BlockStationNamePlate.java @@ -3,6 +3,7 @@ import org.mtr.mapping.holder.*; import org.mtr.mapping.mapper.BlockEntityExtension; import org.mtr.mapping.mapper.BlockHelper; +import org.mtr.mapping.mapper.TextHelper; import org.mtr.mapping.tool.HolderBase; import org.mtr.mod.Items; import org.mtr.mod.block.BlockRouteSignBase; @@ -13,6 +14,7 @@ import ziyue.tjmetro.mod.Registry; import ziyue.tjmetro.mod.block.base.BlockRailwaySignBase; import ziyue.tjmetro.mod.block.base.IRailwaySign; +import ziyue.tjmetro.mod.data.IGuiExtension; import ziyue.tjmetro.mod.packet.PacketOpenBlockEntityScreen; import javax.annotation.Nonnull; @@ -91,6 +93,7 @@ public VoxelShape getOutlineShape2(BlockState state, BlockView world, BlockPos p @Override public void addTooltips(ItemStack stack, @Nullable BlockView world, List tooltip, TooltipContext options) { + IGuiExtension.addHoldShiftTooltip(tooltip, TextHelper.translatable("tooltip.tjmetro.station_name_plate")); } @Override diff --git a/fabric/src/main/java/ziyue/tjmetro/mod/item/ItemPSDAPGTianjinBase.java b/fabric/src/main/java/ziyue/tjmetro/mod/item/ItemPSDAPGTianjinBase.java index 21e717d..e323ae6 100644 --- a/fabric/src/main/java/ziyue/tjmetro/mod/item/ItemPSDAPGTianjinBase.java +++ b/fabric/src/main/java/ziyue/tjmetro/mod/item/ItemPSDAPGTianjinBase.java @@ -10,6 +10,7 @@ import ziyue.tjmetro.mod.block.base.BlockFlagAPGTianjinBMT; import ziyue.tjmetro.mod.block.base.BlockFlagPSDTianjin; import ziyue.tjmetro.mod.block.base.BlockFlagPSDTianjinBMT; +import ziyue.tjmetro.mod.data.IGuiExtension; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -86,6 +87,9 @@ public void addTooltips(ItemStack stack, @Nullable World world, List