mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 00:38:35 +01:00
MineTweaker test..? I guess?
This commit is contained in:
parent
6ad4f39258
commit
ff741068c2
5 changed files with 153 additions and 4 deletions
|
@ -16,8 +16,8 @@ import de.ellpeck.actuallyadditions.blocks.base.BlockStair;
|
||||||
import de.ellpeck.actuallyadditions.blocks.base.BlockWallAA;
|
import de.ellpeck.actuallyadditions.blocks.base.BlockWallAA;
|
||||||
import de.ellpeck.actuallyadditions.blocks.metalists.TheMiscBlocks;
|
import de.ellpeck.actuallyadditions.blocks.metalists.TheMiscBlocks;
|
||||||
import de.ellpeck.actuallyadditions.config.values.ConfigBoolValues;
|
import de.ellpeck.actuallyadditions.config.values.ConfigBoolValues;
|
||||||
import de.ellpeck.actuallyadditions.util.CompatUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.util.ModUtil;
|
import de.ellpeck.actuallyadditions.util.ModUtil;
|
||||||
|
import de.ellpeck.actuallyadditions.util.compat.CompatUtil;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
|
|
|
@ -19,9 +19,9 @@ import de.ellpeck.actuallyadditions.items.metalists.TheFoods;
|
||||||
import de.ellpeck.actuallyadditions.items.metalists.TheMiscItems;
|
import de.ellpeck.actuallyadditions.items.metalists.TheMiscItems;
|
||||||
import de.ellpeck.actuallyadditions.material.InitArmorMaterials;
|
import de.ellpeck.actuallyadditions.material.InitArmorMaterials;
|
||||||
import de.ellpeck.actuallyadditions.material.InitToolMaterials;
|
import de.ellpeck.actuallyadditions.material.InitToolMaterials;
|
||||||
import de.ellpeck.actuallyadditions.util.CompatUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.util.ModUtil;
|
import de.ellpeck.actuallyadditions.util.ModUtil;
|
||||||
import de.ellpeck.actuallyadditions.util.Util;
|
import de.ellpeck.actuallyadditions.util.Util;
|
||||||
|
import de.ellpeck.actuallyadditions.util.compat.CompatUtil;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
|
|
|
@ -5,10 +5,10 @@
|
||||||
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||||
*
|
*
|
||||||
* © 2015 Ellpeck
|
* © 2016 Ellpeck
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.util;
|
package de.ellpeck.actuallyadditions.util.compat;
|
||||||
|
|
||||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||||
import de.ellpeck.actuallyadditions.items.ItemSeed;
|
import de.ellpeck.actuallyadditions.items.ItemSeed;
|
|
@ -0,0 +1,126 @@
|
||||||
|
/*
|
||||||
|
* This file ("Crusher.java") is part of the Actually Additions Mod for Minecraft.
|
||||||
|
* It is created and owned by Ellpeck and distributed
|
||||||
|
* under the Actually Additions License to be found at
|
||||||
|
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
||||||
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||||
|
*
|
||||||
|
* © 2016 Ellpeck
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.ellpeck.actuallyadditions.util.compat.minetweaker;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.recipe.CrusherRecipeRegistry;
|
||||||
|
import de.ellpeck.actuallyadditions.util.ItemUtil;
|
||||||
|
import minetweaker.IUndoableAction;
|
||||||
|
import minetweaker.MineTweakerAPI;
|
||||||
|
import minetweaker.api.item.IItemStack;
|
||||||
|
import minetweaker.api.minecraft.MineTweakerMC;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import stanhebben.zenscript.annotations.Optional;
|
||||||
|
import stanhebben.zenscript.annotations.ZenClass;
|
||||||
|
import stanhebben.zenscript.annotations.ZenMethod;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@ZenClass("mods.actuallyadditions.crusher")
|
||||||
|
public class Crusher{
|
||||||
|
|
||||||
|
@ZenMethod
|
||||||
|
public static void addRecipe(IItemStack input, IItemStack outputOne, @Optional IItemStack outputTwo, @Optional int outputTwoChance){
|
||||||
|
CrusherRecipeRegistry.CrusherRecipe recipe = new CrusherRecipeRegistry.CrusherRecipe(MineTweakerMC.getItemStack(input), MineTweakerMC.getItemStack(outputOne), MineTweakerMC.getItemStack(outputTwo), outputTwoChance);
|
||||||
|
MineTweakerAPI.apply(new Add(recipe));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ZenMethod
|
||||||
|
public static void removeRecipe(IItemStack outputOne){
|
||||||
|
MineTweakerAPI.apply(new Remove(MineTweakerMC.getItemStack(outputOne)));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class Add implements IUndoableAction{
|
||||||
|
|
||||||
|
private CrusherRecipeRegistry.CrusherRecipe recipe;
|
||||||
|
|
||||||
|
public Add(CrusherRecipeRegistry.CrusherRecipe recipe){
|
||||||
|
this.recipe = recipe;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void apply(){
|
||||||
|
CrusherRecipeRegistry.recipes.add(this.recipe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canUndo(){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void undo(){
|
||||||
|
CrusherRecipeRegistry.recipes.remove(this.recipe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String describe(){
|
||||||
|
return "Adding Crusher Recipe for "+this.recipe.getRecipeOutputOnes().get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String describeUndo(){
|
||||||
|
return "Removing added Crusher Recipe for "+this.recipe.getRecipeOutputOnes().get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getOverrideKey(){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class Remove implements IUndoableAction{
|
||||||
|
|
||||||
|
private final ItemStack output;
|
||||||
|
private List<CrusherRecipeRegistry.CrusherRecipe> removedRecipes = new ArrayList<CrusherRecipeRegistry.CrusherRecipe>();
|
||||||
|
|
||||||
|
public Remove(ItemStack output){
|
||||||
|
this.output = output;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void apply(){
|
||||||
|
this.removedRecipes.clear();
|
||||||
|
|
||||||
|
for(CrusherRecipeRegistry.CrusherRecipe recipe : CrusherRecipeRegistry.recipes){
|
||||||
|
if(ItemUtil.contains(recipe.getRecipeOutputOnes(), this.output, true)){
|
||||||
|
this.removedRecipes.add(recipe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CrusherRecipeRegistry.recipes.removeAll(this.removedRecipes);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canUndo(){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void undo(){
|
||||||
|
CrusherRecipeRegistry.recipes.addAll(this.removedRecipes);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String describe(){
|
||||||
|
return "Removing Crusher Recipe for "+this.output.getDisplayName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String describeUndo(){
|
||||||
|
return "Re-Adding Crusher Recipe for "+this.output.getDisplayName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getOverrideKey(){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
/*
|
||||||
|
* This file ("MineTweaker.java") is part of the Actually Additions Mod for Minecraft.
|
||||||
|
* It is created and owned by Ellpeck and distributed
|
||||||
|
* under the Actually Additions License to be found at
|
||||||
|
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
||||||
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||||
|
*
|
||||||
|
* © 2016 Ellpeck
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.ellpeck.actuallyadditions.util.compat.minetweaker;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.Loader;
|
||||||
|
import minetweaker.MineTweakerAPI;
|
||||||
|
|
||||||
|
public class MineTweaker{
|
||||||
|
|
||||||
|
public static void init(){
|
||||||
|
if(Loader.isModLoaded("MineTweaker3")){
|
||||||
|
MineTweakerAPI.registerClass(Crusher.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue