mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
parent
6a7a138ca4
commit
03168769b9
1 changed files with 65 additions and 0 deletions
|
@ -0,0 +1,65 @@
|
|||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ 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/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
public void collide(Entity entity) {
|
||||
if (!this.isSameVehicle(entity)) {
|
||||
if (!entity.noclip && !this.noclip) {
|
||||
+ if (this.world.paperConfig.onlyPlayersCollide && !(entity instanceof EntityPlayer || this instanceof EntityPlayer)) return; // Paper
|
||||
double d0 = entity.locX() - this.locX();
|
||||
double d1 = entity.locZ() - this.locZ();
|
||||
double d2 = MathHelper.a(d0, d1);
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityBoat.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityBoat.java
|
||||
@@ -0,0 +0,0 @@ public class EntityBoat extends Entity {
|
||||
|
||||
@Override
|
||||
public void collide(Entity entity) {
|
||||
+ if (!this.world.paperConfig.allowVehicleCollisions && this.world.paperConfig.onlyPlayersCollide && !(entity instanceof EntityPlayer)) return; // Paper
|
||||
if (entity instanceof EntityBoat) {
|
||||
if (entity.getBoundingBox().minY < this.getBoundingBox().maxY) {
|
||||
// CraftBukkit start
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityMinecartAbstract extends Entity {
|
||||
public void collide(Entity entity) {
|
||||
if (!this.world.isClientSide) {
|
||||
if (!entity.noclip && !this.noclip) {
|
||||
+ if (!this.world.paperConfig.allowVehicleCollisions && this.world.paperConfig.onlyPlayersCollide && !(entity instanceof EntityPlayer)) return; // Paper
|
||||
if (!this.w(entity)) {
|
||||
// CraftBukkit start
|
||||
VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), entity.getBukkitEntity());
|
Loading…
Reference in a new issue