mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 08:27:43 +01:00
Snowman set pumpkin on/off by player interaction
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
From e560363dbb4d096d26d2b6d6e184426d9e9193d5 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Fri, 3 May 2019 23:58:44 -0500
|
||||
Subject: [PATCH] Snowman set pumpkin on/off by player interaction
|
||||
|
||||
---
|
||||
.../net/minecraft/server/EntitySnowman.java | 19 +++++++++++++++++--
|
||||
1 file changed, 17 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntitySnowman.java b/src/main/java/net/minecraft/server/EntitySnowman.java
|
||||
index b5c2fd92..7518d997 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntitySnowman.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntitySnowman.java
|
||||
@@ -7,7 +7,7 @@ import org.bukkit.event.player.PlayerShearEntityEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
public class EntitySnowman extends EntityGolem implements IRangedEntity {
|
||||
-
|
||||
+ private static final RecipeItemStack PUMPKIN = RecipeItemStack.a(Blocks.PUMPKIN.getItem(), Blocks.CARVED_PUMPKIN.getItem(), Blocks.JACK_O_LANTERN.getItem()); // Purpur
|
||||
private static final DataWatcherObject<Byte> a = DataWatcher.a(EntitySnowman.class, DataWatcherRegistry.a);
|
||||
|
||||
public EntitySnowman(World world) {
|
||||
@@ -107,7 +107,7 @@ public class EntitySnowman extends EntityGolem implements IRangedEntity {
|
||||
protected boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
||||
ItemStack itemstack = entityhuman.b(enumhand);
|
||||
|
||||
- if (itemstack.getItem() == Items.SHEARS && this.hasPumpkin() && !this.world.isClientSide) {
|
||||
+ if (this.hasPumpkin()) { if (itemstack.getItem() == Items.SHEARS) { // Purpur
|
||||
// CraftBukkit start
|
||||
PlayerShearEntityEvent event = new PlayerShearEntityEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), this.getBukkitEntity());
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
@@ -119,6 +119,21 @@ public class EntitySnowman extends EntityGolem implements IRangedEntity {
|
||||
|
||||
this.setHasPumpkin(false);
|
||||
itemstack.damage(1, entityhuman);
|
||||
+
|
||||
+ // Purpur start
|
||||
+ EntityItem pumpkin = new EntityItem(world, locX, locY, locZ, new ItemStack(Blocks.PUMPKIN.getItem()));
|
||||
+ pumpkin.pickupDelay = 10;
|
||||
+ world.addEntity(pumpkin);
|
||||
+ return true;
|
||||
+ }} else {
|
||||
+ if (PUMPKIN.test(itemstack)) {
|
||||
+ setHasPumpkin(true);
|
||||
+ if (!entityhuman.abilities.canInstantlyBuild) {
|
||||
+ itemstack.subtract(1);
|
||||
+ }
|
||||
+ return true;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
|
||||
return super.a(entityhuman, enumhand);
|
||||
--
|
||||
2.20.1
|
||||
|
||||
Reference in New Issue
Block a user