Compare commits
	
		
			No commits in common. "8aa8895c52317a137ede1b2bf2bbd57fbb5179d6" and "0ab7da3ff032e396b04e56fc4a65865a72af2450" have entirely different histories.
		
	
	
		
			8aa8895c52
			...
			0ab7da3ff0
		
	
		
@ -16,7 +16,6 @@ repositories {
 | 
			
		||||
	// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
 | 
			
		||||
	// See https://docs.gradle.org/current/userguide/declaring_repositories.html
 | 
			
		||||
	// for more information about repositories.
 | 
			
		||||
	maven{url "https://maven.shedaniel.me/"}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
dependencies {
 | 
			
		||||
@ -29,9 +28,7 @@ dependencies {
 | 
			
		||||
	modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
 | 
			
		||||
 | 
			
		||||
	// Custom API's
 | 
			
		||||
	modApi ("me.shedaniel.cloth:cloth-config-fabric:4.11.26") {
 | 
			
		||||
		exclude(group: "net.fabricmc.fabric-api")
 | 
			
		||||
	}
 | 
			
		||||
	implementation "me.zeroeightsix:fiber:${project.fiber_version}"
 | 
			
		||||
 | 
			
		||||
	// PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs.
 | 
			
		||||
	// You may need to force-disable transitiveness on them.
 | 
			
		||||
 | 
			
		||||
@ -15,3 +15,4 @@ org.gradle.jvmargs=-Xmx1G
 | 
			
		||||
# Dependencies
 | 
			
		||||
	# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
 | 
			
		||||
	fabric_version=0.32.5+1.16
 | 
			
		||||
	fiber_version =0.23.0-2
 | 
			
		||||
 | 
			
		||||
@ -2,22 +2,14 @@ package me.parsell.glowstonewire;
 | 
			
		||||
 | 
			
		||||
import me.parsell.glowstonewire.core.glowBlocks;
 | 
			
		||||
import me.parsell.glowstonewire.core.glowItems;
 | 
			
		||||
import me.parsell.glowstonewire.core.glowRecipes;
 | 
			
		||||
import me.shedaniel.autoconfig.AutoConfig;
 | 
			
		||||
import me.shedaniel.autoconfig.serializer.GsonConfigSerializer;
 | 
			
		||||
import net.fabricmc.api.ModInitializer;
 | 
			
		||||
 | 
			
		||||
public class GlowstoneWire implements ModInitializer {
 | 
			
		||||
	public static final String MODID = "glowstonewire";
 | 
			
		||||
	public static GlowstoneWireConfig CONFIG;
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public void onInitialize() {
 | 
			
		||||
		AutoConfig.register(GlowstoneWireConfig.class, GsonConfigSerializer::new);
 | 
			
		||||
		CONFIG = AutoConfig.getConfigHolder(GlowstoneWireConfig.class).getConfig();
 | 
			
		||||
 | 
			
		||||
    	glowBlocks.init();
 | 
			
		||||
    	glowItems.init();
 | 
			
		||||
		glowRecipes.init();
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,11 +0,0 @@
 | 
			
		||||
package me.parsell.glowstonewire;
 | 
			
		||||
 | 
			
		||||
import me.shedaniel.autoconfig.ConfigData;
 | 
			
		||||
import me.shedaniel.autoconfig.annotation.Config;
 | 
			
		||||
 | 
			
		||||
@Config(name = "GlowstoneWire")
 | 
			
		||||
public class GlowstoneWireConfig implements ConfigData{
 | 
			
		||||
    public boolean addPotionRecipes = true;
 | 
			
		||||
    public boolean replaceGlowstoneDrop = true;
 | 
			
		||||
    public boolean addConversionRecipe = true;
 | 
			
		||||
}
 | 
			
		||||
@ -70,9 +70,9 @@ public class GlowstoneWireBlock extends Block{
 | 
			
		||||
 | 
			
		||||
	private static boolean hasConnection(BlockState state) {
 | 
			
		||||
		return ((GlowWireConnection)state.get(WIRE_CONNECTION_NORTH)).isConnected() || 
 | 
			
		||||
				((GlowWireConnection)state.get(WIRE_CONNECTION_SOUTH)).isConnected() ||
 | 
			
		||||
				((GlowWireConnection)state.get(WIRE_CONNECTION_EAST)).isConnected() ||
 | 
			
		||||
				((GlowWireConnection)state.get(WIRE_CONNECTION_WEST)).isConnected();
 | 
			
		||||
					((GlowWireConnection)state.get(WIRE_CONNECTION_SOUTH)).isConnected() ||
 | 
			
		||||
					((GlowWireConnection)state.get(WIRE_CONNECTION_EAST)).isConnected() ||
 | 
			
		||||
					((GlowWireConnection)state.get(WIRE_CONNECTION_WEST)).isConnected();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	private BlockState determineState(WorldAccess world, BlockState state, BlockPos pos){
 | 
			
		||||
@ -85,18 +85,17 @@ public class GlowstoneWireBlock extends Block{
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	private GlowWireConnection determineConnection(WorldAccess world, BlockPos pos, Direction direction){
 | 
			
		||||
		BlockPos offsetPos = pos.offset(direction);
 | 
			
		||||
		if((world.getBlockState(offsetPos.up()).isOf(this) && world.isAir(pos.up()))) // If offset+up is me && if up is air
 | 
			
		||||
			if(!world.getBlockState(offsetPos.up()).get(DIRECTION_TO_WIRE_CONNECTION.get(direction.getOpposite())).isBroken()) //if offset+up is not broken
 | 
			
		||||
				if(world.getBlockState(offsetPos).hasSidedTransparency())	
 | 
			
		||||
		if((world.getBlockState(pos.offset(direction).up()).isOf(this) && world.isAir(pos.up()))) // If offset+up is me && if up is air
 | 
			
		||||
			if(!world.getBlockState(pos.offset(direction).up()).get(DIRECTION_TO_WIRE_CONNECTION.get(direction.getOpposite())).isBroken()) //if offset+up is not broken
 | 
			
		||||
				if(world.getBlockState(pos.offset(direction)).hasSidedTransparency())	
 | 
			
		||||
					return GlowWireConnection.SIDE;
 | 
			
		||||
				else	
 | 
			
		||||
					return GlowWireConnection.UP;
 | 
			
		||||
		if(world.getBlockState(offsetPos.down()).isOf(this) && world.isAir(offsetPos)) // if offset+down is me && if offset is air
 | 
			
		||||
			if(!world.getBlockState(offsetPos.down()).get(DIRECTION_TO_WIRE_CONNECTION.get(direction.getOpposite())).isBroken()) //if offset+down is not broken
 | 
			
		||||
		if(world.getBlockState(pos.offset(direction).down()).isOf(this) && world.isAir(pos.offset(direction))) // if offset+down is me && if offset is air
 | 
			
		||||
			if(!world.getBlockState(pos.offset(direction).down()).get(DIRECTION_TO_WIRE_CONNECTION.get(direction.getOpposite())).isBroken()) //if offset+down is not broken
 | 
			
		||||
				return GlowWireConnection.SIDE;		
 | 
			
		||||
		if(world.getBlockState(offsetPos).isOf(this)) // if offset is me
 | 
			
		||||
			if(!world.getBlockState(offsetPos).get(DIRECTION_TO_WIRE_CONNECTION.get(direction.getOpposite())).isBroken()) // if offset is not broken
 | 
			
		||||
		if(world.getBlockState(pos.offset(direction)).isOf(this)) // if offset is me
 | 
			
		||||
			if(!world.getBlockState(pos.offset(direction)).get(DIRECTION_TO_WIRE_CONNECTION.get(direction.getOpposite())).isBroken()) // if offset is not broken
 | 
			
		||||
				return GlowWireConnection.SIDE;
 | 
			
		||||
		return GlowWireConnection.NONE;
 | 
			
		||||
	}
 | 
			
		||||
@ -109,9 +108,9 @@ public class GlowstoneWireBlock extends Block{
 | 
			
		||||
	public VoxelShape determineVoxelShape(BlockState state){
 | 
			
		||||
		VoxelShape voxelShape = DOT_VOXELSHAPE;
 | 
			
		||||
 | 
			
		||||
		Iterator dirItr = Direction.Type.HORIZONTAL.iterator();
 | 
			
		||||
		while(dirItr.hasNext()) {
 | 
			
		||||
		   Direction direction = (Direction)dirItr.next();
 | 
			
		||||
		Iterator dirItr1 = Direction.Type.HORIZONTAL.iterator();
 | 
			
		||||
		while(dirItr1.hasNext()) {
 | 
			
		||||
		   Direction direction = (Direction)dirItr1.next();
 | 
			
		||||
		   GlowWireConnection wireConnection = state.get(DIRECTION_TO_WIRE_CONNECTION.get(direction));
 | 
			
		||||
		   if(state.equals(this.getDefaultState().with(DIRECTION_TO_WIRE_CONNECTION.get(direction), GlowWireConnection.SIDE))) {
 | 
			
		||||
				voxelShape = VoxelShapes.union(voxelShape, (VoxelShape)DIRECTION_HITBOX.get(direction));
 | 
			
		||||
 | 
			
		||||
@ -1,7 +1,7 @@
 | 
			
		||||
package me.parsell.glowstonewire.core;
 | 
			
		||||
 | 
			
		||||
import me.parsell.glowstonewire.GlowstoneWire;
 | 
			
		||||
import me.parsell.glowstonewire.mixin.BrewingRecipeRegistryInvoker;
 | 
			
		||||
import me.parsell.glowstonewire.mixin.BrewingRecipeRegistryAccessor;
 | 
			
		||||
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
 | 
			
		||||
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
 | 
			
		||||
import net.minecraft.item.BlockItem;
 | 
			
		||||
@ -20,17 +20,25 @@ 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);
 | 
			
		||||
    // Modded Glowstone Potion Recipes
 | 
			
		||||
    // TODO: IF "replace" or "both" config is set
 | 
			
		||||
    if (true) {
 | 
			
		||||
      BrewingRecipeRegistryAccessor.registerPotionRecipe(Potions.WATER, GLOWSTONE_DUST, Potions.THICK);
 | 
			
		||||
      BrewingRecipeRegistryAccessor.registerPotionRecipe(Potions.LEAPING, GLOWSTONE_DUST, Potions.STRONG_LEAPING);
 | 
			
		||||
      BrewingRecipeRegistryAccessor.registerPotionRecipe(Potions.SLOWNESS, GLOWSTONE_DUST, Potions.STRONG_SLOWNESS);
 | 
			
		||||
      BrewingRecipeRegistryAccessor.registerPotionRecipe(Potions.TURTLE_MASTER, GLOWSTONE_DUST, Potions.STRONG_TURTLE_MASTER);
 | 
			
		||||
      BrewingRecipeRegistryAccessor.registerPotionRecipe(Potions.SWIFTNESS, GLOWSTONE_DUST, Potions.STRONG_SWIFTNESS);
 | 
			
		||||
      BrewingRecipeRegistryAccessor.registerPotionRecipe(Potions.HEALING, GLOWSTONE_DUST, Potions.STRONG_HEALING);
 | 
			
		||||
      BrewingRecipeRegistryAccessor.registerPotionRecipe(Potions.HARMING, GLOWSTONE_DUST, Potions.STRONG_HARMING);
 | 
			
		||||
      BrewingRecipeRegistryAccessor.registerPotionRecipe(Potions.POISON, GLOWSTONE_DUST, Potions.STRONG_POISON);
 | 
			
		||||
      BrewingRecipeRegistryAccessor.registerPotionRecipe(Potions.REGENERATION, GLOWSTONE_DUST, Potions.STRONG_REGENERATION);
 | 
			
		||||
      BrewingRecipeRegistryAccessor.registerPotionRecipe(Potions.STRENGTH, GLOWSTONE_DUST, Potions.STRONG_STRENGTH);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
    // Vanilla Glowstone -> Modded Glowstone
 | 
			
		||||
    // TODO: IF "convert" or "both" config is set
 | 
			
		||||
    if(true) {
 | 
			
		||||
      
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,56 +0,0 @@
 | 
			
		||||
package me.parsell.glowstonewire.core;
 | 
			
		||||
 | 
			
		||||
import com.google.gson.JsonArray;
 | 
			
		||||
import com.google.gson.JsonObject;
 | 
			
		||||
 | 
			
		||||
import me.parsell.glowstonewire.GlowstoneWire;
 | 
			
		||||
 | 
			
		||||
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
 | 
			
		||||
            JsonObject cIngredientVanilla = new JsonObject();
 | 
			
		||||
            JsonObject CIngredientModded = new JsonObject();
 | 
			
		||||
            JsonArray cIngredientsList = new JsonArray();
 | 
			
		||||
    
 | 
			
		||||
            cIngredientVanilla.addProperty("item", "minecraft:glowstone_dust");
 | 
			
		||||
            CIngredientModded.addProperty("item", "glowstonewire:glowstone_dust");
 | 
			
		||||
 | 
			
		||||
            // 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);
 | 
			
		||||
 | 
			
		||||
            // Clearing out the old array for new
 | 
			
		||||
            cIngredientsList = new JsonArray();
 | 
			
		||||
    
 | 
			
		||||
            // 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());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -8,7 +8,7 @@ import net.minecraft.potion.Potion;
 | 
			
		||||
import net.minecraft.recipe.BrewingRecipeRegistry;
 | 
			
		||||
 | 
			
		||||
@Mixin(BrewingRecipeRegistry.class)
 | 
			
		||||
public interface BrewingRecipeRegistryInvoker {
 | 
			
		||||
public interface BrewingRecipeRegistryAccessor {
 | 
			
		||||
    @Invoker("registerPotionRecipe")
 | 
			
		||||
    public static void registerPotionRecipe(Potion input, Item item, Potion output) {
 | 
			
		||||
        throw new AssertionError();
 | 
			
		||||
@ -1,28 +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.glowRecipes;
 | 
			
		||||
import net.minecraft.recipe.RecipeManager;
 | 
			
		||||
import net.minecraft.resource.ResourceManager;
 | 
			
		||||
import net.minecraft.util.Identifier;
 | 
			
		||||
import net.minecraft.util.profiler.Profiler;
 | 
			
		||||
 | 
			
		||||
@Mixin(RecipeManager.class)
 | 
			
		||||
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) {
 | 
			
		||||
            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);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -26,7 +26,6 @@
 | 
			
		||||
    ]
 | 
			
		||||
  },
 | 
			
		||||
  "mixins": [
 | 
			
		||||
    "glowstonewire.mixins.json"
 | 
			
		||||
  ],
 | 
			
		||||
 | 
			
		||||
  "depends": {
 | 
			
		||||
 | 
			
		||||
@ -1,15 +0,0 @@
 | 
			
		||||
{
 | 
			
		||||
  "required": true,
 | 
			
		||||
  "minVersion": "0.8",
 | 
			
		||||
  "package": "me.parsell.glowstonewire.mixin",
 | 
			
		||||
  "compatibilityLevel": "JAVA_8",
 | 
			
		||||
  "mixins": [
 | 
			
		||||
  ],
 | 
			
		||||
  "client": [
 | 
			
		||||
    "BrewingRecipeRegistryInvoker",
 | 
			
		||||
    "RecipeManagerInjector"
 | 
			
		||||
  ],
 | 
			
		||||
  "injectors": {
 | 
			
		||||
    "defaultRequire": 1
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user