mirror of
https://git.zelz.net/catfoolyou/Project164.git
synced 2025-12-14 22:17:41 +00:00
More fixes
This commit is contained in:
@@ -101,7 +101,7 @@ public class Minecraft
|
||||
|
||||
/** The game settings that currently hold effect. */
|
||||
public GameSettings gameSettings;
|
||||
public SoundManager sndManager;
|
||||
public SoundManager sndManager = new SoundManager();
|
||||
|
||||
/** Mouse helper instance. */
|
||||
public MouseHelper mouseHelper;
|
||||
@@ -650,48 +650,36 @@ public class Minecraft
|
||||
* Shuts down the minecraft applet by stopping the resource downloads, and clearing up GL stuff; called when the
|
||||
* application (or web page) is exited.
|
||||
*/
|
||||
public void shutdownMinecraftApplet()
|
||||
{
|
||||
try
|
||||
{
|
||||
this.statFileWriter.syncStats();
|
||||
this.getLogAgent().logInfo("Stopping!");
|
||||
public void shutdownMinecraftApplet() {
|
||||
try {
|
||||
|
||||
try
|
||||
{
|
||||
this.loadWorld((WorldClient)null);
|
||||
}
|
||||
catch (Throwable var7)
|
||||
{
|
||||
System.err.println("Stopping!");
|
||||
|
||||
try {
|
||||
this.loadWorld((WorldClient) null);
|
||||
} catch (Throwable var8) {
|
||||
;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
GLAllocation.deleteTexturesAndDisplayLists();
|
||||
}
|
||||
catch (Throwable var6)
|
||||
{
|
||||
} catch (Throwable var7) {
|
||||
;
|
||||
}
|
||||
|
||||
this.sndManager.cleanup();
|
||||
}
|
||||
finally
|
||||
{
|
||||
Display.destroy();
|
||||
this.sndManager.closeMinecraft();
|
||||
} finally {
|
||||
EaglerAdapter.destroyContext();
|
||||
|
||||
if (!this.hasCrashed)
|
||||
{
|
||||
System.exit(0);
|
||||
if (!this.hasCrashed) {
|
||||
EaglerAdapter.exit();
|
||||
}
|
||||
}
|
||||
|
||||
System.gc();
|
||||
}
|
||||
|
||||
public void run()
|
||||
{
|
||||
public void run() {
|
||||
this.running = true;
|
||||
this.startGame();
|
||||
while (this.running) {
|
||||
@@ -802,10 +790,10 @@ public class Minecraft
|
||||
secondTimer = EaglerAdapter.steadyTimeMillis();
|
||||
}
|
||||
|
||||
/*if(isGonnaTakeDatScreenShot) {
|
||||
if(isGonnaTakeDatScreenShot) {
|
||||
isGonnaTakeDatScreenShot = false;
|
||||
EaglerAdapter.saveScreenshot();
|
||||
}*/
|
||||
}
|
||||
|
||||
EaglerAdapter.doJavascriptCoroutines();
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ import net.lax1dude.eaglercraft.EaglercraftRandom;
|
||||
|
||||
import net.lax1dude.eaglercraft.TextureLocation;
|
||||
import net.lax1dude.eaglercraft.adapter.Tessellator;
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import org.lwjgl.opengl.ARBOcclusionQuery;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class RenderGlobal implements IWorldAccess
|
||||
{
|
||||
@@ -175,14 +175,14 @@ public class RenderGlobal implements IWorldAccess
|
||||
}
|
||||
|
||||
this.starGLCallList = GLAllocation.generateDisplayLists(3);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glNewList(this.starGLCallList, GL11.GL_COMPILE);
|
||||
EaglerAdapter.glPushMatrix();
|
||||
EaglerAdapter.glNewList(this.starGLCallList, EaglerAdapter.GL_COMPILE);
|
||||
this.renderStars();
|
||||
GL11.glEndList();
|
||||
GL11.glPopMatrix();
|
||||
EaglerAdapter.glEndList();
|
||||
EaglerAdapter.glPopMatrix();
|
||||
Tessellator var4 = Tessellator.instance;
|
||||
this.glSkyList = this.starGLCallList + 1;
|
||||
GL11.glNewList(this.glSkyList, GL11.GL_COMPILE);
|
||||
EaglerAdapter.glNewList(this.glSkyList, EaglerAdapter.GL_COMPILE);
|
||||
byte var6 = 64;
|
||||
int var7 = 256 / var6 + 2;
|
||||
float var5 = 16.0F;
|
||||
@@ -202,9 +202,9 @@ public class RenderGlobal implements IWorldAccess
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glEndList();
|
||||
EaglerAdapter.glEndList();
|
||||
this.glSkyList2 = this.starGLCallList + 2;
|
||||
GL11.glNewList(this.glSkyList2, GL11.GL_COMPILE);
|
||||
EaglerAdapter.glNewList(this.glSkyList2, EaglerAdapter.GL_COMPILE);
|
||||
var5 = -16.0F;
|
||||
var4.startDrawingQuads();
|
||||
|
||||
@@ -220,7 +220,7 @@ public class RenderGlobal implements IWorldAccess
|
||||
}
|
||||
|
||||
var4.draw();
|
||||
GL11.glEndList();
|
||||
EaglerAdapter.glEndList();
|
||||
}
|
||||
|
||||
private void renderStars()
|
||||
@@ -653,16 +653,16 @@ public class RenderGlobal implements IWorldAccess
|
||||
var19 = this.sortedWorldRenderers.length;
|
||||
}
|
||||
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glDisable(GL11.GL_FOG);
|
||||
GL11.glColorMask(false, false, false, false);
|
||||
GL11.glDepthMask(false);
|
||||
EaglerAdapter.glDisable(EaglerAdapter.GL_TEXTURE_2D);
|
||||
EaglerAdapter.glDisable(EaglerAdapter.GL_LIGHTING);
|
||||
EaglerAdapter.glDisable(EaglerAdapter.GL_ALPHA_TEST);
|
||||
EaglerAdapter.glDisable(EaglerAdapter.GL_FOG);
|
||||
EaglerAdapter.glColorMask(false, false, false, false);
|
||||
EaglerAdapter.glDepthMask(false);
|
||||
this.theWorld.theProfiler.startSection("check");
|
||||
this.checkOcclusionQueryResult(var35, var19);
|
||||
this.theWorld.theProfiler.endSection();
|
||||
GL11.glPushMatrix();
|
||||
EaglerAdapter.glPushMatrix();
|
||||
float var36 = 0.0F;
|
||||
float var21 = 0.0F;
|
||||
float var22 = 0.0F;
|
||||
@@ -697,7 +697,7 @@ public class RenderGlobal implements IWorldAccess
|
||||
|
||||
if (var30 != 0.0F || var31 != 0.0F || var32 != 0.0F)
|
||||
{
|
||||
GL11.glTranslatef(var30, var31, var32);
|
||||
EaglerAdapter.glTranslatef(var30, var31, var32);
|
||||
var36 += var30;
|
||||
var21 += var31;
|
||||
var22 += var32;
|
||||
@@ -714,28 +714,28 @@ public class RenderGlobal implements IWorldAccess
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
EaglerAdapter.glPopMatrix();
|
||||
|
||||
if (this.mc.gameSettings.anaglyph)
|
||||
{
|
||||
if (EntityRenderer.anaglyphField == 0)
|
||||
{
|
||||
GL11.glColorMask(false, true, true, true);
|
||||
EaglerAdapter.glColorMask(false, true, true, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glColorMask(true, false, false, true);
|
||||
EaglerAdapter.glColorMask(true, false, false, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glColorMask(true, true, true, true);
|
||||
EaglerAdapter.glColorMask(true, true, true, true);
|
||||
}
|
||||
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glEnable(GL11.GL_FOG);
|
||||
EaglerAdapter.glDepthMask(true);
|
||||
EaglerAdapter.glEnable(EaglerAdapter.GL_TEXTURE_2D);
|
||||
EaglerAdapter.glEnable(EaglerAdapter.GL_ALPHA_TEST);
|
||||
EaglerAdapter.glEnable(EaglerAdapter.GL_FOG);
|
||||
this.theWorld.theProfiler.endStartSection("render");
|
||||
var34 += this.renderSortedRenderers(var35, var19, par2, par3);
|
||||
}
|
||||
@@ -897,42 +897,42 @@ public class RenderGlobal implements IWorldAccess
|
||||
{
|
||||
if (this.mc.theWorld.provider.dimensionId == 1)
|
||||
{
|
||||
GL11.glDisable(GL11.GL_FOG);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
EaglerAdapter.glDisable(EaglerAdapter.GL_FOG);
|
||||
EaglerAdapter.glDisable(EaglerAdapter.GL_ALPHA_TEST);
|
||||
EaglerAdapter.glEnable(EaglerAdapter.GL_BLEND);
|
||||
EaglerAdapter.glBlendFunc(EaglerAdapter.GL_SRC_ALPHA, EaglerAdapter.GL_ONE_MINUS_SRC_ALPHA);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDepthMask(false);
|
||||
EaglerAdapter.glDepthMask(false);
|
||||
locationEndSkyPng.bindTexture();
|
||||
Tessellator var21 = Tessellator.instance;
|
||||
|
||||
for (int var22 = 0; var22 < 6; ++var22)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
EaglerAdapter.glPushMatrix();
|
||||
|
||||
if (var22 == 1)
|
||||
{
|
||||
GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
EaglerAdapter.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
|
||||
if (var22 == 2)
|
||||
{
|
||||
GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
|
||||
EaglerAdapter.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
|
||||
if (var22 == 3)
|
||||
{
|
||||
GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
|
||||
EaglerAdapter.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
|
||||
if (var22 == 4)
|
||||
{
|
||||
GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
|
||||
EaglerAdapter.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
|
||||
}
|
||||
|
||||
if (var22 == 5)
|
||||
{
|
||||
GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F);
|
||||
EaglerAdapter.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F);
|
||||
}
|
||||
|
||||
var21.startDrawingQuads();
|
||||
@@ -942,16 +942,16 @@ public class RenderGlobal implements IWorldAccess
|
||||
var21.addVertexWithUV(100.0D, -100.0D, 100.0D, 16.0D, 16.0D);
|
||||
var21.addVertexWithUV(100.0D, -100.0D, -100.0D, 16.0D, 0.0D);
|
||||
var21.draw();
|
||||
GL11.glPopMatrix();
|
||||
EaglerAdapter.glPopMatrix();
|
||||
}
|
||||
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
EaglerAdapter.glDepthMask(true);
|
||||
EaglerAdapter.glEnable(EaglerAdapter.GL_TEXTURE_2D);
|
||||
EaglerAdapter.glEnable(EaglerAdapter.GL_ALPHA_TEST);
|
||||
}
|
||||
else if (this.mc.theWorld.provider.isSurfaceWorld())
|
||||
{
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
EaglerAdapter.glDisable(EaglerAdapter.GL_TEXTURE_2D);
|
||||
Vec3 var2 = this.theWorld.getSkyColor(this.mc.renderViewEntity, par1);
|
||||
float var3 = (float)var2.xCoord;
|
||||
float var4 = (float)var2.yCoord;
|
||||
@@ -968,16 +968,16 @@ public class RenderGlobal implements IWorldAccess
|
||||
var5 = var8;
|
||||
}
|
||||
|
||||
GL11.glColor3f(var3, var4, var5);
|
||||
EaglerAdapter.glColor3f(var3, var4, var5);
|
||||
Tessellator var23 = Tessellator.instance;
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glEnable(GL11.GL_FOG);
|
||||
GL11.glColor3f(var3, var4, var5);
|
||||
GL11.glCallList(this.glSkyList);
|
||||
GL11.glDisable(GL11.GL_FOG);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
EaglerAdapter.glDepthMask(false);
|
||||
EaglerAdapter.glEnable(EaglerAdapter.GL_FOG);
|
||||
EaglerAdapter.glColor3f(var3, var4, var5);
|
||||
EaglerAdapter.glCallList(this.glSkyList);
|
||||
EaglerAdapter.glDisable(EaglerAdapter.GL_FOG);
|
||||
EaglerAdapter.glDisable(EaglerAdapter.GL_ALPHA_TEST);
|
||||
EaglerAdapter.glEnable(EaglerAdapter.GL_BLEND);
|
||||
EaglerAdapter.glBlendFunc(EaglerAdapter.GL_SRC_ALPHA, EaglerAdapter.GL_ONE_MINUS_SRC_ALPHA);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
float[] var24 = this.theWorld.provider.calcSunriseSunsetColors(this.theWorld.getCelestialAngle(par1), par1);
|
||||
float var9;
|
||||
@@ -987,12 +987,12 @@ public class RenderGlobal implements IWorldAccess
|
||||
|
||||
if (var24 != null)
|
||||
{
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(MathHelper.sin(this.theWorld.getCelestialAngleRadians(par1)) < 0.0F ? 180.0F : 0.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
|
||||
EaglerAdapter.glDisable(EaglerAdapter.GL_TEXTURE_2D);
|
||||
EaglerAdapter.glShadeModel(EaglerAdapter.GL_SMOOTH);
|
||||
EaglerAdapter.glPushMatrix();
|
||||
EaglerAdapter.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
EaglerAdapter.glRotatef(MathHelper.sin(this.theWorld.getCelestialAngleRadians(par1)) < 0.0F ? 180.0F : 0.0F, 0.0F, 0.0F, 1.0F);
|
||||
EaglerAdapter.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
|
||||
var8 = var24[0];
|
||||
var9 = var24[1];
|
||||
var10 = var24[2];
|
||||
@@ -1023,21 +1023,21 @@ public class RenderGlobal implements IWorldAccess
|
||||
}
|
||||
|
||||
var23.draw();
|
||||
GL11.glPopMatrix();
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
EaglerAdapter.glPopMatrix();
|
||||
EaglerAdapter.glShadeModel(EaglerAdapter.GL_FLAT);
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
|
||||
GL11.glPushMatrix();
|
||||
EaglerAdapter.glEnable(EaglerAdapter.GL_TEXTURE_2D);
|
||||
EaglerAdapter.glBlendFunc(EaglerAdapter.GL_SRC_ALPHA, EaglerAdapter.GL_ONE);
|
||||
EaglerAdapter.glPushMatrix();
|
||||
var8 = 1.0F - this.theWorld.getRainStrength(par1);
|
||||
var9 = 0.0F;
|
||||
var10 = 0.0F;
|
||||
var11 = 0.0F;
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, var8);
|
||||
GL11.glTranslatef(var9, var10, var11);
|
||||
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(this.theWorld.getCelestialAngle(par1) * 360.0F, 1.0F, 0.0F, 0.0F);
|
||||
EaglerAdapter.glColor4f(1.0F, 1.0F, 1.0F, var8);
|
||||
EaglerAdapter.glTranslatef(var9, var10, var11);
|
||||
EaglerAdapter.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
|
||||
EaglerAdapter.glRotatef(this.theWorld.getCelestialAngle(par1) * 360.0F, 1.0F, 0.0F, 0.0F);
|
||||
var12 = 30.0F;
|
||||
locationSunPng.bindTexture();
|
||||
var23.startDrawingQuads();
|
||||
@@ -1061,30 +1061,30 @@ public class RenderGlobal implements IWorldAccess
|
||||
var23.addVertexWithUV((double)var12, -100.0D, (double)(-var12), (double)var16, (double)var17);
|
||||
var23.addVertexWithUV((double)(-var12), -100.0D, (double)(-var12), (double)var18, (double)var17);
|
||||
var23.draw();
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
EaglerAdapter.glDisable(EaglerAdapter.GL_TEXTURE_2D);
|
||||
float var20 = this.theWorld.getStarBrightness(par1) * var8;
|
||||
|
||||
if (var20 > 0.0F)
|
||||
{
|
||||
GL11.glColor4f(var20, var20, var20, var20);
|
||||
GL11.glCallList(this.starGLCallList);
|
||||
EaglerAdapter.glColor4f(var20, var20, var20, var20);
|
||||
EaglerAdapter.glCallList(this.starGLCallList);
|
||||
}
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glEnable(GL11.GL_FOG);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glColor3f(0.0F, 0.0F, 0.0F);
|
||||
EaglerAdapter.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
EaglerAdapter.glDisable(EaglerAdapter.GL_BLEND);
|
||||
EaglerAdapter.glEnable(EaglerAdapter.GL_ALPHA_TEST);
|
||||
EaglerAdapter.glEnable(EaglerAdapter.GL_FOG);
|
||||
EaglerAdapter.glPopMatrix();
|
||||
EaglerAdapter.glDisable(EaglerAdapter.GL_TEXTURE_2D);
|
||||
EaglerAdapter.glColor3f(0.0F, 0.0F, 0.0F);
|
||||
double var25 = this.mc.thePlayer.getPosition(par1).yCoord - this.theWorld.getHorizon();
|
||||
|
||||
if (var25 < 0.0D)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0.0F, 12.0F, 0.0F);
|
||||
GL11.glCallList(this.glSkyList2);
|
||||
GL11.glPopMatrix();
|
||||
EaglerAdapter.glPushMatrix();
|
||||
EaglerAdapter.glTranslatef(0.0F, 12.0F, 0.0F);
|
||||
EaglerAdapter.glCallList(this.glSkyList2);
|
||||
EaglerAdapter.glPopMatrix();
|
||||
var10 = 1.0F;
|
||||
var11 = -((float)(var25 + 65.0D));
|
||||
var12 = -var10;
|
||||
@@ -1115,19 +1115,19 @@ public class RenderGlobal implements IWorldAccess
|
||||
|
||||
if (this.theWorld.provider.isSkyColored())
|
||||
{
|
||||
GL11.glColor3f(var3 * 0.2F + 0.04F, var4 * 0.2F + 0.04F, var5 * 0.6F + 0.1F);
|
||||
EaglerAdapter.glColor3f(var3 * 0.2F + 0.04F, var4 * 0.2F + 0.04F, var5 * 0.6F + 0.1F);
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glColor3f(var3, var4, var5);
|
||||
EaglerAdapter.glColor3f(var3, var4, var5);
|
||||
}
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0.0F, -((float)(var25 - 16.0D)), 0.0F);
|
||||
GL11.glCallList(this.glSkyList2);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDepthMask(true);
|
||||
EaglerAdapter.glPushMatrix();
|
||||
EaglerAdapter.glTranslatef(0.0F, -((float)(var25 - 16.0D)), 0.0F);
|
||||
EaglerAdapter.glCallList(this.glSkyList2);
|
||||
EaglerAdapter.glPopMatrix();
|
||||
EaglerAdapter.glEnable(EaglerAdapter.GL_TEXTURE_2D);
|
||||
EaglerAdapter.glDepthMask(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1141,14 +1141,14 @@ public class RenderGlobal implements IWorldAccess
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
EaglerAdapter.glDisable(EaglerAdapter.GL_CULL_FACE);
|
||||
float var2 = (float)(this.mc.renderViewEntity.lastTickPosY + (this.mc.renderViewEntity.posY - this.mc.renderViewEntity.lastTickPosY) * (double)par1);
|
||||
byte var3 = 32;
|
||||
int var4 = 256 / var3;
|
||||
Tessellator var5 = Tessellator.instance;
|
||||
locationCloudsPng.bindTexture();
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
EaglerAdapter.glEnable(EaglerAdapter.GL_BLEND);
|
||||
EaglerAdapter.glBlendFunc(EaglerAdapter.GL_SRC_ALPHA, EaglerAdapter.GL_ONE_MINUS_SRC_ALPHA);
|
||||
Vec3 var6 = this.theWorld.getCloudColour(par1);
|
||||
float var7 = (float)var6.xCoord;
|
||||
float var8 = (float)var6.yCoord;
|
||||
@@ -1191,9 +1191,9 @@ public class RenderGlobal implements IWorldAccess
|
||||
}
|
||||
|
||||
var5.draw();
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
EaglerAdapter.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
EaglerAdapter.glDisable(EaglerAdapter.GL_BLEND);
|
||||
EaglerAdapter.glEnable(EaglerAdapter.GL_CULL_FACE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1211,7 +1211,7 @@ public class RenderGlobal implements IWorldAccess
|
||||
*/
|
||||
public void renderCloudsFancy(float par1)
|
||||
{
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
EaglerAdapter.glDisable(EaglerAdapter.GL_CULL_FACE);
|
||||
float var2 = (float)(this.mc.renderViewEntity.lastTickPosY + (this.mc.renderViewEntity.posY - this.mc.renderViewEntity.lastTickPosY) * (double)par1);
|
||||
Tessellator var3 = Tessellator.instance;
|
||||
float var4 = 12.0F;
|
||||
@@ -1225,8 +1225,8 @@ public class RenderGlobal implements IWorldAccess
|
||||
var8 -= (double)(var13 * 2048);
|
||||
var10 -= (double)(var14 * 2048);
|
||||
locationCloudsPng.bindTexture();
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
EaglerAdapter.glEnable(EaglerAdapter.GL_BLEND);
|
||||
EaglerAdapter.glBlendFunc(EaglerAdapter.GL_SRC_ALPHA, EaglerAdapter.GL_ONE_MINUS_SRC_ALPHA);
|
||||
Vec3 var15 = this.theWorld.getCloudColour(par1);
|
||||
float var16 = (float)var15.xCoord;
|
||||
float var17 = (float)var15.yCoord;
|
||||
@@ -1255,28 +1255,28 @@ public class RenderGlobal implements IWorldAccess
|
||||
byte var24 = 8;
|
||||
byte var25 = 4;
|
||||
float var26 = 9.765625E-4F;
|
||||
GL11.glScalef(var4, 1.0F, var4);
|
||||
EaglerAdapter.glScalef(var4, 1.0F, var4);
|
||||
|
||||
for (int var27 = 0; var27 < 2; ++var27)
|
||||
{
|
||||
if (var27 == 0)
|
||||
{
|
||||
GL11.glColorMask(false, false, false, false);
|
||||
EaglerAdapter.glColorMask(false, false, false, false);
|
||||
}
|
||||
else if (this.mc.gameSettings.anaglyph)
|
||||
{
|
||||
if (EntityRenderer.anaglyphField == 0)
|
||||
{
|
||||
GL11.glColorMask(false, true, true, true);
|
||||
EaglerAdapter.glColorMask(false, true, true, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glColorMask(true, false, false, true);
|
||||
EaglerAdapter.glColorMask(true, false, false, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glColorMask(true, true, true, true);
|
||||
EaglerAdapter.glColorMask(true, true, true, true);
|
||||
}
|
||||
|
||||
for (int var28 = -var25 + 1; var28 <= var25; ++var28)
|
||||
@@ -1371,9 +1371,9 @@ public class RenderGlobal implements IWorldAccess
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
EaglerAdapter.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
EaglerAdapter.glDisable(EaglerAdapter.GL_BLEND);
|
||||
EaglerAdapter.glEnable(EaglerAdapter.GL_CULL_FACE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1548,14 +1548,14 @@ public class RenderGlobal implements IWorldAccess
|
||||
|
||||
if (!this.damagedBlocks.isEmpty())
|
||||
{
|
||||
GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_SRC_COLOR);
|
||||
EaglerAdapter.glBlendFunc(EaglerAdapter.GL_DST_COLOR, EaglerAdapter.GL_SRC_COLOR);
|
||||
TextureMap.locationBlocksTexture.bindTexture();
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glPolygonOffset(-3.0F, -3.0F);
|
||||
GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
EaglerAdapter.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);
|
||||
EaglerAdapter.glPushMatrix();
|
||||
EaglerAdapter.glDisable(EaglerAdapter.GL_ALPHA_TEST);
|
||||
EaglerAdapter.glPolygonOffset(-3.0F, -3.0F);
|
||||
EaglerAdapter.glEnable(EaglerAdapter.GL_POLYGON_OFFSET_FILL);
|
||||
EaglerAdapter.glEnable(EaglerAdapter.GL_ALPHA_TEST);
|
||||
par1Tessellator.startDrawingQuads();
|
||||
par1Tessellator.setTranslation(-var4, -var6, -var8);
|
||||
par1Tessellator.disableColor();
|
||||
@@ -1588,12 +1588,12 @@ public class RenderGlobal implements IWorldAccess
|
||||
|
||||
par1Tessellator.draw();
|
||||
par1Tessellator.setTranslation(0.0D, 0.0D, 0.0D);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glPolygonOffset(0.0F, 0.0F);
|
||||
GL11.glDisable(GL11.GL_POLYGON_OFFSET_FILL);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glPopMatrix();
|
||||
EaglerAdapter.glDisable(EaglerAdapter.GL_ALPHA_TEST);
|
||||
EaglerAdapter.glPolygonOffset(0.0F, 0.0F);
|
||||
EaglerAdapter.glDisable(EaglerAdapter.GL_POLYGON_OFFSET_FILL);
|
||||
EaglerAdapter.glEnable(EaglerAdapter.GL_ALPHA_TEST);
|
||||
EaglerAdapter.glDepthMask(true);
|
||||
EaglerAdapter.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1604,12 +1604,12 @@ public class RenderGlobal implements IWorldAccess
|
||||
{
|
||||
if (par3 == 0 && par2MovingObjectPosition.typeOfHit == EnumMovingObjectType.TILE)
|
||||
{
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glColor4f(0.0F, 0.0F, 0.0F, 0.4F);
|
||||
GL11.glLineWidth(2.0F);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDepthMask(false);
|
||||
EaglerAdapter.glEnable(EaglerAdapter.GL_BLEND);
|
||||
EaglerAdapter.glBlendFunc(EaglerAdapter.GL_SRC_ALPHA, EaglerAdapter.GL_ONE_MINUS_SRC_ALPHA);
|
||||
EaglerAdapter.glColor4f(0.0F, 0.0F, 0.0F, 0.4F);
|
||||
EaglerAdapter.glLineWidth(2.0F);
|
||||
EaglerAdapter.glDisable(EaglerAdapter.GL_TEXTURE_2D);
|
||||
EaglerAdapter.glDepthMask(false);
|
||||
float var5 = 0.002F;
|
||||
int var6 = this.theWorld.getBlockId(par2MovingObjectPosition.blockX, par2MovingObjectPosition.blockY, par2MovingObjectPosition.blockZ);
|
||||
|
||||
@@ -1622,9 +1622,9 @@ public class RenderGlobal implements IWorldAccess
|
||||
this.drawOutlinedBoundingBox(Block.blocksList[var6].getSelectedBoundingBoxFromPool(this.theWorld, par2MovingObjectPosition.blockX, par2MovingObjectPosition.blockY, par2MovingObjectPosition.blockZ).expand((double)var5, (double)var5, (double)var5).getOffsetBoundingBox(-var7, -var9, -var11));
|
||||
}
|
||||
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
EaglerAdapter.glDepthMask(true);
|
||||
EaglerAdapter.glEnable(EaglerAdapter.GL_TEXTURE_2D);
|
||||
EaglerAdapter.glDisable(EaglerAdapter.GL_BLEND);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,82 +1,64 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import paulscode.sound.SoundSystem;
|
||||
import paulscode.sound.SoundSystemConfig;
|
||||
import paulscode.sound.SoundSystemException;
|
||||
import paulscode.sound.codecs.CodecJOrbis;
|
||||
import paulscode.sound.codecs.CodecWav;
|
||||
import paulscode.sound.libraries.LibraryLWJGLOpenAL;
|
||||
import net.lax1dude.eaglercraft.EaglercraftRandom;
|
||||
import net.minecraft.src.Minecraft;
|
||||
|
||||
public class SoundManager implements ResourceManagerReloadListener
|
||||
{
|
||||
private static final String[] field_130084_a = new String[] {"ogg"};
|
||||
public class SoundManager {
|
||||
|
||||
/** A reference to the sound system. */
|
||||
private SoundSystem sndSystem;
|
||||
|
||||
/** Set to true when the SoundManager has been initialised. */
|
||||
private boolean loaded;
|
||||
|
||||
/** Sound pool containing sounds. */
|
||||
private final SoundPool soundPoolSounds;
|
||||
|
||||
/** Sound pool containing streaming audio. */
|
||||
private final SoundPool soundPoolStreaming;
|
||||
|
||||
/** Sound pool containing music. */
|
||||
private final SoundPool soundPoolMusic;
|
||||
|
||||
/**
|
||||
* The last ID used when a sound is played, passed into SoundSystem to give active sounds a unique ID
|
||||
*/
|
||||
private int latestSoundID;
|
||||
|
||||
/** A reference to the game settings. */
|
||||
private GameSettings options;
|
||||
private final File fileAssets;
|
||||
|
||||
/** Identifiers of all currently playing sounds. Type: HashSet<String> */
|
||||
private final Set playingSounds = new HashSet();
|
||||
private final List field_92072_h = new ArrayList();
|
||||
|
||||
/** RNG. */
|
||||
private Random rand = new Random();
|
||||
private int ticksBeforeMusic;
|
||||
|
||||
private HashMap<String,Integer> sounddefinitions;
|
||||
|
||||
public SoundManager(ResourceManager par1ResourceManager, GameSettings par2GameSettings, File par3File)
|
||||
{
|
||||
this.ticksBeforeMusic = this.rand.nextInt(12000);
|
||||
this.options = par2GameSettings;
|
||||
this.fileAssets = par3File;
|
||||
this.soundPoolSounds = new SoundPool(par1ResourceManager, "sound", true);
|
||||
this.soundPoolStreaming = new SoundPool(par1ResourceManager, "records", false);
|
||||
this.soundPoolMusic = new SoundPool(par1ResourceManager, "music", true);
|
||||
this.sounddefinitions = null;
|
||||
|
||||
try
|
||||
{
|
||||
SoundSystemConfig.addLibrary(LibraryLWJGLOpenAL.class);
|
||||
SoundSystemConfig.setCodec("ogg", CodecJOrbis.class);
|
||||
SoundSystemConfig.setCodec("wav", CodecWav.class);
|
||||
private static class EntitySoundEvent {
|
||||
private Entity e;
|
||||
private int id;
|
||||
public EntitySoundEvent(Entity e, int id) {
|
||||
this.e = e;
|
||||
this.id = id;
|
||||
}
|
||||
catch (SoundSystemException var5)
|
||||
{
|
||||
var5.printStackTrace();
|
||||
System.err.println("error linking with the LibraryJavaSound plug-in");
|
||||
}
|
||||
|
||||
this.loadSounds();
|
||||
}
|
||||
|
||||
public void loadSoundSettings(GameSettings par1GameSettings){
|
||||
private static class QueuedSoundEvent {
|
||||
private String sound;
|
||||
private float x;
|
||||
private float y;
|
||||
private float z;
|
||||
private float volume;
|
||||
private float pitch;
|
||||
private int timer;
|
||||
public QueuedSoundEvent(String sound, float x, float y, float z, float volume, float pitch, int timer) {
|
||||
this.sound = sound;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.volume = volume;
|
||||
this.pitch = pitch;
|
||||
this.timer = timer;
|
||||
}
|
||||
}
|
||||
|
||||
private GameSettings options;
|
||||
private ArrayList<EntitySoundEvent> soundevents;
|
||||
private ArrayList<QueuedSoundEvent> queuedsoundevents;
|
||||
private ArrayList<Integer> activerecords;
|
||||
private HashMap<String,Integer> sounddefinitions;
|
||||
private EaglercraftRandom soundrandom;
|
||||
|
||||
public SoundManager() {
|
||||
this.soundevents = new ArrayList();
|
||||
this.queuedsoundevents = new ArrayList();
|
||||
this.activerecords = new ArrayList();
|
||||
this.sounddefinitions = null;
|
||||
this.soundrandom = new EaglercraftRandom();
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for loading sound settings from GameSettings
|
||||
*/
|
||||
public void loadSoundSettings(GameSettings par1GameSettings) {
|
||||
this.options = par1GameSettings;
|
||||
EaglerAdapter.setMusicVolume(options.musicVolume);
|
||||
EaglerAdapter.setMasterVolume(options.soundVolume);
|
||||
@@ -102,90 +84,10 @@ public class SoundManager implements ResourceManagerReloadListener
|
||||
}
|
||||
}
|
||||
|
||||
public void onResourceManagerReload(ResourceManager par1ResourceManager)
|
||||
{
|
||||
this.stopAllSounds();
|
||||
this.cleanup();
|
||||
this.tryToSetLibraryAndCodecs();
|
||||
}
|
||||
|
||||
private void loadSounds()
|
||||
{
|
||||
if (this.fileAssets.isDirectory())
|
||||
{
|
||||
Collection var1 = FileUtils.listFiles(this.fileAssets, field_130084_a, true);
|
||||
Iterator var2 = var1.iterator();
|
||||
|
||||
while (var2.hasNext())
|
||||
{
|
||||
File var3 = (File)var2.next();
|
||||
this.loadSoundFile(var3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void loadSoundFile(File par1File)
|
||||
{
|
||||
String var2 = this.fileAssets.toURI().relativize(par1File.toURI()).getPath();
|
||||
int var3 = var2.indexOf("/");
|
||||
|
||||
if (var3 != -1)
|
||||
{
|
||||
String var4 = var2.substring(0, var3);
|
||||
var2 = var2.substring(var3 + 1);
|
||||
|
||||
if ("sound".equalsIgnoreCase(var4))
|
||||
{
|
||||
this.addSound(var2);
|
||||
}
|
||||
else if ("records".equalsIgnoreCase(var4))
|
||||
{
|
||||
this.addStreaming(var2);
|
||||
}
|
||||
else if ("music".equalsIgnoreCase(var4))
|
||||
{
|
||||
this.addMusic(var2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to add the paulscode library and the relevant codecs. If it fails, the volumes (sound and music) will be
|
||||
* set to zero in the options file.
|
||||
*/
|
||||
private synchronized void tryToSetLibraryAndCodecs()
|
||||
{
|
||||
if (!this.loaded)
|
||||
{
|
||||
float var1 = this.options.soundVolume;
|
||||
float var2 = this.options.musicVolume;
|
||||
this.options.soundVolume = 0.0F;
|
||||
this.options.musicVolume = 0.0F;
|
||||
this.options.saveOptions();
|
||||
|
||||
try
|
||||
{
|
||||
(new Thread(new SoundManagerINNER1(this))).start();
|
||||
this.options.soundVolume = var1;
|
||||
this.options.musicVolume = var2;
|
||||
}
|
||||
catch (RuntimeException var4)
|
||||
{
|
||||
var4.printStackTrace();
|
||||
System.err.println("error starting SoundSystem turning off sounds & music");
|
||||
this.options.soundVolume = 0.0F;
|
||||
this.options.musicVolume = 0.0F;
|
||||
}
|
||||
|
||||
this.options.saveOptions();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when one of the sound level options has changed.
|
||||
*/
|
||||
public void onSoundOptionsChanged() // FIX THIS (maybe)
|
||||
{
|
||||
public void onSoundOptionsChanged() {
|
||||
EaglerAdapter.setMusicVolume(options.musicVolume);
|
||||
if(options.musicVolume > 0.0f) {
|
||||
EaglerAdapter.fireTitleMusicEvent(titleMusic != -1, options.musicVolume);
|
||||
@@ -194,357 +96,336 @@ public class SoundManager implements ResourceManagerReloadListener
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans up the Sound System
|
||||
* Called when Minecraft is closing down.
|
||||
*/
|
||||
public void cleanup()
|
||||
{
|
||||
if (this.loaded)
|
||||
{
|
||||
this.sndSystem.cleanup();
|
||||
this.loaded = false;
|
||||
}
|
||||
}
|
||||
public void closeMinecraft() {
|
||||
|
||||
/**
|
||||
* Adds a sounds with the name from the file. Args: name, file
|
||||
*/
|
||||
public void addSound(String par1Str)
|
||||
{
|
||||
this.soundPoolSounds.addSound(par1Str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an audio file to the streaming SoundPool.
|
||||
*/
|
||||
public void addStreaming(String par1Str)
|
||||
{
|
||||
this.soundPoolStreaming.addSound(par1Str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an audio file to the music SoundPool.
|
||||
*/
|
||||
public void addMusic(String par1Str)
|
||||
{
|
||||
this.soundPoolMusic.addSound(par1Str);
|
||||
}
|
||||
|
||||
/**
|
||||
* If its time to play new music it starts it up.
|
||||
*/
|
||||
public void playRandomMusicIfReady()
|
||||
{
|
||||
if (this.loaded && this.options.musicVolume != 0.0F)
|
||||
{
|
||||
if (!this.sndSystem.playing("BgMusic") && !this.sndSystem.playing("streaming"))
|
||||
{
|
||||
if (this.ticksBeforeMusic > 0)
|
||||
{
|
||||
--this.ticksBeforeMusic;
|
||||
}
|
||||
else
|
||||
{
|
||||
SoundPoolEntry var1 = this.soundPoolMusic.getRandomSound();
|
||||
public void playRandomMusicIfReady() {
|
||||
|
||||
if (var1 != null)
|
||||
{
|
||||
this.ticksBeforeMusic = this.rand.nextInt(12000) + 12000;
|
||||
this.sndSystem.backgroundMusic("BgMusic", var1.getSoundUrl(), var1.getSoundName(), false);
|
||||
this.sndSystem.setVolume("BgMusic", this.options.musicVolume);
|
||||
this.sndSystem.play("BgMusic");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the listener of sounds
|
||||
*/
|
||||
public void setListener(EntityLivingBase par1EntityLivingBase, float par2)
|
||||
{
|
||||
if (this.loaded && this.options.soundVolume != 0.0F && par1EntityLivingBase != null)
|
||||
{
|
||||
float var3 = par1EntityLivingBase.prevRotationPitch + (par1EntityLivingBase.rotationPitch - par1EntityLivingBase.prevRotationPitch) * par2;
|
||||
float var4 = par1EntityLivingBase.prevRotationYaw + (par1EntityLivingBase.rotationYaw - par1EntityLivingBase.prevRotationYaw) * par2;
|
||||
double var5 = par1EntityLivingBase.prevPosX + (par1EntityLivingBase.posX - par1EntityLivingBase.prevPosX) * (double)par2;
|
||||
double var7 = par1EntityLivingBase.prevPosY + (par1EntityLivingBase.posY - par1EntityLivingBase.prevPosY) * (double)par2;
|
||||
double var9 = par1EntityLivingBase.prevPosZ + (par1EntityLivingBase.posZ - par1EntityLivingBase.prevPosZ) * (double)par2;
|
||||
float var11 = MathHelper.cos(-var4 * 0.017453292F - (float)Math.PI);
|
||||
float var12 = MathHelper.sin(-var4 * 0.017453292F - (float)Math.PI);
|
||||
float var13 = -var12;
|
||||
float var14 = -MathHelper.sin(-var3 * 0.017453292F - (float)Math.PI);
|
||||
float var15 = -var11;
|
||||
float var16 = 0.0F;
|
||||
float var17 = 1.0F;
|
||||
float var18 = 0.0F;
|
||||
this.sndSystem.setListenerPosition((float)var5, (float)var7, (float)var9);
|
||||
this.sndSystem.setListenerOrientation(var13, var14, var15, var16, var17, var18);
|
||||
public void setListener(EntityLiving par1EntityLiving, float par2) {
|
||||
if(par1EntityLiving == null) {
|
||||
EaglerAdapter.setListenerPos(0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f);
|
||||
}else {
|
||||
double x = par1EntityLiving.prevPosX + (par1EntityLiving.posX - par1EntityLiving.prevPosX) * par2;
|
||||
double y = par1EntityLiving.prevPosY + (par1EntityLiving.posY - par1EntityLiving.prevPosY) * par2;
|
||||
double z = par1EntityLiving.prevPosZ + (par1EntityLiving.posZ - par1EntityLiving.prevPosZ) * par2;
|
||||
double pitch = par1EntityLiving.prevRotationPitch + (par1EntityLiving.rotationPitch - par1EntityLiving.prevRotationPitch) * par2;
|
||||
double yaw = par1EntityLiving.prevRotationYaw + (par1EntityLiving.rotationYaw - par1EntityLiving.prevRotationYaw) * par2;
|
||||
|
||||
try {
|
||||
EaglerAdapter.setListenerPos((float)x, (float)y, (float)z, (float)par1EntityLiving.motionX, (float)par1EntityLiving.motionY, (float)par1EntityLiving.motionZ, (float)pitch, (float)yaw);
|
||||
}catch(Throwable t) {
|
||||
System.err.println("AudioListener f***ed up again");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setListener(EntityClientPlayerMP par1EntityLiving, float par2) {
|
||||
if(par1EntityLiving == null) {
|
||||
EaglerAdapter.setListenerPos(0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f);
|
||||
}else {
|
||||
double x = par1EntityLiving.prevPosX + (par1EntityLiving.posX - par1EntityLiving.prevPosX) * par2;
|
||||
double y = par1EntityLiving.prevPosY + (par1EntityLiving.posY - par1EntityLiving.prevPosY) * par2;
|
||||
double z = par1EntityLiving.prevPosZ + (par1EntityLiving.posZ - par1EntityLiving.prevPosZ) * par2;
|
||||
double pitch = par1EntityLiving.prevRotationPitch + (par1EntityLiving.rotationPitch - par1EntityLiving.prevRotationPitch) * par2;
|
||||
double yaw = par1EntityLiving.prevRotationYaw + (par1EntityLiving.rotationYaw - par1EntityLiving.prevRotationYaw) * par2;
|
||||
|
||||
try {
|
||||
EaglerAdapter.setListenerPos((float)x, (float)y, (float)z, (float)par1EntityLiving.motionX, (float)par1EntityLiving.motionY, (float)par1EntityLiving.motionZ, (float)pitch, (float)yaw);
|
||||
}catch(Throwable t) {
|
||||
System.err.println("AudioListener f***ed up again");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops all currently playing sounds
|
||||
*/
|
||||
public void stopAllSounds()
|
||||
{
|
||||
if (this.loaded)
|
||||
{
|
||||
Iterator var1 = this.playingSounds.iterator();
|
||||
|
||||
while (var1.hasNext())
|
||||
{
|
||||
String var2 = (String)var1.next();
|
||||
this.sndSystem.stop(var2);
|
||||
}
|
||||
|
||||
this.playingSounds.clear();
|
||||
public void stopAllSounds() {
|
||||
for(EntitySoundEvent e : soundevents) {
|
||||
EaglerAdapter.endSound(e.id);
|
||||
}
|
||||
for(Integer i : activerecords) {
|
||||
EaglerAdapter.endSound(i.intValue());
|
||||
}
|
||||
}
|
||||
|
||||
public void playStreaming(String par1Str, float par2, float par3, float par4)
|
||||
{
|
||||
if (this.loaded && (this.options.soundVolume != 0.0F || par1Str == null))
|
||||
{
|
||||
String var5 = "streaming";
|
||||
public void playStreaming(String par1Str, float par2, float par3, float par4) {
|
||||
playStreaming(par1Str, par2, par3, par4, false);
|
||||
}
|
||||
|
||||
if (this.sndSystem.playing(var5))
|
||||
{
|
||||
this.sndSystem.stop(var5);
|
||||
}
|
||||
|
||||
if (par1Str != null)
|
||||
{
|
||||
SoundPoolEntry var6 = this.soundPoolStreaming.getRandomSoundFromSoundPool(par1Str);
|
||||
|
||||
if (var6 != null)
|
||||
{
|
||||
if (this.sndSystem.playing("BgMusic"))
|
||||
{
|
||||
this.sndSystem.stop("BgMusic");
|
||||
}
|
||||
|
||||
this.sndSystem.newStreamingSource(true, var5, var6.getSoundUrl(), var6.getSoundName(), false, par2, par3, par4, 2, 64.0F);
|
||||
this.sndSystem.setVolume(var5, 0.5F * this.options.soundVolume);
|
||||
this.sndSystem.play(var5);
|
||||
}
|
||||
public void playStreaming(String par1Str, float par2, float par3, float par4, boolean music) {
|
||||
for (Integer record : activerecords) {
|
||||
EaglerAdapter.endSound(record.intValue());
|
||||
}
|
||||
activerecords.clear();
|
||||
if (par1Str != null) {
|
||||
String path = "/records/" + par1Str.replace('.', '/') + ".mp3";
|
||||
int snd = EaglerAdapter.beginPlayback(path, par2, par3, par4, 1.0F, 1.0F, music);
|
||||
if (snd != -1) {
|
||||
activerecords.add(Integer.valueOf(snd));
|
||||
} else {
|
||||
System.err.println("unregistered record: "+par1Str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the sound associated with the entity with that entity's position and velocity. Args: the entity
|
||||
* Updates the sound associated with the entity with that entity's position and
|
||||
* velocity. Args: the entity
|
||||
*/
|
||||
public void updateSoundLocation(Entity par1Entity)
|
||||
{
|
||||
this.updateSoundLocation(par1Entity, par1Entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the sound associated with soundEntity with the position and velocity of trackEntity. Args: soundEntity,
|
||||
* trackEntity
|
||||
*/
|
||||
public void updateSoundLocation(Entity par1Entity, Entity par2Entity)
|
||||
{
|
||||
String var3 = "entity_" + par1Entity.entityId;
|
||||
|
||||
if (this.playingSounds.contains(var3))
|
||||
{
|
||||
if (this.sndSystem.playing(var3))
|
||||
{
|
||||
this.sndSystem.setPosition(var3, (float)par2Entity.posX, (float)par2Entity.posY, (float)par2Entity.posZ);
|
||||
this.sndSystem.setVelocity(var3, (float)par2Entity.motionX, (float)par2Entity.motionY, (float)par2Entity.motionZ);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.playingSounds.remove(var3);
|
||||
public void updateSoundLocation(Entity par1Entity) {
|
||||
for(EntitySoundEvent e : soundevents) {
|
||||
if(e.e.equals(par1Entity)) {
|
||||
EaglerAdapter.moveSound(e.id, (float)par1Entity.posX, (float)par1Entity.posY, (float)par1Entity.posZ, (float)par1Entity.motionX, (float)par1Entity.motionY, (float)par1Entity.motionZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if a sound is currently associated with the given entity, or false otherwise.
|
||||
* Updates the sound associated with soundEntity with the position and velocity
|
||||
* of trackEntity. Args: soundEntity, trackEntity
|
||||
*/
|
||||
public boolean isEntitySoundPlaying(Entity par1Entity)
|
||||
{
|
||||
if (par1Entity != null && this.loaded)
|
||||
{
|
||||
String var2 = "entity_" + par1Entity.entityId;
|
||||
return this.sndSystem.playing(var2);
|
||||
public void updateSoundLocation(Entity par1Entity, Entity par2Entity) {
|
||||
for(EntitySoundEvent e : soundevents) {
|
||||
if(e.e.equals(par1Entity)) {
|
||||
EaglerAdapter.moveSound(e.id, (float)par2Entity.posX, (float)par2Entity.posY, (float)par2Entity.posZ, (float)par2Entity.motionX, (float)par2Entity.motionY, (float)par2Entity.motionZ);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if a sound is currently associated with the given entity, or
|
||||
* false otherwise.
|
||||
*/
|
||||
public boolean isEntitySoundPlaying(Entity par1Entity) {
|
||||
for(EntitySoundEvent e : soundevents) {
|
||||
if(e.e.equals(par1Entity)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops playing the sound associated with the given entity
|
||||
*/
|
||||
public void stopEntitySound(Entity par1Entity)
|
||||
{
|
||||
if (par1Entity != null && this.loaded)
|
||||
{
|
||||
String var2 = "entity_" + par1Entity.entityId;
|
||||
|
||||
if (this.playingSounds.contains(var2))
|
||||
{
|
||||
if (this.sndSystem.playing(var2))
|
||||
{
|
||||
this.sndSystem.stop(var2);
|
||||
}
|
||||
|
||||
this.playingSounds.remove(var2);
|
||||
public void stopEntitySound(Entity par1Entity) {
|
||||
for(EntitySoundEvent e : soundevents) {
|
||||
if(e.e.equals(par1Entity)) {
|
||||
EaglerAdapter.endSound(e.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the volume of the sound associated with the given entity, if one is playing. The volume is scaled by the
|
||||
* global sound volume. Args: the entity, the volume (from 0 to 1)
|
||||
* Sets the volume of the sound associated with the given entity, if one is
|
||||
* playing. The volume is scaled by the global sound volume. Args: the entity,
|
||||
* the volume (from 0 to 1)
|
||||
*/
|
||||
public void setEntitySoundVolume(Entity par1Entity, float par2)
|
||||
{
|
||||
if (par1Entity != null && this.loaded && this.options.soundVolume != 0.0F)
|
||||
{
|
||||
String var3 = "entity_" + par1Entity.entityId;
|
||||
|
||||
if (this.sndSystem.playing(var3))
|
||||
{
|
||||
this.sndSystem.setVolume(var3, par2 * this.options.soundVolume);
|
||||
public void setEntitySoundVolume(Entity par1Entity, float par2) {
|
||||
for(EntitySoundEvent e : soundevents) {
|
||||
if(e.e.equals(par1Entity)) {
|
||||
EaglerAdapter.setVolume(e.id, par2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the pitch of the sound associated with the given entity, if one is playing. Args: the entity, the pitch
|
||||
* Sets the pitch of the sound associated with the given entity, if one is
|
||||
* playing. Args: the entity, the pitch
|
||||
*/
|
||||
public void setEntitySoundPitch(Entity par1Entity, float par2)
|
||||
{
|
||||
if (par1Entity != null && this.loaded && this.options.soundVolume != 0.0F)
|
||||
{
|
||||
String var3 = "entity_" + par1Entity.entityId;
|
||||
|
||||
if (this.sndSystem.playing(var3))
|
||||
{
|
||||
this.sndSystem.setPitch(var3, par2);
|
||||
public void setEntitySoundPitch(Entity par1Entity, float par2) {
|
||||
for(EntitySoundEvent e : soundevents) {
|
||||
if(e.e.equals(par1Entity)) {
|
||||
EaglerAdapter.setPitch(e.id, par2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static final Map<String, String> remapAdl;
|
||||
|
||||
static {
|
||||
remapAdl = new HashMap();
|
||||
remapAdl.put("ambient.cave.cave", "!adl.b");
|
||||
remapAdl.put("damage.hit", "!random.classic_hurt");
|
||||
remapAdl.put("damage.hurtflesh", "!random.classic_hurt");
|
||||
remapAdl.put("mob.zombie.hurt", "adl.yee");
|
||||
remapAdl.put("mob.zombie.say", "adl.yee");
|
||||
remapAdl.put("mob.zombiepig.zpig", "!adl.eee");
|
||||
remapAdl.put("mob.zombiepig.zpigangry", "adl.eee");
|
||||
remapAdl.put("mob.blaze.breathe", "adl.yee");
|
||||
remapAdl.put("mob.endermen.scream", "adl.yee");
|
||||
remapAdl.put("mob.endermen.stare", "!adl.l");
|
||||
remapAdl.put("mob.pig.say", "!adl.eee");
|
||||
remapAdl.put("mob.pig.death", "adl.eee");
|
||||
remapAdl.put("mob.silverfish.say", "!adl.eee");
|
||||
remapAdl.put("mob.ghast.scream", "!adl.yee");
|
||||
remapAdl.put("mob.slime.big", "!adl.eee");
|
||||
remapAdl.put("mob.slime.small", "!adl.eee");
|
||||
remapAdl.put("mob.slime.attack", "!adl.eee");
|
||||
remapAdl.put("mob.spider.say", "adl.eee");
|
||||
remapAdl.put("mob.villager.default", "!adl.a");
|
||||
remapAdl.put("mob.villager.defaulthurt", "!adl.a");
|
||||
}
|
||||
|
||||
/**
|
||||
* If a sound is already playing from the given entity, update the position and velocity of that sound to match the
|
||||
* entity. Otherwise, start playing a sound from that entity. Setting the last flag to true will prevent other
|
||||
* sounds from overriding this one. Args: The sound name, the entity, the volume, the pitch, priority
|
||||
* If a sound is already playing from the given entity, update the position and
|
||||
* velocity of that sound to match the entity. Otherwise, start playing a sound
|
||||
* from that entity. Setting the last flag to true will prevent other sounds
|
||||
* from overriding this one. Args: The sound name, the entity, the volume, the
|
||||
* pitch, priority
|
||||
*/
|
||||
public void playEntitySound(String par1Str, Entity par2Entity, float par3, float par4, boolean par5)
|
||||
{
|
||||
if (this.loaded && (this.options.soundVolume != 0.0F || par1Str == null) && par2Entity != null)
|
||||
{
|
||||
String var6 = "entity_" + par2Entity.entityId;
|
||||
|
||||
if (this.playingSounds.contains(var6))
|
||||
{
|
||||
this.updateSoundLocation(par2Entity);
|
||||
public void playEntitySound(String par1Str, Entity par2Entity, float par3, float par4, boolean par5) {
|
||||
for(EntitySoundEvent e : soundevents) {
|
||||
if(e.e.equals(par2Entity)) {
|
||||
EaglerAdapter.moveSound(e.id, (float)par2Entity.posX, (float)par2Entity.posY, (float)par2Entity.posZ, (float)par2Entity.motionX, (float)par2Entity.motionY, (float)par2Entity.motionZ);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.sndSystem.playing(var6))
|
||||
{
|
||||
this.sndSystem.stop(var6);
|
||||
}
|
||||
|
||||
if (par1Str != null)
|
||||
{
|
||||
SoundPoolEntry var7 = this.soundPoolSounds.getRandomSoundFromSoundPool(par1Str);
|
||||
|
||||
if (var7 != null && par3 > 0.0F)
|
||||
{
|
||||
float var8 = 16.0F;
|
||||
|
||||
if (par3 > 1.0F)
|
||||
{
|
||||
var8 *= par3;
|
||||
}
|
||||
if(this.options.soundVolume > 0.0F && par3 > 0.0F) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
if(mc.gameSettings.adderall || mc.entityRenderer.asdfghjkl) {
|
||||
if(mc.entityRenderer.startup > 300) {
|
||||
String rp = remapAdl.get(par1Str);
|
||||
if(rp != null) {
|
||||
if(rp.startsWith("!")) {
|
||||
par1Str = rp.substring(1);
|
||||
}else {
|
||||
int i = 4 - (mc.entityRenderer.startup - 300) / 200;
|
||||
if(i < 0) i = 0;
|
||||
if(soundrandom.nextInt(2 + i) == 0) {
|
||||
par1Str = rp;
|
||||
}
|
||||
}
|
||||
|
||||
this.sndSystem.newSource(par5, var6, var7.getSoundUrl(), var7.getSoundName(), false, (float)par2Entity.posX, (float)par2Entity.posY, (float)par2Entity.posZ, 2, var8);
|
||||
this.sndSystem.setLooping(var6, true);
|
||||
this.sndSystem.setPitch(var6, par4);
|
||||
|
||||
if (par3 > 1.0F)
|
||||
{
|
||||
par3 = 1.0F;
|
||||
}
|
||||
|
||||
this.sndSystem.setVolume(var6, par3 * this.options.soundVolume);
|
||||
this.sndSystem.setVelocity(var6, (float)par2Entity.motionX, (float)par2Entity.motionY, (float)par2Entity.motionZ);
|
||||
this.sndSystem.play(var6);
|
||||
this.playingSounds.add(var6);
|
||||
}
|
||||
}
|
||||
}
|
||||
Integer ct = this.sounddefinitions.get(par1Str);
|
||||
if(ct != null) {
|
||||
int c = ct.intValue();
|
||||
String path;
|
||||
if(c <= 1) {
|
||||
path = "/sounds/"+par1Str.replace('.', '/')+".mp3";
|
||||
}else {
|
||||
int r = soundrandom.nextInt(c) + 1;
|
||||
path = "/sounds/"+par1Str.replace('.', '/')+r+".mp3";
|
||||
}
|
||||
int id = 0;
|
||||
float i = Minecraft.getMinecraft().entityRenderer.startup / 800.0f;
|
||||
if(i > 1.0f) i = 1.0f;
|
||||
i = i * i;
|
||||
float v = i > 0.0f ? 1.0f + (soundrandom.nextFloat() - 0.5f) * i * 0.6f : 1.0f;
|
||||
float p = i > 0.0f ? 1.0f + (soundrandom.nextFloat() - 0.2f) * i * 1.3f : 1.0f;
|
||||
soundevents.add(new EntitySoundEvent(par2Entity, id = EaglerAdapter.beginPlayback(path, 0f, 0f, 0f, par3 * v * 0.8f, par4 * p)));
|
||||
EaglerAdapter.moveSound(id, (float)par2Entity.posX + (i > 0.0f ? (soundrandom.nextFloat() - 0.5f) * i * 4.0f : 0.0f),
|
||||
(float)par2Entity.posY + (i > 0.0f ? (soundrandom.nextFloat() - 0.5f) * i * 4.0f : 0.0f),
|
||||
(float)par2Entity.posZ + (i > 0.0f ? (soundrandom.nextFloat() - 0.5f) * i * 4.0f : 0.0f),
|
||||
(float)par2Entity.motionX, (float)par2Entity.motionY, (float)par2Entity.motionZ);
|
||||
if(i > 0.3f) {
|
||||
while(soundrandom.nextFloat() * i > 0.3f) {
|
||||
soundevents.add(new EntitySoundEvent(par2Entity, id = EaglerAdapter.beginPlayback(path, 0f, 0f, 0f, par3 * v *
|
||||
(soundrandom.nextFloat() * 0.4f + 0.8f), par4 * p * (pow2(soundrandom.nextFloat()) * 1.5f + 0.3f))));
|
||||
EaglerAdapter.moveSound(id, (float)par2Entity.posX + (soundrandom.nextFloat() - 0.5f) * i * 2.0f,
|
||||
(float)par2Entity.posY + (soundrandom.nextFloat() - 0.5f) * i * 2.0f,
|
||||
(float)par2Entity.posZ + (soundrandom.nextFloat() - 0.5f) * i * 2.0f,
|
||||
(float)par2Entity.motionX, (float)par2Entity.motionY, (float)par2Entity.motionZ);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
System.err.println("unregistered sound effect: "+par1Str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Plays a sound. Args: soundName, x, y, z, volume, pitch
|
||||
*/
|
||||
public void playSound(String par1Str, float par2, float par3, float par4, float par5, float par6)
|
||||
{
|
||||
if (this.loaded && this.options.soundVolume != 0.0F)
|
||||
{
|
||||
SoundPoolEntry var7 = this.soundPoolSounds.getRandomSoundFromSoundPool(par1Str);
|
||||
|
||||
if (var7 != null && par5 > 0.0F)
|
||||
{
|
||||
this.latestSoundID = (this.latestSoundID + 1) % 256;
|
||||
String var8 = "sound_" + this.latestSoundID;
|
||||
float var9 = 16.0F;
|
||||
|
||||
if (par5 > 1.0F)
|
||||
{
|
||||
var9 *= par5;
|
||||
public void playSound(String par1Str, float par2, float par3, float par4, float par5, float par6) {
|
||||
if(this.options.soundVolume > 0.0F && par5 > 0.0F) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
if(mc.gameSettings.adderall || mc.entityRenderer.asdfghjkl) {
|
||||
if(mc.entityRenderer.startup > 300) {
|
||||
String rp = remapAdl.get(par1Str);
|
||||
if(rp != null) {
|
||||
if(rp.startsWith("!")) {
|
||||
par1Str = rp.substring(1);
|
||||
}else {
|
||||
int i = 4 - (mc.entityRenderer.startup - 300) / 200;
|
||||
if(i < 0) i = 0;
|
||||
if(soundrandom.nextInt(2 + i) == 0) {
|
||||
par1Str = rp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.sndSystem.newSource(par5 > 1.0F, var8, var7.getSoundUrl(), var7.getSoundName(), false, par2, par3, par4, 2, var9);
|
||||
|
||||
if (par5 > 1.0F)
|
||||
{
|
||||
par5 = 1.0F;
|
||||
}
|
||||
Integer ct = this.sounddefinitions.get(par1Str);
|
||||
if(ct != null) {
|
||||
int c = ct.intValue();
|
||||
String path;
|
||||
if(c <= 1) {
|
||||
path = "/sounds/"+par1Str.replace('.', '/')+".mp3";
|
||||
}else {
|
||||
int r = soundrandom.nextInt(c) + 1;
|
||||
path = "/sounds/"+par1Str.replace('.', '/')+r+".mp3";
|
||||
}
|
||||
|
||||
this.sndSystem.setPitch(var8, par6);
|
||||
this.sndSystem.setVolume(var8, par5 * this.options.soundVolume);
|
||||
this.sndSystem.play(var8);
|
||||
float i = mc.entityRenderer.startup / 800.0f;
|
||||
if(i > 1.0f) i = 1.0f;
|
||||
i = i * i;
|
||||
float v = i > 0.0f ? 1.0f + (soundrandom.nextFloat() - 0.5f) * i * 0.6f : 1.0f;
|
||||
float p = i > 0.0f ? 1.0f + (soundrandom.nextFloat() - 0.2f) * i * 1.3f : 1.0f;
|
||||
if(i > 0.3f) {
|
||||
par2 += (soundrandom.nextFloat() - 0.5f) * i * 3.0f;
|
||||
par3 += (soundrandom.nextFloat() - 0.5f) * i * 3.0f;
|
||||
par4 += (soundrandom.nextFloat() - 0.5f) * i * 3.0f;
|
||||
while(soundrandom.nextFloat() * i > 0.3f) {
|
||||
EaglerAdapter.beginPlayback(path, par2 + (soundrandom.nextFloat() - 0.5f) * i * 3.0f, par3 + (soundrandom.nextFloat() - 0.5f) * i * 3.0f,
|
||||
par4 + (soundrandom.nextFloat() - 0.5f) * i * 3.0f, par5 * v * (soundrandom.nextFloat() * 0.4f + 0.8f),
|
||||
par6 * p * (pow2(soundrandom.nextFloat()) * 1.5f + 0.3f));
|
||||
}
|
||||
}
|
||||
EaglerAdapter.beginPlayback(path, par2, par3, par4, par5 * v, par6 * p);
|
||||
}else {
|
||||
System.err.println("unregistered sound effect: "+par1Str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static float pow2(float f) {
|
||||
return f * f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Plays a sound effect with the volume and pitch of the parameters passed. The sound isn't affected by position of
|
||||
* the player (full volume and center balanced)
|
||||
* Plays a sound effect with the volume and pitch of the parameters passed. The
|
||||
* sound isn't affected by position of the player (full volume and center
|
||||
* balanced)
|
||||
*/
|
||||
public void playSoundFX(String par1Str, float par2, float par3)
|
||||
{
|
||||
if (this.loaded && this.options.soundVolume != 0.0F)
|
||||
{
|
||||
SoundPoolEntry var4 = this.soundPoolSounds.getRandomSoundFromSoundPool(par1Str);
|
||||
|
||||
if (var4 != null && par2 > 0.0F)
|
||||
{
|
||||
this.latestSoundID = (this.latestSoundID + 1) % 256;
|
||||
String var5 = "sound_" + this.latestSoundID;
|
||||
this.sndSystem.newSource(false, var5, var4.getSoundUrl(), var4.getSoundName(), false, 0.0F, 0.0F, 0.0F, 0, 0.0F);
|
||||
|
||||
if (par2 > 1.0F)
|
||||
{
|
||||
par2 = 1.0F;
|
||||
public void playSoundFX(String par1Str, float par2, float par3) {
|
||||
if(this.options.soundVolume > 0.0F && par2 > 0.0F) {
|
||||
Integer ct = this.sounddefinitions.get(par1Str);
|
||||
if(ct != null) {
|
||||
int c = ct.intValue();
|
||||
String path;
|
||||
if(c <= 1) {
|
||||
path = "/sounds/"+par1Str.replace('.', '/')+".mp3";
|
||||
}else {
|
||||
int r = soundrandom.nextInt(c) + 1;
|
||||
path = "/sounds/"+par1Str.replace('.', '/')+r+".mp3";
|
||||
}
|
||||
|
||||
par2 *= 0.25F;
|
||||
this.sndSystem.setPitch(var5, par3);
|
||||
this.sndSystem.setVolume(var5, par2 * this.options.soundVolume);
|
||||
this.sndSystem.play(var5);
|
||||
EaglerAdapter.beginPlaybackStatic(path, par2, par3);
|
||||
}else {
|
||||
System.err.println("unregistered sound effect: "+par1Str);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -552,64 +433,42 @@ public class SoundManager implements ResourceManagerReloadListener
|
||||
/**
|
||||
* Pauses all currently playing sounds
|
||||
*/
|
||||
public void pauseAllSounds()
|
||||
{
|
||||
Iterator var1 = this.playingSounds.iterator();
|
||||
public void pauseAllSounds() {
|
||||
|
||||
while (var1.hasNext())
|
||||
{
|
||||
String var2 = (String)var1.next();
|
||||
this.sndSystem.pause(var2);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resumes playing all currently playing sounds (after pauseAllSounds)
|
||||
*/
|
||||
public void resumeAllSounds()
|
||||
{
|
||||
Iterator var1 = this.playingSounds.iterator();
|
||||
public void resumeAllSounds() {
|
||||
|
||||
while (var1.hasNext())
|
||||
{
|
||||
String var2 = (String)var1.next();
|
||||
this.sndSystem.play(var2);
|
||||
}
|
||||
}
|
||||
|
||||
public void func_92071_g()
|
||||
{
|
||||
if (!this.field_92072_h.isEmpty())
|
||||
{
|
||||
Iterator var1 = this.field_92072_h.iterator();
|
||||
private int resetTimer = 0;
|
||||
|
||||
while (var1.hasNext())
|
||||
{
|
||||
ScheduledSound var2 = (ScheduledSound)var1.next();
|
||||
--var2.field_92064_g;
|
||||
|
||||
if (var2.field_92064_g <= 0)
|
||||
{
|
||||
this.playSound(var2.field_92069_a, var2.field_92067_b, var2.field_92068_c, var2.field_92065_d, var2.field_92066_e, var2.field_92063_f);
|
||||
var1.remove();
|
||||
public void func_92071_g() {
|
||||
++resetTimer;
|
||||
if(resetTimer % 20 == 0) {
|
||||
ArrayList<EntitySoundEvent> e = this.soundevents;
|
||||
this.soundevents = new ArrayList();
|
||||
for(EntitySoundEvent e2 : e) {
|
||||
if(EaglerAdapter.isPlaying(e2.id)) {
|
||||
soundevents.add(e2);
|
||||
}
|
||||
}
|
||||
}
|
||||
Iterator<QueuedSoundEvent> itr = queuedsoundevents.iterator();
|
||||
while(itr.hasNext()) {
|
||||
QueuedSoundEvent e = itr.next();
|
||||
if(--e.timer <= 0) {
|
||||
playSound(e.sound, e.x, e.y, e.z, e.volume, e.pitch);
|
||||
itr.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void func_92070_a(String par1Str, float par2, float par3, float par4, float par5, float par6, int par7)
|
||||
{
|
||||
this.field_92072_h.add(new ScheduledSound(par1Str, par2, par3, par4, par5, par6, par7));
|
||||
}
|
||||
|
||||
static SoundSystem func_130080_a(SoundManager par0SoundManager, SoundSystem par1SoundSystem)
|
||||
{
|
||||
return par0SoundManager.sndSystem = par1SoundSystem;
|
||||
}
|
||||
|
||||
static boolean func_130082_a(SoundManager par0SoundManager, boolean par1)
|
||||
{
|
||||
return par0SoundManager.loaded = par1;
|
||||
public void func_92070_a(String par1Str, float par2, float par3, float par4, float par5, float par6, int par7) {
|
||||
queuedsoundevents.add(new QueuedSoundEvent(par1Str, par2, par3, par4, par5, par6, par7));
|
||||
}
|
||||
|
||||
private int titleMusic = -1;
|
||||
@@ -630,4 +489,5 @@ public class SoundManager implements ResourceManagerReloadListener
|
||||
}
|
||||
titleMusic = -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import paulscode.sound.SoundSystem;
|
||||
|
||||
class SoundManagerINNER1 implements Runnable
|
||||
{
|
||||
final SoundManager theSoundManager;
|
||||
|
||||
SoundManagerINNER1(SoundManager par1SoundManager)
|
||||
{
|
||||
this.theSoundManager = par1SoundManager;
|
||||
}
|
||||
|
||||
public void run()
|
||||
{
|
||||
SoundManager.func_130080_a(this.theSoundManager, new SoundSystem());
|
||||
SoundManager.func_130082_a(this.theSoundManager, true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user