mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-27 15:23:16 +00:00
Apply various common one-to-one replacements
More work on common too. network package now done.
This commit is contained in:
1 parent
a0114b5112
commit
a80f724cc2
189 files changed
+1586
-1634
No files matched your search
@@ -7,6 +7,7 @@ import mekanism.common.MekanismBlocks;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
|
||||
@@ -23,9 +24,9 @@ public class WorldGenSalt extends WorldGenerator
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean generate(World world, Random random, int x, int y, int z)
|
||||
public boolean generate(World world, Random random, BlockPos pos)
|
||||
{
|
||||
if(world.getBlock(x, y, z).getMaterial() != Material.water)
|
||||
if(world.getBlockState(pos).getBlock().getMaterial() != Material.water)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -33,22 +34,23 @@ public class WorldGenSalt extends WorldGenerator
|
||||
int toGenerate = random.nextInt(numberOfBlocks - 2) + 2;
|
||||
byte yOffset = 1;
|
||||
|
||||
for(int xPos = x - toGenerate; xPos <= x + toGenerate; xPos++)
|
||||
for(int xPos = pos.getX() - toGenerate; xPos <= pos.getX() + toGenerate; xPos++)
|
||||
{
|
||||
for(int zPos = z - toGenerate; zPos <= z + toGenerate; zPos++)
|
||||
for(int zPos = pos.getZ() - toGenerate; zPos <= pos.getZ() + toGenerate; zPos++)
|
||||
{
|
||||
int xOffset = xPos - x;
|
||||
int zOffset = zPos - z;
|
||||
int xOffset = xPos - pos.getX();
|
||||
int zOffset = zPos - pos.getZ();
|
||||
|
||||
if((xOffset*xOffset) + (zOffset*zOffset) <= toGenerate*toGenerate)
|
||||
{
|
||||
for(int yPos = y - yOffset; yPos <= y + yOffset; yPos++)
|
||||
for(int yPos = pos.getY() - yOffset; yPos <= pos.getY() + yOffset; yPos++)
|
||||
{
|
||||
Block block = world.getBlock(xPos, yPos, zPos);
|
||||
BlockPos newPos = new BlockPos(xPos, yPos, zPos);
|
||||
Block block = world.getBlockState(newPos).getBlock();
|
||||
|
||||
if(block == Blocks.dirt || block == Blocks.clay || block == MekanismBlocks.SaltBlock)
|
||||
{
|
||||
world.setBlock(xPos, yPos, zPos, blockGen, 0, 2);
|
||||
world.setBlockState(newPos, blockGen.getDefaultState(), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user