mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 01:39:52 +03:00
110 lines
7.9 KiB
Diff
110 lines
7.9 KiB
Diff
--- ../src-base/minecraft/net/minecraft/block/BlockVine.java
|
|
+++ ../src-work/minecraft/net/minecraft/block/BlockVine.java
|
|
@@ -27,8 +27,9 @@
|
|
import net.minecraft.world.World;
|
|
import net.minecraftforge.fml.relauncher.Side;
|
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
|
|
-public class BlockVine extends Block
|
|
+public class BlockVine extends Block implements net.minecraftforge.common.IShearable
|
|
{
|
|
public static final PropertyBool UP = PropertyBool.create("up");
|
|
public static final PropertyBool NORTH = PropertyBool.create("north");
|
|
@@ -185,7 +186,7 @@
|
|
{
|
|
if (!worldIn.isRemote)
|
|
{
|
|
- if (worldIn.rand.nextInt(4) == 0)
|
|
+ if (worldIn.rand.nextInt(Math.max(1, (int) (100.0F / worldIn.spigotConfig.vineModifier) * 4)) == 0 && worldIn.isAreaLoaded(pos, 4)) // Forge: check area to prevent loading unloaded chunks
|
|
{
|
|
int i = 4;
|
|
int j = 5;
|
|
@@ -233,7 +234,11 @@
|
|
|
|
if (((Boolean)iblockstate2.getValue(NORTH)).booleanValue() || ((Boolean)iblockstate2.getValue(EAST)).booleanValue() || ((Boolean)iblockstate2.getValue(SOUTH)).booleanValue() || ((Boolean)iblockstate2.getValue(WEST)).booleanValue())
|
|
{
|
|
- worldIn.setBlockState(blockpos2, iblockstate2, 2);
|
|
+// worldIn.setBlockState(blockpos2, iblockstate2, 2);
|
|
+ BlockPos target = blockpos2;
|
|
+ org.bukkit.block.Block source = worldIn.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ());
|
|
+ org.bukkit.block.Block block = worldIn.getWorld().getBlockAt(target.getX(), target.getY(), target.getZ());
|
|
+ CraftEventFactory.handleBlockSpreadEvent(block, source, this, getMetaFromState(iblockstate2));
|
|
}
|
|
}
|
|
else if (enumfacing1.getAxis().isHorizontal() && !((Boolean)state.getValue(getPropertyFor(enumfacing1))).booleanValue())
|
|
@@ -244,7 +249,7 @@
|
|
IBlockState iblockstate3 = worldIn.getBlockState(blockpos4);
|
|
Block block1 = iblockstate3.getBlock();
|
|
|
|
- if (block1.blockMaterial == Material.AIR)
|
|
+ if (block1.isAir(iblockstate3, worldIn, blockpos4))
|
|
{
|
|
EnumFacing enumfacing3 = enumfacing1.rotateY();
|
|
EnumFacing enumfacing4 = enumfacing1.rotateYCCW();
|
|
@@ -253,21 +258,30 @@
|
|
BlockPos blockpos = blockpos4.offset(enumfacing3);
|
|
BlockPos blockpos1 = blockpos4.offset(enumfacing4);
|
|
|
|
+ org.bukkit.block.Block source = worldIn.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ());
|
|
+ org.bukkit.block.Block bukkitBlock = worldIn.getWorld().getBlockAt(blockpos4.getX(), blockpos4.getY(), blockpos4.getZ());
|
|
+
|
|
if (flag1 && this.canAttachTo(worldIn, blockpos.offset(enumfacing3), enumfacing3))
|
|
{
|
|
- worldIn.setBlockState(blockpos4, this.getDefaultState().withProperty(getPropertyFor(enumfacing3), Boolean.valueOf(true)), 2);
|
|
+// worldIn.setBlockState(blockpos4, this.getDefaultState().withProperty(getPropertyFor(enumfacing3), Boolean.valueOf(true)), 2);
|
|
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, getMetaFromState(this.getDefaultState().withProperty(getPropertyFor(enumfacing3), true)));
|
|
}
|
|
else if (flag2 && this.canAttachTo(worldIn, blockpos1.offset(enumfacing4), enumfacing4))
|
|
{
|
|
- worldIn.setBlockState(blockpos4, this.getDefaultState().withProperty(getPropertyFor(enumfacing4), Boolean.valueOf(true)), 2);
|
|
+// worldIn.setBlockState(blockpos4, this.getDefaultState().withProperty(getPropertyFor(enumfacing4), Boolean.valueOf(true)), 2);
|
|
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, getMetaFromState(this.getDefaultState().withProperty(getPropertyFor(enumfacing4), true)));
|
|
}
|
|
else if (flag1 && worldIn.isAirBlock(blockpos) && this.canAttachTo(worldIn, blockpos, enumfacing1))
|
|
{
|
|
- worldIn.setBlockState(blockpos, this.getDefaultState().withProperty(getPropertyFor(enumfacing1.getOpposite()), Boolean.valueOf(true)), 2);
|
|
+// worldIn.setBlockState(blockpos, this.getDefaultState().withProperty(getPropertyFor(enumfacing1.getOpposite()), Boolean.valueOf(true)), 2);
|
|
+ bukkitBlock = worldIn.getWorld().getBlockAt(blockpos.getX(), blockpos.getY(), blockpos.getZ());
|
|
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, getMetaFromState(this.getDefaultState().withProperty(getPropertyFor(enumfacing1.getOpposite()), true)));
|
|
}
|
|
else if (flag2 && worldIn.isAirBlock(blockpos1) && this.canAttachTo(worldIn, blockpos1, enumfacing1))
|
|
{
|
|
- worldIn.setBlockState(blockpos1, this.getDefaultState().withProperty(getPropertyFor(enumfacing1.getOpposite()), Boolean.valueOf(true)), 2);
|
|
+// worldIn.setBlockState(blockpos1, this.getDefaultState().withProperty(getPropertyFor(enumfacing1.getOpposite()), Boolean.valueOf(true)), 2);
|
|
+ bukkitBlock = worldIn.getWorld().getBlockAt(blockpos1.getX(), blockpos1.getY(), blockpos1.getZ());
|
|
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, getMetaFromState(this.getDefaultState().withProperty(getPropertyFor(enumfacing1.getOpposite()), true)));
|
|
}
|
|
}
|
|
else if (iblockstate3.getBlockFaceShape(worldIn, blockpos4, enumfacing1) == BlockFaceShape.SOLID)
|
|
@@ -298,7 +312,10 @@
|
|
|
|
if (((Boolean)iblockstate1.getValue(NORTH)).booleanValue() || ((Boolean)iblockstate1.getValue(EAST)).booleanValue() || ((Boolean)iblockstate1.getValue(SOUTH)).booleanValue() || ((Boolean)iblockstate1.getValue(WEST)).booleanValue())
|
|
{
|
|
- worldIn.setBlockState(blockpos3, iblockstate1, 2);
|
|
+// worldIn.setBlockState(blockpos3, iblockstate1, 2);
|
|
+ org.bukkit.block.Block source = worldIn.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ());
|
|
+ org.bukkit.block.Block bukkitBlock = worldIn.getWorld().getBlockAt(blockpos3.getX(), blockpos3.getY(), blockpos3.getZ());
|
|
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, getMetaFromState(iblockstate1));
|
|
}
|
|
}
|
|
else if (block == this)
|
|
@@ -459,7 +476,17 @@
|
|
|
|
return i;
|
|
}
|
|
+ /*************************FORGE START***********************************/
|
|
+ @Override public boolean isLadder(IBlockState state, IBlockAccess world, BlockPos pos, EntityLivingBase entity){ return true; }
|
|
+ @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; }
|
|
+ @Override
|
|
+ public java.util.List<ItemStack> onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune)
|
|
+ {
|
|
+ return java.util.Arrays.asList(new ItemStack(this, 1));
|
|
+ }
|
|
+ /*************************FORGE END***********************************/
|
|
|
|
+
|
|
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face)
|
|
{
|
|
return BlockFaceShape.UNDEFINED;
|