This doesn't seem to work...
@ObjectHolder(MODID)
public static final Item CHAINMAIL_PLATE = null;
public ExampleMod() {
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
}
private void setup(FMLCommonSetupEvent e) {
DeferredWorkQueue.runLater(ExampleMod::doReplaceChainmailRepairMaterial);
}
private static final String OBSFUCATED_FIELD_NAME_ARMORMATERIAL_REPAIRMATERIAL = "field_200914_m";
static void doReplaceChainmailRepairMaterial() {
try {
ObfuscationReflectionHelper.setPrivateValue(
ArmorMaterial.class,
ArmorMaterial.CHAIN,
new LazyLoadBase<>(() -> Ingredient.fromItems(CHAINMAIL_PLATE)),
OBSFUCATED_FIELD_NAME_ARMORMATERIAL_REPAIRMATERIAL);
} catch(ObfuscationReflectionHelper.UnableToFindFieldException e) {
throw new RuntimeException("Could not find field ArmorMaterial.CHAIN.repairMaterial", e);
} catch(ObfuscationReflectionHelper.UnableToAccessFieldException e) {
throw new RuntimeException("Could not access field ArmorMaterial.CHAIN.repairMaterial", e);
}
}
No exceptions, it just doesn't have any effect in-game.
Full code: https://github.com/Leo40Git/CraftableChainmail/blob/1.14.4/src/main/java/adudecalledleo/craftablechainmail/CraftableChainmail.java