Fandom

Minecraft Mod Custom Stuff Wiki

Wheat

175pages on
this wiki
Add New Page
Comments0 Share

This block type uses the model of vanilla wheat, with 4 intersecting planes.


Example Wheat Block

mod.js

config.addBlockIdProperty("cropMeat", 500);
mod.addBlock("cropMeat.js", "wheat");

cropMeat.js

name = "cropMeat";
id = config.getBlockId("cropMeat");
material = "grass";
stepSound = "grass";
creativeTab = "Testing Tab";
tickrate = 20;
displayName[0] = "Baby Meat Crop";
hardness[0] = 0.3;
resistance[0] = 15;
toolClass[0] = "pickaxe";
harvestLevel[0] = 0;
textureFileYP[0] = "cropMeat1.png";
textureFileYN[0] = "cropMeat1.png";
addToCreative[0] = true;

Example Growing Wheat Block

mod.js

config.addBlockIdProperty("cropMeat", 500);
mod.addBlock("cropMeat.js", "wheat");

cropMeat.js

name = "cropMeat";
id = config.getBlockId("cropMeat");
material = "grass";
stepSound = "grass";
creativeTab = "Testing Tab";
tickrate = 20;
displayName[0] = "Baby Meat Crop";
hardness[0] = 0.3;
resistance[0] = 15;
toolClass[0] = "hoe";
harvestLevel[0] = 0;
textureFileYP[0] = "cropMeat1.png";
textureFileYN[0] = "cropMeat1.png";
addToCreative[0] = true;
onUpdate[0] = "mod.loadScript('cropGrow.js');";
displayName[1] = "Baby Meat Crop";
hardness[1] = 0.3;
resistance[1] = 15;
toolClass[1] = "hoe";
harvestLevel[1] = 0;
textureFileYP[1] = "cropMeat2.png";
textureFileYN[1] = "cropMeat2.png";
addToCreative[1] = false;
onUpdate[1] = "mod.loadScript('cropGrow.js');";
...
displayName[7] = "Fully Grown Meat Crop";
hardness[7] = 0.3;
resistance[7] = 15;
toolClass[7] = "hoe";
harvestLevel[7] = 0;
textureFileYP[7] = "cropMeat8.png";
textureFileYN[7] = "cropMeat8.png";
addToCreative[7] = false;

cropGrow.js

if(Math.floor(Math.random()*10) < 2)
{
     world.setBlockMetadata(position, world.getBlockMetadata(position) + 1)
}
//This is extremely fast (20% chance per update(which is set to 20 ticks per update in the cropMeat.js file)), but it's just an example. In an actual plant, you may want to only have it update 5% of the time, or less.

It's worth noting that on my personal setup of these files, my tickrate is set to 600 (every 30 seconds), so there's a 20% chance that the plant will grow one stage every 30 seconds. Feels pretty close to vanilla wheat to me.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.