Skip to content

Commit 72ab0df

Browse files
committed
rks server crash attempt.
1 parent d05386f commit 72ab0df

File tree

1 file changed

+8
-10
lines changed
  • common/src/main/java/generations/gg/generations/core/generationscore/common/world/level/block/entities

1 file changed

+8
-10
lines changed

common/src/main/java/generations/gg/generations/core/generationscore/common/world/level/block/entities/RksMachineBlockEntity.kt

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -225,15 +225,14 @@ open class RksMachineBlockEntity(pos: BlockPos, state: BlockState) :
225225
.map { a: RecipeHolder<*> -> a as RecipeHolder<RksRecipe> }
226226
}
227227

228-
private val result: Optional<ItemStack>
228+
private val result: ItemStack
229229
get() {
230-
val maybe_result = currentRecipe.map { recipe: RecipeHolder<RksRecipe> ->
230+
return server()?.registryAccess()?.let { server -> currentRecipe.map { recipe: RecipeHolder<RksRecipe> ->
231231
recipe.value().assemble(
232-
craftingInput, server()!!.registryAccess()
233-
)
234-
}
235-
236-
return Optional.of(maybe_result.orElse(ItemStack.EMPTY))
232+
craftingInput, server
233+
)
234+
}.getOrNull()
235+
} ?: ItemStack.EMPTY
237236
}
238237

239238
protected fun canSmelt(result: ItemStack, recipe: RksRecipe): Boolean {
@@ -357,10 +356,9 @@ open class RksMachineBlockEntity(pos: BlockPos, state: BlockState) :
357356
val flag1 = false
358357

359358
if (tile.isToggled) {
360-
val result = tile.result.orElse(ItemStack.EMPTY)
359+
val result = tile.result;
361360

362-
val recipe =
363-
tile.currentRecipe
361+
val recipe = tile.currentRecipe
364362

365363
if (recipe.isPresent && (!tile.isInputEmpty)) {
366364
if (tile.canSmelt(result, recipe.get().value())) {

0 commit comments

Comments
 (0)