mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-21 18:37:42 +01:00
Shulker change color with dye
This commit is contained in:
committed by
granny
parent
504c35afb7
commit
c9760f34b3
@@ -8,6 +8,28 @@
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
@@ -88,6 +_,21 @@
|
||||
this.lookControl = new Shulker.ShulkerLookControl(this);
|
||||
}
|
||||
|
||||
+ // Purpur start - Shulker change color with dye
|
||||
+ @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);
|
||||
+ }
|
||||
+ // Purpur end - Shulker change color with dye
|
||||
+
|
||||
@Override
|
||||
protected void registerGoals() {
|
||||
this.goalSelector.addGoal(1, new LookAtPlayerGoal(this, Player.class, 8.0F, 0.02F, true));
|
||||
@@ -459,11 +_,21 @@
|
||||
private void hitByShulkerBullet() {
|
||||
Vec3 vec3 = this.position();
|
||||
|
||||
Reference in New Issue
Block a user