Skip to content

Commit

Permalink
move recipe tweaker out to LibCD
Browse files Browse the repository at this point in the history
  • Loading branch information
LemmaEOF committed Jun 17, 2019
1 parent d4e7011 commit 3ac5310
Show file tree
Hide file tree
Showing 17 changed files with 33 additions and 649 deletions.
5 changes: 5 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ minecraft {

repositories {
mavenCentral()
maven { url "http://server.bbkr.space:8081/artifactory/libs-snapshot/" }
maven { url "http://server.bbkr.space:8081/artifactory/libs-release/" }
}

dependencies {
Expand All @@ -45,6 +47,9 @@ dependencies {
// Fabric API. This is technically optional, but you probably want it anyway.
modCompile "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

modCompile "io.github.cottonmc:LibCD:${project.libcd_version}"
include "io.github.cottonmc:LibCD:${project.libcd_version}"

compileOnly ("com.google.code.findbugs:jsr305:3.0.2") { transitive = false }
implementation ("blue.endless:jankson:1.1.2") { transitive = false }
shadow ("blue.endless:jankson:1.1.2") { transitive = false }
Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
loader_version=0.4.8+build.154

# Mod Properties
mod_version = 0.7.5+1.14.2
mod_version = 0.7.6+1.14.2
maven_group = io.github.cottonmc
archives_base_name = cotton

# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric
fabric_version=0.3.0-pre+build.156
libcd_version=1.1.0+1.14.2
14 changes: 1 addition & 13 deletions src/main/java/io/github/cottonmc/cotton/Cotton.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,13 @@
import io.github.cottonmc.cotton.logging.ModLogger;
import io.github.cottonmc.cotton.registry.CommonTags;
import io.github.cottonmc.cotton.tweaker.*;
import io.github.cottonmc.libcd.tweaker.Tweaker;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
import net.fabricmc.fabric.api.resource.ResourceManagerHelper;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.block.Blocks;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionUtil;
import net.minecraft.potion.Potions;
import net.minecraft.resource.ResourceType;
import net.minecraft.util.Identifier;

import java.io.File;
Expand All @@ -42,14 +37,7 @@ public void onInitialize() {
//setup
PackMetaManager.saveMeta();
CottonRecipes.init();
ResourceManagerHelper.get(ResourceType.SERVER_DATA).registerReloadListener(new TweakerLoader());
Tweaker.addTweaker(CauldronTweaker.INSTANCE);
Tweaker.addTweaker(RecipeTweaker.INSTANCE);
TweakerStackGetter.registerGetter(new Identifier("minecraft", "potion"), (id) -> {
Potion potion = Potion.byId(id.toString());
if (potion == Potions.EMPTY) return ItemStack.EMPTY;
return PotionUtil.setPotion(new ItemStack(Items.POTION), potion);
});

//example config and logger code
config = ConfigManager.loadConfig(CottonConfig.class);
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
package io.github.cottonmc.cotton.mixins;

import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.JsonSyntaxException;
import io.github.cottonmc.cotton.tweaker.TweakerUtils;
import net.minecraft.item.ItemStack;
import net.minecraft.recipe.Ingredient;
import net.minecraft.util.JsonHelper;
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.CallbackInfoReturnable;

@Mixin(Ingredient.class)
public class MixinIngredient {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import java.util.Map;
import java.util.function.Predicate;

import io.github.cottonmc.cotton.impl.RecipeMapAccessor;
import net.minecraft.recipe.RecipeType;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
Expand All @@ -22,16 +21,13 @@
import net.minecraft.util.Identifier;

@Mixin(RecipeManager.class)
public class MixinRecipeManager implements RecipeMapAccessor {
public class MixinRecipeManager {
@Shadow
@Final
public static int PREFIX_LENGTH;
@Shadow
@Final
public static int SUFFIX_LENGTH;
@Shadow
@Final
private Map<RecipeType<?>, Map<Identifier, Recipe<?>>> recipeMap;

@ModifyVariable(method = "apply", at = @At(value = "INVOKE_ASSIGN", target = "Ljava/util/Collection;iterator()Ljava/util/Iterator;", ordinal = 0, remap = false))
public Iterator<Identifier> filterIterator(Iterator<Identifier> iterator) {
Expand Down Expand Up @@ -61,8 +57,4 @@ public void mixinAdd(Recipe<?> recipe, CallbackInfo info) {
}
}

@Override
public Map<RecipeType<?>, Map<Identifier, Recipe<?>>> getRecipeMap() {
return recipeMap;
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import io.github.cottonmc.cotton.cauldron.CauldronBehavior;
import io.github.cottonmc.cotton.cauldron.CauldronContext;
import io.github.cottonmc.libcd.tweaker.Tweaker;
import net.minecraft.entity.*;
import net.minecraft.entity.mob.MobEntity;
import net.minecraft.entity.player.PlayerEntity;
Expand Down
217 changes: 0 additions & 217 deletions src/main/java/io/github/cottonmc/cotton/tweaker/RecipeParser.java

This file was deleted.

Loading

0 comments on commit 3ac5310

Please sign in to comment.