mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-24 03:25:15 +01:00
43 lines
2.0 KiB
Diff
43 lines
2.0 KiB
Diff
--- a/net/minecraft/server/EntitySnowman.java
|
|
+++ b/net/minecraft/server/EntitySnowman.java
|
|
@@ -1,5 +1,11 @@
|
|
package net.minecraft.server;
|
|
|
|
+// CraftBukkit start
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
|
|
+import org.bukkit.event.block.EntityBlockFormEvent;
|
|
+// CraftBukkit end
|
|
+
|
|
public class EntitySnowman extends EntityGolem implements IRangedEntity {
|
|
|
|
private static final DataWatcherObject<Byte> a = DataWatcher.a(EntitySnowman.class, DataWatcherRegistry.a);
|
|
@@ -40,7 +46,7 @@
|
|
}
|
|
|
|
if (this.world.getBiome(new BlockPosition(i, 0, k)).a(new BlockPosition(i, j, k)) > 1.0F) {
|
|
- this.damageEntity(DamageSource.BURN, 1.0F);
|
|
+ this.damageEntity(CraftEventFactory.MELTING, 1.0F); // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING
|
|
}
|
|
|
|
if (!this.world.getGameRules().getBoolean("mobGriefing")) {
|
|
@@ -54,7 +60,17 @@
|
|
BlockPosition blockposition = new BlockPosition(i, j, k);
|
|
|
|
if (this.world.getType(blockposition).getMaterial() == Material.AIR && this.world.getBiome(new BlockPosition(i, 0, k)).a(blockposition) < 0.8F && Blocks.SNOW_LAYER.canPlace(this.world, blockposition)) {
|
|
- this.world.setTypeUpdate(blockposition, Blocks.SNOW_LAYER.getBlockData());
|
|
+ // CraftBukkit start
|
|
+ org.bukkit.block.BlockState blockState = this.world.getWorld().getBlockAt(i, j, k).getState();
|
|
+ blockState.setType(CraftMagicNumbers.getMaterial(Blocks.SNOW_LAYER));
|
|
+
|
|
+ EntityBlockFormEvent event = new EntityBlockFormEvent(this.getBukkitEntity(), blockState.getBlock(), blockState);
|
|
+ this.world.getServer().getPluginManager().callEvent(event);
|
|
+
|
|
+ if(!event.isCancelled()) {
|
|
+ blockState.update(true);
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|
|
}
|
|
}
|