Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-201374

Wrong position passed to getCollisionShape from CampfireBlock#isSmokingBlockAt

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.16.3, 24w21b
    • None
    • Windows 10, AdoptOpenJDK 7.0.232 Hotspot, Minecraft Forge 1.16.3 34.1.0
    • Confirmed
    • (Unassigned)

      I ran into an odd bug randomly which I am pretty sure is just due to accidentally passing the wrong parameter to a method. Using forge names, the method isSmokingBlockAt in CampfireBlock seems to be passing the wrong position to getCollisionShape. With forge mappings the method looks like this:

      public static boolean isSmokingBlockAt(World world, BlockPos pos) {
        for(int i = 1; i <= 5; ++i) {
           BlockPos blockpos = pos.down(i);
           BlockState blockstate = world.getBlockState(blockpos);
           if (isLit(blockstate)) {
              return true;
           }
      
           boolean flag = VoxelShapes.compare(SMOKING_SHAPE, blockstate.getCollisionShape(world, pos, ISelectionContext.dummy()), IBooleanFunction.AND);
           if (flag) {
              BlockState blockstate1 = world.getBlockState(blockpos.down());
              return isLit(blockstate1);
           }
        }
      
        return false;
      }
      

      and passes pos to blockstate#getCollisionShape. The issue is that BlockState is gotten from the world at blockpos and not pos, and likely doesn't even exist in the world at pos.

            Unassigned Unassigned
            pupnewfster Sara Freimer
            Votes:
            8 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              CHK: