mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-25 14:14:32 +01:00
Cache computed shapes (should improve bed performance)
This commit is contained in:
parent
ac5aedb488
commit
9ef3a946f6
2 changed files with 3 additions and 3 deletions
|
@ -31,7 +31,6 @@ import net.minecraft.util.shape.VoxelShape;
|
||||||
import net.minecraft.util.shape.VoxelShapes;
|
import net.minecraft.util.shape.VoxelShapes;
|
||||||
import net.minecraft.world.BlockView;
|
import net.minecraft.world.BlockView;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.WorldAccess;
|
|
||||||
import net.minecraft.world.event.GameEvent;
|
import net.minecraft.world.event.GameEvent;
|
||||||
|
|
||||||
public class FancyBedBlock extends BedBlock {
|
public class FancyBedBlock extends BedBlock {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.minelittlepony.unicopia.util;
|
package com.minelittlepony.unicopia.util;
|
||||||
|
|
||||||
|
import net.minecraft.util.Util;
|
||||||
import net.minecraft.util.math.Box;
|
import net.minecraft.util.math.Box;
|
||||||
import net.minecraft.util.math.Direction;
|
import net.minecraft.util.math.Direction;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
@ -14,7 +15,7 @@ public interface VoxelShapeUtil {
|
||||||
Vec3d CENTER = new Vec3d(0.5, 0, 0.5);
|
Vec3d CENTER = new Vec3d(0.5, 0, 0.5);
|
||||||
|
|
||||||
static Function<Direction, VoxelShape> rotator(VoxelShape base) {
|
static Function<Direction, VoxelShape> rotator(VoxelShape base) {
|
||||||
return d -> rotate(base, d);
|
return Util.memoize(d -> rotate(base, d));
|
||||||
}
|
}
|
||||||
|
|
||||||
static VoxelShape rotate(VoxelShape shape, Direction direction) {
|
static VoxelShape rotate(VoxelShape shape, Direction direction) {
|
||||||
|
|
Loading…
Reference in a new issue