Skip to content

Instantly share code, notes, and snippets.

@kindlich
Last active February 17, 2019 08:33
Show Gist options
  • Save kindlich/7fd3ddaf93cff13979557ec2007c9935 to your computer and use it in GitHub Desktop.
Save kindlich/7fd3ddaf93cff13979557ec2007c9935 to your computer and use it in GitHub Desktop.
[INITIALIZATION][CLIENT][INFO] [crafttweaker | SIDE_CLIENT]: Loading Script: {[0:crafttweaker]: kragnoth_zenclass.zs}
[INITIALIZATION][CLIENT][INFO] Checking for diamond
[INITIALIZATION][CLIENT][INFO] Checking with <minecraft:diamond_helmet>: true
[INITIALIZATION][CLIENT][INFO] Checking with <minecraft:diamond_chestplate>: true
[INITIALIZATION][CLIENT][INFO] Checking with <minecraft:diamond_leggings>: true
[INITIALIZATION][CLIENT][INFO] Checking with <minecraft:diamond_boots>: true
[INITIALIZATION][CLIENT][INFO] Checking with <minecraft:golden_helmet>: false
[INITIALIZATION][CLIENT][INFO] Checking with <minecraft:golden_chestplate>: false
[INITIALIZATION][CLIENT][INFO] Checking with <minecraft:golden_leggings>: false
[INITIALIZATION][CLIENT][INFO] Checking with <minecraft:golden_boots>: false
[INITIALIZATION][CLIENT][INFO] Checking with <minecraft:iron_helmet>: false
[INITIALIZATION][CLIENT][INFO] Checking with <minecraft:iron_chestplate>: false
[INITIALIZATION][CLIENT][INFO] Checking with <minecraft:iron_leggings>: false
[INITIALIZATION][CLIENT][INFO] Checking with <minecraft:iron_boots>: false
[INITIALIZATION][CLIENT][INFO] Checking for gold
[INITIALIZATION][CLIENT][INFO] Checking with <minecraft:diamond_helmet>: false
[INITIALIZATION][CLIENT][INFO] Checking with <minecraft:diamond_chestplate>: false
[INITIALIZATION][CLIENT][INFO] Checking with <minecraft:diamond_leggings>: false
[INITIALIZATION][CLIENT][INFO] Checking with <minecraft:diamond_boots>: false
[INITIALIZATION][CLIENT][INFO] Checking with <minecraft:golden_helmet>: true
[INITIALIZATION][CLIENT][INFO] Checking with <minecraft:golden_chestplate>: true
[INITIALIZATION][CLIENT][INFO] Checking with <minecraft:golden_leggings>: true
[INITIALIZATION][CLIENT][INFO] Checking with <minecraft:golden_boots>: true
[INITIALIZATION][CLIENT][INFO] Checking with <minecraft:iron_helmet>: false
[INITIALIZATION][CLIENT][INFO] Checking with <minecraft:iron_chestplate>: false
[INITIALIZATION][CLIENT][INFO] Checking with <minecraft:iron_leggings>: false
[INITIALIZATION][CLIENT][INFO] Checking with <minecraft:iron_boots>: false
[INITIALIZATION][CLIENT][INFO] Completed script loading in: 448ms
import crafttweaker.item.IItemStack;
import crafttweaker.item.IIngredient;
zenClass someArmorMatching {
val helmet as IItemStack;
val chestplate as IItemStack;
val leggings as IItemStack;
val boots as IItemStack;
zenConstructor(helmet as IItemStack, chestplate as IItemStack, leggings as IItemStack, boots as IItemStack) {
this.helmet = helmet;
this.chestplate = chestplate;
this.leggings = leggings;
this.boots = boots;
}
function matches(stack as IItemStack) as bool {
return matchesHelmet(stack) || matchesChestplate(stack) || matchesLeggings(stack) || matchesBoots(stack);
}
function matchesHelmet(stack as IItemStack) as bool {
return !isNull(helmet) && helmet.matches(stack);
}
function matchesChestplate(stack as IItemStack) as bool {
return !isNull(chestplate) && chestplate.matches(stack);
}
function matchesLeggings(stack as IItemStack) as bool {
return !isNull(leggings) && leggings.matches(stack);
}
function matchesBoots(stack as IItemStack) as bool {
return !isNull(boots) && boots.matches(stack);
}
}
var armorArray = [
someArmorMatching(<minecraft:diamond_helmet>, <minecraft:diamond_chestplate>, <minecraft:diamond_leggings>, <minecraft:diamond_boots>),
someArmorMatching(<minecraft:golden_helmet>, <minecraft:golden_chestplate>, <minecraft:golden_leggings>, <minecraft:golden_boots>)
] as someArmorMatching[];
val stacksToTest = [<minecraft:diamond_helmet>, <minecraft:diamond_chestplate>, <minecraft:diamond_leggings>, <minecraft:diamond_boots>, <minecraft:golden_helmet>, <minecraft:golden_chestplate>, <minecraft:golden_leggings>, <minecraft:golden_boots>, <minecraft:iron_helmet>, <minecraft:iron_chestplate>, <minecraft:iron_leggings>, <minecraft:iron_boots>] as IItemStack[];
for i, name in ["diamond", "gold"] as string[] {
val matcher = armorArray[i];
print("Checking for " ~ name);
for stack in stacksToTest {
print("\tChecking with " ~ stack.commandString ~ ": " ~ matcher.matches(stack));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment