Files
CatServer/patches/net/minecraft/entity/monster/EntitySnowman.java.patch
2018-09-08 17:51:33 +08:00

43 lines
2.0 KiB
Diff

--- ../src-base/minecraft/net/minecraft/entity/monster/EntitySnowman.java
+++ ../src-work/minecraft/net/minecraft/entity/monster/EntitySnowman.java
@@ -1,6 +1,11 @@
package net.minecraft.entity.monster;
import javax.annotation.Nullable;
+
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
+import org.bukkit.event.block.EntityBlockFormEvent;
+
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
@@ -84,7 +89,7 @@
if (this.worldObj.getBiome(new BlockPos(i, 0, k)).getFloatTemperature(new BlockPos(i, j, k)) > 1.0F)
{
- this.attackEntityFrom(DamageSource.onFire, 1.0F);
+ this.attackEntityFrom(CraftEventFactory.MELTING, 1.0F); // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING
}
if (!this.worldObj.getGameRules().getBoolean("mobGriefing"))
@@ -101,7 +106,17 @@
if (this.worldObj.getBlockState(blockpos).getMaterial() == Material.AIR && this.worldObj.getBiome(new BlockPos(i, 0, k)).getFloatTemperature(blockpos) < 0.8F && Blocks.SNOW_LAYER.canPlaceBlockAt(this.worldObj, blockpos))
{
- this.worldObj.setBlockState(blockpos, Blocks.SNOW_LAYER.getDefaultState());
+ // CraftBukkit start
+ org.bukkit.block.BlockState blockState = this.worldObj.getWorld().getBlockAt(i, j, k).getState();
+ blockState.setType(CraftMagicNumbers.getMaterial(Blocks.SNOW_LAYER));
+
+ EntityBlockFormEvent event = new EntityBlockFormEvent(this.getBukkitEntity(), blockState.getBlock(), blockState);
+ this.worldObj.getServer().getPluginManager().callEvent(event);
+
+ if(!event.isCancelled()) {
+ blockState.update(true);
+ }
+ // CraftBukkit end
}
}
}