package info.u_team.u_team_core.util.world;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.math.*;

public class WorldUtil {
	
	public static RayTraceResult rayTraceServerSide(EntityPlayer player, double range) {
		return rayTraceServerSide(player, range, RayTraceFluidMode.NEVER, false, true);
	}
	
	public static RayTraceResult rayTraceServerSide(EntityPlayer player, double range, RayTraceFluidMode liquidMode, boolean ignoreBlockWithoutBoundingBox, boolean returnLastUncollidableBlock) {
		Vec3d playerVector = new Vec3d(player.posX, player.posY + player.getEyeHeight(), player.posZ);
		Vec3d lookVector = player.getLookVec();
		Vec3d locationVector = playerVector.add(lookVector.x * range, lookVector.y * range, lookVector.z * range);
		return player.world.rayTraceBlocks(playerVector, locationVector, liquidMode, ignoreBlockWithoutBoundingBox, returnLastUncollidableBlock);
	}
}

@@ -38,16 +38,53 @@
 world;%0A%0A
+import java.util.function.Function;%0A%0A
 import n
@@ -157,16 +157,153 @@
 .math.*;
+%0Aimport net.minecraft.world.World;%0Aimport net.minecraft.world.dimension.DimensionType;%0Aimport net.minecraft.world.storage.WorldSavedData;
 %0A%0Apublic
@@ -1079,10 +1079,377 @@
 ck);%0A%09%7D%0A
+%09%0A%09public static %3CT extends WorldSavedData%3E T getSaveData(World world, String name, Function%3CString, T%3E function) %7B%0A%09%09final DimensionType type = world.getDimension().getType();%0A%09%09T instance = world.getSavedData(type, function, name);%0A%09%09if (instance == null) %7B%0A%09%09%09instance = function.apply(name);%0A%09%09%09world.setSavedData(type, name, instance);%0A%09%09%7D%0A%09%09return instance;%0A%09%7D%0A
 %7D%0A

Add a method to get savedata from the world quit easy