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());
}
}
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);
}
}
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);
}
Aggregations