Posted June 11, 201411 yr Pretty much a solar pannel, I need to be able to check if its day, and if it has visibility to the sky, I looked through the block class and did not find any thing interesting. Thanks, -gmod622 Not new to java >> New to modding.
June 11, 201411 yr i would say take the blocks xyz pos, and see if there are any blocks on above the block on the y axis, from the blocks y pos to 256, i would also reccomend passing through glass and other transparent blocks. For example. while(int y = yPos; y <=256; y++) { if((world.getBlockatCoords(xPos,y,zPos) != null) || (world.getBlockatCoords(xPos,y,zPos) != Blocks.glass)) { skyVisible = false; } } [shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]
June 12, 201411 yr i would say take the blocks xyz pos, and see if there are any blocks on above the block on the y axis, from the blocks y pos to 256, i would also reccomend passing through glass and other transparent blocks. For example. while(int y = yPos; y <=256; y++) { if((world.getBlockatCoords(xPos,y,zPos) != null) || (world.getBlockatCoords(xPos,y,zPos) != Blocks.glass)) { skyVisible = false; } } The method is getBlock(x, y, z) and the null check is useless. Blocks.air is returned in any case other than a regular block. -S- (if I helped, please click Thank and applaud) http://6upnqa.dm2301.livefilestore.com/y2mtf-vG7Tqq1TiiVpIm53KWj7294NDPoHfSHHb4PzZiMAUfRCfK0UY0MwOu7Q3zTBNVTKqWjr2-xgBfFRpQT5p-QivtvknPpoABMNUw9br9WuZcBFkjePhnAbW500gVm-P/sequiturian.png[/img]
June 12, 201411 yr I use this for my solar furnace. public static boolean sunIsVisible = false; /** * Checks if the specified block is able to see the sky */ public void updateSunVisibility() { this.sunIsVisible = isSunVisible(this.worldObj, this.xCoord, this.yCoord + 1, this.zCoord); } public static boolean isSunVisible(World world, int x, int y, int z) { return (world.isDaytime()) && (!world.provider.hasNoSky) && (world.canBlockSeeTheSky(x, y, z)) && (((world.getWorldChunkManager().getBiomeGenAt(x, z) instanceof BiomeGenDesert)) || ((!world.isRaining()) && (!world.isThundering()))); }
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.