Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
friendlyhj authored Jan 31, 2020
1 parent e21801d commit 575281e
Show file tree
Hide file tree
Showing 2 changed files with 109 additions and 0 deletions.
33 changes: 33 additions & 0 deletions classes/ConditionedItemStack.zs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#priority 32767
import crafttweaker.item.IItemStack;
import crafttweaker.item.IIngredient;
import crafttweaker.item.IItemCondition;
import crafttweaker.data.IData;


zenClass ConditionedItemStack {
var stack as IItemStack = null;
zenConstructor(para as IItemStack) {
stack = para;
}
function setStack(stack as IItemStack) {
this.stack = stack;
}
function onlyEmptyTag() as IItemStack {
return this.stack.only(function(item) {
return (item.tag == {});
});
}
function withLore(para as string[]) as IItemStack {
return this.stack.only(function(item) {
val data as string = item.tag.asString();
var result as bool = true;
for i in para {
if (result) {
result &= data.contains(i);
} else break;
}
return result;
});
}
}
76 changes: 76 additions & 0 deletions classes/MaterialSystemHelper.zs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#priority 30001
#loader contenttweaker
import mods.contenttweaker.MaterialSystem;
import mods.contenttweaker.Material;
import mods.contenttweaker.Part;
import mods.contenttweaker.PartBuilder;
import mods.contenttweaker.MaterialPart;
import mods.contenttweaker.RegisterMaterialPart;
import mods.contenttweaker.PartDataPiece;
import mods.contenttweaker.MaterialPartData;
import mods.contenttweaker.PartType;
import mods.contenttweaker.IItemColorSupplier;
import mods.contenttweaker.IBlockColorSupplier;
import scripts.grassUtils.StringHelperCot as StringHelper;
import scripts.grassUtils.LoggerCot as Logger;

zenClass MaterialSystemHelper {
zenConstructor() {
}
var materialList as Material[string] = {};
var partList as Part[string] = {};

function registerMaterial(name as string,color as int) as Material {
val id as string = StringHelper.toUpperCamelCase(name);
var material as Material = MaterialSystem.getMaterialBuilder().setName(id).setColor(color).build();
this.materialList[id] = material;
return material;
}

function getMaterial(key as string) as Material {
return MaterialSystem.getMaterial(key);
}

function getAllMaterials() as Material[string] {
return MaterialSystem.getMaterials();
}

function registerNormalPart(name as string, type as string, hasOverlay as bool) as Part {
val id as string = StringHelper.toSnakeCase(name);
val oreDictID as string = StringHelper.toLowerCamelCase(name);
var part as Part = MaterialSystem.getPartBuilder().setName(id).setPartType(MaterialSystem.getPartType(type)).setHasOverlay(hasOverlay).setOreDictName(oreDictID).build();
this.partList[name] = part;
return part;
}

function registerSpecialPart(name as string, hasOverlay as bool, fx as RegisterMaterialPart) as Part {
// TODO
return null;
}

function getPart(key as string) as Part {
return MaterialSystem.getPart(key);
}

function getAllParts() as Part[string] {
return MaterialSystem.getParts();
}

function registerAMaterialPart(materialID as string, partID as string) /* as MaterialPart */{
/* return */this.partList[partID].registerToMaterial(this.materialList[materialID]);
}

function registerMaterialPartByPart(partID as string) /* as MaterialPart[] */{
/* return */ this.partList[partID].registerToMaterials(this.materialList.values);
}

function registerMaterialPartByMaterial(materialID as string) /* as MaterialPart[] */{
/* return */ this.materialList[materialID].registerParts(this.partList.values);
}

function registerAllMaterialParts() {
for key in partList {
this.registerMaterialPartByPart(key);
}
}
}

0 comments on commit 575281e

Please sign in to comment.