six patches

This commit is contained in:
Ben Kerllenevich
2021-06-16 07:50:20 -04:00
parent 8489c54fc8
commit 7447eb7020
11 changed files with 385 additions and 438 deletions

View File

@@ -0,0 +1,42 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Sat, 15 Jun 2019 03:12:15 -0500
Subject: [PATCH] Make Iron Golems Swim
diff --git a/src/main/java/net/minecraft/world/entity/animal/IronGolem.java b/src/main/java/net/minecraft/world/entity/animal/IronGolem.java
index ec00c2dd8f969eb99ec6a014e3bcd09c7484b237..9604bda9ed7e0a87bd627521440e8b70f076584a 100644
--- a/src/main/java/net/minecraft/world/entity/animal/IronGolem.java
+++ b/src/main/java/net/minecraft/world/entity/animal/IronGolem.java
@@ -30,6 +30,7 @@ import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.NeutralMob;
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
import net.minecraft.world.entity.ai.attributes.Attributes;
+import net.minecraft.world.entity.ai.goal.FloatGoal;
import net.minecraft.world.entity.ai.goal.GolemRandomStrollInVillageGoal;
import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal;
import net.minecraft.world.entity.ai.goal.MeleeAttackGoal;
@@ -72,6 +73,7 @@ public class IronGolem extends AbstractGolem implements NeutralMob {
@Override
protected void registerGoals() {
+ if (level.purpurConfig.ironGolemCanSwim) this.goalSelector.addGoal(0, new FloatGoal(this)); // Purpur
this.goalSelector.addGoal(1, new MeleeAttackGoal(this, 1.0D, true));
this.goalSelector.addGoal(2, new MoveTowardsTargetGoal(this, 0.9D, 32.0F));
this.goalSelector.addGoal(2, new MoveBackToVillageGoal(this, 0.6D, false));
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index f9908c4edd1b47b447556feeb5de05a0fd3db468..d7a0d258fb150a595fc8fcbf47cc9dbdb899421a 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -154,6 +154,11 @@ public class PurpurWorldConfig {
illusionerMaxHealth = getDouble("mobs.illusioner.attributes.max-health", illusionerMaxHealth);
}
+ public boolean ironGolemCanSwim = false;
+ private void ironGolemSettings() {
+ ironGolemCanSwim = getBoolean("mobs.iron_golem.can-swim", ironGolemCanSwim);
+ }
+
public double rabbitNaturalToast = 0.0D;
public double rabbitNaturalKiller = 0.0D;
private void rabbitSettings() {

View File

@@ -0,0 +1,57 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Sat, 6 Jul 2019 17:00:04 -0500
Subject: [PATCH] Dont send useless entity packets
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index 8ea4209400489116823eced292d8cd9654a1c809..d19a025337c4b0a2965184b4c872f23d15a4a60b 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -189,6 +189,7 @@ public class ServerEntity {
this.teleportDelay = 0;
packet1 = new ClientboundTeleportEntityPacket(this.entity);
}
+ if (net.pl3x.purpur.PurpurConfig.dontSendUselessEntityPackets && isUselessPacket(packet1)) packet1 = null; // Purpur
}
if ((this.trackDelta || this.entity.hasImpulse || this.entity instanceof LivingEntity && ((LivingEntity) this.entity).isFallFlying()) && this.tickCount > 0) {
@@ -257,6 +258,22 @@ public class ServerEntity {
}
+ // Purpur start
+ private boolean isUselessPacket(Packet<?> possibleUselessPacket) {
+ if (possibleUselessPacket instanceof ClientboundMoveEntityPacket) {
+ ClientboundMoveEntityPacket packet = (ClientboundMoveEntityPacket) possibleUselessPacket;
+ if (possibleUselessPacket instanceof ClientboundMoveEntityPacket.Pos) {
+ return packet.getXa() == 0 && packet.getYa() == 0 && packet.getZa() == 0;
+ } else if (possibleUselessPacket instanceof ClientboundMoveEntityPacket.PosRot) {
+ return packet.getXa() == 0 && packet.getYa() == 0 && packet.getZa() == 0 && packet.getyRot() == 0 && packet.getxRot() == 0;
+ } else if (possibleUselessPacket instanceof ClientboundMoveEntityPacket.Rot) {
+ return packet.getyRot() == 0 && packet.getxRot() == 0;
+ }
+ }
+ return false;
+ }
+ // Purpur end
+
public void removePairing(ServerPlayer player) {
this.entity.stopSeenByPlayer(player);
player.connection.send(new ClientboundRemoveEntityPacket(this.entity.getId()));
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
index 4e8f346cfe09b5806f53ae85729b3597b2e7c9eb..561c27bc5c23e3761018b8475ad1512d880418fc 100644
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
@@ -177,6 +177,11 @@ public class PurpurConfig {
enderChestPermissionRows = getBoolean("settings.blocks.ender_chest.use-permissions-for-rows", enderChestPermissionRows);
}
+ public static boolean dontSendUselessEntityPackets = false;
+ private static void dontSendUselessEntityPackets() {
+ dontSendUselessEntityPackets = getBoolean("settings.dont-send-useless-entity-packets", dontSendUselessEntityPackets);
+ }
+
public static boolean loggerSuppressInitLegacyMaterialError = false;
public static boolean loggerSuppressIgnoredAdvancementWarnings = false;
private static void loggerSettings() {

View File

@@ -0,0 +1,92 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Sat, 13 Jul 2019 15:56:22 -0500
Subject: [PATCH] Tulips change fox type
diff --git a/src/main/java/net/minecraft/world/entity/animal/Fox.java b/src/main/java/net/minecraft/world/entity/animal/Fox.java
index 31f4e4a93ea5fd3ffe7e60dff2e2a9642b51daa2..26470e4e07387fcf0c02c1f8845950eca4140a56 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Fox.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Fox.java
@@ -34,6 +34,7 @@ import net.minecraft.tags.Tag;
import net.minecraft.util.Mth;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.InteractionHand;
+import net.minecraft.world.InteractionResult;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.AgeableMob;
import net.minecraft.world.entity.Entity;
@@ -85,6 +86,7 @@ import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.CaveVines;
import net.minecraft.world.level.block.SweetBerryBushBlock;
import net.minecraft.world.level.block.state.BlockState;
+import net.minecraft.world.level.gameevent.GameEvent;
import net.minecraft.world.level.pathfinder.BlockPathTypes;
import net.minecraft.world.phys.Vec3;
@@ -328,6 +330,11 @@ public class Fox extends Animal {
}
private void setTargetGoals() {
+ // Purpur start - do not add duplicate goals
+ this.targetSelector.removeGoal(this.landTargetGoal);
+ this.targetSelector.removeGoal(this.turtleEggTargetGoal);
+ this.targetSelector.removeGoal(this.fishTargetGoal);
+ // Purpur end
if (this.getFoxType() == Fox.Type.RED) {
this.targetSelector.addGoal(4, this.landTargetGoal);
this.targetSelector.addGoal(4, this.turtleEggTargetGoal);
@@ -360,6 +367,7 @@ public class Fox extends Animal {
public void setFoxType(Fox.Type type) {
this.entityData.set(Fox.DATA_TYPE_ID, type.getId());
+ this.setTargetGoals(); // Purpur - fix API bug not updating pathfinders on type change
}
List<UUID> getTrustedUUIDs() {
@@ -690,6 +698,29 @@ public class Fox extends Animal {
return this.getTrustedUUIDs().contains(uuid);
}
+ // Purpur start
+ @Override
+ public InteractionResult mobInteract(Player player, InteractionHand hand) {
+ if (level.purpurConfig.foxTypeChangesWithTulips) {
+ ItemStack itemstack = player.getItemInHand(hand);
+ if (getFoxType() == Type.RED && itemstack.getItem() == Items.WHITE_TULIP) {
+ setFoxType(Type.SNOW);
+ if (!player.getAbilities().instabuild) {
+ itemstack.shrink(1);
+ }
+ return InteractionResult.SUCCESS;
+ } else if (getFoxType() == Type.SNOW && itemstack.getItem() == Items.ORANGE_TULIP) {
+ setFoxType(Type.RED);
+ if (!player.getAbilities().instabuild) {
+ itemstack.shrink(1);
+ }
+ return InteractionResult.SUCCESS;
+ }
+ }
+ return super.mobInteract(player, hand);
+ }
+ // Purpur end
+
@Override
// Paper start - Cancellable death event
protected org.bukkit.event.entity.EntityDeathEvent dropAllDeathLoot(DamageSource source) {
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index d7a0d258fb150a595fc8fcbf47cc9dbdb899421a..142135c8058eb3f199f5f7d4572daaac45d997a0 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -118,6 +118,11 @@ public class PurpurWorldConfig {
creeperChargedChance = getDouble("mobs.creeper.naturally-charged-chance", creeperChargedChance);
}
+ public boolean foxTypeChangesWithTulips = false;
+ private void foxSettings() {
+ foxTypeChangesWithTulips = getBoolean("mobs.fox.tulips-change-type", foxTypeChangesWithTulips);
+ }
+
public float giantStepHeight = 2.0F;
public float giantJumpHeight = 1.0F;
public double giantMovementSpeed = 0.5D;

View File

@@ -0,0 +1,104 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Thu, 26 Mar 2020 19:46:44 -0500
Subject: [PATCH] Breedable Polar Bears
diff --git a/src/main/java/net/minecraft/world/entity/animal/PolarBear.java b/src/main/java/net/minecraft/world/entity/animal/PolarBear.java
index 0694cd0b994ee595adca43c988485e6dc13c7244..583bb80059b9351d27d15859b1687dd817ba165e 100644
--- a/src/main/java/net/minecraft/world/entity/animal/PolarBear.java
+++ b/src/main/java/net/minecraft/world/entity/animal/PolarBear.java
@@ -32,6 +32,7 @@ import net.minecraft.world.entity.Pose;
import net.minecraft.world.entity.SpawnGroupData;
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
import net.minecraft.world.entity.ai.attributes.Attributes;
+import net.minecraft.world.entity.ai.goal.BreedGoal;
import net.minecraft.world.entity.ai.goal.FloatGoal;
import net.minecraft.world.entity.ai.goal.FollowParentGoal;
import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal;
@@ -39,11 +40,13 @@ import net.minecraft.world.entity.ai.goal.MeleeAttackGoal;
import net.minecraft.world.entity.ai.goal.PanicGoal;
import net.minecraft.world.entity.ai.goal.RandomLookAroundGoal;
import net.minecraft.world.entity.ai.goal.RandomStrollGoal;
+import net.minecraft.world.entity.ai.goal.TemptGoal;
import net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal;
import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal;
import net.minecraft.world.entity.ai.goal.target.ResetUniversalAngerTargetGoal;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
+import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.ServerLevelAccessor;
@@ -66,6 +69,30 @@ public class PolarBear extends Animal implements NeutralMob {
super(type, world);
}
+ // Purpur start
+ @Override
+ public boolean canMate(Animal other) {
+ if (other == this) {
+ return false;
+ } else if (this.isStanding()) {
+ return false;
+ } else if (this.getTarget() != null) {
+ return false;
+ } else if (!(other instanceof PolarBear)) {
+ return false;
+ } else {
+ PolarBear bear = (PolarBear) other;
+ if (bear.isStanding()) {
+ return false;
+ }
+ if (bear.getTarget() != null) {
+ return false;
+ }
+ return this.isInLove() && bear.isInLove();
+ }
+ }
+ // Purpur end
+
@Override
public AgeableMob getBreedOffspring(ServerLevel world, AgeableMob entity) {
return EntityType.POLAR_BEAR.create(world);
@@ -73,7 +100,7 @@ public class PolarBear extends Animal implements NeutralMob {
@Override
public boolean isFood(ItemStack stack) {
- return false;
+ return level.purpurConfig.polarBearBreedableItem != null && stack.getItem() == level.purpurConfig.polarBearBreedableItem; // Purpur;
}
@Override
@@ -82,6 +109,12 @@ public class PolarBear extends Animal implements NeutralMob {
this.goalSelector.addGoal(0, new FloatGoal(this));
this.goalSelector.addGoal(1, new PolarBear.PolarBearMeleeAttackGoal());
this.goalSelector.addGoal(1, new PolarBear.PolarBearPanicGoal());
+ // Purpur start
+ if (level.purpurConfig.polarBearBreedableItem != null) {
+ this.goalSelector.addGoal(2, new BreedGoal(this, 1.0D));
+ this.goalSelector.addGoal(3, new TemptGoal(this, 1.0D, Ingredient.of(level.purpurConfig.polarBearBreedableItem), false));
+ }
+ // Purpur end
this.goalSelector.addGoal(4, new FollowParentGoal(this, 1.25D));
this.goalSelector.addGoal(5, new RandomStrollGoal(this, 1.0D));
this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 6.0F));
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 142135c8058eb3f199f5f7d4572daaac45d997a0..8191eba054e4d47a1310c6d57688d759b909443e 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -164,6 +164,14 @@ public class PurpurWorldConfig {
ironGolemCanSwim = getBoolean("mobs.iron_golem.can-swim", ironGolemCanSwim);
}
+ public String polarBearBreedableItemString = "";
+ public Item polarBearBreedableItem = null;
+ private void polarBearSettings() {
+ polarBearBreedableItemString = getString("mobs.polar_bear.breedable-item", polarBearBreedableItemString);
+ Item item = Registry.ITEM.get(new ResourceLocation(polarBearBreedableItemString));
+ if (item != Items.AIR) polarBearBreedableItem = item;
+ }
+
public double rabbitNaturalToast = 0.0D;
public double rabbitNaturalKiller = 0.0D;
private void rabbitSettings() {

View File

@@ -0,0 +1,83 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Sun, 12 Apr 2020 13:19:34 -0500
Subject: [PATCH] Chickens can retaliate
diff --git a/src/main/java/net/minecraft/world/entity/animal/Chicken.java b/src/main/java/net/minecraft/world/entity/animal/Chicken.java
index 8460bed561c09a647f6e0209f7c5448e5a42b281..56aee819372d4baacf73c345603ce889b3a60b52 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Chicken.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Chicken.java
@@ -20,10 +20,12 @@ import net.minecraft.world.entity.ai.goal.BreedGoal;
import net.minecraft.world.entity.ai.goal.FloatGoal;
import net.minecraft.world.entity.ai.goal.FollowParentGoal;
import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal;
+import net.minecraft.world.entity.ai.goal.MeleeAttackGoal;
import net.minecraft.world.entity.ai.goal.PanicGoal;
import net.minecraft.world.entity.ai.goal.RandomLookAroundGoal;
import net.minecraft.world.entity.ai.goal.TemptGoal;
import net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal;
+import net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
@@ -52,16 +54,33 @@ public class Chicken extends Animal {
this.setPathfindingMalus(BlockPathTypes.WATER, 0.0F);
}
+ // Purpur start
+ @Override
+ protected void initAttributes() {
+ if (level.purpurConfig.chickenRetaliate) {
+ this.getAttribute(Attributes.ATTACK_DAMAGE).setBaseValue(2.0D);
+ }
+ }
+ // Purpur end
+
@Override
protected void registerGoals() {
this.goalSelector.addGoal(0, new FloatGoal(this));
- this.goalSelector.addGoal(1, new PanicGoal(this, 1.4D));
+ // this.goalSelector.addGoal(1, new PanicGoal(this, 1.4D)); // Purpur - moved down
this.goalSelector.addGoal(2, new BreedGoal(this, 1.0D));
this.goalSelector.addGoal(3, new TemptGoal(this, 1.0D, Chicken.FOOD_ITEMS, false));
this.goalSelector.addGoal(4, new FollowParentGoal(this, 1.1D));
this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 1.0D));
this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 6.0F));
this.goalSelector.addGoal(7, new RandomLookAroundGoal(this));
+ // Purpur start
+ if (level.purpurConfig.chickenRetaliate) {
+ this.goalSelector.addGoal(1, new MeleeAttackGoal(this, 1.0D, false));
+ this.targetSelector.addGoal(1, new HurtByTargetGoal(this));
+ } else {
+ this.goalSelector.addGoal(1, new PanicGoal(this, 1.4D));
+ }
+ // Purpur end
}
@Override
@@ -70,7 +89,7 @@ public class Chicken extends Animal {
}
public static AttributeSupplier.Builder createAttributes() {
- return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 4.0D).add(Attributes.MOVEMENT_SPEED, 0.25D);
+ return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 4.0D).add(Attributes.MOVEMENT_SPEED, 0.25D).add(Attributes.ATTACK_DAMAGE, 0.0D); // Purpur
}
@Override
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 8191eba054e4d47a1310c6d57688d759b909443e..615f7a3ccb925a8db52c5f2e4e0510f740784194 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -113,6 +113,11 @@ public class PurpurWorldConfig {
turtleEggsBreakFromMinecarts = getBoolean("blocks.turtle_egg.break-from-minecarts", turtleEggsBreakFromMinecarts);
}
+ public boolean chickenRetaliate = false;
+ private void chickenSettings() {
+ chickenRetaliate = getBoolean("mobs.chicken.retaliate", chickenRetaliate);
+ }
+
public double creeperChargedChance = 0.0D;
private void creeperSettings() {
creeperChargedChance = getDouble("mobs.creeper.naturally-charged-chance", creeperChargedChance);

View File

@@ -0,0 +1,34 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Sun, 6 Oct 2019 12:46:35 -0500
Subject: [PATCH] Add option to set armorstand step height
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
index 5fc66d7096afcfe63eba774e1dc330ac3263e4b0..7a3a364f5e3b025cc0a5694401cb9298c80cb733 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
@@ -669,6 +669,7 @@ public class ArmorStand extends LivingEntity {
@Override
public void tick() {
+ maxUpStep = level.purpurConfig.armorstandStepHeight;
// Paper start
if (!this.canTick) {
if (this.noTickPoseDirty) {
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 615f7a3ccb925a8db52c5f2e4e0510f740784194..5d80cd3049e33d1bed7d347f4092a0ca476f711b 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -63,6 +63,11 @@ public class PurpurWorldConfig {
return PurpurConfig.config.getString("world-settings." + worldName + "." + path, PurpurConfig.config.getString("world-settings.default." + path));
}
+ public float armorstandStepHeight = 0.0F;
+ private void armorstandSettings() {
+ armorstandStepHeight = (float) getDouble("gameplay-mechanics.armorstand.step-height", armorstandStepHeight);
+ }
+
public boolean idleTimeoutKick = true;
public boolean idleTimeoutTickNearbyEntities = true;
public boolean idleTimeoutCountAsSleeping = false;