mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 14:26:00 +03:00
57 lines
2.3 KiB
Diff
57 lines
2.3 KiB
Diff
--- ../src-base/minecraft/net/minecraft/block/BlockMushroom.java
|
|
+++ ../src-work/minecraft/net/minecraft/block/BlockMushroom.java
|
|
@@ -1,6 +1,10 @@
|
|
package net.minecraft.block;
|
|
|
|
import java.util.Random;
|
|
+
|
|
+import org.bukkit.TreeType;
|
|
+import org.bukkit.event.block.BlockSpreadEvent;
|
|
+
|
|
import net.minecraft.block.state.IBlockState;
|
|
import net.minecraft.init.Blocks;
|
|
import net.minecraft.util.math.AxisAlignedBB;
|
|
@@ -26,7 +30,8 @@
|
|
|
|
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
|
|
{
|
|
- if (rand.nextInt(25) == 0)
|
|
+ int sourceX = pos.getX();int sourceY = pos.getY();int sourceZ = pos.getZ(); // CraftBukkit
|
|
+ if (rand.nextInt(Math.max(1, (int) (100.0F / worldIn.spigotConfig.mushroomModifier) * 25)) == 0) //Spigot
|
|
{
|
|
int i = 5;
|
|
int j = 4;
|
|
@@ -58,7 +63,18 @@
|
|
|
|
if (worldIn.isAirBlock(blockpos1) && this.canBlockStay(worldIn, blockpos1, this.getDefaultState()))
|
|
{
|
|
- worldIn.setBlockState(blockpos1, this.getDefaultState(), 2);
|
|
+ // CraftBukkit start
|
|
+ //worldIn.setBlockState(blockpos1, this.getDefaultState(), 2);
|
|
+ org.bukkit.World bworld = worldIn.getWorld();
|
|
+ org.bukkit.block.BlockState blockState = bworld.getBlockAt(blockpos1.getX(), blockpos1.getY(), blockpos1.getZ()).getState();
|
|
+ blockState.setType(org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(this));
|
|
+
|
|
+ BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(sourceX, sourceY, sourceZ), blockState);
|
|
+ worldIn.getServer().getPluginManager().callEvent(event);
|
|
+ if (!event.isCancelled()) {
|
|
+ blockState.update(true);
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|
|
}
|
|
}
|
|
@@ -93,10 +109,12 @@
|
|
|
|
if (this == Blocks.BROWN_MUSHROOM)
|
|
{
|
|
+ BlockSapling.treeType = TreeType.BROWN_MUSHROOM; // CraftBukkit
|
|
worldgenerator = new WorldGenBigMushroom(Blocks.BROWN_MUSHROOM_BLOCK);
|
|
}
|
|
else if (this == Blocks.RED_MUSHROOM)
|
|
{
|
|
+ BlockSapling.treeType = TreeType.RED_MUSHROOM; // CraftBukkit
|
|
worldgenerator = new WorldGenBigMushroom(Blocks.RED_MUSHROOM_BLOCK);
|
|
}
|
|
|