use of net.minecraft.util.math.BlockPos in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class PhysicsObject method loadClaimedChunks.
public void loadClaimedChunks() {
ArrayList<TileEntity> nodeTileEntitiesToUpdate = new ArrayList<TileEntity>();
claimedChunks = new Chunk[(ownedChunks.radius * 2) + 1][(ownedChunks.radius * 2) + 1];
claimedChunksEntries = new PlayerChunkMapEntry[(ownedChunks.radius * 2) + 1][(ownedChunks.radius * 2) + 1];
for (int x = ownedChunks.minX; x <= ownedChunks.maxX; x++) {
for (int z = ownedChunks.minZ; z <= ownedChunks.maxZ; z++) {
Chunk chunk = worldObj.getChunkFromChunkCoords(x, z);
if (chunk == null) {
System.out.println("Just a loaded a null chunk");
chunk = new Chunk(worldObj, x, z);
}
// Do this to get it re-integrated into the world
if (!worldObj.isRemote) {
injectChunkIntoWorld(chunk, x, z, false);
}
for (Entry<BlockPos, TileEntity> entry : chunk.chunkTileEntityMap.entrySet()) {
TileEntity tile = entry.getValue();
if (tile instanceof INodeProvider) {
nodeTileEntitiesToUpdate.add(tile);
}
}
claimedChunks[x - ownedChunks.minX][z - ownedChunks.minZ] = chunk;
}
}
VKChunkCache = new VWChunkCache(worldObj, claimedChunks);
refrenceBlockPos = getRegionCenter();
coordTransform = new CoordTransformObject(this);
if (!worldObj.isRemote) {
createPhysicsCalculations();
}
detectBlockPositions();
for (TileEntity tile : nodeTileEntitiesToUpdate) {
Node node = ((INodeProvider) tile).getNode();
if (node != null) {
node.updateBuildState();
} else {
System.err.println("How the fuck did we get a null node?");
}
}
coordTransform.updateAllTransforms();
}
use of net.minecraft.util.math.BlockPos in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class PhysicsCalculations method calculateForces.
public void calculateForces() {
double modifiedDrag = Math.pow(drag, physTickSpeed / .05D);
linearMomentum.multiply(modifiedDrag);
angularVelocity.multiply(modifiedDrag);
if (PhysicsSettings.doGravity) {
addForceAtPoint(new Vector(0, 0, 0), ValkyrienWarfareMod.gravity.getProduct(mass * physTickSpeed));
}
addQueuedForces();
Collections.shuffle(activeForcePositions);
Vector blockForce = new Vector();
Vector inBodyWO = new Vector();
Vector crossVector = new Vector();
if (PhysicsSettings.doPhysicsBlocks) {
for (BlockPos pos : activeForcePositions) {
IBlockState state = parent.VKChunkCache.getBlockState(pos);
Block blockAt = state.getBlock();
BigBastardMath.getBodyPosWithOrientation(pos, centerOfMass, parent.coordTransform.lToWRotation, inBodyWO);
BlockForce.basicForces.getForceFromState(state, pos, worldObj, physTickSpeed, parent, blockForce);
if (blockForce != null) {
if (blockAt instanceof IBlockForceProvider) {
Vector otherPosition = ((IBlockForceProvider) blockAt).getBlockForcePosition(worldObj, pos, state, parent.wrapper, physTickSpeed);
if (otherPosition != null) {
BigBastardMath.getBodyPosWithOrientation(otherPosition, centerOfMass, parent.coordTransform.lToWRotation, inBodyWO);
}
}
addForceAtPoint(inBodyWO, blockForce, crossVector);
} else {
}
}
}
if (PhysicsSettings.doBalloons) {
for (BalloonProcessor balloon : parent.balloonManager.balloonProcessors) {
balloon.tickBalloonTemperatures(physTickSpeed, this);
Vector balloonForce = balloon.getBalloonForce(physTickSpeed, this);
Vector balloonCenterInBody = balloon.getForceCenter();
BigBastardMath.getBodyPosWithOrientation(balloonCenterInBody, centerOfMass, parent.coordTransform.lToWRotation, inBodyWO);
addForceAtPoint(inBodyWO, balloonForce, crossVector);
}
}
convertTorqueToVelocity();
}
use of net.minecraft.util.math.BlockPos in project Realistic-Terrain-Generation by Team-RTG.
the class BiomeDecoratorRTG method rPopulatePostDecorate.
public void rPopulatePostDecorate(World worldObj, Random rand, int chunkX, int chunkZ, boolean flag) {
// Are flowing liquid modifications enabled?
if (!rtgConfig.ENABLE_FLOWING_LIQUID_MODIFICATIONS.get()) {
return;
}
int worldX = chunkX * 16;
int worldZ = chunkZ * 16;
int worldHeight = worldObj.provider.getActualHeight();
//Flowing water.
if (rtgConfig.FLOWING_WATER_CHANCE.get() > 0) {
if (rand.nextInt(rtgConfig.FLOWING_WATER_CHANCE.get()) == 0) {
for (int l18 = 0; l18 < 50; l18++) {
// + 8;
int l21 = worldX + rand.nextInt(16);
int k23 = rand.nextInt(rand.nextInt(worldHeight - 16) + 10);
// + 8;
int l24 = worldZ + rand.nextInt(16);
(new WorldGenLiquids(Blocks.FLOWING_WATER)).generate(worldObj, rand, new BlockPos(l21, k23, l24));
}
}
}
//Flowing lava.
if (rtgConfig.FLOWING_LAVA_CHANCE.get() > 0) {
if (rand.nextInt(rtgConfig.FLOWING_LAVA_CHANCE.get()) == 0) {
for (int i19 = 0; i19 < 20; i19++) {
// + 8;
int i22 = worldX + rand.nextInt(16);
int l23 = rand.nextInt(worldHeight / 2);
// + 8;
int i25 = worldZ + rand.nextInt(16);
(new WorldGenLiquids(Blocks.FLOWING_LAVA)).generate(worldObj, rand, new BlockPos(i22, l23, i25));
}
}
}
}
use of net.minecraft.util.math.BlockPos in project Realistic-Terrain-Generation by Team-RTG.
the class BiomeDecoratorRTG method decorateOres.
/*
* This method should only be called by ChunkProviderRTG#generateOres.
*/
public void decorateOres(World worldIn, Random random, int worldX, int worldZ) {
//Logger.debug("Started generating ores in %s (%d %d)", this.biome.getBiomeName(), worldX, worldZ);
BiomeDecorator biomeDecorator = biome.theBiomeDecorator;
if (biomeDecorator.chunkProviderSettings == null) {
String generatorOptions = worldIn.getWorldInfo().getGeneratorOptions();
generatorOptions = (generatorOptions != null) ? generatorOptions : "";
biomeDecorator.chunkProviderSettings = ChunkProviderSettings.Factory.jsonToFactory(generatorOptions).build();
}
// This local variable has to be declared/initialised AFTER the chunk provider settings have been built.
ChunkProviderSettings chunkProviderSettings = biomeDecorator.chunkProviderSettings;
pos = new BlockPos(worldX, 0, worldZ);
biomeDecorator.dirtGen = new WorldGenMinable(Blocks.DIRT.getDefaultState(), chunkProviderSettings.dirtSize);
biomeDecorator.gravelGen = new WorldGenMinable(Blocks.GRAVEL.getDefaultState(), chunkProviderSettings.gravelSize);
biomeDecorator.graniteGen = new WorldGenMinable(Blocks.STONE.getDefaultState().withProperty(BlockStone.VARIANT, BlockStone.EnumType.GRANITE), chunkProviderSettings.graniteSize);
biomeDecorator.dioriteGen = new WorldGenMinable(Blocks.STONE.getDefaultState().withProperty(BlockStone.VARIANT, BlockStone.EnumType.DIORITE), chunkProviderSettings.dioriteSize);
biomeDecorator.andesiteGen = new WorldGenMinable(Blocks.STONE.getDefaultState().withProperty(BlockStone.VARIANT, BlockStone.EnumType.ANDESITE), chunkProviderSettings.andesiteSize);
biomeDecorator.coalGen = new WorldGenMinable(Blocks.COAL_ORE.getDefaultState(), chunkProviderSettings.coalSize);
biomeDecorator.ironGen = new WorldGenMinable(Blocks.IRON_ORE.getDefaultState(), chunkProviderSettings.ironSize);
biomeDecorator.goldGen = new WorldGenMinable(Blocks.GOLD_ORE.getDefaultState(), chunkProviderSettings.goldSize);
biomeDecorator.redstoneGen = new WorldGenMinable(Blocks.REDSTONE_ORE.getDefaultState(), chunkProviderSettings.redstoneSize);
biomeDecorator.diamondGen = new WorldGenMinable(Blocks.DIAMOND_ORE.getDefaultState(), chunkProviderSettings.diamondSize);
biomeDecorator.lapisGen = new WorldGenMinable(Blocks.LAPIS_ORE.getDefaultState(), chunkProviderSettings.lapisSize);
MinecraftForge.ORE_GEN_BUS.post(new OreGenEvent.Pre(worldIn, random, pos));
if (TerrainGen.generateOre(worldIn, random, biomeDecorator.dirtGen, pos, OreGenEvent.GenerateMinable.EventType.DIRT)) {
this.genStandardOre1(worldIn, random, chunkProviderSettings.dirtCount, biomeDecorator.dirtGen, chunkProviderSettings.dirtMinHeight, chunkProviderSettings.dirtMaxHeight);
}
if (TerrainGen.generateOre(worldIn, random, biomeDecorator.gravelGen, pos, OreGenEvent.GenerateMinable.EventType.GRAVEL)) {
this.genStandardOre1(worldIn, random, chunkProviderSettings.gravelCount, biomeDecorator.gravelGen, chunkProviderSettings.gravelMinHeight, chunkProviderSettings.gravelMaxHeight);
}
if (TerrainGen.generateOre(worldIn, random, biomeDecorator.dioriteGen, pos, OreGenEvent.GenerateMinable.EventType.DIORITE)) {
this.genStandardOre1(worldIn, random, chunkProviderSettings.dioriteCount, biomeDecorator.dioriteGen, chunkProviderSettings.dioriteMinHeight, chunkProviderSettings.dioriteMaxHeight);
}
if (TerrainGen.generateOre(worldIn, random, biomeDecorator.graniteGen, pos, OreGenEvent.GenerateMinable.EventType.GRANITE)) {
this.genStandardOre1(worldIn, random, chunkProviderSettings.graniteCount, biomeDecorator.graniteGen, chunkProviderSettings.graniteMinHeight, chunkProviderSettings.graniteMaxHeight);
}
if (TerrainGen.generateOre(worldIn, random, biomeDecorator.andesiteGen, pos, OreGenEvent.GenerateMinable.EventType.ANDESITE)) {
this.genStandardOre1(worldIn, random, chunkProviderSettings.andesiteCount, biomeDecorator.andesiteGen, chunkProviderSettings.andesiteMinHeight, chunkProviderSettings.andesiteMaxHeight);
}
if (TerrainGen.generateOre(worldIn, random, biomeDecorator.coalGen, pos, OreGenEvent.GenerateMinable.EventType.COAL)) {
this.genStandardOre1(worldIn, random, chunkProviderSettings.coalCount, biomeDecorator.coalGen, chunkProviderSettings.coalMinHeight, chunkProviderSettings.coalMaxHeight);
}
if (TerrainGen.generateOre(worldIn, random, biomeDecorator.ironGen, pos, OreGenEvent.GenerateMinable.EventType.IRON)) {
this.genStandardOre1(worldIn, random, chunkProviderSettings.ironCount, biomeDecorator.ironGen, chunkProviderSettings.ironMinHeight, chunkProviderSettings.ironMaxHeight);
}
if (TerrainGen.generateOre(worldIn, random, biomeDecorator.goldGen, pos, OreGenEvent.GenerateMinable.EventType.GOLD)) {
this.genStandardOre1(worldIn, random, chunkProviderSettings.goldCount, biomeDecorator.goldGen, chunkProviderSettings.goldMinHeight, chunkProviderSettings.goldMaxHeight);
}
if (TerrainGen.generateOre(worldIn, random, biomeDecorator.redstoneGen, pos, OreGenEvent.GenerateMinable.EventType.REDSTONE)) {
this.genStandardOre1(worldIn, random, chunkProviderSettings.redstoneCount, biomeDecorator.redstoneGen, chunkProviderSettings.redstoneMinHeight, chunkProviderSettings.redstoneMaxHeight);
}
if (TerrainGen.generateOre(worldIn, random, biomeDecorator.diamondGen, pos, OreGenEvent.GenerateMinable.EventType.DIAMOND)) {
this.genStandardOre1(worldIn, random, chunkProviderSettings.diamondCount, biomeDecorator.diamondGen, chunkProviderSettings.diamondMinHeight, chunkProviderSettings.diamondMaxHeight);
}
if (TerrainGen.generateOre(worldIn, random, biomeDecorator.lapisGen, pos, OreGenEvent.GenerateMinable.EventType.LAPIS)) {
this.genStandardOre2(worldIn, random, chunkProviderSettings.lapisCount, biomeDecorator.lapisGen, chunkProviderSettings.lapisCenterHeight, chunkProviderSettings.lapisSpread);
}
if (rbb.generatesEmeralds()) {
this.genEmeraldOre(worldIn, random, pos);
}
if (rbb.generatesSilverfish()) {
this.genSilverfishOre(worldIn, random, pos);
}
if (rbb.getExtraGoldGenCount() > 0) {
this.genStandardOre1(worldIn, random, rbb.getExtraGoldGenCount(), biomeDecorator.goldGen, rbb.getExtraGoldGenMinHeight(), rbb.getExtraGoldGenMaxHeight());
}
MinecraftForge.ORE_GEN_BUS.post(new OreGenEvent.Post(worldIn, random, pos));
//Logger.debug("Finished generating ores in %s (%d %d)", this.biome.getBiomeName(), worldX, worldZ);
}
use of net.minecraft.util.math.BlockPos in project Realistic-Terrain-Generation by Team-RTG.
the class DecoCactus method generate.
@Override
public void generate(IRealisticBiome biome, RTGWorld rtgWorld, Random rand, int worldX, int worldZ, float strength, float river, boolean hasPlacedVillageBlocks) {
if (this.allowed) {
if (TerrainGen.decorate(rtgWorld.world, rand, new BlockPos(worldX, 0, worldZ), CACTUS)) {
WorldGenerator worldGenerator = new WorldGenCacti(this.sandOnly, 0, this.soilBlock);
int loopCount = this.loops;
loopCount = (this.strengthFactor > 0f) ? (int) (this.strengthFactor * strength) : loopCount;
for (int i = 0; i < loopCount * 10; i++) {
// + 8;
int intX = worldX + rand.nextInt(16);
int intY = rand.nextInt(this.maxY);
// + 8;
int intZ = worldZ + rand.nextInt(16);
if (intY <= this.maxY && rand.nextInt(this.chance) == 0) {
worldGenerator.generate(rtgWorld.world, rand, new BlockPos(intX, intY, intZ));
}
}
}
}
}
Aggregations