Vanilla Content Creation (Minecraft)
Description
Creates custom items, blocks, and fluids for later use. Textures and other assets such as translations will be loaded from the groovy/assets/ folder.
Warning
Item and blocks will automatically generate a model file inside if one is not present. Textures will be missingno until assigned, and names will be the raw lang key until a localization file sets the relevant lang key to a value. The localization file must be all lowercase, such as en_us.lang!
Danger
The packid must be valid for any content to be created!
Identifier
The identifier content will be used as the default on this page.
All Identifiers
Any of these can be used to refer to this compat:
content/* Used as page default */
Content
mc.content
mc.Content
MC.content
MC.Content
vanilla.content
vanilla.Content
Vanilla.content
Vanilla.Content
minecraft.content
minecraft.Content
Minecraft.content
Minecraft.Content
mods.mc.content
mods.mc.Content
mods.MC.content
mods.MC.Content
mods.vanilla.content
mods.vanilla.Content
mods.Vanilla.content
mods.Vanilla.Content
mods.minecraft.content
mods.minecraft.Content
mods.Minecraft.content
mods.Minecraft.ContentCreative Tab Manipulation
Sets the default Creative Tab used when registering items through GroovyScript:
groovycontent.setDefaultCreativeTab(CreativeTabs)
Example
content.setDefaultCreativeTab(content.createCreativeTab('groovyscript.example_creative_tab', _ -> item('groovyscriptdev:heartofauniverse')))Create Custom Content
Create a creative tab with the given icon:
groovycontent.createCreativeTab(String, Item)Create a creative tab with the given icon:
groovycontent.createCreativeTab(String, ItemStack)Create a creative tab with the given icon:
groovycontent.createCreativeTab(String, Closure<ItemStack>)Create a creative tab with the given icon:
groovycontent.createCreativeTab(String, Supplier<ItemStack>)Register an already created item. Useful for when provided methods do not suffice to create the desired item:
groovycontent.registerItem(String, Item)Register an already created block. Useful for when provided methods do not suffice to create the desired block:
groovycontent.registerBlock(String, Block)Register an already created block. Useful for when provided methods do not suffice to create the desired block:
groovycontent.registerBlock(String, Block, ItemBlock)Register an already created fluid. Useful for when provided methods do not suffice to create the desired fluid:
groovycontent.registerFluid(Fluid)
Example
content.createCreativeTab('groovyscript.other_tab_clay', _ -> item('minecraft:clay'))
content.registerItem('snack', (new ItemFood(20, 10, false) {
protected void onFoodEaten(ItemStack stack, World worldIn, EntityPlayer player) {
if (!worldIn.isRemote) {
player.addPotionEffect(new PotionEffect(potion('minecraft:regeneration'), 240000, 3, false, false))
player.addPotionEffect(new PotionEffect(potion('minecraft:resistance'), 240000, 3, false, false))
}
}
}).setAlwaysEdible())
content.registerBlock('dragon_egg_lamp', (new Block(blockMaterial('redstone_light')) {
protected static final AxisAlignedBB DRAGON_EGG_AABB = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 0.9375D, 1.0D, 0.9375D)
AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
return DRAGON_EGG_AABB
}
boolean isOpaqueCube(IBlockState state) {
return false
}
boolean isFullCube(IBlockState state) {
return false
}
boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
return true
}
BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) {
return BlockFaceShape.UNDEFINED
}
}).setLightLevel(1.0F))Recipe Builder
Just like other recipe types, the Vanilla Content Creation also uses a recipe builder.
Don't know what a builder is? Check the builder info page out.
Create Custom Items
Create a GroovyItem with the given name. The name is the registry name used and must consist of exclusively lower case letters, numbers, and underscores
_.groovycontent.createItem(String)
boolean. Sets if the item has the shimmer effect, typically associated with potions or enchantments. (Defaultfalse).groovysetEnchantedEffect()IRarity. Sets the rarity this will be is displayed as, primarily impacts the color of its name.groovysetRarity(IRarity)boolean. Sets if the items render the object in full 3D, like tools. (Defaultfalse).groovysetFull3D()boolean. Sets if the item can be repaired, typically by combining two of the same item in the crafting grid. (Defaulttrue).groovysetNoRepair()int. Sets the max damage of the item, used as durability for tools. (Default0).groovysetMaxDamage(int)boolean. Sets if the item has subtypes, like dyes or terracotta. (Defaultfalse).groovysetHasSubtypes(boolean)int. Sets the max stack size of the item. (Default64).groovysetMaxStackSize(int)Item. Sets the Container Item, which will replace this item when it breaks.groovysetContainerItem(Item)int. Sets the enchantability level. (Default0).groovysetEnchantability(int)CreativeTabs. Sets the Creative Tab the item should display on. (Defaultcontent.getDefaultTab()).groovysetCreativeTab(CreativeTabs)String. Sets the base String used for translation. Prefixed bytile.and checks the suffix.namefor the block display name. (DefaultregistryName).groovysetTranslationKey(String)
Registers the Item and returns itself (returns
GroovyItem).groovyregister()
Example
content.createItem('heartofauniverse')
.setRarity(EnumRarity.EPIC)
.setMaxStackSize(1)
.register()
content.createItem('clay_2')
.setMaxStackSize(5)
.setRarity(EnumRarity.RARE)
.register()
content.createItem('clay_3')
.setCreativeTab(creativeTab('misc'))
.setEnchantedEffect()
.register()Create Custom Blocks
Create a GroovyBlock with the given name with the material
Material.ROCK. The name is the registry name used and must consist of exclusively lower case letters, numbers, and underscores_.groovycontent.createBlock(String)
int. Sets how much light the block emits, multiplied by 15. (Default0).groovysetLightLevel(float)int. Sets how much light is subtracted for going through this block. (Default0).groovysetLightOpacity(int)float. Sets the difficulty of the block to break, primarily affecting the speed to break. A hardness of0will cause no durability loss, and a hardness of-1will be unbreakable. (Default2.0f).groovysetHardness(float) // Also increases block resistance to itself * 5 setBlockUnbreakable() // Makes the block unbreakable by setting hardness to -1.0fSoundType. Sets the sound played when stepping on the block. (DefaultSoundType.STONE).groovysetSoundType(SoundType)String. Sets the base String used for translation. Prefixed byitem.and checks the suffix.namefor the item display name. (DefaultregistryName).groovysetTranslationKey(String)float. Sets the explosion resistance of the block. (Default10.0f).groovysetHardness(float) // Also increases block resistance to itself * 5 setResistance(float) setBlockUnbreakable() // Makes the block unbreakable by setting hardness to -1.0fboolean. Sets if the block has random ticks. (Defaultfalse).groovysetTickRandomly(boolean)CreativeTabs. Sets the Creative Tab the item representing the block should be displayed on.groovysetCreativeTab(CreativeTabs)
Registers the Block and a corresponding ItemBlock and returns itself (returns
GroovyBlock).groovyregister()
Example
content.createBlock('generic_block')
.register()Create Custom Blocks
Create a GroovyBlock with the given name and material. The name is the registry name used and must consist of exclusively lower case letters, numbers, and underscores
_.groovycontent.createBlock(String, Material)
int. Sets how much light the block emits, multiplied by 15. (Default0).groovysetLightLevel(float)int. Sets how much light is subtracted for going through this block. (Default0).groovysetLightOpacity(int)float. Sets the difficulty of the block to break, primarily affecting the speed to break. A hardness of0will cause no durability loss, and a hardness of-1will be unbreakable. (Default2.0f).groovysetHardness(float) // Also increases block resistance to itself * 5 setBlockUnbreakable() // Makes the block unbreakable by setting hardness to -1.0fSoundType. Sets the sound played when stepping on the block. (DefaultSoundType.STONE).groovysetSoundType(SoundType)String. Sets the base String used for translation. Prefixed byitem.and checks the suffix.namefor the item display name. (DefaultregistryName).groovysetTranslationKey(String)float. Sets the explosion resistance of the block. (Default10.0f).groovysetHardness(float) // Also increases block resistance to itself * 5 setResistance(float) setBlockUnbreakable() // Makes the block unbreakable by setting hardness to -1.0fboolean. Sets if the block has random ticks. (Defaultfalse).groovysetTickRandomly(boolean)CreativeTabs. Sets the Creative Tab the item representing the block should be displayed on.groovysetCreativeTab(CreativeTabs)
Registers the Block and a corresponding ItemBlock and returns itself (returns
GroovyBlock).groovyregister()
Create Custom Fluids
Create a GroovyFluid with the given name.
groovycontent.createFluid(String)
int. Sets the color of the fluid. (Default0xFFFFFF).groovysetColor(int)ResourceLocation. Sets the texture used for when the fluid is still. (DefaultDEFAULT_STILL).groovysetDefaultTexture() setMetalTexture() setStill(ResourceLocation) setTexture(ResourceLocation, ResourceLocation) // still, flowing setTexture(ResourceLocation, ResourceLocation, ResourceLocation) // still, flowing, overlayEnumRarity. Sets the rarity this will be is displayed as, primarily impacts the color of its name. (DefaultEnumRarity.COMMON).groovysetRarity(EnumRarity)int. Sets the density of the fluid, which controls what other fluids it can displace. (Default1000).groovysetDensity(int)ResourceLocation. Sets the texture used for when the fluid is flowing. (DefaultDEFAULT_FLOWING).groovysetDefaultTexture() setMetalTexture() setFlowing(ResourceLocation) setTexture(ResourceLocation, ResourceLocation) // still, flowing setTexture(ResourceLocation, ResourceLocation, ResourceLocation) // still, flowing, overlayResourceLocation. Sets the texture used as an overlay for the fluid.groovysetOverlay(ResourceLocation) setTexture(ResourceLocation, ResourceLocation, ResourceLocation) // still, flowing, overlayMaterial. Sets the material the block has, if a block is created. (DefaultblockMaterial('water')).groovysetLavaMaterial() setWaterMaterial()SoundEvent. Sets the sound played when the fluid is picked up.groovysetFillSound(SoundEvent) setSound(SoundEvent, SoundEvent)boolean. Sets if the fluid is gaseous, typically indicating a negative density. (Defaultfalse).groovysetGaseous(boolean)int. Sets the viscosity of the fluid, which impacts how fast the fluid spreads. (Default1000).groovysetViscosity(int)SoundEvent. Sets the sound played when the fluid is emptied out.groovysetEmptySound(SoundEvent) setSound(SoundEvent, SoundEvent)int. Sets how much light the fluid produces. (Default0).groovysetLuminosity(int)boolean. Sets if the fluid creates a block. (Defaulttrue).groovynoBlock()int. Sets the temperature of the fluid. (Default300).groovysetTemperature(int)boolean. Sets if the fluid is a finite block, if a block is created. (Defaultfalse).groovyisFinite()
Registers the Fluid and returns the registered Fluid (returns
Fluid).groovyregister()
Example
content.createFluid('amongium')
.setMetalTexture()
.setColor(0x00FF00)
.register()Helper methods
Get the default Creative Tab for GroovyScript, which is set by
setDefaultCreativeTab:groovycontent.getDefaultTab()
