Search in sources :

Example 56 with Vec3

use of net.minecraft.util.Vec3 in project NewHorizonsCoreMod by GTNewHorizons.

the class AllPurposeDebugCommand method processCommand.

@Override
public void processCommand(ICommandSender pCmdSender, String[] pArgs) {
    try {
        if (pArgs.length == 0) {
            moarArgs(pCmdSender);
            return;
        } else if (pArgs[0].equalsIgnoreCase("ci")) {
            EntityPlayer tEP = ((EntityPlayer) pCmdSender);
            World tWorldObj = tEP.worldObj;
            int x = (int) tEP.posX;
            int z = (int) tEP.posZ;
            BiomeGenBase tBiomeInfo = tWorldObj.getBiomeGenForCoords(x, z);
            PlayerChatHelper.SendInfo(pCmdSender, "POS: x/z %d / %d", x, z);
            PlayerChatHelper.SendInfo(pCmdSender, "DimID: %d", tWorldObj.provider.dimensionId);
            PlayerChatHelper.SendInfo(pCmdSender, "BiomeID / Name: %d / %s", tBiomeInfo.biomeID, tBiomeInfo.biomeName);
        } else if (pArgs[0].equalsIgnoreCase("reloadconfig")) {
            MainRegistry.CoreConfig.LoadConfig();
            PlayerChatHelper.SendInfo(pCmdSender, "Config reloaded");
        } else if (pArgs[0].equalsIgnoreCase("test")) {
            if (pArgs.length == 2) {
                PlayerChatHelper.SendInfo(pCmdSender, "LOC: %d %d %d", (int) ((EntityPlayer) pCmdSender).posX, (int) ((EntityPlayer) pCmdSender).posY, (int) ((EntityPlayer) pCmdSender).posZ);
                Vec3 calculatedPos = PlayerHelper.addDistanceByPlayerDirection((EntityPlayer) pCmdSender, Integer.parseInt(pArgs[1]));
                PlayerChatHelper.SendInfo(pCmdSender, "Calculated Block: %d %d %d", (int) calculatedPos.xCoord, (int) calculatedPos.yCoord, (int) calculatedPos.zCoord);
                ((EntityPlayer) pCmdSender).getEntityWorld().setBlock((int) calculatedPos.xCoord, (int) calculatedPos.yCoord, (int) calculatedPos.zCoord, Blocks.bedrock);
            } else
                moarArgs(pCmdSender);
        } else if (pArgs[0].equalsIgnoreCase("oilstruct")) {
            IModFix tModFix = ModFixesMaster.getModFixInstance(OilGeneratorFix.ModFixName);
            if (tModFix == null) {
                PlayerChatHelper.SendError(pCmdSender, "Required ModFix is not loaded");
                return;
            }
            OilGeneratorFix tOilGenFix = (OilGeneratorFix) tModFix;
            if (pArgs.length == 5) {
                String[] tBlock = pArgs[1].split(":");
                Vec3 tSourcePos = Vec3.createVectorHelper(((EntityPlayer) pCmdSender).posX, (double) Integer.parseInt(pArgs[2]), ((EntityPlayer) pCmdSender).posZ);
                // Offset Structure-gen by 50 Blocks from players current location
                Vec3 tOilStructPos = PlayerHelper.addDistanceByVecAndYaw(tSourcePos, ((EntityPlayer) pCmdSender).rotationYaw, 50);
                int tStructRadius = Integer.parseInt(pArgs[3]);
                int tStructGroundLevel = Integer.parseInt(pArgs[4]);
                Block tTargetBlock = GameRegistry.findBlock(tBlock[0], tBlock[1]);
                if (tTargetBlock != null) {
                    PlayerChatHelper.SendInfo(pCmdSender, "Creating oilStruct at location %d / %d / %d, radius [%d], virtual groundLevel [%d] with block [%s]", (int) tOilStructPos.xCoord, (int) tOilStructPos.yCoord, (int) tOilStructPos.zCoord, tStructRadius, tStructGroundLevel, pArgs[1]);
                    tOilGenFix.buildOilStructure(((EntityPlayer) pCmdSender).worldObj, new Random(), (int) tOilStructPos.xCoord, (int) tOilStructPos.yCoord, (int) tOilStructPos.zCoord, tStructRadius, tStructGroundLevel, tTargetBlock, false);
                } else
                    PlayerChatHelper.SendError(pCmdSender, "Unknown block [%s]", pArgs[1]);
            } else {
                moarArgs(pCmdSender);
                return;
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
        PlayerChatHelper.SendError(pCmdSender, "Unknown error occoured [%s]", e.getMessage());
    }
}
Also used : OilGeneratorFix(com.dreammaster.modfixes.oilgen.OilGeneratorFix) Random(java.util.Random) Vec3(net.minecraft.util.Vec3) EntityPlayer(net.minecraft.entity.player.EntityPlayer) Block(net.minecraft.block.Block) IModFix(com.dreammaster.modfixes.IModFix) World(net.minecraft.world.World) BiomeGenBase(net.minecraft.world.biome.BiomeGenBase)

Example 57 with Vec3

use of net.minecraft.util.Vec3 in project NewHorizonsCoreMod by GTNewHorizons.

the class OilGeneratorFix method generateOil.

private void generateOil(World world, Random rand, int xx, int zz, boolean testFirst) {
    Vec3 pos = Vec3.createVectorHelper(0, 0, 0);
    if (shouldSpawnOil(world, rand, xx, zz, pos)) {
        int x = (int) pos.xCoord;
        int cy = (int) pos.yCoord;
        int z = (int) pos.zCoord;
        int tMinRadius = MainRegistry.CoreConfig.OilFixConfig.OilSphereMinRadius;
        int tMaxRadius = MainRegistry.CoreConfig.OilFixConfig.OilSphereMaxSize;
        int r = rand.nextInt(tMaxRadius + 1 - tMinRadius) + tMinRadius;
        if ((testFirst) && (checkOilPresent(world, x, cy, z, r)))
            return;
        if (YAMCore.isDebug())
            _mLog.info(String.format("About to generate OilSphere, centered at %d/%d/%d, radius %d", x, cy, z, r));
        // Taken from BuildCraft; Dont' generate if topblock is at y = 5
        // Should already be covered in shouldSpawnOil, but you never know..
        int groundLevel = getTopBlock(world, x, z);
        if (groundLevel < 5) {
            if (YAMCore.isDebug())
                _mLog.warn("OilGenerator stopped; World-height is below 5");
            return;
        }
        buildOilStructure(world, rand, x, cy, z, r, groundLevel, _mBuildCraftOilBlock, true);
    }
}
Also used : Vec3(net.minecraft.util.Vec3)

Example 58 with Vec3

use of net.minecraft.util.Vec3 in project Engine by VoltzEngine-Project.

the class ModelUtility method drawCuboid.

public static void drawCuboid(float xOffset, float yOffset, float zOffset, float xSize, float ySize, float zSize) {
    Vec3 v1, v2, v3, v4, v5, v6, v7, v8;
    float x, y, z;
    float x2, y2, z2;
    x = xOffset;
    y = yOffset;
    z = zOffset;
    x2 = x + xSize;
    y2 = y + ySize;
    z2 = z + zSize;
    v1 = Vec3.createVectorHelper(x, y2, z2);
    v2 = Vec3.createVectorHelper(x2, y2, z2);
    v3 = Vec3.createVectorHelper(x2, y2, z);
    v4 = Vec3.createVectorHelper(x, y2, z);
    v5 = Vec3.createVectorHelper(x, y, z);
    v6 = Vec3.createVectorHelper(x2, y, z);
    v7 = Vec3.createVectorHelper(x2, y, z2);
    v8 = Vec3.createVectorHelper(x, y, z2);
    drawCuboidRaw(v1, v2, v3, v4, v5, v6, v7, v8);
}
Also used : Vec3(net.minecraft.util.Vec3)

Aggregations

Vec3 (net.minecraft.util.Vec3)58 MovingObjectPosition (net.minecraft.util.MovingObjectPosition)19 AxisAlignedBB (net.minecraft.util.AxisAlignedBB)12 Entity (net.minecraft.entity.Entity)11 EntityPlayer (net.minecraft.entity.player.EntityPlayer)11 ItemStack (net.minecraft.item.ItemStack)7 ArrayList (java.util.ArrayList)5 Random (java.util.Random)5 EntityItem (net.minecraft.entity.item.EntityItem)5 TileEntity (net.minecraft.tileentity.TileEntity)5 List (java.util.List)4 Block (net.minecraft.block.Block)4 EntityLivingBase (net.minecraft.entity.EntityLivingBase)4 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)4 ChunkPosition (net.minecraft.world.ChunkPosition)3 World (net.minecraft.world.World)3 Linear (com.microsoft.Malmo.Schemas.AnimationDecorator.Linear)2 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)2 IBlockState (net.minecraft.block.state.IBlockState)2 BlockPos (net.minecraft.util.BlockPos)2