Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-7966

Generating tree yields a java.lang.UnsupportedOperationException: Not supported yet.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None
    • None
    • This server is running CraftBukkit version 4392-Spigot-60c9969-f282231 (MC: 1.21.3) (Implementing API version 1.21.3-R0.1-SNAPSHOT)
    • TwerkingForTrees
    • Yes

      I previously filed a bug about trees not being generated that was wrong because I had the location wrong in the test code, but I kept on seeing the issue, and decided to copy and paste most of the twerking-for-trees code (at least the pertinent parts) into the test plugin. The experience I was seeing was that code was not being run after the generate tree had occurred. Nada. It just returned to the main loop.

      I managed to capture the error:

      [09:42:48] [Server thread/INFO]: Setting CraftBlock{pos=BlockPosition{x=-2, y=76, z=-116},type=OAK_SAPLING,data=Block{minecraft:oak_sapling}[stage=0],fluid=net.minecraft.world.level.material.FluidTypeEmpty@74dd5ea7} mat OAK_SAPLING to air
      [09:42:48] [Server thread/INFO]: Done
      [09:42:48] [Server thread/WARN]: [TestPlugin] Task #3 for TestPlugin v1.0 generated an exception
      java.lang.UnsupportedOperationException: Not supported yet.
      	at org.bukkit.craftbukkit.v1_21_R2.util.DummyGeneratorAccess.H_(DummyGeneratorAccess.java:103) ~[spigot-1.21.3-R0.1-SNAPSHOT.jar:4392-Spigot-60c9969-f282231]
      	at net.minecraft.world.level.levelgen.structure.templatesystem.DefinedStructure.lambda$updateShapeAtEdge$4(DefinedStructure.java:465) ~[spigot-1.21.3-R0.1-SNAPSHOT.jar:4392-Spigot-60c9969-f282231]
      	at net.minecraft.world.phys.shapes.VoxelShapeDiscrete.a(SourceFile:225) ~[spigot-1.21.3-R0.1-SNAPSHOT.jar:4392-Spigot-60c9969-f282231]
      	at net.minecraft.world.phys.shapes.VoxelShapeDiscrete.a(SourceFile:202) ~[spigot-1.21.3-R0.1-SNAPSHOT.jar:4392-Spigot-60c9969-f282231]
      	at net.minecraft.world.level.levelgen.structure.templatesystem.DefinedStructure.a(DefinedStructure.java:460) ~[spigot-1.21.3-R0.1-SNAPSHOT.jar:4392-Spigot-60c9969-f282231]
      	at net.minecraft.world.level.levelgen.feature.WorldGenTrees.a(SourceFile:164) ~[spigot-1.21.3-R0.1-SNAPSHOT.jar:4392-Spigot-60c9969-f282231]
      	at java.base/java.util.Optional.map(Optional.java:260) ~[?:?]
      	at net.minecraft.world.level.levelgen.feature.WorldGenTrees.a(SourceFile:162) ~[spigot-1.21.3-R0.1-SNAPSHOT.jar:4392-Spigot-60c9969-f282231]
      	at net.minecraft.world.level.levelgen.feature.WorldGenerator.a(SourceFile:168) ~[spigot-1.21.3-R0.1-SNAPSHOT.jar:4392-Spigot-60c9969-f282231]
      	at net.minecraft.world.level.levelgen.feature.WorldGenFeatureConfigured.a(SourceFile:28) ~[spigot-1.21.3-R0.1-SNAPSHOT.jar:4392-Spigot-60c9969-f282231]
      	at org.bukkit.craftbukkit.v1_21_R2.CraftRegionAccessor.generateTree(CraftRegionAccessor.java:290) ~[spigot-1.21.3-R0.1-SNAPSHOT.jar:4392-Spigot-60c9969-f282231]
      	at org.bukkit.craftbukkit.v1_21_R2.CraftRegionAccessor.generateTree(CraftRegionAccessor.java:193) ~[spigot-1.21.3-R0.1-SNAPSHOT.jar:4392-Spigot-60c9969-f282231]
      	at us.tastybento.test.TestPlugin.growTree(TestPlugin.java:108) ~[?:?]
      	at us.tastybento.test.TestPlugin.lambda$runChecker$4(TestPlugin.java:94) ~[?:?]
      	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) ~[?:?]
      	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[?:?]
      	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179) ~[?:?]
      	at java.base/java.util.HashMap$EntrySpliterator.forEachRemaining(HashMap.java:1858) ~[?:?]
      	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[?:?]
      	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?]
      	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) ~[?:?]
      	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) ~[?:?]
      	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
      	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596) ~[?:?]
      	at us.tastybento.test.TestPlugin.lambda$runChecker$5(TestPlugin.java:94) ~[?:?]
      	at org.bukkit.craftbukkit.v1_21_R2.scheduler.CraftTask.run(CraftTask.java:82) ~[spigot-1.21.3-R0.1-SNAPSHOT.jar:4392-Spigot-60c9969-f282231]
      	at org.bukkit.craftbukkit.v1_21_R2.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:415) ~[spigot-1.21.3-R0.1-SNAPSHOT.jar:4392-Spigot-60c9969-f282231]
      	at net.minecraft.server.MinecraftServer.c(MinecraftServer.java:1502) ~[spigot-1.21.3-R0.1-SNAPSHOT.jar:4392-Spigot-60c9969-f282231]
      	at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1391) ~[spigot-1.21.3-R0.1-SNAPSHOT.jar:4392-Spigot-60c9969-f282231]
      	at net.minecraft.server.MinecraftServer.y(MinecraftServer.java:1093) ~[spigot-1.21.3-R0.1-SNAPSHOT.jar:4392-Spigot-60c9969-f282231]
      	at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:329) ~[spigot-1.21.3-R0.1-SNAPSHOT.jar:4392-Spigot-60c9969-f282231]
      	at java.base/java.lang.Thread.run(Thread.java:1583) [?:?]
       

      The code where this happens is:

              if (SAPLING_TO_TREE_TYPE.containsKey(t)) {
                  TreeType type = SAPLING_TO_TREE_TYPE.getOrDefault(b.getType(), TreeType.TREE);
                  System.out.println("Setting " + b + " mat " + t + " to air");            b.setType(Material.AIR);
                  System.out.println("Done");
                  if (b.getWorld().generateTree(b.getLocation(), RAND, type, (Predicate<BlockState>) this::checkPlace)) {
                      System.out.println("Success?");
                      showSparkles(b);                b.getWorld().playSound(b.getLocation(), Sound.BLOCK_NOTE_BLOCK_BASS, 1F, 1F);
                  }
              } else {
                  System.out.println("Failure");
                  System.out.println("Generate tree failed at " + b);
                  // Tree generation failed, so reset block
                  b.setType(t);
              }
              System.out.println("Why no output?"); 

      You can see that the System.out.println debug statements do not get called - the console log ends at that point.

      Attached plugin will replicate this. To use, place a sapling (I used Oak) on grass and stand a few blocks away and hit left shift repeatedly. You'll see particles and hear a note. After about 10 seconds or so (may be up to 20s) the sapling will disappear and the error will fire in the console.

      The code for this can be found here: https://github.com/BentoBoxWorld/TwerkingForTrees/blob/develop/src/main/java/world/bentobox/twerk/listeners/TreeGrowListener.java

            Unassigned Unassigned
            tastybento tastybento
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: