mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-22 02:47:43 +01:00
save stuff here
This commit is contained in:
@@ -5,7 +5,7 @@ Subject: [PATCH] Cows eat mushrooms
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Cow.java b/src/main/java/net/minecraft/world/entity/animal/Cow.java
|
||||
index 9a973e2dc94aa1c8928eea87a6a12789381d15d8..07d60d3f49a4ed67cc4739baddbb41818b557eb1 100644
|
||||
index d26a44d634fe02e595654e573d02243b5eb66086..e5e84c85d2b1c84c7612392bb060f713bd03ddcf 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Cow.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Cow.java
|
||||
@@ -2,6 +2,7 @@ package net.minecraft.world.entity.animal;
|
||||
@@ -28,7 +28,7 @@ index 9a973e2dc94aa1c8928eea87a6a12789381d15d8..07d60d3f49a4ed67cc4739baddbb4181
|
||||
this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur
|
||||
this.goalSelector.addGoal(1, new PanicGoal(this, 2.0D));
|
||||
this.goalSelector.addGoal(2, new BreedGoal(this, 1.0D));
|
||||
+ if (level.purpurConfig.cowFeedMushrooms > 0) this.goalSelector.addGoal(3, new TemptGoal(this, 1.25D, Ingredient.of(Items.WHEAT, Blocks.RED_MUSHROOM.asItem(), Blocks.BROWN_MUSHROOM.asItem()), false)); else // Purpur
|
||||
+ if (level().purpurConfig.cowFeedMushrooms > 0) this.goalSelector.addGoal(3, new TemptGoal(this, 1.25D, Ingredient.of(Items.WHEAT, Blocks.RED_MUSHROOM.asItem(), Blocks.BROWN_MUSHROOM.asItem()), false)); else // Purpur
|
||||
this.goalSelector.addGoal(3, new TemptGoal(this, 1.25D, Ingredient.of(Items.WHEAT), false));
|
||||
this.goalSelector.addGoal(4, new FollowParentGoal(this, 1.25D));
|
||||
this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 1.0D));
|
||||
@@ -37,7 +37,7 @@ index 9a973e2dc94aa1c8928eea87a6a12789381d15d8..07d60d3f49a4ed67cc4739baddbb4181
|
||||
player.setItemInHand(hand, itemstack1);
|
||||
return InteractionResult.sidedSuccess(this.level().isClientSide);
|
||||
+ // Purpur start - feed mushroom to change to mooshroom
|
||||
+ } else if (level.purpurConfig.cowFeedMushrooms > 0 && this.getType() != EntityType.MOOSHROOM && isMushroom(itemstack)) {
|
||||
+ } else if (level().purpurConfig.cowFeedMushrooms > 0 && this.getType() != EntityType.MOOSHROOM && isMushroom(itemstack)) {
|
||||
+ return this.feedMushroom(player, itemstack);
|
||||
+ // Purpur end
|
||||
} else {
|
||||
@@ -67,7 +67,7 @@ index 9a973e2dc94aa1c8928eea87a6a12789381d15d8..07d60d3f49a4ed67cc4739baddbb4181
|
||||
+ private InteractionResult feedMushroom(Player player, ItemStack stack) {
|
||||
+ level.broadcastEntityEvent(this, (byte) 18); // hearts
|
||||
+ playSound(SoundEvents.COW_MILK, 1.0F, 1.0F);
|
||||
+ if (incrementFeedCount(stack) < level.purpurConfig.cowFeedMushrooms) {
|
||||
+ if (incrementFeedCount(stack) < level().purpurConfig.cowFeedMushrooms) {
|
||||
+ if (!player.getAbilities().instabuild) {
|
||||
+ stack.shrink(1);
|
||||
+ }
|
||||
@@ -114,22 +114,22 @@ index 9a973e2dc94aa1c8928eea87a6a12789381d15d8..07d60d3f49a4ed67cc4739baddbb4181
|
||||
+ // Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index aad4d95b24473a3bdcaa8120c39985b62adb7aa4..b3f8077b7a27a0298d88a651cb93b4028f2621ee 100644
|
||||
index df28065f664791a4cf5bbae5cd3cabe691d07a39..ed32ff8a2ab16226a8679daff5835cc819b3b709 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -273,6 +273,7 @@ public class PurpurWorldConfig {
|
||||
}
|
||||
|
||||
@@ -331,6 +331,7 @@ public class PurpurWorldConfig {
|
||||
public boolean cowRidableInWater = true;
|
||||
public boolean cowControllable = true;
|
||||
public double cowMaxHealth = 10.0D;
|
||||
+ public int cowFeedMushrooms = 0;
|
||||
private void cowSettings() {
|
||||
if (PurpurConfig.version < 10) {
|
||||
double oldValue = getDouble("mobs.cow.attributes.max-health", cowMaxHealth);
|
||||
@@ -280,6 +281,7 @@ public class PurpurWorldConfig {
|
||||
cowRidable = getBoolean("mobs.cow.ridable", cowRidable);
|
||||
cowRidableInWater = getBoolean("mobs.cow.ridable-in-water", cowRidableInWater);
|
||||
@@ -341,6 +342,7 @@ public class PurpurWorldConfig {
|
||||
set("mobs.cow.attributes.max_health", oldValue);
|
||||
}
|
||||
cowMaxHealth = getDouble("mobs.cow.attributes.max_health", cowMaxHealth);
|
||||
+ cowFeedMushrooms = getInt("mobs.cow.feed-mushrooms-for-mooshroom", cowFeedMushrooms);
|
||||
}
|
||||
|
||||
public double creeperMaxHealth = 20.0D;
|
||||
public boolean creeperRidable = false;
|
||||
|
||||
Reference in New Issue
Block a user