Move diffs around to compile without later ones applied
This commit is contained in:
parent
e66037960b
commit
c57d1aa245
772 changed files with 546 additions and 499 deletions
157
patches/server/0822-Friction-API.patch
Normal file
157
patches/server/0822-Friction-API.patch
Normal file
|
@ -0,0 +1,157 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Noah van der Aa <ndvdaa@gmail.com>
|
||||
Date: Wed, 15 Sep 2021 20:44:22 +0200
|
||||
Subject: [PATCH] Friction API
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 5cc93ed8e082324c12ba55e7d388a8cdc7f67f1a..2d8404f4b78ab9a25a3e6be8cf8bf5bb0b1ea090 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -261,6 +261,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
public boolean bukkitPickUpLoot;
|
||||
public org.bukkit.craftbukkit.entity.CraftLivingEntity getBukkitLivingEntity() { return (org.bukkit.craftbukkit.entity.CraftLivingEntity) super.getBukkitEntity(); } // Paper
|
||||
public boolean silentDeath = false; // Paper - mark entity as dying silently for cancellable death event
|
||||
+ public net.kyori.adventure.util.TriState frictionState = net.kyori.adventure.util.TriState.NOT_SET; // Paper - Friction API
|
||||
|
||||
@Override
|
||||
public float getBukkitYaw() {
|
||||
@@ -716,7 +717,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
public boolean shouldDiscardFriction() {
|
||||
- return this.discardFriction;
|
||||
+ return !this.frictionState.toBooleanOrElse(!this.discardFriction); // Paper - Friction API
|
||||
}
|
||||
|
||||
public void setDiscardFriction(boolean noDrag) {
|
||||
@@ -760,6 +761,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
|
||||
@Override
|
||||
public void addAdditionalSaveData(CompoundTag nbt) {
|
||||
+ // Paper start - Friction API
|
||||
+ if (this.frictionState != net.kyori.adventure.util.TriState.NOT_SET) {
|
||||
+ nbt.putString("Paper.FrictionState", this.frictionState.toString());
|
||||
+ }
|
||||
+ // Paper end - Friction API
|
||||
nbt.putFloat("Health", this.getHealth());
|
||||
nbt.putShort("HurtTime", (short) this.hurtTime);
|
||||
nbt.putInt("HurtByTimestamp", this.lastHurtByMobTimestamp);
|
||||
@@ -803,6 +809,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
this.internalSetAbsorptionAmount(absorptionAmount);
|
||||
// Paper end - Check for NaN
|
||||
+ // Paper start - Friction API
|
||||
+ if (nbt.contains("Paper.FrictionState")) {
|
||||
+ String fs = nbt.getString("Paper.FrictionState");
|
||||
+ try {
|
||||
+ frictionState = net.kyori.adventure.util.TriState.valueOf(fs);
|
||||
+ } catch (Exception ignored) {
|
||||
+ LOGGER.error("Unknown friction state " + fs + " for " + this);
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end - Friction API
|
||||
if (nbt.contains("Attributes", 9) && this.level() != null && !this.level().isClientSide) {
|
||||
this.getAttributes().load(nbt.getList("Attributes", 10));
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
index 8aaca29b115a55bf48306e71432c4c20d2bd21dc..eb0d6238588efa35fa868f26290547574a08eca2 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
@@ -57,6 +57,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
private int lastTick = MinecraftServer.currentTick - 1; // CraftBukkit
|
||||
public boolean canMobPickup = true; // Paper - Item#canEntityPickup
|
||||
private int despawnRate = -1; // Paper - Alternative item-despawn-rate
|
||||
+ public net.kyori.adventure.util.TriState frictionState = net.kyori.adventure.util.TriState.NOT_SET; // Paper - Friction API
|
||||
|
||||
public ItemEntity(EntityType<? extends ItemEntity> type, Level world) {
|
||||
super(type, world);
|
||||
@@ -178,7 +179,11 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
this.move(MoverType.SELF, this.getDeltaMovement());
|
||||
float f1 = 0.98F;
|
||||
|
||||
- if (this.onGround()) {
|
||||
+ // Paper start - Friction API
|
||||
+ if (frictionState == net.kyori.adventure.util.TriState.FALSE) {
|
||||
+ f1 = 1F;
|
||||
+ } else if (this.onGround()) {
|
||||
+ // Paper end - Friction API
|
||||
f1 = this.level().getBlockState(this.getBlockPosBelowThatAffectsMyMovement()).getBlock().getFriction() * 0.98F;
|
||||
}
|
||||
|
||||
@@ -387,6 +392,11 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
|
||||
@Override
|
||||
public void addAdditionalSaveData(CompoundTag nbt) {
|
||||
+ // Paper start - Friction API
|
||||
+ if (this.frictionState != net.kyori.adventure.util.TriState.NOT_SET) {
|
||||
+ nbt.putString("Paper.FrictionState", this.frictionState.toString());
|
||||
+ }
|
||||
+ // Paper end - Friction API
|
||||
nbt.putShort("Health", (short) this.health);
|
||||
nbt.putShort("Age", (short) this.age);
|
||||
nbt.putShort("PickupDelay", (short) this.pickupDelay);
|
||||
@@ -421,6 +431,17 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
this.cachedThrower = null;
|
||||
}
|
||||
|
||||
+ // Paper start - Friction API
|
||||
+ if (nbt.contains("Paper.FrictionState")) {
|
||||
+ String fs = nbt.getString("Paper.FrictionState");
|
||||
+ try {
|
||||
+ frictionState = net.kyori.adventure.util.TriState.valueOf(fs);
|
||||
+ } catch (Exception ignored) {
|
||||
+ com.mojang.logging.LogUtils.getLogger().error("Unknown friction state " + fs + " for " + this);
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end - Friction API
|
||||
+
|
||||
CompoundTag nbttagcompound1 = nbt.getCompound("Item");
|
||||
|
||||
this.setItem(ItemStack.of(nbttagcompound1));
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
|
||||
index cbfd4cf1d7d32757cf124d1aaa4b83d8a155868f..832def3c518be8d6d81e71f6022566e6179e2d17 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
|
||||
@@ -99,6 +99,18 @@ public class CraftItem extends CraftEntity implements Item {
|
||||
this.getHandle().age = willAge ? 0 : NO_AGE_TIME;
|
||||
}
|
||||
|
||||
+ @org.jetbrains.annotations.NotNull
|
||||
+ @Override
|
||||
+ public net.kyori.adventure.util.TriState getFrictionState() {
|
||||
+ return this.getHandle().frictionState;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setFrictionState(@org.jetbrains.annotations.NotNull net.kyori.adventure.util.TriState state) {
|
||||
+ java.util.Objects.requireNonNull(state, "state may not be null");
|
||||
+ this.getHandle().frictionState = state;
|
||||
+ }
|
||||
+
|
||||
@Override
|
||||
public int getHealth() {
|
||||
return this.getHandle().health;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
index d12734b0c6b10ca8997a79e06fc9791abe0e9ed5..97c7bb2032584847f2f8a946c1f8d13fef908edf 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -1083,6 +1083,18 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
});
|
||||
}
|
||||
|
||||
+ @org.jetbrains.annotations.NotNull
|
||||
+ @Override
|
||||
+ public net.kyori.adventure.util.TriState getFrictionState() {
|
||||
+ return this.getHandle().frictionState;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setFrictionState(@org.jetbrains.annotations.NotNull net.kyori.adventure.util.TriState state) {
|
||||
+ java.util.Objects.requireNonNull(state, "state may not be null");
|
||||
+ this.getHandle().frictionState = state;
|
||||
+ }
|
||||
+
|
||||
@Override
|
||||
public void knockback(double strength, double directionX, double directionZ) {
|
||||
Preconditions.checkArgument(strength > 0, "Knockback strength must be > 0");
|
Loading…
Add table
Add a link
Reference in a new issue