Skip to content

Commit

Permalink
Rename isProbeInHand to isProbe, old is now Deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
strubium committed Oct 17, 2024
1 parent 58f378a commit 9c139a5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static void showHarvestLevel(IProbeInfo probeInfo, IBlockState blockState, Block
}

static void showCanBeHarvested(IProbeInfo probeInfo, World world, BlockPos pos, Block block, EntityPlayer player) {
if (ModItems.isProbeInHand(player.getHeldItemMainhand())) {
if (ModItems.isProbe(player.getHeldItemMainhand())) {
return; // No need to show harvestability for the probe itself
}

Expand Down
13 changes: 11 additions & 2 deletions src/main/java/mcjty/theoneprobe/items/ModItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,15 @@ public static void initClient() {
BaubleTools.initProbeModel(probeGoggles);
}
}

@SideOnly(Side.CLIENT)
@Deprecated //Old Hook, dont use
public static boolean isProbeInHand(ItemStack stack) {
return isProbe(stack);
}

@SideOnly(Side.CLIENT)
public static boolean isProbe(ItemStack stack) {
if (stack.isEmpty()) {
return false;
}
Expand All @@ -127,6 +134,7 @@ public static boolean isProbeInHand(ItemStack stack) {
}
return stack.getTagCompound().hasKey(PROBETAG);
}

@SideOnly(Side.CLIENT)
private static boolean isProbeHelmet(ItemStack stack) {
if (stack.isEmpty()) {
Expand All @@ -140,10 +148,11 @@ private static boolean isProbeHelmet(ItemStack stack) {
}
return stack.getTagCompound().hasKey(PROBETAG);
}

@SideOnly(Side.CLIENT)
public static boolean hasAProbeSomewhere(EntityPlayer player) {
return isProbeInHand(player.getHeldItem(EnumHand.MAIN_HAND))
|| isProbeInHand(player.getHeldItem(EnumHand.OFF_HAND))
return isProbe(player.getHeldItem(EnumHand.MAIN_HAND))
|| isProbe(player.getHeldItem(EnumHand.OFF_HAND))
|| isProbeHelmet(player.inventory.getStackInSlot(36 + 3))
|| (ModSetup.baubles && BaubleTools.hasProbeGoggle(player));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ private static void requestBlockInfo(ProbeMode mode, RayTraceResult mouseOver, B
// Protection for some invalid items.
pickBlock = ItemStack.EMPTY;
}
if (pickBlock != null && (!pickBlock.isEmpty()) && ConfigSetup.getDontSendNBTSet().contains(pickBlock.getItem().getRegistryName())) {
if (!pickBlock.isEmpty() && ConfigSetup.getDontSendNBTSet().contains(pickBlock.getItem().getRegistryName())) {
pickBlock = pickBlock.copy();
pickBlock.setTagCompound(null);
}
Expand Down

0 comments on commit 9c139a5

Please sign in to comment.