Uploaded image for project: 'Minecraft (Bedrock codebase)'
  1. Minecraft (Bedrock codebase)
  2. MCPE-155479

Wrong range of the hopper to fetch entities

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • None
    • 1.18.32, 1.19.0.31 Preview, 1.19.0.30 Beta, 1.18.30, 1.18.31
    • None
    • Confirmed
    • Windows

          In "Hopper::_pullInItems()" ,  the position passed to "Hopper::_getItemAt()" is offsetted by +0.625 on the y-axis, "Hopper::_getItemAt()" defines a cube fetch range with a side length of 1, and inwards in all axes shrink by 0.0001. The final result is:

       

       
          As shown in the figure, the range of BE is different from that of JE, which makes BE's hopper unable to fetch drops above the soul sand. For this, the height of the BE's hopper fetch range should be changed to 1.375 for version parity.

       

          The fetch range of the hopper should never shrink inwards, the real solution is to replace all "AABB::intersectsInner()" inside "BlockSource::fetchEntities()" with "AABB::intersects()" . Following paragraphs will explain the reason behind.

       

       
          The float in C++ is only accurate to 6~7 digits in decimal, you can see that when the value exceeds 2048, the shrinking 0.0001 will not have any effect.
       

       
          You can test it in game, drop items against block like this, and the items will be sucked into the hopper. This happens for any hopper whose coordinates are outside ±2049, which is obviously unacceptable.

       

       
          The fetch range of the hopper at the chunk boundary will also be wrong. Here I use the RenderDragon shader bin I wrote myself to visualize the chunk boundary, which can be found at https://github.com/OEOTYAN/useless-shaders/releases/tag/v.rd.0.2 . When the coordinates are within ±2048, if you drop an item into a hopper with a honey block above the block on all sides, the item will be sucked correctly, but if you drop the item at the chunk boundary as shown in the figure, the item will be stuck between the honey block and the hopper gaps even the hopper is empty.

          This behavior is "repaired" at certain boundaries outside of ±2049, as the range of the funnel becomes 1*1 instead of 0.9998*0.9998.
       

       
          This is because "Bounds::Bounds()" in "BlockSource::fetchEntities()" is fetched using the hopper's range passed in, but this range does not contain neighboring chunks.
       

       
          The original AABB should still be used when determining with "AABB::intersects()" , and the search AABB should be extended by 0.125 for the xz axis when getting the chunk list. The same is true for hopper minecarts. You can add a parameter to the "BlockSource::fetchEntities()" function, or you can extend 0.125 for the get type of item inside the function.

        1. hopper-0.png
          hopper-0.png
          24 kB
        2. hopper-1.png
          hopper-1.png
          25 kB
        3. hopper-2.png
          hopper-2.png
          27 kB
        4. image01.png
          image01.png
          178 kB
        5. image02.png
          image02.png
          5.27 MB
        6. image03.png
          image03.png
          1.71 MB

            ΘΣΦΓΥΔΝ ΘΣΦΓΥΔΝ
            Votes:
            20 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: