/** * Gets the light level of the spot above this block. Does not take into account sunlight. * @return 0-15 */ public int GetLightLevelWithoutSky() { return mc.theWorld.getLightFor(EnumSkyBlock.BLOCK, new BlockPos(x, y + 1, z)); }
/** * Gets the light level of the spot above this block. Take into account sunlight. * @return 0-15 */ public int GetLightLevelWithSky() { return mc.theWorld.getLightFor(EnumSkyBlock.SKY, new BlockPos(x, y + 1, z)); }
public static Block GetBlock(int x, int y, int z) { BlockPos pos = new BlockPos(x, y, z); return GetBlock(pos); } public static Block GetBlock(BlockPos pos)
public static IBlockState GetBlockState(int x, int y, int z) { BlockPos pos = new BlockPos(x, y, z); return GetBlockState(pos); } public static IBlockState GetBlockState(BlockPos pos)
/** * Makes the player use the Block in their currently selected hotbar slot. * To use Items, use SendUseItem() */ public static boolean SendUseBlock() { //Blocks need to use the onPlayerRightClick() function to work properly //return mc.playerController.onPlayerRightClick(mc.thePlayer, mc.theWorld, mc.thePlayer.getHeldItem(), mc.objectMouseOver.blockX, mc.objectMouseOver.blockY, mc.objectMouseOver.blockZ, mc.objectMouseOver.sideHit, mc.objectMouseOver.hitVec); boolean sendUseBlock = mc.playerController.onPlayerRightClick(mc.thePlayer, mc.theWorld, mc.thePlayer.getHeldItem(), new BlockPos(mc.objectMouseOver.hitVec.xCoord, mc.objectMouseOver.hitVec.yCoord, mc.objectMouseOver.hitVec.zCoord), mc.objectMouseOver.sideHit, mc.objectMouseOver.hitVec); BlockPos pos = new BlockPos(mc.objectMouseOver.hitVec.xCoord, mc.objectMouseOver.hitVec.yCoord, mc.objectMouseOver.hitVec.zCoord); return sendUseBlock; }
protected static String CalculateBiomeForInfoLine() { int xCoord = MathHelper.floor_double(mc.thePlayer.posX); int zCoord = MathHelper.floor_double(mc.thePlayer.posZ); String biomeName = mc.theWorld.getBiomeGenForCoords(new BlockPos(xCoord, 64, zCoord)).biomeName; return EnumChatFormatting.WHITE + biomeName; }
/** * Checks if mobs can spawn ON the block at a location. * @param dx x location relative to this block * @param dy y location relative to this block * @param dz z location relative to this block * @return true if mobs can spawn ON this block */ public boolean CanMobsSpawnOnBlock(int dx, int dy, int dz) { Block block = GetBlock(dx, dy, dz); if (block == null || block == Blocks.air || block instanceof BlockBarrier || block instanceof BlockSlime) { return false; } if (block.isOpaqueCube() || mc.theWorld.doesBlockHaveSolidTopSurface(mc.theWorld, new BlockPos(x + dx, y + dy, z + dz)) || block instanceof BlockFarmland) //the one exception to the isOpaqueCube and doesBlockHaveSolidTopSurface rules { return true; } return false; }
protected static String CalculateCanSnowForInfoLine(String infoLineMessageUpToThisPoint) { int xCoord = MathHelper.floor_double(mc.thePlayer.posX); int yCoord = MathHelper.floor_double(mc.thePlayer.posY) - 1; int zCoord = MathHelper.floor_double(mc.thePlayer.posZ); BlockPos pos = new BlockPos(xCoord, yCoord, zCoord); boolean canSnowAtPlayersFeet = mc.theWorld.canSnowAtBody(pos, false); if(canSnowAtPlayersFeet) { float scaler = 0.66f; GL11.glScalef(scaler, scaler, scaler); int x = (int)(mc.fontRendererObj.getStringWidth(infoLineMessageUpToThisPoint) / scaler); int y = (int)(-1); itemRenderer.renderItemAndEffectIntoGUI(new ItemStack(Items.snowball), x, y); GL11.glDisable(GL11.GL_LIGHTING); GL11.glScalef(1/scaler, 1/scaler, 1/scaler); return " "; } return ""; }