geforkt von Mirrors/Paper
bc127ea819
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: eec4aab0 SPIGOT-6657: Add getPlayer to SheepDyeWoolEvent 205213c6 SPIGOT-6656: CauldronLevelChangeEvent is not fired correctly when dripstone fills the cauldron CraftBukkit Changes: b8c522d5 SPIGOT-6657: Add getPlayer to SheepDyeWoolEvent f04a77dc SPIGOT-6656: CauldronLevelChangeEvent is not fired correctly when dripstone fills the cauldron d1dbcebc SPIGOT-6653: Canceling snow bucket placement removes snow from bucket 4f34a67b #891: Fix scheduler task ID overflow and duplication issues Spigot Changes: d03d7f12 BUILDTOOLS-604: Rebuild patches
82 Zeilen
5.0 KiB
Diff
82 Zeilen
5.0 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Mariell Hoversholm <proximyst@proximyst.com>
|
|
Date: Sat, 14 Nov 2020 16:48:37 +0100
|
|
Subject: [PATCH] Collision option for requiring a player participant
|
|
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
index 4227e7fc46e22265316b42bbdb166d60e5aed94e..3d16e4a6bf842a209c760fd89f8edf995cabce7d 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
@@ -64,6 +64,18 @@ public class PaperWorldConfig {
|
|
}
|
|
}
|
|
|
|
+ public boolean onlyPlayersCollide = false;
|
|
+ public boolean allowVehicleCollisions = true;
|
|
+ private void onlyPlayersCollide() {
|
|
+ onlyPlayersCollide = getBoolean("only-players-collide", onlyPlayersCollide);
|
|
+ allowVehicleCollisions = getBoolean("allow-vehicle-collisions", allowVehicleCollisions);
|
|
+ if (onlyPlayersCollide && !allowVehicleCollisions) {
|
|
+ log("Collisions will only work if a player is one of the two entities colliding.");
|
|
+ } else if (onlyPlayersCollide) {
|
|
+ log("Collisions will only work if a player OR a vehicle is one of the two entities colliding.");
|
|
+ }
|
|
+ }
|
|
+
|
|
public int wanderingTraderSpawnMinuteTicks = 1200;
|
|
public int wanderingTraderSpawnDayTicks = 24000;
|
|
public int wanderingTraderSpawnChanceFailureIncrement = 25;
|
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
index f744bf2d19291991ffa9c7b13fc62a479702d201..9b4bbdec896fa8c37d68604f095cc3cd54c8cab2 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -1606,6 +1606,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
|
public void push(Entity entity) {
|
|
if (!this.isPassengerOfSameVehicle(entity)) {
|
|
if (!entity.noPhysics && !this.noPhysics) {
|
|
+ if (this.level.paperConfig.onlyPlayersCollide && !(entity instanceof ServerPlayer || this instanceof ServerPlayer)) return; // Paper
|
|
double d0 = entity.getX() - this.getX();
|
|
double d1 = entity.getZ() - this.getZ();
|
|
double d2 = Mth.absMax(d0, d1);
|
|
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
|
index 9653b142c199c068e4d6175bcd3cbecb6465853f..309bafd257d4932cfd69c2c212b32306938cd234 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
|
@@ -21,6 +21,7 @@ import net.minecraft.network.protocol.game.ClientboundAddEntityPacket;
|
|
import net.minecraft.network.syncher.EntityDataAccessor;
|
|
import net.minecraft.network.syncher.EntityDataSerializers;
|
|
import net.minecraft.network.syncher.SynchedEntityData;
|
|
+import net.minecraft.server.level.ServerPlayer;
|
|
import net.minecraft.tags.BlockTags;
|
|
import net.minecraft.tags.Tag;
|
|
import net.minecraft.util.Mth;
|
|
@@ -833,6 +834,7 @@ public abstract class AbstractMinecart extends Entity {
|
|
public void push(Entity entity) {
|
|
if (!this.level.isClientSide) {
|
|
if (!entity.noPhysics && !this.noPhysics) {
|
|
+ if (!this.level.paperConfig.allowVehicleCollisions && this.level.paperConfig.onlyPlayersCollide && !(entity instanceof ServerPlayer)) return; // Paper
|
|
if (!this.hasPassenger(entity)) {
|
|
// CraftBukkit start
|
|
VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), entity.getBukkitEntity());
|
|
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
|
index a1b93f2878e22fa1d0cad639416d2dc5b8339c73..aa7c022c4faade23bd9061311d4152cf845d3331 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
|
@@ -16,6 +16,7 @@ import net.minecraft.network.protocol.game.ServerboundPaddleBoatPacket;
|
|
import net.minecraft.network.syncher.EntityDataAccessor;
|
|
import net.minecraft.network.syncher.EntityDataSerializers;
|
|
import net.minecraft.network.syncher.SynchedEntityData;
|
|
+import net.minecraft.server.level.ServerPlayer;
|
|
import net.minecraft.sounds.SoundEvent;
|
|
import net.minecraft.sounds.SoundEvents;
|
|
import net.minecraft.tags.FluidTags;
|
|
@@ -240,6 +241,7 @@ public class Boat extends Entity {
|
|
|
|
@Override
|
|
public void push(Entity entity) {
|
|
+ if (!this.level.paperConfig.allowVehicleCollisions && this.level.paperConfig.onlyPlayersCollide && !(entity instanceof ServerPlayer)) return; // Paper
|
|
if (entity instanceof Boat) {
|
|
if (entity.getBoundingBox().minY < this.getBoundingBox().maxY) {
|
|
// CraftBukkit start
|