disallow disable brewing reccipe, added firestar
This commit is contained in:
		
							parent
							
								
									8aa8895c52
								
							
						
					
					
						commit
						5a3510873b
					
				@ -5,7 +5,6 @@ import me.shedaniel.autoconfig.annotation.Config;
 | 
			
		||||
 | 
			
		||||
@Config(name = "GlowstoneWire")
 | 
			
		||||
public class GlowstoneWireConfig implements ConfigData{
 | 
			
		||||
    public boolean addPotionRecipes = true;
 | 
			
		||||
    public boolean addConversionRecipes = true;
 | 
			
		||||
    public boolean replaceGlowstoneDrop = true;
 | 
			
		||||
    public boolean addConversionRecipe = true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -19,18 +19,5 @@ public class glowItems {
 | 
			
		||||
 | 
			
		||||
  public static void init(){
 | 
			
		||||
    Registry.register(Registry.ITEM, new Identifier(GlowstoneWire.MODID, "glowstone_dust"), GLOWSTONE_DUST);
 | 
			
		||||
 | 
			
		||||
    if (GlowstoneWire.CONFIG.addPotionRecipes) {
 | 
			
		||||
      BrewingRecipeRegistryInvoker.registerPotionRecipe(Potions.WATER, GLOWSTONE_DUST, Potions.THICK);
 | 
			
		||||
      BrewingRecipeRegistryInvoker.registerPotionRecipe(Potions.LEAPING, GLOWSTONE_DUST, Potions.STRONG_LEAPING);
 | 
			
		||||
      BrewingRecipeRegistryInvoker.registerPotionRecipe(Potions.SLOWNESS, GLOWSTONE_DUST, Potions.STRONG_SLOWNESS);
 | 
			
		||||
      BrewingRecipeRegistryInvoker.registerPotionRecipe(Potions.TURTLE_MASTER, GLOWSTONE_DUST, Potions.STRONG_TURTLE_MASTER);
 | 
			
		||||
      BrewingRecipeRegistryInvoker.registerPotionRecipe(Potions.SWIFTNESS, GLOWSTONE_DUST, Potions.STRONG_SWIFTNESS);
 | 
			
		||||
      BrewingRecipeRegistryInvoker.registerPotionRecipe(Potions.HEALING, GLOWSTONE_DUST, Potions.STRONG_HEALING);
 | 
			
		||||
      BrewingRecipeRegistryInvoker.registerPotionRecipe(Potions.HARMING, GLOWSTONE_DUST, Potions.STRONG_HARMING);
 | 
			
		||||
      BrewingRecipeRegistryInvoker.registerPotionRecipe(Potions.POISON, GLOWSTONE_DUST, Potions.STRONG_POISON);
 | 
			
		||||
      BrewingRecipeRegistryInvoker.registerPotionRecipe(Potions.REGENERATION, GLOWSTONE_DUST, Potions.STRONG_REGENERATION);
 | 
			
		||||
      BrewingRecipeRegistryInvoker.registerPotionRecipe(Potions.STRENGTH, GLOWSTONE_DUST, Potions.STRONG_STRENGTH);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -4,15 +4,33 @@ import com.google.gson.JsonArray;
 | 
			
		||||
import com.google.gson.JsonObject;
 | 
			
		||||
 | 
			
		||||
import me.parsell.glowstonewire.GlowstoneWire;
 | 
			
		||||
import me.parsell.glowstonewire.mixin.BrewingRecipeRegistryInvoker;
 | 
			
		||||
import me.parsell.glowstonewire.mixin.FireworkStarRecipeAccessor;
 | 
			
		||||
import net.minecraft.item.Items;
 | 
			
		||||
import net.minecraft.potion.Potions;
 | 
			
		||||
import net.minecraft.recipe.Ingredient;
 | 
			
		||||
 | 
			
		||||
public class glowRecipes {
 | 
			
		||||
    public static JsonObject MODDED_TO_VANILLA;
 | 
			
		||||
    public static JsonObject VANILLA_TO_MODDED;
 | 
			
		||||
 | 
			
		||||
    public static void init(){
 | 
			
		||||
        // Vanilla Glowstone -> Modded Glowstone
 | 
			
		||||
        if(GlowstoneWire.CONFIG.addConversionRecipe || true) {
 | 
			
		||||
            // This is the json objects
 | 
			
		||||
        BrewingRecipeRegistryInvoker.registerPotionRecipe(Potions.WATER, glowItems.GLOWSTONE_DUST, Potions.THICK);
 | 
			
		||||
        BrewingRecipeRegistryInvoker.registerPotionRecipe(Potions.LEAPING, glowItems.GLOWSTONE_DUST, Potions.STRONG_LEAPING);
 | 
			
		||||
        BrewingRecipeRegistryInvoker.registerPotionRecipe(Potions.SLOWNESS, glowItems.GLOWSTONE_DUST, Potions.STRONG_SLOWNESS);
 | 
			
		||||
        BrewingRecipeRegistryInvoker.registerPotionRecipe(Potions.TURTLE_MASTER, glowItems.GLOWSTONE_DUST, Potions.STRONG_TURTLE_MASTER);
 | 
			
		||||
        BrewingRecipeRegistryInvoker.registerPotionRecipe(Potions.SWIFTNESS, glowItems.GLOWSTONE_DUST, Potions.STRONG_SWIFTNESS);
 | 
			
		||||
        BrewingRecipeRegistryInvoker.registerPotionRecipe(Potions.HEALING, glowItems.GLOWSTONE_DUST, Potions.STRONG_HEALING);
 | 
			
		||||
        BrewingRecipeRegistryInvoker.registerPotionRecipe(Potions.HARMING, glowItems.GLOWSTONE_DUST, Potions.STRONG_HARMING);
 | 
			
		||||
        BrewingRecipeRegistryInvoker.registerPotionRecipe(Potions.POISON, glowItems.GLOWSTONE_DUST, Potions.STRONG_POISON);
 | 
			
		||||
        BrewingRecipeRegistryInvoker.registerPotionRecipe(Potions.REGENERATION, glowItems.GLOWSTONE_DUST, Potions.STRONG_REGENERATION);
 | 
			
		||||
        BrewingRecipeRegistryInvoker.registerPotionRecipe(Potions.STRENGTH, glowItems.GLOWSTONE_DUST, Potions.STRONG_STRENGTH);
 | 
			
		||||
 | 
			
		||||
        // Manually reset the glowstone compability, since i cant find a way to read and reset.
 | 
			
		||||
        FireworkStarRecipeAccessor.setFlickerModifier(Ingredient.ofItems(Items.GLOWSTONE_DUST, glowItems.GLOWSTONE_DUST));
 | 
			
		||||
 | 
			
		||||
        if(GlowstoneWire.CONFIG.addConversionRecipes) {
 | 
			
		||||
            // Base JsonObjects
 | 
			
		||||
            JsonObject cIngredientVanilla = new JsonObject();
 | 
			
		||||
            JsonObject CIngredientModded = new JsonObject();
 | 
			
		||||
            JsonArray cIngredientsList = new JsonArray();
 | 
			
		||||
@ -22,14 +40,11 @@ public class glowRecipes {
 | 
			
		||||
 | 
			
		||||
            // FOR VANILLA TO MODDED
 | 
			
		||||
            VANILLA_TO_MODDED = new JsonObject();
 | 
			
		||||
            
 | 
			
		||||
            // Header, defining what type of crafting recipe it is
 | 
			
		||||
            VANILLA_TO_MODDED.addProperty("type", "minecraft:crafting_shapeless");
 | 
			
		||||
    
 | 
			
		||||
            // Adding the ingredients
 | 
			
		||||
            cIngredientsList.add(cIngredientVanilla);
 | 
			
		||||
            VANILLA_TO_MODDED.add("ingredients", cIngredientsList);
 | 
			
		||||
    
 | 
			
		||||
            // Adding the result
 | 
			
		||||
            VANILLA_TO_MODDED.add("result", CIngredientModded);
 | 
			
		||||
 | 
			
		||||
@ -38,19 +53,13 @@ public class glowRecipes {
 | 
			
		||||
    
 | 
			
		||||
            // FOR MODDED TO VANILLA
 | 
			
		||||
            MODDED_TO_VANILLA = new JsonObject();
 | 
			
		||||
    
 | 
			
		||||
            // Define recipe type
 | 
			
		||||
            MODDED_TO_VANILLA.addProperty("type", "minecraft:crafting_shapeless");
 | 
			
		||||
    
 | 
			
		||||
            // Add ingredients
 | 
			
		||||
            cIngredientsList.add(CIngredientModded);
 | 
			
		||||
            MODDED_TO_VANILLA.add("ingredients", cIngredientsList);
 | 
			
		||||
    
 | 
			
		||||
            // Add result
 | 
			
		||||
            MODDED_TO_VANILLA.add("result", cIngredientVanilla);
 | 
			
		||||
 | 
			
		||||
            System.out.println(MODDED_TO_VANILLA.toString());
 | 
			
		||||
            System.out.println(VANILLA_TO_MODDED.toString());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,20 @@
 | 
			
		||||
package me.parsell.glowstonewire.mixin;
 | 
			
		||||
 | 
			
		||||
import org.spongepowered.asm.mixin.Mixin;
 | 
			
		||||
import org.spongepowered.asm.mixin.gen.Accessor;
 | 
			
		||||
 | 
			
		||||
import net.minecraft.recipe.FireworkStarRecipe;
 | 
			
		||||
import net.minecraft.recipe.Ingredient;
 | 
			
		||||
 | 
			
		||||
@Mixin(FireworkStarRecipe.class)
 | 
			
		||||
public interface FireworkStarRecipeAccessor {
 | 
			
		||||
    @Accessor("FLICKER_MODIFIER")
 | 
			
		||||
    public static Ingredient getFlickerModifier(){
 | 
			
		||||
        throw new AssertionError();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Accessor("FLICKER_MODIFIER")
 | 
			
		||||
    public static void setFlickerModifier(Ingredient FLICKER_MODIFIER){
 | 
			
		||||
        throw new AssertionError();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -20,7 +20,7 @@ import net.minecraft.util.profiler.Profiler;
 | 
			
		||||
public class RecipeManagerInjector {
 | 
			
		||||
    @Inject(method = "apply", at = @At("HEAD"))
 | 
			
		||||
    public void interceptApply(Map<Identifier, JsonElement> map, ResourceManager resourceManager, Profiler profiler, CallbackInfo info) {
 | 
			
		||||
        if (GlowstoneWire.CONFIG.addConversionRecipe) {
 | 
			
		||||
        if (GlowstoneWire.CONFIG.addConversionRecipes) {
 | 
			
		||||
            map.put(new Identifier(GlowstoneWire.MODID, "glowstone_vanilla_modded"), glowRecipes.VANILLA_TO_MODDED);
 | 
			
		||||
            map.put(new Identifier(GlowstoneWire.MODID, "glowstone_modded_vanilla"), glowRecipes.MODDED_TO_VANILLA);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -7,7 +7,8 @@
 | 
			
		||||
  ],
 | 
			
		||||
  "client": [
 | 
			
		||||
    "BrewingRecipeRegistryInvoker",
 | 
			
		||||
    "RecipeManagerInjector"
 | 
			
		||||
    "RecipeManagerInjector",
 | 
			
		||||
    "FireworkStarRecipeAccessor"
 | 
			
		||||
  ],
 | 
			
		||||
  "injectors": {
 | 
			
		||||
    "defaultRequire": 1
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user