mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 01:39:52 +03:00
65 lines
2.7 KiB
Diff
65 lines
2.7 KiB
Diff
--- ../src-base/minecraft/net/minecraft/block/BlockReed.java
|
|
+++ ../src-work/minecraft/net/minecraft/block/BlockReed.java
|
|
@@ -21,7 +21,7 @@
|
|
import net.minecraftforge.fml.relauncher.Side;
|
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
|
|
-public class BlockReed extends Block
|
|
+public class BlockReed extends Block implements net.minecraftforge.common.IPlantable
|
|
{
|
|
public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 15);
|
|
protected static final AxisAlignedBB REED_AABB = new AxisAlignedBB(0.125D, 0.0D, 0.125D, 0.875D, 1.0D, 0.875D);
|
|
@@ -55,15 +55,21 @@
|
|
{
|
|
int j = ((Integer)state.getValue(AGE)).intValue();
|
|
|
|
- if (j == 15)
|
|
+ if(net.minecraftforge.common.ForgeHooks.onCropsGrowPre(worldIn, pos, state, true))
|
|
{
|
|
- worldIn.setBlockState(pos.up(), this.getDefaultState());
|
|
+ if (j >= (byte) range(3, ((100.0F / worldIn.spigotConfig.caneModifier) * 15) + 0.5F, 15)) // Spigot
|
|
+ {
|
|
+// worldIn.setBlockState(pos.up(), this.getDefaultState());
|
|
+ BlockPos upPos = pos.up();
|
|
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(worldIn, upPos.getX(), upPos.getY(), upPos.getZ(), this, 0);
|
|
worldIn.setBlockState(pos, state.withProperty(AGE, Integer.valueOf(0)), 4);
|
|
}
|
|
else
|
|
{
|
|
worldIn.setBlockState(pos, state.withProperty(AGE, Integer.valueOf(j + 1)), 4);
|
|
}
|
|
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(worldIn, pos, state, worldIn.getBlockState(pos));
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
@@ -71,7 +77,9 @@
|
|
|
|
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
|
|
{
|
|
- Block block = worldIn.getBlockState(pos.down()).getBlock();
|
|
+ IBlockState state = worldIn.getBlockState(pos.down());
|
|
+ Block block = state.getBlock();
|
|
+ if (block.canSustainPlant(state, worldIn, pos.down(), EnumFacing.UP, this)) return true;
|
|
|
|
if (block == this)
|
|
{
|
|
@@ -165,6 +173,17 @@
|
|
return ((Integer)state.getValue(AGE)).intValue();
|
|
}
|
|
|
|
+ @Override
|
|
+ public net.minecraftforge.common.EnumPlantType getPlantType(IBlockAccess world, BlockPos pos)
|
|
+ {
|
|
+ return net.minecraftforge.common.EnumPlantType.Beach;
|
|
+ }
|
|
+ @Override
|
|
+ public IBlockState getPlant(IBlockAccess world, BlockPos pos)
|
|
+ {
|
|
+ return this.getDefaultState();
|
|
+ }
|
|
+
|
|
protected BlockStateContainer createBlockState()
|
|
{
|
|
return new BlockStateContainer(this, new IProperty[] {AGE});
|