mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 11:25:55 +03:00
86 lines
6.2 KiB
Diff
86 lines
6.2 KiB
Diff
--- ../src-base/minecraft/net/minecraft/block/BlockVine.java
|
|
+++ ../src-work/minecraft/net/minecraft/block/BlockVine.java
|
|
@@ -2,6 +2,9 @@
|
|
|
|
import java.util.Random;
|
|
import javax.annotation.Nullable;
|
|
+
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
+
|
|
import net.minecraft.block.material.Material;
|
|
import net.minecraft.block.properties.IProperty;
|
|
import net.minecraft.block.properties.PropertyBool;
|
|
@@ -182,7 +185,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) //Spigot
|
|
{
|
|
int i = 4;
|
|
int j = 5;
|
|
@@ -228,7 +231,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);
|
|
+ // CraftBukkit start - Call BlockSpreadEvent
|
|
+ org.bukkit.block.Block source = worldIn.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ());
|
|
+ org.bukkit.block.Block block = worldIn.getWorld().getBlockAt(blockpos2.getX(), blockpos2.getY(), blockpos2.getZ());
|
|
+ CraftEventFactory.handleBlockSpreadEvent(block, source, this, getMetaFromState(iblockstate2));
|
|
+ // CraftBukkit end
|
|
}
|
|
}
|
|
}
|
|
@@ -249,26 +256,32 @@
|
|
BlockPos blockpos = blockpos4.offset(enumfacing3);
|
|
BlockPos blockpos1 = blockpos4.offset(enumfacing4);
|
|
|
|
+ // CraftBukkit start - Call BlockSpreadEvent
|
|
+ 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.canAttachVineOn(worldIn.getBlockState(blockpos)))
|
|
{
|
|
- worldIn.setBlockState(blockpos4, this.getDefaultState().withProperty(getPropertyFor(enumfacing3), Boolean.valueOf(true)), 2);
|
|
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, getMetaFromState(getDefaultState().withProperty(getPropertyFor(enumfacing3), true)));
|
|
}
|
|
else if (flag2 && this.canAttachVineOn(worldIn.getBlockState(blockpos1)))
|
|
{
|
|
- worldIn.setBlockState(blockpos4, this.getDefaultState().withProperty(getPropertyFor(enumfacing4), Boolean.valueOf(true)), 2);
|
|
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, getMetaFromState(getDefaultState().withProperty(getPropertyFor(enumfacing4), true)));
|
|
}
|
|
else if (flag1 && worldIn.isAirBlock(blockpos) && this.canAttachVineOn(worldIn.getBlockState(pos.offset(enumfacing3))))
|
|
{
|
|
- 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(getDefaultState().withProperty(getPropertyFor(enumfacing1.getOpposite()), true)));
|
|
}
|
|
else if (flag2 && worldIn.isAirBlock(blockpos1) && this.canAttachVineOn(worldIn.getBlockState(pos.offset(enumfacing4))))
|
|
{
|
|
- 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(getDefaultState().withProperty(getPropertyFor(enumfacing1.getOpposite()), true)));
|
|
}
|
|
else if (this.canAttachVineOn(worldIn.getBlockState(blockpos4.up())))
|
|
{
|
|
- worldIn.setBlockState(blockpos4, this.getDefaultState(), 2);
|
|
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, getMetaFromState(getDefaultState()));
|
|
}
|
|
+ // CraftBukkit end
|
|
}
|
|
else if (block1.blockMaterial.isOpaque() && iblockstate3.isFullCube())
|
|
{
|
|
@@ -298,7 +311,11 @@
|
|
|
|
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);
|
|
+ // CraftBukkit start - Call BlockSpreadEvent
|
|
+ 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));
|
|
+ // CraftBukkit end
|
|
}
|
|
}
|
|
else if (block == this)
|