1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved Ported Map Crashes b/c of Milk.

Discussion in 'Help' started by JUSTaMod, Jul 29, 2018.

  1. JUSTaMod

    JUSTaMod Spider Jockey

    Messages:
    38
    GitHub:
    justamod
    I've ported a map from MC Java for use in one of my PE servers, and as part of my usual fly-around to make sure everything was correct - I noticed the server kept crashing when a certain few chunks were loaded.

    As per the console output - InvalidArgumentException: "Unable to resolve "minecraft:milk_bucket" to a valid item" there are a/a few milk buckets somewhere that cannot be resolved to an item ID.

    I understand why this is happening, as MC Java and MCPE item ID's get quite different. Just not sure what I can do to fix it at this point.

    Does anyone have any ideas on how I can remove the item/s from the map? I have already used MCEdit to clear all entities and mess around with a few other things... so at this point I'm assuming the milk is in a chest. Maybe.

    A second question I had- How come PocketMine can handle mostly everything else when using a ported PC world... but milk crashes it? lol.

    Edit- Figured above question out. Thanks @corytortoise

    I know this topic may not have all too much to do with PocketMine itself.... so feel free to yell at me for that.

    As per the usual, thank you all in advance.
     
    Last edited: Jul 29, 2018
  2. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    Maybe this code from ItemFactory could be useful? Perhaps you could register the Milk item so it doesn't throw that error. You'd probably want to figure out the ID and/or name difference between BE and JE though.

    Edit: Apparently PMMP handles milk buckets as a normal bucket with meta values representing different types, i.e. milk, water, lava. That's part of why the name milk_bucket causes issues, I think.
     
  3. JUSTaMod

    JUSTaMod Spider Jockey

    Messages:
    38
    GitHub:
    justamod
    Hrmm. I'll take a look at that code.

    The ID and name difference -

    Java
    ID- 335
    Name- minecraft:milk_bucket
    PE
    ID- 325:1
    Name- bucket
     
  4. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    Maybe you could create a plugin that searches all inventories in the world, looks for ID 335, and changes it to the BE equivalent?
     
  5. JUSTaMod

    JUSTaMod Spider Jockey

    Messages:
    38
    GitHub:
    justamod
    Yea. From looking at the item factory code the name would cause an issue b/c PE uses meta values on buckets where Java just has different ID and names.... so I agree with your Edit you made.

    This would also break for all the other types of buckets.

    I know how to read this stuff... not how to create it. I'll give a shot at coding something... but I don't know what I'm doing.

    Edit- I thought I had generated my world without structures. So much for that working as intended. Would have made my life easier. Rip
     
  6. JUSTaMod

    JUSTaMod Spider Jockey

    Messages:
    38
    GitHub:
    justamod
    Ok. So. Since I don't know PHP and cant code plugins for the life of me- I've just edited ItemFactory directly- and added this under line 352.

    if(strpos($str, 'minecraft:milk_bucket') !== false) {
    $b = explode(":", str_replace([" ", "minecraft:milk_"], ["_", ""], trim($str)));
    }

    I've tested and it makes buckets appear where milk buckets were before. However- No one use this. It does work, but it's a terrible idea.


    Edit - I'm using this just to remove milk. Then switching the world back to the pre-production server.
     
    Last edited: Jul 29, 2018
    hikingjungle and corytortoise like this.
  7. JUSTaMod

    JUSTaMod Spider Jockey

    Messages:
    38
    GitHub:
    justamod
  8. hikingjungle

    hikingjungle Baby Zombie

    Messages:
    123
    GitHub:
    hikingjungle
    I had the same problem except mine was because of a water_bucket
     
  9. JUSTaMod

    JUSTaMod Spider Jockey

    Messages:
    38
    GitHub:
    justamod
    Aye. It will happen on any bucket. Feel free to use the code in my previous post (at your own risk.) and replace "minecraft:milk_" with "minecraft:water_"
     
  10. hikingjungle

    hikingjungle Baby Zombie

    Messages:
    123
    GitHub:
    hikingjungle
    ill try
     
  11. hikingjungle

    hikingjungle Baby Zombie

    Messages:
    123
    GitHub:
    hikingjungle
    wow thanks that worked
    (days of world edit modding on that world saved)
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.