mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 08:27:43 +01:00
51 lines
3.1 KiB
Diff
51 lines
3.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
|
Date: Sat, 21 Aug 2021 00:07:39 -0500
|
|
Subject: [PATCH] Shulker change color with dye
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/monster/Shulker.java b/src/main/java/net/minecraft/world/entity/monster/Shulker.java
|
|
index 8464a8288f7ec7ae14e44b93607ebb0617790c46..837a251afd68b68c5f5f6ab940d62332cb80fe6f 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/Shulker.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/Shulker.java
|
|
@@ -126,6 +126,19 @@ public class Shulker extends AbstractGolem implements VariantHolder<Optional<Dye
|
|
return this.level().purpurConfig.shulkerTakeDamageFromWater;
|
|
}
|
|
|
|
+ @Override
|
|
+ protected net.minecraft.world.InteractionResult mobInteract(Player player, net.minecraft.world.InteractionHand hand) {
|
|
+ net.minecraft.world.item.ItemStack itemstack = player.getItemInHand(hand);
|
|
+ if (player.level().purpurConfig.shulkerChangeColorWithDye && itemstack.getItem() instanceof net.minecraft.world.item.DyeItem dye && dye.getDyeColor() != this.getColor()) {
|
|
+ this.setVariant(Optional.of(dye.getDyeColor()));
|
|
+ if (!player.getAbilities().instabuild) {
|
|
+ itemstack.shrink(1);
|
|
+ }
|
|
+ return net.minecraft.world.InteractionResult.SUCCESS;
|
|
+ }
|
|
+ return super.mobInteract(player, hand);
|
|
+ }
|
|
+
|
|
@Override
|
|
protected void registerGoals() {
|
|
this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur
|
|
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
index ff4d9ccbb9801649ad8ea9dac72b0f32f58e06c1..a47ddcb40340c19ce99a8befe8034240e0457acb 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
@@ -2327,6 +2327,7 @@ public class PurpurWorldConfig {
|
|
public double shulkerSpawnFromBulletNearbyRange = 8.0D;
|
|
public String shulkerSpawnFromBulletNearbyEquation = "(nearby - 1) / 5.0";
|
|
public boolean shulkerSpawnFromBulletRandomColor = false;
|
|
+ public boolean shulkerChangeColorWithDye = false;
|
|
private void shulkerSettings() {
|
|
shulkerRidable = getBoolean("mobs.shulker.ridable", shulkerRidable);
|
|
shulkerRidableInWater = getBoolean("mobs.shulker.ridable-in-water", shulkerRidableInWater);
|
|
@@ -2344,6 +2345,7 @@ public class PurpurWorldConfig {
|
|
shulkerSpawnFromBulletNearbyRange = getDouble("mobs.shulker.spawn-from-bullet.nearby-range", shulkerSpawnFromBulletNearbyRange);
|
|
shulkerSpawnFromBulletNearbyEquation = getString("mobs.shulker.spawn-from-bullet.nearby-equation", shulkerSpawnFromBulletNearbyEquation);
|
|
shulkerSpawnFromBulletRandomColor = getBoolean("mobs.shulker.spawn-from-bullet.random-color", shulkerSpawnFromBulletRandomColor);
|
|
+ shulkerChangeColorWithDye = getBoolean("mobs.shulker.change-color-with-dye", shulkerChangeColorWithDye);
|
|
}
|
|
|
|
public boolean silverfishRidable = false;
|