Last active
February 15, 2016 21:45
-
-
Save AlexIIL/3e693cbf60c4b7742577 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void grow(World world, BlockPos pos, IBlockState state) | |
{ | |
int currentMeta = world.getBlockState(pos).getValue(AGE).intValue(); | |
//if(world.getBlockState(new BlockPos(pos.getX() ,pos.getY() - 1, pos.getZ())).getBlock() == Blocks.farmland) | |
{ | |
//Erster Block | |
if(currentMeta < 7) | |
{ | |
System.out.println("Updating growth state"); | |
world.setBlockState(pos, getDefaultState().withProperty(AGE, currentMeta + 1)); | |
world.setBlockState(pos.west(), Blocks.stone.getStateFromMeta(currentMeta + 1)); | |
} | |
else /* if(currentMeta >= 7)*/ | |
{ | |
System.out.println("Setting block above"); | |
world.setBlockState(new BlockPos(pos.getX(), pos.getY() + 1, pos.getZ()), getDefaultState()); | |
} | |
} | |
if(world.getBlockState(new BlockPos(pos.getX() , pos.getY() - 1 , pos.getZ())).getBlock() == this | |
&& world.getBlockState(new BlockPos(pos.getX(), pos.getY() - 2, pos.getZ())).getBlock() == Blocks.farmland) | |
{ | |
//Zweiter Block | |
if(currentMeta < 8) | |
{ | |
world.setBlockState(pos, getDefaultState().withProperty(AGE, currentMeta + 1)); | |
} | |
else/* if(currentMeta >= 8)*/ | |
{ | |
world.setBlockState(new BlockPos(pos.getX(), pos.getY() + 1, pos.getZ()),getDefaultState()); | |
} | |
} | |
if(world.getBlockState(new BlockPos(pos.getX(), pos.getY() - 1, pos.getZ())).getBlock() == this | |
&& world.getBlockState(new BlockPos(pos.getX(), pos.getY() - 2, pos.getZ())).getBlock() == this | |
&& world.getBlockState(new BlockPos(pos.getX(), pos.getY() - 3, pos.getZ())).getBlock() == Blocks.farmland) | |
{ | |
if(currentMeta < 9) | |
{ | |
world.setBlockState(pos, getDefaultState().withProperty(AGE, currentMeta + 1)); | |
} | |
if(currentMeta == 9) | |
{ | |
//Crop ready grown | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment