Skip to content

Commit

Permalink
allow force enable display mode.
Browse files Browse the repository at this point in the history
Took 32 minutes
  • Loading branch information
xkball committed Nov 11, 2024
1 parent 14b22e6 commit e7d7d7d
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ mod_name=Power Tool
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=GPL-3.0
# The mod version. See https://semver.org/
mod_version=1.4.24
mod_version=1.4.25
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.ItemInteractionResult;
import net.minecraft.world.MenuProvider;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
Expand Down Expand Up @@ -37,11 +38,12 @@ protected MapCodec<? extends BaseEntityBlock> codec() {
}

@Override
@SuppressWarnings("deprecation")
public RenderShape getRenderShape(BlockState pState) {
return RenderShape.MODEL;
}



@Override
protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) {
return use(level, pos, player);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public InteractionResult useOn(UseOnContext context) {
BlockState blockState = level.getBlockState(pos);
MenuProvider menuProvider = blockState.getMenuProvider(level, pos);
Component blockName = VanillaUtils.getName(blockState.getBlock());
if (menuProvider == null) {
if (menuProvider == null && !player.isShiftKeyDown()) {
player.displayClientMessage(
Component.translatable("powertool.gui.display_mode_error", blockName)
.withStyle(ChatFormatting.RED),
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/powertool/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,5 +138,5 @@
"tooltip.powertool.display_tool": "Use on block to toggle Display Mode",
"powertool.gui.display_mode_enabled": "Enabled display mode on %s",
"powertool.gui.display_mode_disabled": "Disabled display mode on %s",
"powertool.gui.display_mode_error": "Could not enable display mode on %s because it has no ability to open any screen."
"powertool.gui.display_mode_error": "Could not enable display mode on %s because it has no ability to open any screen. Or press shift key and click again to force enable display mode."
}
2 changes: 1 addition & 1 deletion src/main/resources/assets/powertool/lang/zh_cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,6 @@
"tooltip.powertool.display_tool": "在方块上使用以切换展示模式",
"powertool.gui.display_mode_enabled": "已在%s上启用展示模式",
"powertool.gui.display_mode_disabled": "已在%s上禁用展示模式",
"powertool.gui.display_mode_error": "无法在%s上启用展示模式,因为它无法打开任何可交互界面"
"powertool.gui.display_mode_error": "无法在%s上启用展示模式,因为它无法打开任何可交互界面.按下shift键强制启用展示模式."

}

0 comments on commit e7d7d7d

Please sign in to comment.