Can't tell if this has been discussed (search didn't find it), so I'm making a thread where we can add some tips on how to update our WorldGeneration code from 1.7.10 to 1.8.
If there is another thread on this, please point me to it, otherwise I'll try to update this first post to include all of the tips.
So here is what I have so far:
Helper function to replace world.getHeightValue(int x, int y):
public static int getHeightValue(World parWorld, int x, int z)
{
int chunkX = x >> 4;
int chunkZ = z >> 4;
int height = parWorld.getChunkFromChunkCoords(chunkX, chunkZ).getHeight(x & 15, z & 15);
return height;
}
Helper function to replace world.getHeightValue(double x, double y):
public static double getHeightValue(World parWorld, double parX, double parZ)
{
int intX = MathHelper.floor_double(parX);
int intZ = MathHelper.floor_double(parZ);
Helper function to replace world.blockExists(int x, int y, int z) (this one I don't know if it works):
public static boolean blockExists(World parWorld, int x, int y, int z) {
IBlockState state = parWorld.getBlockState(new BlockPos(x, y, z));
if (state != null)
return true;
else
return false;
}
Code to replace world.setBlock(x, y, z, , metaData, Flag)
For the blockExists replacement, can't you just copy the code from the 1.7.10 method, using world.getChunkProvider().chunkExists(x, y) instead of world.chunkExists(x, y)?
As a side note, World#getBlockState will return Blocks.air.getDefaultState() rather than null when you pass it an invalid BlockPos.
For the spawner, TileEntityMobSpawner#func_145881_a has been renamed/deobfuscated to getSpawnerBaseLogic.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
For the blockExists replacement, can't you just copy the code from the 1.7.10 method, using world.getChunkProvider().chunkExists(x, y) instead of world.chunkExists(x, y)?
As a side note, World#getBlockState will return Blocks.air.getDefaultState() rather than null when you pass it an invalid BlockPos.
For the spawner, TileEntityMobSpawner#func_145881_a has been renamed/deobfuscated to getSpawnerBaseLogic.
Thanks. I'll update this tonight after I've tested it out.
I'll probably add a few more thing too, like what do you use instead of setBlock.
Can't tell if this has been discussed (search didn't find it), so I'm making a thread where we can add some tips on how to update our WorldGeneration code from 1.7.10 to 1.8.
If there is another thread on this, please point me to it, otherwise I'll try to update this first post to include all of the tips.
So here is what I have so far:
Helper function to replace world.getHeightValue(int x, int y):
public static int getHeightValue(World parWorld, int x, int z)
{
int chunkX = x >> 4;
int chunkZ = z >> 4;
int height = parWorld.getChunkFromChunkCoords(chunkX, chunkZ).getHeight(x & 15, z & 15);
return height;
}
Helper function to replace world.getHeightValue(double x, double y):
{
int intX = MathHelper.floor_double(parX);
int intZ = MathHelper.floor_double(parZ);
int chunkX = intX >> 4;
int chunkZ = intZ >> 4;
double height = parWorld.getChunkFromChunkCoords(chunkX, chunkZ).getHeight(intX & 15, intZ & 15);
return height;
}
Helper function to replace world.blockExists(int x, int y, int z) (this one I don't know if it works):
public static boolean blockExists(World parWorld, int x, int y, int z) {
IBlockState state = parWorld.getBlockState(new BlockPos(x, y, z));
if (state != null)
return true;
else
return false;
}
Code to replace world.setBlock(x, y, z, , metaData, Flag)
world.setBlockState(new BlockPos(x,y,z), block.getDefaultState(), flag);
Although, keep in mind the above doesn't set the metaData.
[url=2482915-wip-arkcraft-survival-evolved-dinos-taming]
So in addition to what I do have, I need some code to replace this:
TileEntityMobSpawner spawner = new TileEntityMobSpawner();
world.setTileEntity(new BlockPos(x, y, z), spawner);
spawner.func_145881_a().setEntityName("creeper");
Just the last line of code above is the problem, the first two were shown for reference.
[url=2482915-wip-arkcraft-survival-evolved-dinos-taming]
For the blockExists replacement, can't you just copy the code from the 1.7.10 method, using world.getChunkProvider().chunkExists(x, y) instead of world.chunkExists(x, y)?
As a side note, World#getBlockState will return Blocks.air.getDefaultState() rather than null when you pass it an invalid BlockPos.
For the spawner, TileEntityMobSpawner#func_145881_a has been renamed/deobfuscated to getSpawnerBaseLogic.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Thanks. I'll update this tonight after I've tested it out.
I'll probably add a few more thing too, like what do you use instead of setBlock.
[url=2482915-wip-arkcraft-survival-evolved-dinos-taming]