Terra (Fabric/Forge/Paper)

Terra (Fabric/Forge/Paper)

74.2k Downloads

[Bug] Crash when attempting to spawn an entity in a nested script

astrsh opened this issue ยท 1 comments

commented

Pre-Issue Checklist

  • I have checked that I am on the latest version of Terra.
  • I have searched the github issue tracker for similar issues, including closed ones.
  • I have made sure that this is not a bug with another mod or plugin, and it is Terra that is causing the issue.
  • I have checked that this is an issue with Terra and not an issue with the pack I am using.
  • I have attached a copy of the latest.log file
  • I have filled out and provided all the appropriate information.

Environment

Name Value
Terra Version 6.0.0 5ab0e0d
Platform / Platform Version Fabric 1.18.1

Issue Description

Attempting to generate a chunk with the following scripts causes the game to crash

oak_tree_procedural.tesf

// Tree stuff

num beeNestRoll = randomInt(30); // 1 in 30 chance
if (beeNestRoll == 0) {
    structure(0, leafBottomHeight-1, 0, "bee_nest", "NONE", "CW_90", "CCW_90", "CW_180");
}

// Later script stuff

bee_nest.tesf

block(1, 0, 0, "minecraft:bee_nest");
entity(1, -1, 0, "minecraft:bee");
entity(1, -1, 0, "minecraft:bee");
entity(1, -1, 0, "minecraft:bee");
  • Generating bee_nest manually using /structures generate bee_nest correctly generates the bee nest and 3 bees.

  • Generating oak_tree_procedural manually using /structures generate oak_tree_procedural runs through the script until halting when line 2 of bee_nest.tesf is encountered.

  • When oak_tree_procedural generates via chunk generation and the bee_nest script is ran, the game crashes.

Full stacktrace

Exception Stacktrace
Time: 1/29/22, 11:59 AM
Description: Exception ticking world

java.lang.AbstractMethodError: Receiver class net.minecraft.world.ChunkRegion does not define or inherit an implementation of the resolved method 'abstract com.dfsek.terra.api.entity.Entity spawnEntity(double, double, double, com.dfsek.terra.api.entity.EntityType)' of interface com.dfsek.terra.api.world.WritableWorld.
	at com.dfsek.terra.api.world.BufferedWorld.spawnEntity(BufferedWorld.java:92)
	at com.dfsek.terra.api.world.WritableWorld.spawnEntity(WritableWorld.java:52)
	at com.dfsek.terra.addons.terrascript.script.functions.EntityFunction.apply(EntityFunction.java:53)
	at com.dfsek.terra.addons.terrascript.script.functions.EntityFunction.apply(EntityFunction.java:29)
	at com.dfsek.terra.addons.terrascript.parser.lang.Block.apply(Block.java:35)
	at com.dfsek.terra.addons.terrascript.parser.lang.Block.apply(Block.java:28)
	at com.dfsek.terra.addons.terrascript.script.StructureScript.applyBlock(StructureScript.java:146)
	at com.dfsek.terra.addons.terrascript.script.StructureScript.generate(StructureScript.java:140)
	at com.dfsek.terra.addons.terrascript.script.functions.StructureFunction.lambda$apply$0(StructureFunction.java:82)
	at java.base/java.util.Optional.map(Optional.java:260)
	at com.dfsek.terra.addons.terrascript.script.functions.StructureFunction.apply(StructureFunction.java:71)
	at com.dfsek.terra.addons.terrascript.script.functions.StructureFunction.apply(StructureFunction.java:33)
	at com.dfsek.terra.addons.terrascript.parser.lang.Block.apply(Block.java:35)
	at com.dfsek.terra.addons.terrascript.parser.lang.keywords.looplike.IfKeyword.apply(IfKeyword.java:41)
	at com.dfsek.terra.addons.terrascript.parser.lang.keywords.looplike.IfKeyword.apply(IfKeyword.java:23)
	at com.dfsek.terra.addons.terrascript.parser.lang.Block.apply(Block.java:35)
	at com.dfsek.terra.addons.terrascript.parser.lang.Block.apply(Block.java:28)
	at com.dfsek.terra.addons.terrascript.script.StructureScript.applyBlock(StructureScript.java:146)
	at com.dfsek.terra.addons.terrascript.script.StructureScript.generate(StructureScript.java:134)
	at com.dfsek.terra.addons.generation.feature.FeatureGenerationStage.lambda$populate$0(FeatureGenerationStage.java:62)
	at com.dfsek.terra.api.structure.feature.BinaryColumn.forEach(BinaryColumn.java:68)
	at com.dfsek.terra.addons.generation.feature.FeatureGenerationStage.lambda$populate$1(FeatureGenerationStage.java:60)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at com.dfsek.terra.addons.generation.feature.FeatureGenerationStage.populate(FeatureGenerationStage.java:55)
	at com.dfsek.terra.fabric.generation.FabricChunkGeneratorWrapper.lambda$generateFeatures$2(FabricChunkGeneratorWrapper.java:176)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at com.dfsek.terra.fabric.generation.FabricChunkGeneratorWrapper.generateFeatures(FabricChunkGeneratorWrapper.java:174)
	at net.minecraft.world.chunk.ChunkStatus.method_20613(ChunkStatus.java:146)
	at net.minecraft.world.chunk.ChunkStatus.runGenerationTask(ChunkStatus.java:289)
	at net.minecraft.server.world.ThreadedAnvilChunkStorage.method_17225(ThreadedAnvilChunkStorage.java:605)
	at com.mojang.datafixers.util.Either$Left.map(Either.java:38)
	at net.minecraft.server.world.ThreadedAnvilChunkStorage.method_17224(ThreadedAnvilChunkStorage.java:599)
	at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1150)
	at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482)
	at net.minecraft.server.world.ChunkTaskPrioritySystem.method_17634(ChunkTaskPrioritySystem.java:58)
	at net.minecraft.util.thread.TaskExecutor.runNext(TaskExecutor.java:91)
	at net.minecraft.util.thread.TaskExecutor.runWhile(TaskExecutor.java:146)
	at net.minecraft.util.thread.TaskExecutor.run(TaskExecutor.java:102)
	at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1395)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Render thread
Stacktrace:
	at com.dfsek.terra.api.world.BufferedWorld.spawnEntity(BufferedWorld.java:92)
	at com.dfsek.terra.api.world.WritableWorld.spawnEntity(WritableWorld.java:52)
	at com.dfsek.terra.addons.terrascript.script.functions.EntityFunction.apply(EntityFunction.java:53)
	at com.dfsek.terra.addons.terrascript.script.functions.EntityFunction.apply(EntityFunction.java:29)
	at com.dfsek.terra.addons.terrascript.parser.lang.Block.apply(Block.java:35)
	at com.dfsek.terra.addons.terrascript.parser.lang.Block.apply(Block.java:28)
	at com.dfsek.terra.addons.terrascript.script.StructureScript.applyBlock(StructureScript.java:146)
	at com.dfsek.terra.addons.terrascript.script.StructureScript.generate(StructureScript.java:140)
	at com.dfsek.terra.addons.terrascript.script.functions.StructureFunction.lambda$apply$0(StructureFunction.java:82)
	at java.base/java.util.Optional.map(Optional.java:260)
	at com.dfsek.terra.addons.terrascript.script.functions.StructureFunction.apply(StructureFunction.java:71)
	at com.dfsek.terra.addons.terrascript.script.functions.StructureFunction.apply(StructureFunction.java:33)
	at com.dfsek.terra.addons.terrascript.parser.lang.Block.apply(Block.java:35)
	at com.dfsek.terra.addons.terrascript.parser.lang.keywords.looplike.IfKeyword.apply(IfKeyword.java:41)
	at com.dfsek.terra.addons.terrascript.parser.lang.keywords.looplike.IfKeyword.apply(IfKeyword.java:23)
	at com.dfsek.terra.addons.terrascript.parser.lang.Block.apply(Block.java:35)
	at com.dfsek.terra.addons.terrascript.parser.lang.Block.apply(Block.java:28)
	at com.dfsek.terra.addons.terrascript.script.StructureScript.applyBlock(StructureScript.java:146)
	at com.dfsek.terra.addons.terrascript.script.StructureScript.generate(StructureScript.java:134)
	at com.dfsek.terra.addons.generation.feature.FeatureGenerationStage.lambda$populate$0(FeatureGenerationStage.java:62)
	at com.dfsek.terra.api.structure.feature.BinaryColumn.forEach(BinaryColumn.java:68)
	at com.dfsek.terra.addons.generation.feature.FeatureGenerationStage.lambda$populate$1(FeatureGenerationStage.java:60)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at com.dfsek.terra.addons.generation.feature.FeatureGenerationStage.populate(FeatureGenerationStage.java:55)
	at com.dfsek.terra.fabric.generation.FabricChunkGeneratorWrapper.lambda$generateFeatures$2(FabricChunkGeneratorWrapper.java:176)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at com.dfsek.terra.fabric.generation.FabricChunkGeneratorWrapper.generateFeatures(FabricChunkGeneratorWrapper.java:174)
	at net.minecraft.world.chunk.ChunkStatus.method_20613(ChunkStatus.java:146)
	at net.minecraft.world.chunk.ChunkStatus.runGenerationTask(ChunkStatus.java:289)
	at net.minecraft.server.world.ThreadedAnvilChunkStorage.method_17225(ThreadedAnvilChunkStorage.java:605)
	at com.mojang.datafixers.util.Either$Left.map(Either.java:38)
	at net.minecraft.server.world.ThreadedAnvilChunkStorage.method_17224(ThreadedAnvilChunkStorage.java:599)
	at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1150)
	at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482)
	at net.minecraft.server.world.ChunkTaskPrioritySystem.method_17634(ChunkTaskPrioritySystem.java:58)
	at net.minecraft.util.thread.TaskExecutor.runNext(TaskExecutor.java:91)
	at net.minecraft.util.thread.TaskExecutor.runWhile(TaskExecutor.java:146)
	at net.minecraft.util.thread.TaskExecutor.run(TaskExecutor.java:102)
commented

Fixed as of 9fe8ac7
Forgot to implement the spawnEntity method in ChunkRegion.