@Override public void addMerchantRecipe(MC_MerchantRecipe recipe) { Field field = ReflectionAPI.getField(this.villager.getClass(), "br", true); MerchantRecipeList recipes = (MerchantRecipeList) ReflectionAPI.getValue(this.villager, field); recipes.add((MerchantRecipe) recipe.toMerchantRecipeNms()); ReflectionAPI.setValue(this.villager, field, recipes); }
@Override public void setMerchantRecipe(List<MC_MerchantRecipe> recipes) { MerchantRecipeList nms_recipes = new MerchantRecipeList(); for (MC_MerchantRecipe recipe : recipes) { nms_recipes.add((MerchantRecipe) recipe.toMerchantRecipeNms()); } ReflectionAPI.setValue( this.villager, ReflectionAPI.getField(this.villager.getClass(), "br", true), nms_recipes); }