Skip to content

Instantly share code, notes, and snippets.

@Lemonszz
Last active July 3, 2022 06:22
Show Gist options
  • Save Lemonszz/06ffe0c4eab97ee0de0f6ec7e0900272 to your computer and use it in GitHub Desktop.
Save Lemonszz/06ffe0c4eab97ee0de0f6ec7e0900272 to your computer and use it in GitHub Desktop.
Set Effect Examples
import crafttweaker.data.IData;
val helm = <minecraft:diamond_helmet>.withDisplayName("test");
val armor = mods.SetEffect.newSet()
.setName("argh")
.withHead(helm)
.withChest(<minecraft:diamond_chestplate>)
.addEffect(<potion:minecraft:strength>.makePotionEffect(40, 2))
.addEffect(<potion:minecraft:night_vision>.makePotionEffect(40, 1))
.addImmunity(<potion:minecraft:poison>)
.register();
val iron_set = mods.SetEffect.newSet()
.withHead(<minecraft:iron_helmet>)
.withChest(<minecraft:iron_chestplate>)
.withLegs(<minecraft:iron_leggings>)
.withFeet(<minecraft:iron_boots>)
.withMainhand(<minecraft:iron_sword>)
.withOffhand(<minecraft:shield>)
.addEffect(<potion:minecraft:weakness>.makePotionEffect(100, 1))
.setName("Iron_Set_Name")
.register();
val diamond_set = mods.SetEffect.getSetFromMaterial("diamond")
.addEffect(<potion:minecraft:weakness>.makePotionEffect(100, 1));
mods.SetEffect.register(diamond_set);
val heavy_boots = <minecraft:iron_boots>.withDisplayName("Heavy Boots").withLore(["These boots are very heavy!"]);
val heavy_boots_set = mods.SetEffect.newSet()
.setName("heavy_boots")
.withFeet(heavy_boots)
.addEffect(<potion:minecraft:slowness>.makePotionEffect(100, 3, true, false))
.addParticle("totem", 0, 0, 0, 1, 1, 1, -1, -1, -1, 1, 2, 1, -0.2, 0.2, 10)
.register();
val color = {
"display":
{
"color": 16007918
}
} as IData;
val lhelm = <minecraft:leather_helmet>.withTag(color);
val lchest = <minecraft:leather_chestplate>.withTag(color);
val lleg = <minecraft:leather_leggings>.withTag(color);
val lfeet = <minecraft:leather_boots>.withTag(color);
val leather = mods.SetEffect.newSet()
.withHead(lhelm)
.withChest(lchest)
.withLegs(lleg)
.withFeet(lfeet)
.setName("love")
.addParticle("heart", 0, 3, 0, 1, 4, 1, 0, -1, 0, 0, -1, 0, -0.2, 0.2, 3)
.addAttackerEffect(<potion:minecraft:levitation>.makePotionEffect(100, 3, true, false))
.register();
val stage_test = mods.SetEffect.newSet().requireGamestage("only").addParticle("heart", 0, 3, 0, 1, 4, 1, 0, -1, 0, 0, -1, 0, -0.2, 0.2, 3).register();
var gold_set = mods.SetEffect.newSet()
.setName("gold")
.withHead(<minecraft:golden_helmet>)
.withChest(<minecraft:golden_chestplate>)
.withLegs(<minecraft:golden_leggings>)
.withFeet(<minecraft:golden_boots>)
.addEffect(<potion:minecraft:fire_resistance>.makePotionEffect(100, 0))
.addEffect(<potion:minecraft:resistance>.makePotionEffect(100, 1))
.addEffect(<potion:minecraft:absorption>.makePotionEffect(100, 0));
mods.SetEffect.register(gold_set);
@Xarmat-GitHub
Copy link

Xarmat-GitHub commented Sep 7, 2021

//one more example:
import crafttweaker.data.IData;

val poisonArmorSet = mods.SetEffect.newSet()
    //unique set name
    .setName("poisonArmorSet")
    
    //potion effect while wearing the armor; ticks remaining; potion level
    .addEffect(<potion:minecraft:speed>.makePotionEffect(40, 0))

    //when a entity attacks the wearer, he will receive poison IV for 100 ticks
    //note: first boolean = this potion effect is like a bacon | second boolean = if the potion particles will be shown on the attacker
    .addAttackerEffect(<potion:minecraft:poison>.makePotionEffect(100, 3, true, true))
    
    //Player is immune to potions that will be thrown at him (e.g. witch) don't work with cavespieders in this case
    .addImmunity(<potion:minecraft:poison>)
    
    //items
    .withFeet(<minecraft:chainmail_boots>)
    .withChest(<minecraft:chainmail_chestplate>)
    .withHead(<minecraft:chainmail_helmet>)
    .withLegs(<minecraft:chainmail_leggings>)

    //This allow to ignore all NBT data from items (useful for Tinkers Construct Items and coloured items)
    .setIgnoreNBT()

.register();


//particles explained: addParticle(String particleName, float minx, float miny, float minz, float maxx, float maxy, float maxz, float minxoffset, float minyoffset, float minzoffset, float maxxoffset, float maxyoffset, float maxzoffset, float minspeed, float maxspeed, int amount)
//discord note: https://discord.com/channels/533102487880859648/802271162340081674/884761795292725309 <- for more informations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment