Skip to content

Commit

Permalink
In-game description
Browse files Browse the repository at this point in the history
  • Loading branch information
ZiYueCommentary committed Sep 25, 2024
1 parent 218baa8 commit 4a6ccd0
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -71,6 +72,11 @@ public boolean emitsRedstonePower2(BlockState state) {
return true;
}

@Override
public void addTooltips(ItemStack stack, @Nullable BlockView world, List<MutableText> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -48,6 +51,12 @@ public String getTranslationKey2() {
return "block.tjmetro.railway_sign_tianjin_bmt";
}

@Override
public void addTooltips(ItemStack stack, @Nullable BlockView world, List<MutableText> 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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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<MutableText> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -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<MutableText> tooltip, TooltipContext options) {
IGuiExtension.addHoldShiftTooltip(tooltip, TextHelper.translatable("tooltip.tjmetro.station_name_entrance_tianjin"));
}

@Override
public void addBlockProperties(List<HolderBase<?>> properties) {
properties.add(FACING);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -91,6 +93,7 @@ public VoxelShape getOutlineShape2(BlockState state, BlockView world, BlockPos p

@Override
public void addTooltips(ItemStack stack, @Nullable BlockView world, List<MutableText> tooltip, TooltipContext options) {
IGuiExtension.addHoldShiftTooltip(tooltip, TextHelper.translatable("tooltip.tjmetro.station_name_plate"));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -86,6 +87,9 @@ public void addTooltips(ItemStack stack, @Nullable World world, List<MutableText
} else if (this.block.data instanceof BlockPSDAPGGlassBase) {
tooltip.add(TextHelper.translatable("tooltip.mtr.psd_apg_glass").formatted(TextFormatting.GRAY));
}
if (this.block.data instanceof BlockFlagPSDTianjin || this.block.data instanceof BlockFlagAPGTianjinBMT) {
IGuiExtension.addHoldShiftTooltip(tooltip, TextHelper.translatable("tooltip.tjmetro.psd_apg_tianjin"));
}
}

@Nonnull
Expand Down
8 changes: 7 additions & 1 deletion fabric/src/main/resources/assets/tjmetro/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,13 @@
"tooltip.tjmetro.custom_content": "Support custom display content",
"tooltip.tjmetro.custom_color": "Support custom display color",
"tooltip.tjmetro.station_name_sign": "A small station name sign, you can change display content with wrench.",
"tooltip.tjmetro.metal_detection_door": "A device for clearing items from players' inventory. Note this device will delete item directly, instead of taking out items.",
"tooltip.tjmetro.metal_detection_door": "A device that can delete items from players' inventory. Use wrench or brush to open its inventory.",
"tooltip.tjmetro.station_name_plate": "Use wrench to select a platform to display, and use brush to change its arrow direction.",
"tooltip.tjmetro.player_detector": "Detects players in 2 blocks and emits a redstone signal.",
"tooltip.tjmetro.station_name_entrance_tianjin": "Use wrench to specify an exit to display, and use brush to change its style.",
"tooltip.tjmetro.roadblock_sign": "Use wrench or brush to change its display content.",
"tooltip.tjmetro.psd_apg_tianjin": "Use wrench to change its top's display content, and use brush to change its arrow direction.",
"tooltip.tjmetro.railway_sign_bmt": "Use Railway Sign Pole from MTR mod to extend its pole.",
"tooltip.tjmetro.use_tianjin_metro_font": "Render texts with mod font in some blocks.",
"tooltip.tjmetro.shift": "Hold SHIFT for more info",

Expand Down

0 comments on commit 4a6ccd0

Please sign in to comment.