Search in sources :

Example 1 with OilGeneratorFix

use of com.dreammaster.modfixes.oilgen.OilGeneratorFix 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)

Aggregations

IModFix (com.dreammaster.modfixes.IModFix)1 OilGeneratorFix (com.dreammaster.modfixes.oilgen.OilGeneratorFix)1 Random (java.util.Random)1 Block (net.minecraft.block.Block)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 Vec3 (net.minecraft.util.Vec3)1 World (net.minecraft.world.World)1 BiomeGenBase (net.minecraft.world.biome.BiomeGenBase)1