12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- package me.km.api;
- import me.km.KajetansMod;
- import net.minecraft.block.state.IBlockState;
- import net.minecraft.util.math.BlockPos;
- import net.minecraft.util.math.Vec3d;
- import net.minecraft.world.World;
- public class Location
- {
- private final World w;
- private final Vec3d pos;
- private float yaw;
- private float pitch;
-
- public Location(World w, Vec3d pos, float yaw, float pitch)
- {
- this.w = w;
- this.pos = pos;
- this.yaw = yaw;
- this.pitch = pitch;
- }
-
- public Location(World w, Vec3d pos)
- {
- this(w, pos, 0, 0);
- }
- public World getWorld()
- {
- return w;
- }
- public Vec3d getPos()
- {
- return pos;
- }
- public float getYaw()
- {
- return yaw;
- }
- public float getPitch()
- {
- return pitch;
- }
- public void setPitch(float pitch)
- {
- this.pitch = pitch;
- }
- public void setYaw(float yaw)
- {
- this.yaw = yaw;
- }
-
- public static World getWorld(String s)
- {
- if(s == null)
- {
- return null;
- }
- for(World w : KajetansMod.server.worlds)
- {
- if(w.getWorldInfo().getWorldName().equals(s))
- {
- return w;
- }
- }
- return null;
- }
-
- public static IBlockState getRelativeBlock(World w, BlockPos pos, int x, int y, int z)
- {
- return w.getBlockState(new BlockPos(pos.getX() + x, pos.getY() + y, pos.getZ() + z));
- }
- }
|