IMCRegistryError Enum

🔧 Developer-Oriented Content*This page contains content directed towards other mod developers! If you are simply playing the game with the mod, this information is useless.*

This is an enum representing an error thrown during IMC with EtiMod. You will see one of these errors in a crash report sent to you by users. When one of these errors is thrown, it will terminate Forge's loading cycle. It is not possible to catch these errors as to ensure strict compliance with the API.

All of these errors are accompanied with a human-readable error message that is included in the crash log alongside these IDs.

## SUCCESS

If you are seeing this in an error report as the cause of a load termination, something has gone terribly wrong and you need to report this to Eti immediately. This is a flag used to denote that there was no error and the operation completed successfully.

## FAILURE\_INVALID\_METHOD

This occurs if your mod attempted to call an IMC method that doesn't exist. You can see a list of all valid methods here.

#### Examples of what causes this error

```
   InterModComms.sendTo("etimod", "thisIsAFakeMethodAndUsingItWontWork", ...);
   // ^ As the name implies, that method isn't valid.

```

## FAILURE\_INVALID\_ARG\_COUNT

This occurs if the string returned by your argument provider method had an unexpected amount of items separated by vertical bars `|`. The error message will tell you the amount of expected arguments vs the amount it received.

#### Examples of what causes this error

```
   InterModComms.sendTo("etimod", "setUseIfIn", () -> { return "yourmod:block|true|thisIsAnExtraArgument"; });
   // ^ Has an extra argument at the end.
   InterModComms.sendTo("etimod", "setUseIfIn", () -> { return "yourmod:block"; });
   // ^ Missing an argument

```

## FAILURE\_NULL\_ARGS

This occurs if the string returned by your argument provider method was null.

#### Examples of what causes this error

```
   InterModComms.sendTo("etimod", ..., () -> { return null; });
   // ^ Returns null instead of a valid string.

```

## FAILURE\_BLOCK\_IS\_UNOWNED

This occurs if a ResourceLocation passed into an IMC method has a domain different than your mod's ID. **Generally speaking, it is only a good idea to modify blocks *that your mod created* (hence the existence of this error).** If you think someone else's block / a vanilla block should have a different sound, contact the applicable mod creator (or Eti for vanilla blocks). If your mod overrides blocks from another mod or vanilla and you absolutely *unquestionably* must bypass this restriction, you can manually pass in the other mod's ID (see docs for InterModComms.sendTo), however this is strongly discouraged.

#### Examples of what causes this error

```
   InterModComms.sendTo("etimod", "setUseIfIn", () -> { return "rsrc|true"; });
   // ^ n.b. a ResourceLocation with no domain assumes the domain is minecraft, so this resolves to minecraft:rsrc
   // Note that it doesn't necessarily need to exist.
   InterModComms.sendTo("etimod", "setUseIfIn", () -> { return "etimod:decay_mycelium"; });
   // ^ This block is from my mod. Your mod shouldn't be messing with it.

```

## FAILURE\_INVALID\_SPIRIT\_MATERIAL

This occurs if a SpiritMaterial is passed into an argument, and it doesn't exist. For a list of valid SpiritMaterials, check this page.

#### Examples of what causes this error

```
   InterModComms.sendTo("etimod", "registerSpiritStepSound", () -> { return "yourmod:someblock|GET_REAL"; });
   // ^ GET_REAL did not get real, and is not a valid SpiritMaterial
   InterModComms.sendTo("etimod", "registerSpiritStepSound", () -> { return "yourmod:someblock|SpiritMaterial.GRASS"; });
   // ^ While "GRASS" is a valid SpiritMaterial, the method is not expecting it to be prefixed by SpiritMaterial.

```

## FAILURE\_NOT\_MATERIAL\_CLASS

This occurs if a fully-qualified field name is passed in as an argument, and the value of the field is not an instance of `net.minecraft.block.material.Material` (or `net.minecraft.world.level.material.Material` if you use official mappings).

#### Examples of what causes this error

n.b. since this relies on an actual class, this may be a bit more vague. If you use MCP, the value of the field should be created with a `Material.Builder` instance.

```
   InterModComms.sendTo("etiMod", "registerCustomMaterialSound", () -> { return "com.yourmod.block.garbage.SomeClass.FIELD_THAT_ISNT_A_MATERIAL|..."; });

```

## FAILURE\_COULD\_NOT\_RESOLVE\_CLASS

This occurs if a fully-qualified field name is passed in as an argument, and the class that the field is a member of could not be resolved.

#### Examples of what causes this error

```
   InterModComms.sendTo("etiMod", "registerCustomMaterialSound", () -> { return "com.yourmod.SomeClassThatDoesntExist.SOME_FIELD|..."; });

```

## FAILURE\_COULD\_NOT\_RESOLVE\_FIELD

This occurs if a fully-qualified field name is passed in as an argument, and while the class that the field is a member of *could* be resolved, the field itself could not.

#### Examples of what causes this error

```
   InterModComms.sendTo("etiMod", "registerCustomMaterialSound", () -> { return "com.yourmod.SomeClass.SOME_FIELD_THAT_DOESNT_EXIST|..."; });

```

## FAILURE\_FIELD\_IS\_NOT\_STATIC

This occurs if a fully-qualified field name is passed in as an argument, and both the class + field were resolvable, but the field was not static and instead relies on an instance of your class being instantiated and referenced.

#### Examples of what causes this error

```
   InterModComms.sendTo("etiMod", "registerCustomMaterialSound", () -> { return "com.yourmod.SomeClass.someInstanceField|..."; });

```

## FAILURE\_MATERIAL\_IS\_VANILLA

This occurs if a fully-qualified field name is passed in as an argument, but the field points to a vanilla material. Vanilla materials cannot be overridden as they are already defined natively.

#### Examples of what causes this error

```
   InterModComms.sendTo("etiMod", "registerCustomMaterialSound", () -> { return "net.minecraft.block.material.Material.ROCK|..."; });
   // n.b. Using this verbatim would throw FAILURE_COULD_NOT_RESOLVE_CLASS in a production environment
   //   because the actual class itself would be obfuscated.

```

## FAILURE\_MATERIAL\_IS\_NULL

This occurs if a fully-qualified field name is passed in as an argument, the field's type is correctly set to Material, but the value of this field is null.

#### Examples of what causes this error

```
   InterModComms.sendTo("etiMod", "registerCustomMaterialSound", () -> { return "com.yourmod.SomeClass.NULL_MATERIAL_GET_TROLLED_LOL|..."; });

```

## FAILURE\_MATERIAL\_FIELD\_IS\_PRIVATE\_AND\_LOCKED

This occurs if a fully-qualified field name is passed in as an argument, the field's value is correctly set to an instance of Material, but the field is private and you've attached your own security manager to your code which caused `field.setAccessible` to fail. Under most circumstances, no sane person would be able to cause this error, and if you see it you probably need to rethink your mod's code and stop being paranoid (or whatever it was that'd drive someone to implement a custom security manager). It exists only for the sake of completeness given the exceptions I must catch.

#### Examples of what causes this error

Another vague one!

```
   InterModComms.sendTo("etiMod", "registerCustomMaterialSound", () -> { return "com.yourmod.SomeClass.SOME_PRIVATE_SECURE_FIELD|..."; });

```

## FAILURE\_INVALID\_TYPE

This occurs when an argument could not be cast into a different type that was needed by the method.

#### Examples of what causes this error

```
   InterModComms.sendTo("etiMod", "setUseIfIn", () -> { return "yourmod:someblock|garbage"; });
   // ^ "garbage" is not a valid boolean value (true/false).

```

## FAILURE\_NULL\_MOD\_ID

⚠️ Deprecated Content*FAILURE\_NULL\_MOD\_ID is deprecated! It should not be used for new work.*Versions starting from ALPHA 4.6 will now drop malformed sender mod IDs with a non-fatal error in the console rather than terminating the loading cycle.
This occurs if your mod sent an explicit null parameter for the source mod ID. **Generally speaking, it's better to simply not define a custom source mod ID.**

#### Examples of what causes this error

```
   InterModComms.sendTo(null, "etimod", "method", ...);
   // ^ This is using the overload of sendTo that allows sending a custom string for the mod ID, with null in place of this string.

```

## FAILURE\_UNKNOWN\_MOD\_ID

⚠️ Deprecated Content*FAILURE\_UNKNOWN\_MOD\_ID is deprecated! It should not be used for new work.*Versions starting from ALPHA 4.6 will now drop malformed sender mod IDs with a non-fatal error in the console rather than terminating the loading cycle.
This occurs if your mod sent a bogus parameter for the source mod ID. This occurs if the user-friendly display name of your mod is queried and Forge returns a value stating that the mod ID was unrecognized. **Generally speaking, it's better to simply not define a custom source mod ID.**

#### Examples of what causes this error

```
   InterModComms.sendTo("this mod ID is fake", "etimod", "method", ...);
   // ^ Obviously that is not a valid mod ID.

```