Metaobjects and PlayerPlaceItemEvent bug? And a new issue on Tanning rack?

A new update (0.9.2) is available now!
Latest Hotfix: 0.9.2.1 (2026-05-13)
  • Hi


    First thx for adding this new event!


    Now i try to use but i hit some issue. For persistent item placement it work as expected, but it is a issue when try to add items on a metabject (furnace, grill). For example when i want to put ore in furnace, ore gone from inventory but on furnace don't appear nothing and i can put in same slot over and over new ore. If i don't use at all new event i can put items in metaobjects! it's like, with new event activated is canceled by default when put items in metaobjects!


    For testing purpose i use following code:


    From logs:


    Thx


    Bamse

  • Thanks for letting me know! :) I can confirm that there is an issue with placing items in the furnace... unfortunately the item position is wrong, the item is located at the position of the furnace (instead of the item slot) :/ This happens as soon as the PlayerPlaceItemEvent is present...

    I will prepare a fix for that shortly!

  • I don't see mention anywhere as issue is fixed, but after server update from yesterday, it seems new event PlayerPlaceItemEvent is fixed!


    I test with a few metaobjects:

    - Furnace - ok

    - drying rack - ok

    - oven - ok

    - grill - ok

    - skewer - ok

    - grinder - ok

    -paper press - ok


    But with tanning rack i encountered a new issue. I don't think is related with first one but same code who works for other station here give error because when i call method to retrieve definition of metaobject, return null if metaobject is a tanning rack!


    from log:


    Code
    [10:49:11] [ADMIN MESSAGE] (Notification) EXCEPTION OCCURRED IN PLUGIN 'TestRw' (AUTHOR: Bamse) <-- here i put a hide in tanning rack
    -> java.lang.NullPointerException: Cannot read field "name" because "def" is null
    at PLUGIN_CLASS_LOADER//bamse.rw.PermanentItemPlacement2.onPlayerPlaceItem(PermanentItemPlacement2.java:32)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
    at java.base/java.lang.reflect.Method.invoke(Method.java:578)
    at net.jiw.unity.runtime.PluginEventHandler.triggerEvent(PluginEventHandler.java:138)
    16711680
    Object tanningrack (2060346) change info 0 -> 745



    Note (after more research):


    It seems tanning rack is a special object and not a metaobject? Maybe must threat same as a meta object? I can pickup hide from him and no event PlayerPickupItemEvent fired at all! (New event

    PlayerPlaceItemEvent is fired).

    So no way to know if item (hide or leather) is take from tanning rack or how to deny take item from him on some condition?


    Thx


    Bamse

  • Bamse

    Changed the title of the thread from “Metaobjects and PlayerPlaceItemEvent bug?” to “Metaobjects and PlayerPlaceItemEvent bug? And a new issue on Tanning rack?”.
  • Sorry, I forgot to mention this ^^ Yes, this bug was indeed fixed with the latest server update, however, it's only fixed on servers. There was no update for the game, so a plugin using this event will work in multiplayer, but not in singleplayer (a fix for the game will probably be available in the next couple of days).


    About the tanning rack, that's a good point! The tanning rack and the gramophone are two very special cases... they're not meta objects, because they don't require any additional processing by the game and they don't really hold an item (the hide on the rack, for example, is not an actual item, instead it's handled by the object info field).

    This is indeed a bit problematic in this case... turning both objects into meta objects would be certainly the cleanest solution, but that's a bigger change requiring a world conversion (and for the tanning rack it also requires a few more adjustments, because as mentioned above, the pelt on the rack is not an item - it will require a definition for items to be represented as a different model on a per-object basis) :thinking:


    The API event does turn the tanning rack into a (fake) meta object (that's why it's not null), but calling any methods on it won't work...


    Not sure about the best solution for now... maybe it would help if the event just had a getRelatedObject() method (which returns the ObjectElement instead of a MetaObject). Or maybe an additional getRelatedObjectDefinition() helps (so getMetaObject() would return null for the tanning rack, but getRelatedObjectDefinition() would still return the tanning rack definition)?

    Perhaps it might also work if there was a place target enum provided (which would contain values like "Persistent", "MetaObject", "TanningRack" etc) :monocle:

  • I think on a long run the best is to threat them as metaobject, even if game not supplementary do some processing to them.
    On short term probable one enum with target will be very good to know exactly where item is placed (help in future too if other case will appear) and a getRelatedObjectDefinition() to can get definition (where item was placed in tanning rack or gramophone?) for sure is helpful.
    And second thing on item pickup (hide,leather,disk) can be do a fake event PlayerItemPickup (cancelable of course)? I see this event is not trigger at all for tanning rack. On place event is triggered, but on pickup no event.

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!