mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-21 10:27:44 +01:00
Vanilla snowman now drops pumpking when sheared
This commit is contained in:
@@ -5,34 +5,15 @@ Subject: [PATCH] Snowman drop and put back pumpkin
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntitySnowman.java b/src/main/java/net/minecraft/server/EntitySnowman.java
|
||||
index 48997367a67ffd1dbf29cdb048720610528f35cb..95ee716fc9b79b5fcb8508118b3876c51f3f6987 100644
|
||||
index 48997367a67ffd1dbf29cdb048720610528f35cb..51396cbd18d0e053e788f82bf4a3bc2533f20e11 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntitySnowman.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntitySnowman.java
|
||||
@@ -7,6 +7,7 @@ import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
|
||||
public class EntitySnowman extends EntityGolem implements IShearable, 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) {
|
||||
@@ -120,9 +121,25 @@ public class EntitySnowman extends EntityGolem implements IShearable, IRangedEnt
|
||||
itemstack.damage(1, entityhuman, (entityhuman1) -> {
|
||||
entityhuman1.broadcastItemBreak(enumhand);
|
||||
});
|
||||
+ // Purpur start
|
||||
+ if (world.purpurConfig.snowGolemDropsPumpkin) {
|
||||
+ EntityItem pumpkin = new EntityItem(world, locX(), locY(), locZ(), new ItemStack(Blocks.CARVED_PUMPKIN.getItem()));
|
||||
+ pumpkin.pickupDelay = 10;
|
||||
+ world.addEntity(pumpkin);
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
@@ -123,6 +123,14 @@ public class EntitySnowman extends EntityGolem implements IShearable, IRangedEnt
|
||||
}
|
||||
|
||||
return EnumInteractionResult.a(this.world.isClientSide);
|
||||
+ // Purpur start
|
||||
+ } else if (world.purpurConfig.snowGolemPutPumpkinBack && !hasPumpkin() && PUMPKIN.test(itemstack)) {
|
||||
+ } else if (world.purpurConfig.snowGolemPutPumpkinBack && !hasPumpkin() && itemstack.getItem() == Blocks.CARVED_PUMPKIN.getItem()) {
|
||||
+ setHasPumpkin(true);
|
||||
+ if (!entityhuman.abilities.canInstantlyBuild) {
|
||||
+ itemstack.subtract(1);
|
||||
@@ -42,15 +23,23 @@ index 48997367a67ffd1dbf29cdb048720610528f35cb..95ee716fc9b79b5fcb8508118b3876c5
|
||||
} else {
|
||||
return EnumInteractionResult.PASS;
|
||||
}
|
||||
@@ -133,6 +141,7 @@ public class EntitySnowman extends EntityGolem implements IShearable, IRangedEnt
|
||||
this.world.playSound((EntityHuman) null, (Entity) this, SoundEffects.ENTITY_SNOW_GOLEM_SHEAR, soundcategory, 1.0F, 1.0F);
|
||||
if (!this.world.s_()) {
|
||||
this.setHasPumpkin(false);
|
||||
+ if (world.purpurConfig.snowGolemDropsPumpkin) // Purpur
|
||||
this.a(new ItemStack(Items.dj), 1.7F);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 24ef91788ff69004eed1b136a0ceb6176db00e76..6d93ff4b08582f0f3ea1bb4b582aaa881651d34d 100644
|
||||
index 24ef91788ff69004eed1b136a0ceb6176db00e76..609307a409365829e61430da47aa75125afcb8c4 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -208,6 +208,13 @@ public class PurpurWorldConfig {
|
||||
rabbitNaturalKiller = getDouble("mobs.rabbit.spawn-killer-rabbit-chance", rabbitNaturalKiller);
|
||||
}
|
||||
|
||||
+ public boolean snowGolemDropsPumpkin = false;
|
||||
+ public boolean snowGolemDropsPumpkin = true;
|
||||
+ public boolean snowGolemPutPumpkinBack = false;
|
||||
+ private void snowGolemSettings() {
|
||||
+ snowGolemDropsPumpkin = getBoolean("mobs.snow_golem.drop-pumpkin-when-sheared", snowGolemDropsPumpkin);
|
||||
|
||||
Reference in New Issue
Block a user