Added chisel support
This commit is contained in:
parent
1276001e05
commit
b9104b43b4
2 changed files with 139 additions and 0 deletions
|
@ -66,6 +66,7 @@ dependencies {
|
|||
deobfCompile "com.azanor.baubles:Baubles:1.12-1.5.2"
|
||||
deobfCompile "vazkii.botania:Botania:r1.10-353"
|
||||
|
||||
|
||||
deobfCompile("cofh:ThermalExpansion:1.12.2-5.+:deobf") {
|
||||
exclude group: 'mezz.jei'
|
||||
}
|
||||
|
@ -92,6 +93,7 @@ dependencies {
|
|||
deobfCompile("knightminer.tcomplement:TinkersComplement:1.12.1-0.2.1.3") {
|
||||
exclude group: 'mezz.jei'
|
||||
}
|
||||
deobfCompile "team.chisel:Chisel:MC1.12.2-0.2.0.31"
|
||||
}
|
||||
|
||||
processResources {
|
||||
|
|
137
src/main/java/com/blamejared/compat/chisel/Carving.java
Normal file
137
src/main/java/com/blamejared/compat/chisel/Carving.java
Normal file
|
@ -0,0 +1,137 @@
|
|||
package com.blamejared.compat.chisel;
|
||||
|
||||
import com.blamejared.ModTweaker;
|
||||
import com.blamejared.mtlib.utils.BaseAction;
|
||||
import crafttweaker.CraftTweakerAPI;
|
||||
import crafttweaker.annotations.*;
|
||||
import crafttweaker.api.item.IItemStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.*;
|
||||
import team.chisel.api.carving.CarvingUtils;
|
||||
|
||||
import static com.blamejared.mtlib.helpers.InputHelper.toStack;
|
||||
|
||||
@ZenRegister
|
||||
@ZenClass("mods.chisel.Carving")
|
||||
@ModOnly("chisel")
|
||||
public class Carving {
|
||||
|
||||
@ZenMethod
|
||||
public static void addGroup(String name) {
|
||||
ModTweaker.LATE_ADDITIONS.add(new ActionAddGroup(name));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addVariation(String groupName, IItemStack stack) {
|
||||
ModTweaker.LATE_ADDITIONS.add(new ActionAddVariation(groupName, toStack(stack)));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeGroup(String name) {
|
||||
ModTweaker.LATE_REMOVALS.add(new ActionRemoveGroup(name));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeVariation(String groupName, IItemStack stack) {
|
||||
ModTweaker.LATE_ADDITIONS.add(new ActionRemoveVariation(groupName, toStack(stack)));
|
||||
}
|
||||
|
||||
private static class ActionAddGroup extends BaseAction {
|
||||
|
||||
private String groupName;
|
||||
|
||||
protected ActionAddGroup(String groupName) {
|
||||
super("Carving");
|
||||
this.groupName = groupName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
if(CarvingUtils.getChiselRegistry().getSortedGroupNames().contains(groupName)) {
|
||||
CraftTweakerAPI.logError("Error trying to add a Chisel Group that already exists! Group: " + groupName);
|
||||
return;
|
||||
}
|
||||
CarvingUtils.getChiselRegistry().addGroup(CarvingUtils.getDefaultGroupFor(groupName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Adding chisel group called: " + groupName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static class ActionAddVariation extends BaseAction {
|
||||
|
||||
private String groupName;
|
||||
private ItemStack stack;
|
||||
|
||||
|
||||
protected ActionAddVariation(String groupName, ItemStack stack) {
|
||||
super("Variation");
|
||||
this.groupName = groupName;
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
CarvingUtils.getChiselRegistry().addVariation(groupName, CarvingUtils.variationFor(stack, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Adding chisel variation for group: " + groupName + " and item: " + stack;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class ActionRemoveGroup extends BaseAction {
|
||||
|
||||
private String groupName;
|
||||
|
||||
protected ActionRemoveGroup(String groupName) {
|
||||
super("Carving");
|
||||
this.groupName = groupName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
if(!CarvingUtils.getChiselRegistry().getSortedGroupNames().contains(groupName)) {
|
||||
CraftTweakerAPI.logError("Error trying to remove Chisel Group that doesn't exist! Group: " + groupName);
|
||||
return;
|
||||
}
|
||||
CarvingUtils.getChiselRegistry().removeGroup(groupName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Removing chisel group called: " + groupName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class ActionRemoveVariation extends BaseAction {
|
||||
|
||||
private String groupName;
|
||||
private ItemStack item;
|
||||
|
||||
protected ActionRemoveVariation(String groupName, ItemStack item) {
|
||||
super("Variation");
|
||||
this.groupName = groupName;
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
CarvingUtils.getChiselRegistry().removeVariation(item, groupName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Removing chisel group called: " + groupName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue