Skip to content

Instantly share code, notes, and snippets.

@kindlich
Created March 14, 2018 18:45
Show Gist options
  • Select an option

  • Save kindlich/63d2faa387fdf0610252da1c2dfff5e4 to your computer and use it in GitHub Desktop.

Select an option

Save kindlich/63d2faa387fdf0610252da1c2dfff5e4 to your computer and use it in GitHub Desktop.
#loader contenttweaker
import mods.contenttweaker.VanillaFactory;
import mods.contenttweaker.PartType;
import mods.contenttweaker.MaterialSystem;
import mods.contenttweaker.Commands;
var egg = VanillaFactory.createItem("charmander_spawn_egg");
egg.maxStackSize = 64;
egg.itemRightClick = function(stack, world, player, hand) {
if (stack.tag has "entity") {
logger.logWarning("pokespawn " ~ stack.tag.entity.asString());
Commands.call("pokespawn " ~ stack.tag.entity.asString(), player, world);
}
stack.shrink(1);
return "Success";
};
egg.localizedNameSupplier = function(itemStack) {
return (itemStack.tag has "entity" ? itemStack.tag.entity.asString() : "Empty") + " spawn egg";
};
egg.itemColorSupplier = function(itemStack, tint) {
return mods.contenttweaker.Color.fromHex((itemStack.tag has "color") ? itemStack.tag.color.asString() : "000000");
};
egg.register();
val map as string[string] = {
//Poke name : Hexcolor
Charmander : "ffffff",
Salamander : "abcdef",
Something : "000a49"
};
val egg = <contenttweaker:charmander_spawn_egg>;
for name, colorString in map {
mods.jei.JEI.addItem(egg.withTag({entity: name, color : colorString}));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment