Jump to content

TheUnderTaker11

Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by TheUnderTaker11

  1. I'm an idiot, sorry to waste your time, I failed to put pos#down() when checking for netherrack, so obviously it was always going to return false no matter what. Solved my own problem whoops.
  2. Oh well thanks, then the example I got it from had it wrong. Like I said yellow flower is just for testing, but I'm still having the problem where it never places, any idea why that is? Also realized I never used the boolean done, just broke out anyways lol. (So made it a for loop using the if statement, tired code is weird code.)
  3. Sorry if this is some super easy solution but I THINK I'm having some weirdness when getting chunks generated, that or something I can't notice is wrong with where I decide a proper place to put the flower. Even though I fly in the +Z direction, as seen here, Ignore the blue line lol. Well using the code I'll put at the bottom, I get this output. (I'm not multiplying chunkX or chunkZ by anything, for testing purposes. I know normally you would multiply by 16 but I'm super confused, the Z value is staying exactly the same, yet the X value changes a ton, when in reality (Me flying towards +Z) the X is the one staying the same. Now I understand that the X would also change a ton cause it's generating all around me, but why is the Z staying exactly the same? As for the overall purpose of this, it's to make some flowers spawn on top of netherrack throughout the nether, but for them to be pretty rare. So if you notice anything I'm doing stupidly wrong then say something as well. (Just using dandelions for testing, will use my block later.) And here is my code, and I call it using this GameRegistry.registerWorldGenerator(new FlowerGen(), 50000); I set a really high value since it said that higher values would be done last (Well heavier values, which I can only assume means higher). Now the main code. package com.theundertaker11.demonicintervention.worldgen; import java.util.Random; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.IChunkGenerator; import net.minecraftforge.fml.common.IWorldGenerator; public class FlowerGen implements IWorldGenerator { @Override public void generate(Random rand, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) { if (world.provider.getDimension() == -1) { int x = chunkX; int z = chunkZ; int y = 128; System.out.println("Attempting at X, z: " + x + ", " + z); boolean done = false; int counter = 0; while(!done) { if(counter >= (y-3)) break; BlockPos pos = new BlockPos(x, y - counter, z); if(world.getBlockState(pos).getBlock() == Blocks.AIR && world.getBlockState(pos).getBlock() == Blocks.NETHERRACK) { if(true || rand.nextInt(3) < 2) { // I know just want to make sure there isn't a chance thing atm IBlockState state = Blocks.YELLOW_FLOWER.getDefaultState(); world.setBlockState(pos, state); System.out.println("Generated flower at Pos " + pos.getX() + "," + pos.getY() + "," + pos.getZ()); break; } } counter++; } } } Also sorry but I won't be able to reply quickly anyone sees this soon, as it is almost 5am for me and I need some sleep!
  4. It also rotates, forgot to say that, so unless it can rotate the way you said. Also the getUpdateTag is the one thing I was missing, thanks. Had no need to do onDataPacket or handleUpdateTag though.
  5. Am I doing something wrong here, or do I actually have to make an update packet just to send in the onLoad()? TileEntity class is here My exact problem is that I have a TESR which can hold one ItemStack, and renders that stack above itself. When loading into the world, nothing renders until I take out and put the item back in, since my right click method is called on both sides. Is there some simple way to sync them or do I have to make a sync packet myself?
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.