Compare commits
	
		
			No commits in common. "b44c9abf8ea06b79ba72aea6712dada5f6f1beb4" and "8aa8895c52317a137ede1b2bf2bbd57fbb5179d6" have entirely different histories.
		
	
	
		
			b44c9abf8e
			...
			8aa8895c52
		
	
		
@ -2,7 +2,6 @@ package me.parsell.glowstonewire;
 | 
			
		||||
 | 
			
		||||
import me.parsell.glowstonewire.core.glowBlocks;
 | 
			
		||||
import me.parsell.glowstonewire.core.glowItems;
 | 
			
		||||
import me.parsell.glowstonewire.core.glowLootTables;
 | 
			
		||||
import me.parsell.glowstonewire.core.glowRecipes;
 | 
			
		||||
import me.shedaniel.autoconfig.AutoConfig;
 | 
			
		||||
import me.shedaniel.autoconfig.serializer.GsonConfigSerializer;
 | 
			
		||||
@ -20,6 +19,5 @@ public class GlowstoneWire implements ModInitializer {
 | 
			
		||||
    	glowBlocks.init();
 | 
			
		||||
    	glowItems.init();
 | 
			
		||||
		glowRecipes.init();
 | 
			
		||||
		glowLootTables.init();
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -5,6 +5,7 @@ import me.shedaniel.autoconfig.annotation.Config;
 | 
			
		||||
 | 
			
		||||
@Config(name = "GlowstoneWire")
 | 
			
		||||
public class GlowstoneWireConfig implements ConfigData{
 | 
			
		||||
    public boolean addConversionRecipes = true;
 | 
			
		||||
    public boolean addPotionRecipes = true;
 | 
			
		||||
    public boolean replaceGlowstoneDrop = true;
 | 
			
		||||
    public boolean addConversionRecipe = true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -19,5 +19,18 @@ 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);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,127 +0,0 @@
 | 
			
		||||
package me.parsell.glowstonewire.core;
 | 
			
		||||
 | 
			
		||||
import com.google.gson.JsonArray;
 | 
			
		||||
import com.google.gson.JsonObject;
 | 
			
		||||
 | 
			
		||||
import me.parsell.glowstonewire.GlowstoneWire;
 | 
			
		||||
 | 
			
		||||
public class glowLootTables {
 | 
			
		||||
    public static JsonObject glowstonelootTable;
 | 
			
		||||
 | 
			
		||||
    public static void init(){
 | 
			
		||||
      if(GlowstoneWire.CONFIG.replaceGlowstoneDrop) {
 | 
			
		||||
        JsonObject explosion;
 | 
			
		||||
        JsonObject limitValues, limit;
 | 
			
		||||
        JsonObject bonus, parametersValues;
 | 
			
		||||
        JsonObject count, countValues;
 | 
			
		||||
        JsonArray secondItemArray;
 | 
			
		||||
        JsonObject secondItem;
 | 
			
		||||
    
 | 
			
		||||
        JsonObject levelsValues, silktouch;
 | 
			
		||||
        JsonArray enchantmentsArray;
 | 
			
		||||
        JsonObject enchantments, match;
 | 
			
		||||
        JsonArray firstItemArray;
 | 
			
		||||
        JsonObject firstItem;
 | 
			
		||||
    
 | 
			
		||||
        JsonArray alternativesArray;
 | 
			
		||||
        JsonObject alternatives;
 | 
			
		||||
    
 | 
			
		||||
        JsonArray rollsArray;
 | 
			
		||||
        JsonObject rolls;
 | 
			
		||||
    
 | 
			
		||||
        JsonArray lootPoolsArray;
 | 
			
		||||
 | 
			
		||||
        explosion = new JsonObject();
 | 
			
		||||
        explosion.addProperty("function", "minecraft:explosion_decay");
 | 
			
		||||
 | 
			
		||||
        limit = new JsonObject();
 | 
			
		||||
        limit.addProperty("function", "minecraft:limit_count");
 | 
			
		||||
        limitValues = new JsonObject();
 | 
			
		||||
        limitValues.addProperty("max", 4);
 | 
			
		||||
        limitValues.addProperty("min", 1);
 | 
			
		||||
        limit.add("limit", limitValues);
 | 
			
		||||
 | 
			
		||||
        bonus = new JsonObject();
 | 
			
		||||
        bonus.addProperty("function", "minecraft:apply_bonus");
 | 
			
		||||
        bonus.addProperty("enchantment", "minecraft:fortune");
 | 
			
		||||
        bonus.addProperty("formula", "minecraft:uniform_bonus_count");
 | 
			
		||||
        parametersValues = new JsonObject();
 | 
			
		||||
        parametersValues.addProperty("bonusMultiplier", 1);
 | 
			
		||||
        bonus.add("parameters", parametersValues);
 | 
			
		||||
 | 
			
		||||
        count = new JsonObject();
 | 
			
		||||
        count.addProperty("function", "minecraft:set_count");
 | 
			
		||||
        countValues = new JsonObject();
 | 
			
		||||
        countValues.addProperty("min", 2.0);
 | 
			
		||||
        countValues.addProperty("max", 4.0);
 | 
			
		||||
        countValues.addProperty("type", "minecraft:uniform");
 | 
			
		||||
        count.add("count", countValues);
 | 
			
		||||
 | 
			
		||||
        secondItemArray = new JsonArray();
 | 
			
		||||
        secondItemArray.add(count);
 | 
			
		||||
        secondItemArray.add(bonus);
 | 
			
		||||
        secondItemArray.add(limit);
 | 
			
		||||
        secondItemArray.add(explosion);
 | 
			
		||||
 | 
			
		||||
        secondItem = new JsonObject();
 | 
			
		||||
        secondItem.addProperty("type", "minecraft:item");
 | 
			
		||||
        secondItem.add("functions", secondItemArray);
 | 
			
		||||
        secondItem.addProperty("name", "glowstonewire:glowstone_dust");
 | 
			
		||||
 | 
			
		||||
        //
 | 
			
		||||
 | 
			
		||||
        levelsValues = new JsonObject();
 | 
			
		||||
        levelsValues.addProperty("min", 1);
 | 
			
		||||
        silktouch = new JsonObject();
 | 
			
		||||
        silktouch.addProperty("enchantment", "minecraft:silk_touch");
 | 
			
		||||
        silktouch.add("levels", levelsValues);
 | 
			
		||||
 | 
			
		||||
        enchantmentsArray = new JsonArray();
 | 
			
		||||
        enchantmentsArray.add(silktouch);
 | 
			
		||||
        enchantments = new JsonObject();
 | 
			
		||||
        enchantments.add("enchantments", enchantmentsArray);
 | 
			
		||||
 | 
			
		||||
        match = new JsonObject();
 | 
			
		||||
        match.addProperty("condition", "minecraft:match_tool");
 | 
			
		||||
        match.add("predicate", enchantments);
 | 
			
		||||
 | 
			
		||||
        firstItemArray = new JsonArray();
 | 
			
		||||
        firstItemArray.add(match);
 | 
			
		||||
        
 | 
			
		||||
        firstItem = new JsonObject();
 | 
			
		||||
        firstItem.addProperty("type", "minecraft:item");
 | 
			
		||||
        firstItem.add("conditions", firstItemArray);
 | 
			
		||||
        firstItem.addProperty("name", "minecraft:glowstone");
 | 
			
		||||
 | 
			
		||||
        //
 | 
			
		||||
 | 
			
		||||
        alternativesArray = new JsonArray();
 | 
			
		||||
        alternativesArray.add(firstItem);
 | 
			
		||||
        alternativesArray.add(secondItem);
 | 
			
		||||
 | 
			
		||||
        alternatives = new JsonObject();
 | 
			
		||||
        alternatives.addProperty("type", "minecraft:alternatives");
 | 
			
		||||
        alternatives.add("children", alternativesArray);
 | 
			
		||||
 | 
			
		||||
        //
 | 
			
		||||
 | 
			
		||||
        rollsArray = new JsonArray();
 | 
			
		||||
        rollsArray.add(alternatives);
 | 
			
		||||
 | 
			
		||||
        rolls = new JsonObject();
 | 
			
		||||
        rolls.addProperty("rolls", 1);
 | 
			
		||||
        rolls.add("entries", rollsArray);
 | 
			
		||||
 | 
			
		||||
        //
 | 
			
		||||
 | 
			
		||||
        lootPoolsArray = new JsonArray();
 | 
			
		||||
        lootPoolsArray.add(rolls);
 | 
			
		||||
 | 
			
		||||
        glowstonelootTable = new JsonObject();
 | 
			
		||||
        glowstonelootTable.addProperty("type", "minecraft:block");
 | 
			
		||||
        glowstonelootTable.add("pools", lootPoolsArray);
 | 
			
		||||
 | 
			
		||||
        System.out.println(glowstonelootTable.toString());
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -4,33 +4,15 @@ 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(){
 | 
			
		||||
        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
 | 
			
		||||
        // Vanilla Glowstone -> Modded Glowstone
 | 
			
		||||
        if(GlowstoneWire.CONFIG.addConversionRecipe || true) {
 | 
			
		||||
            // This is the json objects
 | 
			
		||||
            JsonObject cIngredientVanilla = new JsonObject();
 | 
			
		||||
            JsonObject CIngredientModded = new JsonObject();
 | 
			
		||||
            JsonArray cIngredientsList = new JsonArray();
 | 
			
		||||
@ -40,11 +22,14 @@ 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);
 | 
			
		||||
 | 
			
		||||
@ -53,13 +38,19 @@ 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());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,20 +0,0 @@
 | 
			
		||||
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();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -1,27 +0,0 @@
 | 
			
		||||
package me.parsell.glowstonewire.mixin;
 | 
			
		||||
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.google.gson.JsonElement;
 | 
			
		||||
 | 
			
		||||
import org.spongepowered.asm.mixin.Mixin;
 | 
			
		||||
import org.spongepowered.asm.mixin.injection.At;
 | 
			
		||||
import org.spongepowered.asm.mixin.injection.Inject;
 | 
			
		||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
 | 
			
		||||
 | 
			
		||||
import me.parsell.glowstonewire.GlowstoneWire;
 | 
			
		||||
import me.parsell.glowstonewire.core.glowLootTables;
 | 
			
		||||
import net.minecraft.loot.LootManager;
 | 
			
		||||
import net.minecraft.resource.ResourceManager;
 | 
			
		||||
import net.minecraft.util.Identifier;
 | 
			
		||||
import net.minecraft.util.profiler.Profiler;
 | 
			
		||||
 | 
			
		||||
@Mixin(LootManager.class)
 | 
			
		||||
public class LootManagerInjector {
 | 
			
		||||
    @Inject(method = "apply", at = @At("HEAD"))
 | 
			
		||||
    public void interceptApply(Map<Identifier, JsonElement> map, ResourceManager resourceManager, Profiler profiler, CallbackInfo info) {
 | 
			
		||||
        if (GlowstoneWire.CONFIG.replaceGlowstoneDrop) {
 | 
			
		||||
            map.put(new Identifier("minecraft", "glowstone"), glowLootTables.glowstonelootTable);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -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.addConversionRecipes) {
 | 
			
		||||
        if (GlowstoneWire.CONFIG.addConversionRecipe) {
 | 
			
		||||
            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);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -1,19 +0,0 @@
 | 
			
		||||
{
 | 
			
		||||
    "type": "minecraft:block",
 | 
			
		||||
    "pools": [
 | 
			
		||||
      {
 | 
			
		||||
        "rolls": 1,
 | 
			
		||||
        "entries": [
 | 
			
		||||
          {
 | 
			
		||||
            "type": "minecraft:item",
 | 
			
		||||
            "name": "glowstonewire:glowstone_dust"
 | 
			
		||||
          }
 | 
			
		||||
        ],
 | 
			
		||||
        "conditions": [
 | 
			
		||||
          {
 | 
			
		||||
            "condition": "minecraft:survives_explosion"
 | 
			
		||||
          }
 | 
			
		||||
        ]
 | 
			
		||||
      }
 | 
			
		||||
    ]
 | 
			
		||||
  }
 | 
			
		||||
@ -1,15 +0,0 @@
 | 
			
		||||
{
 | 
			
		||||
    "type": "minecraft:crafting_shaped",
 | 
			
		||||
    "pattern": [
 | 
			
		||||
      "##",
 | 
			
		||||
      "##"
 | 
			
		||||
    ],
 | 
			
		||||
    "key": {
 | 
			
		||||
      "#": {
 | 
			
		||||
        "item": "glowstonewire:glowstone_dust"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "result": {
 | 
			
		||||
      "item": "minecraft:glowstone"
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
@ -1,20 +0,0 @@
 | 
			
		||||
{
 | 
			
		||||
    "type": "minecraft:crafting_shaped",
 | 
			
		||||
    "pattern": [
 | 
			
		||||
      " # ",
 | 
			
		||||
      "#X#",
 | 
			
		||||
      " # "
 | 
			
		||||
    ],
 | 
			
		||||
    "key": {
 | 
			
		||||
      "#": {
 | 
			
		||||
        "item": "glowstonewire:glowstone_dust"
 | 
			
		||||
      },
 | 
			
		||||
      "X": {
 | 
			
		||||
        "item": "minecraft:arrow"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "result": {
 | 
			
		||||
      "item": "minecraft:spectral_arrow",
 | 
			
		||||
      "count": 2
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
@ -7,9 +7,7 @@
 | 
			
		||||
  ],
 | 
			
		||||
  "client": [
 | 
			
		||||
    "BrewingRecipeRegistryInvoker",
 | 
			
		||||
    "RecipeManagerInjector",
 | 
			
		||||
    "LootManagerInjector",
 | 
			
		||||
    "FireworkStarRecipeAccessor"
 | 
			
		||||
    "RecipeManagerInjector"
 | 
			
		||||
  ],
 | 
			
		||||
  "injectors": {
 | 
			
		||||
    "defaultRequire": 1
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user