MUYUTwilighter / saplanting_fabric

A fabric mod that automatically plant sapling drops in minecraft games.
MIT License
6 stars 0 forks source link

Throws an error with sapplings from BetterEnd in 1.18.2 #13

Closed HaXrDEV closed 11 months ago

HaXrDEV commented 1 year ago

Error: https://mclo.gs/gCm3kld

saplanting-fabric-1.18.2-1.2.4 better-end-1.1.1 Fabric loader 0.14.21

MUYUTwilighter commented 11 months ago

In short

  1. If no other trouble, you can ignore.
  2. Not fully on my side.

In detail:

Errors that start with "Some Errors occurred during planting this item:" means something not good has happened, but the mod Saplanting had catched these errors and deal with it with specific procedures(mentioned below). Which means if this error is not bringing troubles to you, it's OK to just ignore the error.

Anyway, since a detailed traceback is provided, I'll try to explain the error. Interface cool.muyucloud.saplanting.mixin.SaplingGeneratorAccessor is a Mixin-class used to provide access to some information about a sapling. In your case, method getTreeFeature is used to figure out what kind of shape the sapling(s) need to be placed so that the sapling(s) can grow (For example, dark-oak saplings cannot grow unless they're placed in shape of 2x2). Additionally, this method relies on a class member treeFeature maintained by class SaplingBlock, which used to tell Minecraft some properties of a conversion from a sapling to a tree (like conditions to grow a tree, what kind of tree to grow). If this member is null, the Mixin class will throw an exception which cannot be expected until the mod invoke this method.

I've also experienced the mod Better End in some mod packs I like. I'd experienced these errors so I've checked the source code and found some reasons why some modders(not to any specific modder) didn't implement the member.

  1. They leave it null because the mod they make is incomplete and haven't included a tree feature to tell Minecraft what kind of tree to grow, which would also be unable to tell the mod Saplanting how many saplings is required.
  2. They seemed to be unwilling to use Mojang's classes to achieve some features they want, like BYG mentioned in issue #12. What I mean is that it's fantastic for all modders to achieve features via their brilliant codes, but it is a problem for me because I cannot predict all the classes created by modders from all over the world and learn how to figure out what kind of shape the sapling(s) needs to be placed from these classes.

However, mod Saplanting has a universal procedures to deal with all kinds of exceptions occurring when try to plant a sapling.

  1. A try-catch structure surrounds the whole process of planting an sapling-item.
  2. If any exceptions are catched during planting, this specific sapling-item instance will be marked containsError. All the instances with this mark will be excluded from planting. But any form of regeneration will remove the mark. (And of course, an exception and some info will be printed in log)
  3. By default, if errors occurred during planting a type of a sapling, the ID of the type will be automatically recorded in a black list, which means all sapling of this type will be ignored by the mod Saplanting. This feature can be disabled by configuring. So, it's more likely you will only witness the error once for each type of sapling.