Open main menu
Home
Random
Log in
Settings
About Forge Community Wiki
Disclaimers
Forge Community Wiki
Search
Changes
← Older edit
Newer edit →
Events/BlockEvent
(view source)
Revision as of 18:20, 20 April 2021
515 bytes added
,
18:20, 20 April 2021
→CropGrowEvent
Line 166:
Line 166:
{
{
event.setResult(Event.Result.DENY); // make bamboo grow less often
event.setResult(Event.Result.DENY); // make bamboo grow less often
+
}
+
}
+
}
+
+
public void onCropsGrowPost(final BlockEvent.CropGrowEvent.Post event)
+
{
+
IWorld world = event.getWorld();
+
if (!world.isClientSide() && event.getState().is(Blocks.WHEAT)) // check wheat
+
{
+
BlockState newState = event.getState();
+
if (newState.is(Blocks.WHEAT)) // defensive check to make sure we can do this
+
{
+
world.setBlock(event.getPos(), newState.setValue(CropsBlock.AGE, 7), 3); // set max growth wheat
}
}
}
}
EERussianguy
16
edits