public void func_338_a(EntityLiving entityliving, float f) { if (!loaded || options.soundVolume == 0.0F || sndSystem == null) { return; } if (entityliving == null) { return; } else { float f1 = entityliving.prevRotationYaw + (entityliving.rotationYaw - entityliving.prevRotationYaw) * f; double d = entityliving.prevPosX + (entityliving.posX - entityliving.prevPosX) * (double) f; double d1 = entityliving.prevPosY + (entityliving.posY - entityliving.prevPosY) * (double) f; double d2 = entityliving.prevPosZ + (entityliving.posZ - entityliving.prevPosZ) * (double) f; float f2 = MathHelper.cos(-f1 * 0.01745329F - 3.141593F); float f3 = MathHelper.sin(-f1 * 0.01745329F - 3.141593F); float f4 = -f3; float f5 = 0.0F; float f6 = -f2; float f7 = 0.0F; float f8 = 1.0F; float f9 = 0.0F; sndSystem.setListenerPosition((float) d, (float) d1, (float) d2); sndSystem.setListenerOrientation(f4, f5, f6, f7, f8, f9); return; } }
public Packet71Weather(Entity par1Entity) { entityID = par1Entity.entityId; posX = MathHelper.floor_double(par1Entity.posX * 32D); posY = MathHelper.floor_double(par1Entity.posY * 32D); posZ = MathHelper.floor_double(par1Entity.posZ * 32D); if (par1Entity instanceof EntityLightningBolt) { isLightningBolt = 1; } }
public Packet24MobSpawn(EntityLiving entityliving) { entityId = entityliving.entityId; type = (byte) EntityList.getEntityID(entityliving); xPosition = MathHelper.floor_double(entityliving.posX * 32D); yPosition = MathHelper.floor_double(entityliving.posY * 32D); zPosition = MathHelper.floor_double(entityliving.posZ * 32D); yaw = (byte) (int) ((entityliving.rotationYaw * 256F) / 360F); pitch = (byte) (int) ((entityliving.rotationPitch * 256F) / 360F); metaData = entityliving.getDataWatcher(); }
public List func_22176_b() { ArrayList arraylist = new ArrayList(); File afile[] = field_22180_a.listFiles(); File afile1[] = afile; int i = afile1.length; for (int j = 0; j < i; j++) { File file = afile1[j]; if (!file.isDirectory()) { continue; } String s = file.getName(); WorldInfo worldinfo = func_22173_b(s); if (worldinfo == null) { continue; } boolean flag = worldinfo.getSaveVersion() != 19132; String s1 = worldinfo.getWorldName(); if (s1 == null || MathHelper.stringNullOrLengthZero(s1)) { s1 = s; } arraylist.add( new SaveFormatComparator( s, s1, worldinfo.getLastTimePlayed(), worldinfo.getSizeOnDisk(), flag)); } return arraylist; }
public List getSaveList() { ArrayList arraylist = new ArrayList(); File afile[] = savesDirectory.listFiles(); File afile1[] = afile; int i = afile1.length; for (int j = 0; j < i; j++) { File file = afile1[j]; if (!file.isDirectory()) { continue; } String s = file.getName(); WorldInfo worldinfo = getWorldInfo(s); if (worldinfo == null || worldinfo.getSaveVersion() != 19132 && worldinfo.getSaveVersion() != 19133) { continue; } boolean flag = worldinfo.getSaveVersion() != getSaveVersion(); String s1 = worldinfo.getWorldName(); if (s1 == null || MathHelper.stringNullOrLengthZero(s1)) { s1 = s; } long l = 0L; arraylist.add( new SaveFormatComparator( s, s1, worldinfo.getLastTimePlayed(), l, worldinfo.getGameType(), flag, worldinfo.isHardcoreModeEnabled(), worldinfo.areCommandsAllowed())); } return arraylist; }
public void handlePlace(Packet15Place par1Packet15Place) { WorldServer worldserver = mcServer.worldServerForDimension(playerEntity.dimension); ItemStack itemstack = playerEntity.inventory.getCurrentItem(); boolean flag = false; int i = par1Packet15Place.getXPosition(); int j = par1Packet15Place.getYPosition(); int k = par1Packet15Place.getZPosition(); int l = par1Packet15Place.getDirection(); boolean flag1 = worldserver.actionsAllowed = worldserver.provider.worldType != 0 || mcServer.getConfigurationManager().areCommandsAllowed(playerEntity.username) || mcServer.isSinglePlayer(); if (par1Packet15Place.getDirection() == 255) { if (itemstack == null) { return; } playerEntity.theItemInWorldManager.tryUseItem(playerEntity, worldserver, itemstack); } else if (par1Packet15Place.getYPosition() < mcServer.getBuildLimit() - 1 || par1Packet15Place.getDirection() != 1 && par1Packet15Place.getYPosition() < mcServer.getBuildLimit()) { ChunkCoordinates chunkcoordinates = worldserver.getSpawnPoint(); int i1 = MathHelper.abs_int(i - chunkcoordinates.posX); int j1 = MathHelper.abs_int(k - chunkcoordinates.posZ); if (i1 > j1) { j1 = i1; } if (field_72587_r && playerEntity.getDistanceSq((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D) < 64D && (j1 > 16 || flag1)) { playerEntity.theItemInWorldManager.activateBlockOrUseItem( playerEntity, worldserver, itemstack, i, j, k, l, par1Packet15Place.getXOffset(), par1Packet15Place.getYOffset(), par1Packet15Place.getZOffset()); } flag = true; } else { playerEntity.serverForThisPlayer.sendPacketToPlayer( new Packet3Chat( (new StringBuilder()) .append("\2477Height limit for building is ") .append(mcServer.getBuildLimit()) .toString())); flag = true; } if (flag) { playerEntity.serverForThisPlayer.sendPacketToPlayer( new Packet53BlockChange(i, j, k, worldserver)); if (l == 0) { j--; } if (l == 1) { j++; } if (l == 2) { k--; } if (l == 3) { k++; } if (l == 4) { i--; } if (l == 5) { i++; } playerEntity.serverForThisPlayer.sendPacketToPlayer( new Packet53BlockChange(i, j, k, worldserver)); } itemstack = playerEntity.inventory.getCurrentItem(); if (itemstack != null && itemstack.stackSize == 0) { playerEntity.inventory.mainInventory[playerEntity.inventory.currentItem] = null; itemstack = null; } if (itemstack == null || itemstack.getMaxItemUseDuration() == 0) { playerEntity.playerInventoryBeingManipulated = true; playerEntity.inventory.mainInventory[playerEntity.inventory.currentItem] = ItemStack.copyItemStack( playerEntity.inventory.mainInventory[playerEntity.inventory.currentItem]); Slot slot = playerEntity.craftingInventory.getSlotFromInventory( playerEntity.inventory, playerEntity.inventory.currentItem); playerEntity.craftingInventory.updateCraftingResults(); playerEntity.playerInventoryBeingManipulated = false; if (!ItemStack.areItemStacksEqual( playerEntity.inventory.getCurrentItem(), par1Packet15Place.getItemStack())) { sendPacketToPlayer( new Packet103SetSlot( playerEntity.craftingInventory.windowId, slot.slotNumber, playerEntity.inventory.getCurrentItem())); } } worldserver.actionsAllowed = false; }
public void handleBlockDig(Packet14BlockDig par1Packet14BlockDig) { WorldServer worldserver = mcServer.worldServerForDimension(playerEntity.dimension); if (par1Packet14BlockDig.status == 4) { playerEntity.dropOneItem(); return; } if (par1Packet14BlockDig.status == 5) { playerEntity.stopUsingItem(); return; } boolean flag = worldserver.actionsAllowed = worldserver.provider.worldType != 0 || mcServer.getConfigurationManager().areCommandsAllowed(playerEntity.username) || mcServer.isSinglePlayer(); boolean flag1 = false; if (par1Packet14BlockDig.status == 0) { flag1 = true; } if (par1Packet14BlockDig.status == 2) { flag1 = true; } int i = par1Packet14BlockDig.xPosition; int j = par1Packet14BlockDig.yPosition; int k = par1Packet14BlockDig.zPosition; if (flag1) { double d = playerEntity.posX - ((double) i + 0.5D); double d1 = (playerEntity.posY - ((double) j + 0.5D)) + 1.5D; double d3 = playerEntity.posZ - ((double) k + 0.5D); double d5 = d * d + d1 * d1 + d3 * d3; if (d5 > 36D) { return; } if (j >= mcServer.getBuildLimit()) { return; } } ChunkCoordinates chunkcoordinates = worldserver.getSpawnPoint(); int l = MathHelper.abs_int(i - chunkcoordinates.posX); int i1 = MathHelper.abs_int(k - chunkcoordinates.posZ); if (l > i1) { i1 = l; } if (par1Packet14BlockDig.status == 0) { if (i1 > 16 || flag) { playerEntity.theItemInWorldManager.onBlockClicked(i, j, k, par1Packet14BlockDig.face); } else { playerEntity.serverForThisPlayer.sendPacketToPlayer( new Packet53BlockChange(i, j, k, worldserver)); } } else if (par1Packet14BlockDig.status == 2) { playerEntity.theItemInWorldManager.uncheckedTryHarvestBlock(i, j, k); if (worldserver.getBlockId(i, j, k) != 0) { playerEntity.serverForThisPlayer.sendPacketToPlayer( new Packet53BlockChange(i, j, k, worldserver)); } } else if (par1Packet14BlockDig.status == 1) { playerEntity.theItemInWorldManager.destroyBlockInWorldPartially(i, j, k); if (worldserver.getBlockId(i, j, k) != 0) { playerEntity.serverForThisPlayer.sendPacketToPlayer( new Packet53BlockChange(i, j, k, worldserver)); } } else if (par1Packet14BlockDig.status == 3) { double d2 = playerEntity.posX - ((double) i + 0.5D); double d4 = playerEntity.posY - ((double) j + 0.5D); double d6 = playerEntity.posZ - ((double) k + 0.5D); double d7 = d2 * d2 + d4 * d4 + d6 * d6; if (d7 < 256D) { playerEntity.serverForThisPlayer.sendPacketToPlayer( new Packet53BlockChange(i, j, k, worldserver)); } } worldserver.actionsAllowed = false; }
@Override public String getRandomName() { return this.m_names.get(MathHelper.random(this.m_names.size())); }
/** Draws the screen and all the components in it. */ public void drawScreen(int par1, int par2, float par3) { if (panorama) { renderSkybox(par1, par2, par3); } else { drawDefaultBackground(); } Tessellator tessellator = Tessellator.instance; if (oldlogo) { drawLogo(par3); } char c = 274; int i = width / 2 - c / 2; byte byte0 = 30; if (panorama) { drawGradientRect(0, 0, width, height, 0x80ffffff, 0xffffff); drawGradientRect(0, 0, width, height, 0, 0x80000000); } if (!oldlogo) { mc.func_110434_K().func_110577_a(field_110352_y); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); if ((double) updateCounter < 0.0001D) { drawTexturedModalRect(i + 0, byte0 + 0, 0, 0, 99, 44); drawTexturedModalRect(i + 99, byte0 + 0, 129, 0, 27, 44); drawTexturedModalRect(i + 99 + 26, byte0 + 0, 126, 0, 3, 44); drawTexturedModalRect(i + 99 + 26 + 3, byte0 + 0, 99, 0, 26, 44); drawTexturedModalRect(i + 155, byte0 + 0, 0, 45, 155, 44); } else { drawTexturedModalRect(i + 0, byte0 + 0, 0, 0, 155, 44); drawTexturedModalRect(i + 155, byte0 + 0, 0, 45, 155, 44); } } tessellator.setColorOpaque_I(0xffffff); GL11.glPushMatrix(); GL11.glTranslatef(width / 2 + 90, 70F, 0.0F); GL11.glRotatef(-20F, 0.0F, 0.0F, 1.0F); float f = 1.8F - MathHelper.abs( MathHelper.sin( ((float) (Minecraft.getSystemTime() % 1000L) / 1000F) * (float) Math.PI * 2.0F) * 0.1F); f = (f * 100F) / (float) (fontRenderer.getStringWidth(splashText) + 32); GL11.glScalef(f, f, f); drawCenteredString(fontRenderer, splashText, 0, -8, 0xffff00); GL11.glPopMatrix(); String s = version.contains(":") ? version.split(":", 2)[1] : version; if (s.equals("OFF")) { s = "Minecraft " + (new CallableMinecraftVersion(null)).minecraftVersion(); } if (mc.isDemo()) { s = (new StringBuilder()).append(s).append(" Demo").toString(); } if (panorama) { drawString(fontRenderer, s, 2, height - 10, 0xffffff); } else { drawString(fontRenderer, s, 2, 2, 0x505050); } String s1 = "Copyright Mojang AB. Do not distribute!"; drawString( fontRenderer, s1, width - fontRenderer.getStringWidth(s1) - 2, height - 10, 0xffffff); if (field_92025_p != null && field_92025_p.length() > 0) { drawRect( field_92022_t - 2, field_92021_u - 2, field_92020_v + 2, field_92019_w - 1, 0x55200000); drawString(fontRenderer, field_92025_p, field_92022_t, field_92021_u, 0xffffff); drawString( fontRenderer, field_96138_a, (width - field_92024_r) / 2, ((GuiButton) buttonList.get(0)).yPosition - 12, 0xffffff); } super.drawScreen(par1, par2, par3); }
/** Draws the main menu panorama */ private void drawPanorama(int par1, int par2, float par3) { Tessellator tessellator = Tessellator.instance; GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPushMatrix(); GL11.glLoadIdentity(); Project.gluPerspective(120F, 1.0F, 0.05F, 10F); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); GL11.glLoadIdentity(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDepthMask(false); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); int i = 8; for (int j = 0; j < i * i; j++) { GL11.glPushMatrix(); float f = ((float) (j % i) / (float) i - 0.5F) / 64F; float f1 = ((float) (j / i) / (float) i - 0.5F) / 64F; float f2 = 0.0F; GL11.glTranslatef(f, f1, f2); GL11.glRotatef( MathHelper.sin(((float) panoramaTimer + par3) / 400F) * 25F + 20F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(-((float) panoramaTimer + par3) * 0.1F, 0.0F, 1.0F, 0.0F); for (int k = 0; k < 6; k++) { GL11.glPushMatrix(); if (k == 1) { GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F); } if (k == 2) { GL11.glRotatef(180F, 0.0F, 1.0F, 0.0F); } if (k == 3) { GL11.glRotatef(-90F, 0.0F, 1.0F, 0.0F); } if (k == 4) { GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F); } if (k == 5) { GL11.glRotatef(-90F, 1.0F, 0.0F, 0.0F); } mc.func_110434_K().func_110577_a(titlePanoramaPaths[k]); tessellator.startDrawingQuads(); tessellator.setColorRGBA_I(0xffffff, 255 / (j + 1)); float f3 = 0.0F; tessellator.addVertexWithUV(-1D, -1D, 1.0D, 0.0F + f3, 0.0F + f3); tessellator.addVertexWithUV(1.0D, -1D, 1.0D, 1.0F - f3, 0.0F + f3); tessellator.addVertexWithUV(1.0D, 1.0D, 1.0D, 1.0F - f3, 1.0F - f3); tessellator.addVertexWithUV(-1D, 1.0D, 1.0D, 0.0F + f3, 1.0F - f3); tessellator.draw(); GL11.glPopMatrix(); } GL11.glPopMatrix(); GL11.glColorMask(true, true, true, false); } tessellator.setTranslation(0.0D, 0.0D, 0.0D); GL11.glColorMask(true, true, true, true); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPopMatrix(); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_DEPTH_TEST); }