Paper/patches/unapplied/server/0536-Add-fast-alternative-constructor-for-Rotations.patch

30 lines
1.2 KiB
Diff
Raw Normal View History

2021-06-11 14:02:28 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Irmo van den Berge <irmo.vandenberge@ziggo.nl>
Date: Wed, 10 Mar 2021 21:26:31 +0100
2021-06-15 04:59:31 +02:00
Subject: [PATCH] Add fast alternative constructor for Rotations
2021-06-11 14:02:28 +02:00
diff --git a/src/main/java/net/minecraft/core/Rotations.java b/src/main/java/net/minecraft/core/Rotations.java
index 63a6512437a3611f73573f9fc97d4f32fb8be861..d6f1002d0f5760383edd641165f6622f8d6672c2 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/core/Rotations.java
+++ b/src/main/java/net/minecraft/core/Rotations.java
@@ -19,6 +19,18 @@ public class Rotations {
this(serialized.getFloat(0), serialized.getFloat(1), serialized.getFloat(2));
}
+ // Paper start - faster alternative constructor
+ private Rotations(float x, float y, float z, Void dummy_var) {
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ }
+
+ public static Rotations createWithoutValidityChecks(float x, float y, float z) {
+ return new Rotations(x, y, z, null);
+ }
+ // Paper end - faster alternative constructor
2021-06-11 14:02:28 +02:00
+
public ListTag save() {
2021-06-15 04:59:31 +02:00
ListTag listTag = new ListTag();
listTag.add(FloatTag.valueOf(this.x));