mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 01:17:42 +01:00
progress
This commit is contained in:
80
patches/server/0155-Config-to-always-tame-in-Creative.patch
Normal file
80
patches/server/0155-Config-to-always-tame-in-Creative.patch
Normal file
@@ -0,0 +1,80 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Encode42 <me@encode42.dev>
|
||||
Date: Tue, 9 Feb 2021 21:23:37 -0500
|
||||
Subject: [PATCH] Config to always tame in Creative
|
||||
|
||||
Adds a configuration option that ensures a player in Creative always tames a tameable entity.
|
||||
This essentially allows Creative mode players to tame animals on their first try.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/RunAroundLikeCrazyGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/RunAroundLikeCrazyGoal.java
|
||||
index fd0f5c255729b2c05ead5843ab58fe880971b3db..08bdebf99cdedfc6115405e5198346ee4e6e1dce 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/goal/RunAroundLikeCrazyGoal.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/RunAroundLikeCrazyGoal.java
|
||||
@@ -63,7 +63,7 @@ public class RunAroundLikeCrazyGoal extends Goal {
|
||||
int j = this.horse.getMaxTemper();
|
||||
|
||||
// CraftBukkit - fire EntityTameEvent
|
||||
- if (j > 0 && this.horse.getRandom().nextInt(j) < i && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this.horse, ((org.bukkit.craftbukkit.entity.CraftHumanEntity) this.horse.getBukkitEntity().getPassenger()).getHandle()).isCancelled()) {
|
||||
+ if ((this.horse.level.purpurConfig.alwaysTameInCreative && ((Player) entity).getAbilities().instabuild) || (j > 0 && this.horse.getRandom().nextInt(j) < i && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this.horse, ((org.bukkit.craftbukkit.entity.CraftHumanEntity) this.horse.getBukkitEntity().getPassenger()).getHandle()).isCancelled())) { // Purpur
|
||||
this.horse.tameWithName((Player) entity);
|
||||
return;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Cat.java b/src/main/java/net/minecraft/world/entity/animal/Cat.java
|
||||
index 052d1e51a891ee17bed0043f6f3fd162c15b16b2..0d521af1a44acc0fd62f209b845b6d128e42baf4 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Cat.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Cat.java
|
||||
@@ -466,7 +466,7 @@ public class Cat extends TamableAnimal {
|
||||
}
|
||||
} else if (this.isFood(itemstack)) {
|
||||
this.usePlayerItem(player, hand, itemstack);
|
||||
- if (this.random.nextInt(3) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, player).isCancelled()) { // CraftBukkit
|
||||
+ if ((this.level.purpurConfig.alwaysTameInCreative && player.getAbilities().instabuild) || (this.random.nextInt(3) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, player).isCancelled())) { // CraftBukkit // Purpur
|
||||
this.tame(player);
|
||||
this.setOrderedToSit(true);
|
||||
this.level.broadcastEntityEvent(this, (byte) 7);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Parrot.java b/src/main/java/net/minecraft/world/entity/animal/Parrot.java
|
||||
index 2cc91c255e0f77b214b8ec54429c11bb1d6fe8e0..553b0aff0ccc5baf41d5faae1a2fd88249dd5a74 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Parrot.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Parrot.java
|
||||
@@ -316,7 +316,7 @@ public class Parrot extends ShoulderRidingEntity implements FlyingAnimal {
|
||||
}
|
||||
|
||||
if (!this.level.isClientSide) {
|
||||
- if (this.random.nextInt(10) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, player).isCancelled()) { // CraftBukkit
|
||||
+ if ((this.level.purpurConfig.alwaysTameInCreative && player.getAbilities().instabuild) || (this.random.nextInt(10) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, player).isCancelled())) { // CraftBukkit // Purpur
|
||||
this.tame(player);
|
||||
this.level.broadcastEntityEvent(this, (byte) 7);
|
||||
} else {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Wolf.java b/src/main/java/net/minecraft/world/entity/animal/Wolf.java
|
||||
index 518dd0e6b4889c049e438b393baa795a5eac3e7d..21e154c4e7fe261a41c891b481072fbd6d5215b5 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Wolf.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Wolf.java
|
||||
@@ -509,7 +509,7 @@ public class Wolf extends TamableAnimal implements NeutralMob {
|
||||
}
|
||||
|
||||
// CraftBukkit - added event call and isCancelled check.
|
||||
- if (this.random.nextInt(3) == 0 && !CraftEventFactory.callEntityTameEvent(this, player).isCancelled()) {
|
||||
+ if ((this.level.purpurConfig.alwaysTameInCreative && player.getAbilities().instabuild) || (this.random.nextInt(3) == 0 && !CraftEventFactory.callEntityTameEvent(this, player).isCancelled())) { // Purpur
|
||||
this.tame(player);
|
||||
this.navigation.stop();
|
||||
this.setTarget((LivingEntity) null);
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 58338f0d1c1cdd153ce90e79ad4ae2725622752e..930adab7d6d387c935cb9e8d974d4fdf048871be 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -355,6 +355,7 @@ public class PurpurWorldConfig {
|
||||
}
|
||||
|
||||
public boolean useBetterMending = false;
|
||||
+ public boolean alwaysTameInCreative = false;
|
||||
public boolean boatEjectPlayersOnLand = false;
|
||||
public boolean boatsDoFallDamage = true;
|
||||
public boolean disableDropsOnCrammingDeath = false;
|
||||
@@ -374,6 +375,7 @@ public class PurpurWorldConfig {
|
||||
public int animalBreedingCooldownSeconds = 0;
|
||||
private void miscGameplayMechanicsSettings() {
|
||||
useBetterMending = getBoolean("gameplay-mechanics.use-better-mending", useBetterMending);
|
||||
+ alwaysTameInCreative = getBoolean("gameplay-mechanics.always-tame-in-creative", alwaysTameInCreative);
|
||||
boatEjectPlayersOnLand = getBoolean("gameplay-mechanics.boat.eject-players-on-land", boatEjectPlayersOnLand);
|
||||
boatsDoFallDamage = getBoolean("gameplay-mechanics.boat.do-fall-damage", boatsDoFallDamage);
|
||||
disableDropsOnCrammingDeath = getBoolean("gameplay-mechanics.disable-drops-on-cramming-death", disableDropsOnCrammingDeath);
|
||||
93
patches/server/0156-End-crystal-explosion-options.patch
Normal file
93
patches/server/0156-End-crystal-explosion-options.patch
Normal file
@@ -0,0 +1,93 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ben Kerllenevich <me@notom3ga.me>
|
||||
Date: Sat, 13 Feb 2021 09:28:56 -0500
|
||||
Subject: [PATCH] End crystal explosion options
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
|
||||
index 92e65f3fbc8f5d77bb8cc31e7a7780c2589f4227..0c46507ab0b904fb1f79bc5421c88c03e894c869 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
|
||||
@@ -130,6 +130,22 @@ public class EndCrystal extends Entity {
|
||||
phantomDamageCooldown = 0;
|
||||
idleCooldown = 60;
|
||||
}
|
||||
+
|
||||
+ public boolean shouldExplode() {
|
||||
+ return showsBottom() ? level.purpurConfig.basedEndCrystalExplode : level.purpurConfig.baselessEndCrystalExplode;
|
||||
+ }
|
||||
+
|
||||
+ public float getExplosionPower() {
|
||||
+ return (float) (showsBottom() ? level.purpurConfig.basedEndCrystalExplosionPower : level.purpurConfig.baselessEndCrystalExplosionPower);
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasExplosionFire() {
|
||||
+ return showsBottom() ? level.purpurConfig.basedEndCrystalExplosionFire : level.purpurConfig.baselessEndCrystalExplosionFire;
|
||||
+ }
|
||||
+
|
||||
+ public Explosion.BlockInteraction getExplosionEffect() {
|
||||
+ return showsBottom() ? level.purpurConfig.basedEndCrystalExplosionEffect : level.purpurConfig.baselessEndCrystalExplosionEffect;
|
||||
+ }
|
||||
// Purpur end
|
||||
|
||||
@Override
|
||||
@@ -175,15 +191,17 @@ public class EndCrystal extends Entity {
|
||||
// CraftBukkit end
|
||||
this.remove(Entity.RemovalReason.KILLED);
|
||||
if (!source.isExplosion()) {
|
||||
+ if (shouldExplode()) { // Purpur
|
||||
// CraftBukkit start
|
||||
- ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 6.0F, false);
|
||||
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), getExplosionPower(), hasExplosionFire()); // Purpur
|
||||
this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) {
|
||||
this.unsetRemoved();
|
||||
return false;
|
||||
}
|
||||
- this.level.explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), Explosion.BlockInteraction.DESTROY);
|
||||
+ this.level.explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), getExplosionEffect()); // Purpur
|
||||
// CraftBukkit end
|
||||
+ } else this.unsetRemoved(); // Purpur
|
||||
}
|
||||
|
||||
this.onDestroyedBy(source);
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 930adab7d6d387c935cb9e8d974d4fdf048871be..90788945ff4e5915422aed6325ce9808af401477 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -450,6 +450,35 @@ public class PurpurWorldConfig {
|
||||
dispenserPlaceAnvils = getBoolean("blocks.dispenser.place-anvils", dispenserPlaceAnvils);
|
||||
}
|
||||
|
||||
+ public boolean baselessEndCrystalExplode = true;
|
||||
+ public double baselessEndCrystalExplosionPower = 6.0D;
|
||||
+ public boolean baselessEndCrystalExplosionFire = false;
|
||||
+ public Explosion.BlockInteraction baselessEndCrystalExplosionEffect = Explosion.BlockInteraction.DESTROY;
|
||||
+ public boolean basedEndCrystalExplode = true;
|
||||
+ public double basedEndCrystalExplosionPower = 6.0D;
|
||||
+ public boolean basedEndCrystalExplosionFire = false;
|
||||
+ public Explosion.BlockInteraction basedEndCrystalExplosionEffect = Explosion.BlockInteraction.DESTROY;
|
||||
+ private void endCrystalSettings() {
|
||||
+ baselessEndCrystalExplode = getBoolean("blocks.end-crystal.baseless.explode", baselessEndCrystalExplode);
|
||||
+ baselessEndCrystalExplosionPower = getDouble("blocks.end-crystal.baseless.explosion-power", baselessEndCrystalExplosionPower);
|
||||
+ baselessEndCrystalExplosionFire = getBoolean("blocks.end-crystal.baseless.explosion-fire", baselessEndCrystalExplosionFire);
|
||||
+ try {
|
||||
+ baselessEndCrystalExplosionEffect = Explosion.BlockInteraction.valueOf(getString("blocks.end-crystal.baseless.explosion-effect", baselessEndCrystalExplosionEffect.name()));
|
||||
+ } catch (IllegalArgumentException e) {
|
||||
+ log(Level.SEVERE, "Unknown value for `blocks.end-crystal.baseless.explosion-effect`! Using default of `DESTROY`");
|
||||
+ baselessEndCrystalExplosionEffect = Explosion.BlockInteraction.DESTROY;
|
||||
+ }
|
||||
+ basedEndCrystalExplode = getBoolean("blocks.end-crystal.base.explode", basedEndCrystalExplode);
|
||||
+ basedEndCrystalExplosionPower = getDouble("blocks.end-crystal.base.explosion-power", basedEndCrystalExplosionPower);
|
||||
+ basedEndCrystalExplosionFire = getBoolean("blocks.end-crystal.base.explosion-fire", basedEndCrystalExplosionFire);
|
||||
+ try {
|
||||
+ basedEndCrystalExplosionEffect = Explosion.BlockInteraction.valueOf(getString("blocks.end-crystal.base.explosion-effect", basedEndCrystalExplosionEffect.name()));
|
||||
+ } catch (IllegalArgumentException e) {
|
||||
+ log(Level.SEVERE, "Unknown value for `blocks.end-crystal.base.explosion-effect`! Using default of `DESTROY`");
|
||||
+ basedEndCrystalExplosionEffect = Explosion.BlockInteraction.DESTROY;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
public boolean farmlandBypassMobGriefing = false;
|
||||
public boolean farmlandGetsMoistFromBelow = false;
|
||||
public boolean farmlandAlpha = false;
|
||||
111
patches/server/0157-Add-unsafe-Entity-serialization-API.patch
Normal file
111
patches/server/0157-Add-unsafe-Entity-serialization-API.patch
Normal file
@@ -0,0 +1,111 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Mariell Hoversholm <proximyst@proximyst.com>
|
||||
Date: Sat, 9 Jan 2021 21:22:58 +0100
|
||||
Subject: [PATCH] Add unsafe Entity serialization API
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index d2c776b8c189dc01dadb7399d3892399ebcb6276..e2b1574af471699f93956130b50268647f24e0b9 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -1233,5 +1233,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
public boolean isRidableInWater() {
|
||||
return getHandle().rideableUnderWater();
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean spawnAt(Location location, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {
|
||||
+ entity.level = ((CraftWorld) location.getWorld()).getHandle();
|
||||
+ entity.absMoveTo(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||
+ return !entity.valid && entity.level.addEntity(entity, spawnReason);
|
||||
+ }
|
||||
// Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index 9239c4c948ddfc6f7ad8c5f277e355581f8f37ec..75c5cb1a0b95f319eb32da618df7fa75ccefccbd 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -408,9 +408,14 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
Preconditions.checkNotNull(item, "null cannot be serialized");
|
||||
Preconditions.checkArgument(item.getType() != Material.AIR, "air cannot be serialized");
|
||||
|
||||
+ // Purpur start - rework NBT <-> bytes
|
||||
+ return serializeNbtToBytes(CraftItemStack.asNMSCopy(item).save(new CompoundTag()), true);
|
||||
+ }
|
||||
+
|
||||
+ public byte[] serializeNbtToBytes(CompoundTag compound, boolean addDataVersion) {
|
||||
+ if (addDataVersion) compound.putInt("DataVersion", getDataVersion());
|
||||
java.io.ByteArrayOutputStream outputStream = new java.io.ByteArrayOutputStream();
|
||||
- CompoundTag compound = (item instanceof CraftItemStack ? ((CraftItemStack) item).handle : CraftItemStack.asNMSCopy(item)).save(new CompoundTag());
|
||||
- compound.putInt("DataVersion", getDataVersion());
|
||||
+ // Purpur end
|
||||
try {
|
||||
net.minecraft.nbt.NbtIo.writeCompressed(
|
||||
compound,
|
||||
@@ -428,21 +433,52 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
Preconditions.checkNotNull(data, "null cannot be deserialized");
|
||||
Preconditions.checkArgument(data.length > 0, "cannot deserialize nothing");
|
||||
|
||||
+ // Purpur start - rework NBT <-> bytes
|
||||
+ CompoundTag compound = deserializeNbtFromBytes(data, true);
|
||||
+ Dynamic<Tag> converted = DataFixers.getDataFixer().update(References.ITEM_STACK, new Dynamic<>(NbtOps.INSTANCE, compound), compound.getInt("DataVersion"), getDataVersion());
|
||||
+ return net.minecraft.world.item.ItemStack.of((CompoundTag) converted.getValue()).asBukkitMirror();
|
||||
+ }
|
||||
+
|
||||
+ public CompoundTag deserializeNbtFromBytes(byte[] data, boolean verifyDataVersion) {
|
||||
+ // Purpur end
|
||||
try {
|
||||
CompoundTag compound = net.minecraft.nbt.NbtIo.readCompressed(
|
||||
new java.io.ByteArrayInputStream(data)
|
||||
);
|
||||
+ if (verifyDataVersion) { // Purpur
|
||||
int dataVersion = compound.getInt("DataVersion");
|
||||
|
||||
Preconditions.checkArgument(dataVersion <= getDataVersion(), "Newer version! Server downgrades are not supported!");
|
||||
- Dynamic<Tag> converted = DataFixers.getDataFixer().update(References.ITEM_STACK, new Dynamic<Tag>(NbtOps.INSTANCE, compound), dataVersion, getDataVersion());
|
||||
- return CraftItemStack.asCraftMirror(net.minecraft.world.item.ItemStack.of((CompoundTag) converted.getValue()));
|
||||
+ } // Purpur
|
||||
+ return compound; // Purpur
|
||||
} catch (IOException ex) {
|
||||
com.destroystokyo.paper.util.SneakyThrow.sneaky(ex);
|
||||
throw new RuntimeException();
|
||||
}
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ @Override
|
||||
+ public byte[] serializeEntity(org.bukkit.entity.Entity entity) {
|
||||
+ Preconditions.checkNotNull(entity, "null cannot be serialized");
|
||||
+ Preconditions.checkArgument(entity instanceof org.bukkit.craftbukkit.entity.CraftEntity, "non-CraftEntity cannot be serialized");
|
||||
+ CompoundTag compound = new CompoundTag();
|
||||
+ compound.putString("id", ((org.bukkit.craftbukkit.entity.CraftEntity) entity).getHandle().getMinecraftKeyString());
|
||||
+ return serializeNbtToBytes(((org.bukkit.craftbukkit.entity.CraftEntity) entity).getHandle().saveWithoutId(compound), true);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public org.bukkit.entity.Entity deserializeEntity(byte[] data, org.bukkit.World world) {
|
||||
+ CompoundTag compound = deserializeNbtFromBytes(data, true);
|
||||
+ Dynamic<Tag> converted = DataFixers.getDataFixer().update(References.ENTITY, new Dynamic<>(NbtOps.INSTANCE, compound), compound.getInt("DataVersion"), getDataVersion());
|
||||
+ compound = (CompoundTag) converted.getValue();
|
||||
+ compound.remove("UUID"); // Make the server make a new UUID for this entity; makes entities always spawnable.
|
||||
+ return net.minecraft.world.entity.EntityType.create(compound, ((org.bukkit.craftbukkit.CraftWorld) world).getHandle())
|
||||
+ .orElseThrow(() -> new IllegalArgumentException("unknown ID was found for the data; did you downgrade?"))
|
||||
+ .getBukkitEntity();
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
@Override
|
||||
public String getTranslationKey(Material mat) {
|
||||
if (mat.isBlock()) {
|
||||
@@ -0,0 +1,66 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
|
||||
Date: Sat, 20 Feb 2021 14:47:08 -0800
|
||||
Subject: [PATCH] Configs for if Wither/Ender Dragon can ride vehicles
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
||||
index c4800d71a96d3530ba8693638fad6d119f48dbb7..680a3dd1f376ac03250b56179450ba2d5b19240b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
||||
@@ -1109,6 +1109,7 @@ public class EnderDragon extends Mob implements Enemy {
|
||||
|
||||
@Override
|
||||
protected boolean canRide(Entity entity) {
|
||||
+ if (this.level.purpurConfig.enderDragonCanRideVehicles) return this.boardingCooldown <= 0; // Purpur
|
||||
return false;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
index 15d35d325b66e1a417eb7ba699597d627bd4eb54..36745f845f33c877595d572e46bd8e966c03d11a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
@@ -717,6 +717,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
|
||||
|
||||
@Override
|
||||
protected boolean canRide(Entity entity) {
|
||||
+ if (this.level.purpurConfig.witherCanRideVehicles) return this.boardingCooldown <= 0; // Purpur
|
||||
return false;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 90788945ff4e5915422aed6325ce9808af401477..814dab20834481fccdae8e8f0962bffa3b8f1d8a 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -839,6 +839,7 @@ public class PurpurWorldConfig {
|
||||
public double enderDragonMaxHealth = 200.0D;
|
||||
public boolean enderDragonAlwaysDropsFullExp = false;
|
||||
public boolean enderDragonBypassMobGriefing = false;
|
||||
+ public boolean enderDragonCanRideVehicles = false;
|
||||
private void enderDragonSettings() {
|
||||
enderDragonRidable = getBoolean("mobs.ender_dragon.ridable", enderDragonRidable);
|
||||
enderDragonRidableInWater = getBoolean("mobs.ender_dragon.ridable-in-water", enderDragonRidableInWater);
|
||||
@@ -855,6 +856,7 @@ public class PurpurWorldConfig {
|
||||
enderDragonMaxHealth = getDouble("mobs.ender_dragon.attributes.max_health", enderDragonMaxHealth);
|
||||
enderDragonAlwaysDropsFullExp = getBoolean("mobs.ender_dragon.always-drop-full-exp", enderDragonAlwaysDropsFullExp);
|
||||
enderDragonBypassMobGriefing = getBoolean("mobs.ender_dragon.bypass-mob-griefing", enderDragonBypassMobGriefing);
|
||||
+ enderDragonCanRideVehicles = getBoolean("mobs.ender_dragon.can-ride-vehicles", enderDragonCanRideVehicles);
|
||||
}
|
||||
|
||||
public boolean endermanRidable = false;
|
||||
@@ -1825,6 +1827,7 @@ public class PurpurWorldConfig {
|
||||
public float witherHealthRegenAmount = 1.0f;
|
||||
public int witherHealthRegenDelay = 20;
|
||||
public boolean witherBypassMobGriefing = false;
|
||||
+ public boolean witherCanRideVehicles = false;
|
||||
private void witherSettings() {
|
||||
witherRidable = getBoolean("mobs.wither.ridable", witherRidable);
|
||||
witherRidableInWater = getBoolean("mobs.wither.ridable-in-water", witherRidableInWater);
|
||||
@@ -1842,6 +1845,7 @@ public class PurpurWorldConfig {
|
||||
witherHealthRegenAmount = (float) getDouble("mobs.wither.health-regen-amount", witherHealthRegenAmount);
|
||||
witherHealthRegenDelay = getInt("mobs.wither.health-regen-delay", witherHealthRegenDelay);
|
||||
witherBypassMobGriefing = getBoolean("mobs.wither.bypass-mob-griefing", witherBypassMobGriefing);
|
||||
+ witherCanRideVehicles = getBoolean("mobs.wither.can-ride-vehicles", witherCanRideVehicles);
|
||||
}
|
||||
|
||||
public boolean witherSkeletonRidable = false;
|
||||
45
patches/server/0159-Dont-run-with-scissors.patch
Normal file
45
patches/server/0159-Dont-run-with-scissors.patch
Normal file
@@ -0,0 +1,45 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: JustDoom <justdoomdev@gmail.com>
|
||||
Date: Fri, 5 Mar 2021 14:23:16 -0500
|
||||
Subject: [PATCH] Dont run with scissors!
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 6eb0b178e1aec3bfb6c59913dbf70aac222041e2..167619f874304134532cd9144ffc7c3bbdda4473 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -1518,6 +1518,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
this.player.fallDistance = 0.0F;
|
||||
}
|
||||
|
||||
+ // Purpur Start
|
||||
+ if (this.player.isSprinting() && this.player.level.purpurConfig.dontRunWithScissors && (this.player.getItemInHand(InteractionHand.MAIN_HAND).getItem() == Items.SHEARS || this.player.getItemInHand(InteractionHand.OFF_HAND).getItem() == Items.SHEARS) && (int) (Math.random() * 10) == 0) {
|
||||
+ this.player.hurt(net.minecraft.world.damagesource.DamageSource.MAGIC, (float) this.player.level.purpurConfig.scissorsRunningDamage);
|
||||
+ }
|
||||
+ // Purpur End
|
||||
+
|
||||
this.player.checkMovementStatistics(this.player.getX() - d3, this.player.getY() - d4, this.player.getZ() - d5);
|
||||
this.lastGoodX = this.player.getX();
|
||||
this.lastGoodY = this.player.getY();
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 814dab20834481fccdae8e8f0962bffa3b8f1d8a..ea461a88824b7a777fae8fe05b27e23a9faf79f0 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -143,6 +143,8 @@ public class PurpurWorldConfig {
|
||||
public List<Item> itemImmuneToExplosion = new ArrayList<>();
|
||||
public List<Item> itemImmuneToFire = new ArrayList<>();
|
||||
public List<Item> itemImmuneToLightning = new ArrayList<>();
|
||||
+ public boolean dontRunWithScissors = false;
|
||||
+ public double scissorsRunningDamage = 1D;
|
||||
private void itemSettings() {
|
||||
itemImmuneToCactus.clear();
|
||||
getList("gameplay-mechanics.item.immune.cactus", new ArrayList<>()).forEach(key -> {
|
||||
@@ -180,6 +182,8 @@ public class PurpurWorldConfig {
|
||||
Item item = Registry.ITEM.get(new ResourceLocation(key.toString()));
|
||||
if (item != Items.AIR) itemImmuneToLightning.add(item);
|
||||
});
|
||||
+ dontRunWithScissors = getBoolean("gameplay-mechanics.item.shears.damage-if-sprinting", dontRunWithScissors);
|
||||
+ scissorsRunningDamage = getDouble("gameplay-mechanics.item.shears.sprinting-damage", scissorsRunningDamage);
|
||||
}
|
||||
|
||||
public double minecartMaxSpeed = 0.4D;
|
||||
51
patches/server/0160-One-Punch-Man.patch
Normal file
51
patches/server/0160-One-Punch-Man.patch
Normal file
@@ -0,0 +1,51 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Fourmisain <8464472+Fourmisain@users.noreply.github.com>
|
||||
Date: Fri, 5 Mar 2021 17:42:35 -0500
|
||||
Subject: [PATCH] One Punch Man!
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 48c32591f7193cb3d35f2675cbc97ac3a0212757..355f741dfdbe5ef9a4ef36feb3c3ffee052f123f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -2116,6 +2116,20 @@ public abstract class LivingEntity extends Entity {
|
||||
((ServerPlayer) damagesource.getEntity()).awardStat(Stats.DAMAGE_DEALT_ABSORBED, Math.round(f2 * 10.0F));
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ if (damagesource.getEntity() instanceof net.minecraft.world.entity.player.Player player && damagesource.getEntity().level.purpurConfig.creativeOnePunch) {
|
||||
+ if (player.isCreative()) {
|
||||
+ double attackDamage = 0;
|
||||
+ for (AttributeModifier modifier : player.getMainHandItem().getAttributeModifiers(EquipmentSlot.MAINHAND).get(Attributes.ATTACK_DAMAGE)) {
|
||||
+ attackDamage += modifier.getAmount();
|
||||
+ }
|
||||
+ if (attackDamage == 0) {
|
||||
+ this.setHealth(0);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
if (f > 0 || !human) {
|
||||
if (human) {
|
||||
// PAIL: Be sure to drag all this code from the EntityHuman subclass each update.
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index ea461a88824b7a777fae8fe05b27e23a9faf79f0..1e5589f8ece209fd77519d8afc6339b13f489834 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -287,6 +287,7 @@ public class PurpurWorldConfig {
|
||||
public boolean teleportIfOutsideBorder = false;
|
||||
public boolean totemOfUndyingWorksInInventory = false;
|
||||
public boolean playerFixStuckPortal = false;
|
||||
+ public boolean creativeOnePunch = false;
|
||||
private void playerSettings() {
|
||||
idleTimeoutKick = getBoolean("gameplay-mechanics.player.idle-timeout.kick-if-idle", idleTimeoutKick);
|
||||
idleTimeoutTickNearbyEntities = getBoolean("gameplay-mechanics.player.idle-timeout.tick-nearby-entities", idleTimeoutTickNearbyEntities);
|
||||
@@ -299,6 +300,7 @@ public class PurpurWorldConfig {
|
||||
teleportIfOutsideBorder = getBoolean("gameplay-mechanics.player.teleport-if-outside-border", teleportIfOutsideBorder);
|
||||
totemOfUndyingWorksInInventory = getBoolean("gameplay-mechanics.player.totem-of-undying-works-in-inventory", totemOfUndyingWorksInInventory);
|
||||
playerFixStuckPortal = getBoolean("gameplay-mechanics.player.fix-stuck-in-portal", playerFixStuckPortal);
|
||||
+ creativeOnePunch = getBoolean("gameplay-mechanics.player.one-punch-in-creative", creativeOnePunch);
|
||||
}
|
||||
|
||||
public int snowballDamage = -1;
|
||||
46
patches/server/0161-Add-config-for-snow-on-blue-ice.patch
Normal file
46
patches/server/0161-Add-config-for-snow-on-blue-ice.patch
Normal file
@@ -0,0 +1,46 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Fri, 5 Mar 2021 17:59:05 -0600
|
||||
Subject: [PATCH] Add config for snow on blue ice
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/SnowLayerBlock.java b/src/main/java/net/minecraft/world/level/block/SnowLayerBlock.java
|
||||
index 0169d874247a96c2e10a65ecb9c0c093f5a6ecfb..b760e2d014b3ae70671878082bb853b75572ed7f 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/SnowLayerBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/SnowLayerBlock.java
|
||||
@@ -76,7 +76,18 @@ public class SnowLayerBlock extends Block {
|
||||
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
|
||||
BlockState iblockdata1 = world.getBlockState(pos.below());
|
||||
|
||||
- return !iblockdata1.is(Blocks.ICE) && !iblockdata1.is(Blocks.PACKED_ICE) && !iblockdata1.is(Blocks.BARRIER) ? (!iblockdata1.is(Blocks.HONEY_BLOCK) && !iblockdata1.is(Blocks.SOUL_SAND) ? Block.isFaceFull(iblockdata1.getCollisionShape(world, pos.below()), Direction.UP) || iblockdata1.is((Block) this) && (Integer) iblockdata1.getValue(SnowLayerBlock.LAYERS) == 8 : true) : false;
|
||||
+ // Purpur start - rewrite this whole return to make more sense
|
||||
+ if (iblockdata1.is(Blocks.ICE) || iblockdata1.is(Blocks.PACKED_ICE) || iblockdata1.is(Blocks.BARRIER)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ if (iblockdata1.is(Blocks.BLUE_ICE) && !world.getWorldBorder().world.purpurConfig.snowOnBlueIce) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ if (iblockdata1.is(Blocks.HONEY_BLOCK) || iblockdata1.is(Blocks.SOUL_SAND)) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ return Block.isFaceFull(iblockdata1.getCollisionShape(world, pos.below()), Direction.UP) || iblockdata1.is(this) && iblockdata1.getValue(LAYERS) == 8;
|
||||
+ // Purpur end
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 1e5589f8ece209fd77519d8afc6339b13f489834..3dd239cda6a5d54ac5ca62d9b91860728f2c4a25 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -505,6 +505,11 @@ public class PurpurWorldConfig {
|
||||
furnaceInfiniteFuel = getBoolean("blocks.furnace.infinite-fuel", furnaceInfiniteFuel);
|
||||
}
|
||||
|
||||
+ public boolean snowOnBlueIce = true;
|
||||
+ private void iceSettings() {
|
||||
+ snowOnBlueIce = getBoolean("blocks.blue_ice.allow-snow-formation", snowOnBlueIce);
|
||||
+ }
|
||||
+
|
||||
public boolean lavaInfinite = false;
|
||||
public int lavaInfiniteRequiredSources = 2;
|
||||
public int lavaSpeedNether = 10;
|
||||
@@ -0,0 +1,70 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Encode42 <me@encode42.dev>
|
||||
Date: Sun, 7 Mar 2021 19:08:16 -0500
|
||||
Subject: [PATCH] Configurable Ender Pearl cooldown, damage, and Endermite RNG
|
||||
|
||||
- Survival and Creative Cooldown speed
|
||||
- Damage dealt on pearl usage
|
||||
- Endermite spawn chance
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java
|
||||
index a65e0a3357a27dfdf62ba45ebfeb531958851285..c2db9485e69b9679a33a57bc84cf2c76c1de2a42 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java
|
||||
@@ -69,7 +69,7 @@ public class ThrownEnderpearl extends ThrowableItemProjectile {
|
||||
Bukkit.getPluginManager().callEvent(teleEvent);
|
||||
|
||||
if (!teleEvent.isCancelled() && !entityplayer.connection.isDisconnected()) {
|
||||
- if (this.random.nextFloat() < 0.05F && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING)) {
|
||||
+ if (this.random.nextFloat() < this.level.purpurConfig.enderPearlEndermiteChance && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING)) { // Purpur
|
||||
Endermite entityendermite = (Endermite) EntityType.ENDERMITE.create(this.level);
|
||||
|
||||
entityendermite.moveTo(entity.getX(), entity.getY(), entity.getZ(), entity.getYRot(), entity.getXRot());
|
||||
@@ -83,7 +83,7 @@ public class ThrownEnderpearl extends ThrowableItemProjectile {
|
||||
entityplayer.connection.teleport(teleEvent.getTo());
|
||||
entity.fallDistance = 0.0F;
|
||||
CraftEventFactory.entityDamage = this;
|
||||
- entity.hurt(DamageSource.FALL, 5.0F);
|
||||
+ entity.hurt(DamageSource.FALL, this.level.purpurConfig.enderPearlDamage); // Purpur
|
||||
CraftEventFactory.entityDamage = null;
|
||||
}
|
||||
// CraftBukkit end
|
||||
diff --git a/src/main/java/net/minecraft/world/item/EnderpearlItem.java b/src/main/java/net/minecraft/world/item/EnderpearlItem.java
|
||||
index 749ab72edc0d2e9c6f1161415ab8d59d3d6ca976..897c202c0905040072a06fdfa2032a7f9461b088 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/EnderpearlItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/EnderpearlItem.java
|
||||
@@ -36,7 +36,7 @@ public class EnderpearlItem extends Item {
|
||||
|
||||
world.playSound((Player) null, user.getX(), user.getY(), user.getZ(), SoundEvents.ENDER_PEARL_THROW, SoundSource.NEUTRAL, 0.5F, 0.4F / (net.minecraft.world.entity.Entity.SHARED_RANDOM.nextFloat() * 0.4F + 0.8F));
|
||||
user.awardStat(Stats.ITEM_USED.get(this));
|
||||
- user.getCooldowns().addCooldown(this, 20);
|
||||
+ user.getCooldowns().addCooldown(this, user.getAbilities().instabuild ? world.purpurConfig.enderPearlCooldownCreative : world.purpurConfig.enderPearlCooldown); // Purpur
|
||||
} else {
|
||||
// Paper end
|
||||
if (user instanceof net.minecraft.server.level.ServerPlayer) {
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 3dd239cda6a5d54ac5ca62d9b91860728f2c4a25..6d849b9f42858f7ac692eefcac7d788700212ba9 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -145,6 +145,10 @@ public class PurpurWorldConfig {
|
||||
public List<Item> itemImmuneToLightning = new ArrayList<>();
|
||||
public boolean dontRunWithScissors = false;
|
||||
public double scissorsRunningDamage = 1D;
|
||||
+ public float enderPearlDamage = 5.0F;
|
||||
+ public int enderPearlCooldown = 20;
|
||||
+ public int enderPearlCooldownCreative = 20;
|
||||
+ public float enderPearlEndermiteChance = 0.05F;
|
||||
private void itemSettings() {
|
||||
itemImmuneToCactus.clear();
|
||||
getList("gameplay-mechanics.item.immune.cactus", new ArrayList<>()).forEach(key -> {
|
||||
@@ -184,6 +188,10 @@ public class PurpurWorldConfig {
|
||||
});
|
||||
dontRunWithScissors = getBoolean("gameplay-mechanics.item.shears.damage-if-sprinting", dontRunWithScissors);
|
||||
scissorsRunningDamage = getDouble("gameplay-mechanics.item.shears.sprinting-damage", scissorsRunningDamage);
|
||||
+ enderPearlDamage = (float) getDouble("gameplay-mechanics.item.ender-pearl.damage", enderPearlDamage);
|
||||
+ enderPearlCooldown = getInt("gameplay-mechanics.item.ender-pearl.cooldown", enderPearlCooldown);
|
||||
+ enderPearlCooldownCreative = getInt("gameplay-mechanics.item.ender-pearl.creative-cooldown", enderPearlCooldownCreative);
|
||||
+ enderPearlEndermiteChance = (float) getDouble("gameplay-mechanics.item.ender-pearl.endermite-spawn-chance", enderPearlEndermiteChance);
|
||||
}
|
||||
|
||||
public double minecartMaxSpeed = 0.4D;
|
||||
Reference in New Issue
Block a user