mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
55 lines
2.6 KiB
Diff
55 lines
2.6 KiB
Diff
From 545452f08d19964e93df05345cbd7e405c583077 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 | 17 ++++++++++++++++-
|
|
1 file changed, 16 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntitySnowman.java b/src/main/java/net/minecraft/server/EntitySnowman.java
|
|
index 8677f0818..c13dfc6cc 100644
|
|
--- a/src/main/java/net/minecraft/server/EntitySnowman.java
|
|
+++ b/src/main/java/net/minecraft/server/EntitySnowman.java
|
|
@@ -8,6 +8,7 @@ import org.bukkit.event.player.PlayerShearEntityEvent;
|
|
|
|
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> b = DataWatcher.a(EntitySnowman.class, DataWatcherRegistry.a);
|
|
|
|
public EntitySnowman(EntityTypes<? extends EntitySnowman> entitytypes, World world) {
|
|
@@ -112,7 +113,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);
|
|
@@ -126,6 +127,20 @@ public class EntitySnowman extends EntityGolem implements IRangedEntity {
|
|
itemstack.damage(1, entityhuman, (entityhuman1) -> {
|
|
entityhuman1.d(enumhand);
|
|
});
|
|
+
|
|
+ // 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;
|
|
+ }
|
|
}
|
|
|
|
return super.a(entityhuman, enumhand);
|
|
--
|
|
2.20.1
|
|
|