Posted May 15, 201510 yr How do I get the biome the player is currently in? Here is what I am using right now: BlockPos blockPos = new BlockPos(Minecraft.getMinecraft().thePlayer.posX, Minecraft.getMinecraft().thePlayer.posY, Minecraft.getMinecraft().thePlayer.posZ); String currentBiome = event.world.getBiomeGenForCoords(blockPos).biomeName; This bit of code is inside a tick event function which uses the WorldTickEvent. As of now, currentBiome is being set to "Hell" no matter where I am: Jungle, Desert, Forest, Ocean, Nether, End, it doesn't matter. What am I doing wrong?
May 15, 201510 yr There is this code in GuiOverlayDebug: BlockPos blockpos = new BlockPos(this.mc.getRenderViewEntity().posX, this.mc.getRenderViewEntity().getEntityBoundingBox().minY, this.mc.getRenderViewEntity().posZ); (...) if (this.mc.theWorld != null && this.mc.theWorld.isBlockLoaded(blockpos)) { Chunk chunk = this.mc.theWorld.getChunkFromBlockCoords(blockpos); arraylist.add("Biome: " + chunk.getBiome(blockpos, this.mc.theWorld.getWorldChunkManager()).biomeName); You might wanna look into how it works as I don't know (never used) code you posted and why it doesn't work. Overall - BIG WTF! DON'T USE MINECRAFT CLASS IN WorldTickEvent - never ever! You might want to use PlayerTickEvent for per-player effect. 1.7.10 is no longer supported by forge, you are on your own.
May 15, 201510 yr Author Could you please explain why not to use the Minecraft class in the WorldTickEvent? I only started modding two weeks ago, so even though I am capable of understanding this stuff, I have no clue where to find it out because of poor documentation/community organization. So even though I know you mean well, your comment doesn't really help me understand what I am doing; it just gives me an example of code from vanilla that I can adapt to my application.
May 15, 201510 yr There are two sides (threads) running: Logical CLIENT and logical SERVER. On Client.jar there are both running (the client has an integrated server in background) therefore accessing it won't crash. On Server.jar (dedic) there is only SERVER logical side - classes like Minecraft or any other client class are simply not there - it will crash. You cannot have any client-class reference in class used by server. That is why you use Proxies. As to TickEvents: There are 5 tick events. SERVER, CLIENT, WORLD, PLAYER and RENDER. Server runs only on server thread, client and render on client. Player tick runs on both (that means that each side runs code once, unless you do world.isRemote - true=client, false=server; worldObj can be found also in any entity - e.g player from PlayerTickEvent). As to WorldTickEvent - it runs for EVERY loaded world once per tick and ONLY for SERVER. The client has always ONE world (the one the client's player "thePlayer" is in called "theWorld" - those are accessible from Minecraf.class for client purposes only). On forge build 1306 - WorldTickEvent will NOT be called on client world, BUT it might have changed, I am just outdated. More: Each TickEvent has 2 Phases - START and END. Whenever you use TickEvent - pick one phase (event.phase) - otherwise your code will run twice. START happens before all other updates like entity or tileentity updates, END happens last. 1.7.10 is no longer supported by forge, you are on your own.
May 15, 201510 yr The mystery of your double-thank-you is bothering me till this day! (http://www.minecraftforge.net/forum/index.php/topic,30222.msg156872.html#msg156872) 1.7.10 is no longer supported by forge, you are on your own.
May 15, 201510 yr Author It's beyond me. Initially, there is only one thank you, but after I reload the page, another one appears out of the blue. It's almost like it's adding a dummy account before mine with a blank username because there is a comma preceding my username in the thank you.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.