Make the dictionary allow showing block tags and tile tags when sneak right clicking instead of just right clicking iff the block has a tile
@@ -59,12 +59,15 @@ public class ItemDictionary extends Item {
@Override
public ActionResultType onItemUse(ItemUseContext context) {
PlayerEntity player = context.getPlayer();
- if (player != null && !player.isSneaking()) {
+ if (player != null) {
World world = context.getWorld();
- if (!world.isRemote) {
BlockPos pos = context.getPos();
- Set<ResourceLocation> blockTags = world.getBlockState(pos).getBlock().getTags();
TileEntity tile = MekanismUtils.getTileEntity(world, pos);
+ if (tile != null || !player.isSneaking()) {
+ //If there is a tile at the position or the player is not sneaking
+ // grab the tags of the block and the tile
+ if (!world.isRemote) {
+ Set<ResourceLocation> blockTags = world.getBlockState(pos).getBlock().getTags();
Set<ResourceLocation> tileTags = tile == null ? Collections.emptySet() : tile.getType().getTags();
if (blockTags.isEmpty() && tileTags.isEmpty()) {
player.sendMessage(MekanismLang.LOG_FORMAT.translateColored(EnumColor.DARK_BLUE, MekanismLang.MEKANISM, EnumColor.GRAY, MekanismLang.DICTIONARY_NO_KEY),
@@ -77,6 +80,7 @@ public class ItemDictionary extends Item {
}
return ActionResultType.SUCCESS;
}
+ }
return ActionResultType.PASS;
}
