mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-16 15:53:41 +01:00
Make tree fertilizer work on slime saplings
This commit is contained in:
parent
893294b9e4
commit
a440ab6772
1 changed files with 5 additions and 3 deletions
|
@ -31,7 +31,7 @@ public class TreeFertilizerItem extends Item {
|
||||||
return ActionResultType.SUCCESS;
|
return ActionResultType.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
TreesDreamWorld world = new TreesDreamWorld((ServerWorld) context.getWorld());
|
TreesDreamWorld world = new TreesDreamWorld((ServerWorld) context.getWorld(), context.getPos());
|
||||||
BlockPos saplingPos = context.getPos();
|
BlockPos saplingPos = context.getPos();
|
||||||
|
|
||||||
for (BlockPos pos : BlockPos.getAllInBoxMutable(-1, 0, -1, 1, 0, 1)) {
|
for (BlockPos pos : BlockPos.getAllInBoxMutable(-1, 0, -1, 1, 0, 1)) {
|
||||||
|
@ -83,15 +83,17 @@ public class TreeFertilizerItem extends Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TreesDreamWorld extends PlacementSimulationServerWorld {
|
private class TreesDreamWorld extends PlacementSimulationServerWorld {
|
||||||
|
private final BlockPos saplingPos;
|
||||||
|
|
||||||
protected TreesDreamWorld(ServerWorld wrapped) {
|
protected TreesDreamWorld(ServerWorld wrapped, BlockPos saplingPos) {
|
||||||
super(wrapped);
|
super(wrapped);
|
||||||
|
this.saplingPos = saplingPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getBlockState(BlockPos pos) {
|
public BlockState getBlockState(BlockPos pos) {
|
||||||
if (pos.getY() <= 9)
|
if (pos.getY() <= 9)
|
||||||
return Blocks.GRASS_BLOCK.getDefaultState();
|
return world.getBlockState(saplingPos.down());
|
||||||
return super.getBlockState(pos);
|
return super.getBlockState(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue