Jump to content
  • Home
  • Files
  • Docs
Status Updates
  • All Content

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Frozen Storm

Frozen Storm

Members
 View Profile  See their activity
  • Content Count

    4
  • Joined

    January 24
  • Last visited

    February 1

Community Reputation

0 Neutral

About Frozen Storm

  • Rank
    Tree Puncher
  1. Frozen Storm

    Printing the in_open_water parameter to Debug (F3) screen

    Frozen Storm replied to Frozen Storm's topic in Modder Support

    In order to debug this, I hacked the private FishingBobberEntity#func_234603_b_ to be callable using java reflection, and printed out its value for the block the bobber is in and for the player's targeted block (objectMouseOver). This does actually print out seemingly correct values (it prints out false for blocks near the shore and true for blocks further out). I rechecked the code in FishingBobberEntity#tick and it seems the check only happens when a fish is catchable (ticksCatchable > 0 || ticksCatchableDelay > 0), otherwise it just returns true. I thought this explained the problem, but it's still erroneously printing true near the shore, even when the blobber gets pulled into the water (indicating a fish can be caught). I guess I'll just use the hacky solution for now.
    • January 25
    • 6 replies
  2. Frozen Storm

    Printing the in_open_water parameter to Debug (F3) screen

    Frozen Storm replied to Frozen Storm's topic in Modder Support

    So I've dived a bit more into the source code. First off, there seem to be 3 ways to obtain an instance of FishingPredicate: A private constructor and a public static factory method (func_234640_a_) that seems to just invoke this constructor (whatever the reason for this particular design pattern might be). A serialization (func_234637_a_) and deserialization (func_234639_a_) method that handle JSONification of the object. An instance field (field_234635_a_) which seems to just be a fallback placeholder (similar to ANY in many other Predicates). Of these three only the 1st one (func_234640_a_) seems relevant to me, since I don't know where I'd get the required JSON for 2, and 3 just simply always returns true in the test method, which probably isn't what I want. The 1st one is also used in FishingLootTables, namely with the argument true. Additionally the class contains the boolean field_234636_b_, which seems to determine what value of in_open_water the predicate is looking for. Given the call in FishingLootTables I mentioned above, this would make sense, since treasure loot should only be added if in_open_water is true. Last, the class contains the test method (func_234638_a_), which for a FishingBobberEntity argument (such as mc.player.fishingBobber in my code) returns whether the above field_234636_b_ is equal to the result of a call to the argument's func_234605_g_(). This method simply returns the value of a private boolean field (FishingBobberEntity#field_234595_aq_), which in turn gets set in FishingBobberEntity#tick with a check that seems like it could be for open water. Unfortunately I can't access the function FishingBobberEntity#func_234603_b_ (which is part of this check) in my code, as it's private, but I believe that performs the open water check for a specific block. The most sensible explanation for me would therefore be that FishingBobberEntity#func_234605_g_ returns whether the player is currently fishing. However, I decided to display the results of the test method in-game, and it didn't work as expected. Namely, my mod now contains the following code: @SubscribeEvent public void onRenderOverlay(RenderGameOverlayEvent.Text event) { if (mc.gameSettings.showDebugInfo) { ArrayList<String> leftText = event.getLeft(); ArrayList<String> rightText = event.getRight(); if (mc.player.fishingBobber != null) { // if player is currently fishing FishingPredicate alwaysTrue = FishingPredicate.field_234635_a_; // this will just always return true FishingPredicate notIOW = FishingPredicate.func_234640_a_(false); // this checks if in_open_water is false FishingPredicate isIOW = FishingPredicate.func_234640_a_(true); // this checks if in_open_water is true rightText.add(Boolean.toString(mc.player.fishingBobber.func_234605_g_())); // is bobber currently in open water? rightText.add(Boolean.toString(alwaysTrue.func_234638_a_(mc.player.fishingBobber))); rightText.add(Boolean.toString(notIOW.func_234640_a_(false).func_234638_a_(mc.player.fishingBobber))); rightText.add(Boolean.toString(isIOW.func_234640_a_(true).func_234638_a_(mc.player.fishingBobber))); } } } which checks the values of the methods I described. Unfortunately, func_234605_g_ just always returns true in-game, regardless of whether I'm fishing out in deep open water, or in a 2x2x1 pool I dug, or even on land. The predicates return values that fit this (so always returning true, false, true in the above code).
    • January 25
    • 6 replies
  3. Frozen Storm

    Printing the in_open_water parameter to Debug (F3) screen

    Frozen Storm replied to Frozen Storm's topic in Modder Support

    I've looked at FishingPredicate, but both the documentation and the class definition I found with ctrl+click in Eclipse have some very confusing field and function names, so I'm having a little trouble with how I'm supposed to use it. I've found a (somewhat old) post that explains briefly how Predicates work in general (although looking at the docs of other predicates, it seems the apply method has been renamed to test - or maybe this is specific to Forge API predicates?), but I'm not sure how I'm supposed to initialise FishingPredicate (or otherwise obtain it from the player/water block/fishing rod/...).
    • January 25
    • 6 replies
  4. Frozen Storm

    Printing the in_open_water parameter to Debug (F3) screen

    Frozen Storm posted a topic in Modder Support

    According to the patch notes one of the recent updates added the in_open_water parameter. Is there a way to print the value of this parameter to the debug screen (F3) either for the currently targeted block or for the bobber when fishing? I've managed to make a mod that adds something to the debug screen when the player is fishing: @Mod("extended_debug") public class ExtendedDebug { // Directly reference a log4j logger. private static final Logger LOGGER = LogManager.getLogger(); private static final Minecraft mc = Minecraft.getInstance(); public ExtendedDebug() { // Register ourselves for server and other game events we are interested in MinecraftForge.EVENT_BUS.register(this); } @SubscribeEvent public void onRenderOverlay(RenderGameOverlayEvent.Text event) { if (mc.gameSettings.showDebugInfo) { ArrayList<String> leftText = event.getLeft(); ArrayList<String> rightText = event.getRight(); if (mc.player.fishingBobber != null) { rightText.add(""); rightText.add("HELLO WORLD!"); } } } } This properly adds HELLO WORLD to the debug screen when the player is fishing, but I can't find anything in FishingBobberEntity to get information about whether the player is fishing in open water.
    • January 24
    • 6 replies
  • All Activity
  • Home
  • Frozen Storm
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community