2025-04-11 15:42:59 +02:00
|
|
|
package game.block;
|
|
|
|
|
|
|
|
import game.init.Blocks;
|
|
|
|
import game.init.Config;
|
|
|
|
import game.item.CheatTab;
|
|
|
|
import game.item.Item;
|
|
|
|
import game.material.Material;
|
2025-05-04 20:27:55 +02:00
|
|
|
import game.model.Model;
|
|
|
|
import game.model.ModelProvider;
|
2025-04-11 15:42:59 +02:00
|
|
|
import game.rng.Random;
|
|
|
|
import game.world.BlockPos;
|
|
|
|
import game.world.State;
|
|
|
|
import game.world.WorldServer;
|
|
|
|
|
|
|
|
public class BlockBlackenedSoil extends Block
|
|
|
|
{
|
|
|
|
public BlockBlackenedSoil()
|
|
|
|
{
|
|
|
|
super(Material.grass);
|
|
|
|
this.setTickRandomly();
|
|
|
|
this.setTab(CheatTab.tabNature);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void updateTick(WorldServer worldIn, BlockPos pos, State state, Random rand)
|
|
|
|
{
|
|
|
|
if (worldIn.getLightFromNeighbors(pos.up()) < 2 && worldIn.getState(pos.up()).getBlock().getLightOpacity() > 6)
|
|
|
|
{
|
|
|
|
if(Config.darkSoilDecay)
|
|
|
|
worldIn.setState(pos, Blocks.blackened_dirt.getState());
|
|
|
|
}
|
|
|
|
else if (Config.darkSoilSpread && worldIn.getLightFromNeighbors(pos.up()) >= 1)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < 4; i++)
|
|
|
|
{
|
|
|
|
BlockPos blockpos = pos.add(rand.zrange(3) - 1, rand.zrange(5) - 3, rand.zrange(3) - 1);
|
|
|
|
Block block = worldIn.getState(blockpos.up()).getBlock();
|
|
|
|
State iblockstate = worldIn.getState(blockpos);
|
|
|
|
|
|
|
|
if ((iblockstate.getBlock() == Blocks.dirt || iblockstate.getBlock() == Blocks.grass || iblockstate.getBlock() == Blocks.blackened_dirt) && worldIn.getLightFromNeighbors(blockpos.up()) >= 2 && block.getLightOpacity() <= 6)
|
|
|
|
{
|
|
|
|
worldIn.setState(blockpos, Blocks.blackened_soil.getState());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public Item getItemDropped(State state, Random rand, int fortune)
|
|
|
|
{
|
|
|
|
return Blocks.blackened_dirt.getItemDropped(Blocks.blackened_dirt.getState(), rand, fortune);
|
|
|
|
}
|
|
|
|
|
2025-05-04 20:27:55 +02:00
|
|
|
public Model getModel(ModelProvider provider, String name, State state) {
|
|
|
|
return provider.getModel("blackened_dirt").add().d().u("blackened_soil_top").nswe("blackened_soil_side");
|
2025-04-11 15:42:59 +02:00
|
|
|
}
|
|
|
|
}
|