aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0502-Add-fast-alternative-constructor-for-Rotations.patch
blob: e28775fc9a9fd92199436f9e7b1a3beae0743645 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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
Subject: [PATCH] Add fast alternative constructor for Rotations


diff --git a/src/main/java/net/minecraft/core/Rotations.java b/src/main/java/net/minecraft/core/Rotations.java
index e6c97efb3aa89646149d11bb0ae4420b3977d214..27007280dba9e6d19a50dc2a4b160e96b20c67f7 100644
--- a/src/main/java/net/minecraft/core/Rotations.java
+++ b/src/main/java/net/minecraft/core/Rotations.java
@@ -34,6 +34,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
+
     public ListTag save() {
         ListTag listTag = new ListTag();
         listTag.add(FloatTag.valueOf(this.x));