mirror of
https://github.com/GTNewHorizons/StructureLib.git
synced 2026-11-22 04:52:09 +00:00
Use argument object for survival autoplace
This commit is contained in:
1 parent
23605fc22d
commit
c0814274ec
24 files changed
+1083
-183
No files matched your search
@@ -1,14 +1,26 @@
|
||||
package com.gtnewhorizon.structurelib.util;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import net.minecraft.dispenser.IPosition;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class Vec3Impl implements Comparable<Vec3Impl> {
|
||||
public static final Vec3Impl NULL_VECTOR = new Vec3Impl(0, 0, 0);
|
||||
private static final Map<Vec3Impl, Vec3Impl> pool = new HashMap<>();
|
||||
private final int val0;
|
||||
private final int val1;
|
||||
private final int val2;
|
||||
|
||||
/**
|
||||
* THIS WILL CAUSE THIS VECTOR TO PERMANENTLY RESIDE IN STATIC MEMORY. DO NOT USE THIS UNLESS YOU KNOW WHAT YOU ARE
|
||||
* DOING!!!
|
||||
*/
|
||||
public static Vec3Impl getFromPool(int in0, int in1, int in2) {
|
||||
return pool.computeIfAbsent(new Vec3Impl(in0, in1, in2), Function.identity());
|
||||
}
|
||||
|
||||
public Vec3Impl(int in0, int in1, int in2) {
|
||||
this.val0 = in0;
|
||||
this.val1 = in1;
|
||||
|
||||
Reference in new issue
Block a user