add files
This commit is contained in:
commit
784a776dbb
7211 changed files with 811080 additions and 0 deletions
52
src/main/java/net/minecraft/client/audio/GuardianSound.java
Executable file
52
src/main/java/net/minecraft/client/audio/GuardianSound.java
Executable file
|
|
@ -0,0 +1,52 @@
|
|||
package net.minecraft.client.audio;
|
||||
|
||||
import net.minecraft.entity.monster.EntityGuardian;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
/**+
|
||||
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
|
||||
*
|
||||
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
|
||||
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
|
||||
*
|
||||
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class GuardianSound extends MovingSound {
|
||||
private final EntityGuardian guardian;
|
||||
|
||||
public GuardianSound(EntityGuardian guardian) {
|
||||
super(new ResourceLocation("minecraft:mob.guardian.attack"));
|
||||
this.guardian = guardian;
|
||||
this.attenuationType = ISound.AttenuationType.NONE;
|
||||
this.repeat = true;
|
||||
this.repeatDelay = 0;
|
||||
}
|
||||
|
||||
/**+
|
||||
* Like the old updateEntity(), except more generic.
|
||||
*/
|
||||
public void update() {
|
||||
if (!this.guardian.isDead && this.guardian.hasTargetedEntity()) {
|
||||
this.xPosF = (float) this.guardian.posX;
|
||||
this.yPosF = (float) this.guardian.posY;
|
||||
this.zPosF = (float) this.guardian.posZ;
|
||||
float f = this.guardian.func_175477_p(0.0F);
|
||||
this.volume = 0.0F + 1.0F * f * f;
|
||||
this.pitch = 0.7F + 0.5F * f;
|
||||
} else {
|
||||
this.donePlaying = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
57
src/main/java/net/minecraft/client/audio/ISound.java
Executable file
57
src/main/java/net/minecraft/client/audio/ISound.java
Executable file
|
|
@ -0,0 +1,57 @@
|
|||
package net.minecraft.client.audio;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
/**+
|
||||
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
|
||||
*
|
||||
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
|
||||
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
|
||||
*
|
||||
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public interface ISound {
|
||||
ResourceLocation getSoundLocation();
|
||||
|
||||
boolean canRepeat();
|
||||
|
||||
int getRepeatDelay();
|
||||
|
||||
float getVolume();
|
||||
|
||||
float getPitch();
|
||||
|
||||
float getXPosF();
|
||||
|
||||
float getYPosF();
|
||||
|
||||
float getZPosF();
|
||||
|
||||
ISound.AttenuationType getAttenuationType();
|
||||
|
||||
public static enum AttenuationType {
|
||||
NONE(0), LINEAR(2);
|
||||
|
||||
private final int type;
|
||||
|
||||
private AttenuationType(int typeIn) {
|
||||
this.type = typeIn;
|
||||
}
|
||||
|
||||
public int getTypeInt() {
|
||||
return this.type;
|
||||
}
|
||||
}
|
||||
}
|
||||
27
src/main/java/net/minecraft/client/audio/ISoundEventAccessor.java
Executable file
27
src/main/java/net/minecraft/client/audio/ISoundEventAccessor.java
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
package net.minecraft.client.audio;
|
||||
|
||||
/**+
|
||||
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
|
||||
*
|
||||
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
|
||||
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
|
||||
*
|
||||
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public interface ISoundEventAccessor<T> {
|
||||
int getWeight();
|
||||
|
||||
T cloneEntry();
|
||||
}
|
||||
27
src/main/java/net/minecraft/client/audio/ITickableSound.java
Executable file
27
src/main/java/net/minecraft/client/audio/ITickableSound.java
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
package net.minecraft.client.audio;
|
||||
|
||||
import net.minecraft.util.ITickable;
|
||||
|
||||
/**+
|
||||
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
|
||||
*
|
||||
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
|
||||
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
|
||||
*
|
||||
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public interface ITickableSound extends ISound, ITickable {
|
||||
boolean isDonePlaying();
|
||||
}
|
||||
35
src/main/java/net/minecraft/client/audio/MovingSound.java
Executable file
35
src/main/java/net/minecraft/client/audio/MovingSound.java
Executable file
|
|
@ -0,0 +1,35 @@
|
|||
package net.minecraft.client.audio;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
/**+
|
||||
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
|
||||
*
|
||||
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
|
||||
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
|
||||
*
|
||||
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public abstract class MovingSound extends PositionedSound implements ITickableSound {
|
||||
protected boolean donePlaying = false;
|
||||
|
||||
protected MovingSound(ResourceLocation location) {
|
||||
super(location);
|
||||
}
|
||||
|
||||
public boolean isDonePlaying() {
|
||||
return this.donePlaying;
|
||||
}
|
||||
}
|
||||
60
src/main/java/net/minecraft/client/audio/MovingSoundMinecart.java
Executable file
60
src/main/java/net/minecraft/client/audio/MovingSoundMinecart.java
Executable file
|
|
@ -0,0 +1,60 @@
|
|||
package net.minecraft.client.audio;
|
||||
|
||||
import net.minecraft.entity.item.EntityMinecart;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
/**+
|
||||
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
|
||||
*
|
||||
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
|
||||
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
|
||||
*
|
||||
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class MovingSoundMinecart extends MovingSound {
|
||||
private final EntityMinecart minecart;
|
||||
private float distance = 0.0F;
|
||||
|
||||
public MovingSoundMinecart(EntityMinecart minecartIn) {
|
||||
super(new ResourceLocation("minecraft:minecart.base"));
|
||||
this.minecart = minecartIn;
|
||||
this.repeat = true;
|
||||
this.repeatDelay = 0;
|
||||
}
|
||||
|
||||
/**+
|
||||
* Like the old updateEntity(), except more generic.
|
||||
*/
|
||||
public void update() {
|
||||
if (this.minecart.isDead) {
|
||||
this.donePlaying = true;
|
||||
} else {
|
||||
this.xPosF = (float) this.minecart.posX;
|
||||
this.yPosF = (float) this.minecart.posY;
|
||||
this.zPosF = (float) this.minecart.posZ;
|
||||
float f = MathHelper.sqrt_double(
|
||||
this.minecart.motionX * this.minecart.motionX + this.minecart.motionZ * this.minecart.motionZ);
|
||||
if ((double) f >= 0.01D) {
|
||||
this.distance = MathHelper.clamp_float(this.distance + 0.0025F, 0.0F, 1.0F);
|
||||
this.volume = 0.0F + MathHelper.clamp_float(f, 0.0F, 0.5F) * 0.7F;
|
||||
} else {
|
||||
this.distance = 0.0F;
|
||||
this.volume = 0.0F;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
58
src/main/java/net/minecraft/client/audio/MovingSoundMinecartRiding.java
Executable file
58
src/main/java/net/minecraft/client/audio/MovingSoundMinecartRiding.java
Executable file
|
|
@ -0,0 +1,58 @@
|
|||
package net.minecraft.client.audio;
|
||||
|
||||
import net.minecraft.entity.item.EntityMinecart;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
/**+
|
||||
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
|
||||
*
|
||||
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
|
||||
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
|
||||
*
|
||||
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class MovingSoundMinecartRiding extends MovingSound {
|
||||
private final EntityPlayer player;
|
||||
private final EntityMinecart minecart;
|
||||
|
||||
public MovingSoundMinecartRiding(EntityPlayer playerRiding, EntityMinecart minecart) {
|
||||
super(new ResourceLocation("minecraft:minecart.inside"));
|
||||
this.player = playerRiding;
|
||||
this.minecart = minecart;
|
||||
this.attenuationType = ISound.AttenuationType.NONE;
|
||||
this.repeat = true;
|
||||
this.repeatDelay = 0;
|
||||
}
|
||||
|
||||
/**+
|
||||
* Like the old updateEntity(), except more generic.
|
||||
*/
|
||||
public void update() {
|
||||
if (!this.minecart.isDead && this.player.isRiding() && this.player.ridingEntity == this.minecart) {
|
||||
float f = MathHelper.sqrt_double(
|
||||
this.minecart.motionX * this.minecart.motionX + this.minecart.motionZ * this.minecart.motionZ);
|
||||
if ((double) f >= 0.01D) {
|
||||
this.volume = 0.0F + MathHelper.clamp_float(f, 0.0F, 1.0F) * 0.75F;
|
||||
} else {
|
||||
this.volume = 0.0F;
|
||||
}
|
||||
|
||||
} else {
|
||||
this.donePlaying = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
112
src/main/java/net/minecraft/client/audio/MusicTicker.java
Executable file
112
src/main/java/net/minecraft/client/audio/MusicTicker.java
Executable file
|
|
@ -0,0 +1,112 @@
|
|||
package net.minecraft.client.audio;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
/**+
|
||||
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
|
||||
*
|
||||
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
|
||||
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
|
||||
*
|
||||
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class MusicTicker implements ITickable {
|
||||
private final EaglercraftRandom rand = new EaglercraftRandom();
|
||||
private final Minecraft mc;
|
||||
private ISound currentMusic;
|
||||
private int timeUntilNextMusic = 100;
|
||||
|
||||
public MusicTicker(Minecraft mcIn) {
|
||||
this.mc = mcIn;
|
||||
}
|
||||
|
||||
/**+
|
||||
* Like the old updateEntity(), except more generic.
|
||||
*/
|
||||
public void update() {
|
||||
MusicTicker.MusicType musicticker$musictype = this.mc.getAmbientMusicType();
|
||||
if (this.currentMusic != null) {
|
||||
if (!musicticker$musictype.getMusicLocation().equals(this.currentMusic.getSoundLocation())) {
|
||||
this.mc.getSoundHandler().stopSound(this.currentMusic);
|
||||
this.timeUntilNextMusic = MathHelper.getRandomIntegerInRange(this.rand, 0,
|
||||
musicticker$musictype.getMinDelay() / 2);
|
||||
}
|
||||
|
||||
if (!this.mc.getSoundHandler().isSoundPlaying(this.currentMusic)) {
|
||||
this.currentMusic = null;
|
||||
this.timeUntilNextMusic = Math.min(MathHelper.getRandomIntegerInRange(this.rand,
|
||||
musicticker$musictype.getMinDelay(), musicticker$musictype.getMaxDelay()),
|
||||
this.timeUntilNextMusic);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.currentMusic == null && this.timeUntilNextMusic-- <= 0) {
|
||||
this.func_181558_a(musicticker$musictype);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void func_181558_a(MusicTicker.MusicType parMusicType) {
|
||||
this.currentMusic = PositionedSoundRecord.create(parMusicType.getMusicLocation());
|
||||
this.mc.getSoundHandler().playSound(this.currentMusic);
|
||||
this.timeUntilNextMusic = Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
public void func_181557_a() {
|
||||
if (this.currentMusic != null) {
|
||||
this.mc.getSoundHandler().stopSound(this.currentMusic);
|
||||
this.currentMusic = null;
|
||||
this.timeUntilNextMusic = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static enum MusicType {
|
||||
MENU(new ResourceLocation("minecraft:music.menu"), 20, 600),
|
||||
GAME(new ResourceLocation("minecraft:music.game"), 12000, 24000),
|
||||
CREATIVE(new ResourceLocation("minecraft:music.game.creative"), 1200, 3600),
|
||||
CREDITS(new ResourceLocation("minecraft:music.game.end.credits"), Integer.MAX_VALUE, Integer.MAX_VALUE),
|
||||
NETHER(new ResourceLocation("minecraft:music.game.nether"), 1200, 3600),
|
||||
END_BOSS(new ResourceLocation("minecraft:music.game.end.dragon"), 0, 0),
|
||||
END(new ResourceLocation("minecraft:music.game.end"), 6000, 24000);
|
||||
|
||||
private final ResourceLocation musicLocation;
|
||||
private final int minDelay;
|
||||
private final int maxDelay;
|
||||
|
||||
private MusicType(ResourceLocation location, int minDelayIn, int maxDelayIn) {
|
||||
this.musicLocation = location;
|
||||
this.minDelay = minDelayIn;
|
||||
this.maxDelay = maxDelayIn;
|
||||
}
|
||||
|
||||
public ResourceLocation getMusicLocation() {
|
||||
return this.musicLocation;
|
||||
}
|
||||
|
||||
public int getMinDelay() {
|
||||
return this.minDelay;
|
||||
}
|
||||
|
||||
public int getMaxDelay() {
|
||||
return this.maxDelay;
|
||||
}
|
||||
}
|
||||
}
|
||||
78
src/main/java/net/minecraft/client/audio/PositionedSound.java
Executable file
78
src/main/java/net/minecraft/client/audio/PositionedSound.java
Executable file
|
|
@ -0,0 +1,78 @@
|
|||
package net.minecraft.client.audio;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
/**+
|
||||
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
|
||||
*
|
||||
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
|
||||
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
|
||||
*
|
||||
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public abstract class PositionedSound implements ISound {
|
||||
protected final ResourceLocation positionedSoundLocation;
|
||||
protected float volume = 1.0F;
|
||||
protected float pitch = 1.0F;
|
||||
protected float xPosF;
|
||||
protected float yPosF;
|
||||
protected float zPosF;
|
||||
protected boolean repeat = false;
|
||||
/**+
|
||||
* The number of ticks between repeating the sound
|
||||
*/
|
||||
protected int repeatDelay = 0;
|
||||
protected ISound.AttenuationType attenuationType = ISound.AttenuationType.LINEAR;
|
||||
|
||||
protected PositionedSound(ResourceLocation soundResource) {
|
||||
this.positionedSoundLocation = soundResource;
|
||||
}
|
||||
|
||||
public ResourceLocation getSoundLocation() {
|
||||
return this.positionedSoundLocation;
|
||||
}
|
||||
|
||||
public boolean canRepeat() {
|
||||
return this.repeat;
|
||||
}
|
||||
|
||||
public int getRepeatDelay() {
|
||||
return this.repeatDelay;
|
||||
}
|
||||
|
||||
public float getVolume() {
|
||||
return this.volume;
|
||||
}
|
||||
|
||||
public float getPitch() {
|
||||
return this.pitch;
|
||||
}
|
||||
|
||||
public float getXPosF() {
|
||||
return this.xPosF;
|
||||
}
|
||||
|
||||
public float getYPosF() {
|
||||
return this.yPosF;
|
||||
}
|
||||
|
||||
public float getZPosF() {
|
||||
return this.zPosF;
|
||||
}
|
||||
|
||||
public ISound.AttenuationType getAttenuationType() {
|
||||
return this.attenuationType;
|
||||
}
|
||||
}
|
||||
60
src/main/java/net/minecraft/client/audio/PositionedSoundRecord.java
Executable file
60
src/main/java/net/minecraft/client/audio/PositionedSoundRecord.java
Executable file
|
|
@ -0,0 +1,60 @@
|
|||
package net.minecraft.client.audio;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
/**+
|
||||
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
|
||||
*
|
||||
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
|
||||
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
|
||||
*
|
||||
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class PositionedSoundRecord extends PositionedSound {
|
||||
public static PositionedSoundRecord create(ResourceLocation soundResource, float pitch) {
|
||||
return new PositionedSoundRecord(soundResource, 0.25F, pitch, false, 0, ISound.AttenuationType.NONE, 0.0F, 0.0F,
|
||||
0.0F);
|
||||
}
|
||||
|
||||
public static PositionedSoundRecord create(ResourceLocation soundResource) {
|
||||
return new PositionedSoundRecord(soundResource, 1.0F, 1.0F, false, 0, ISound.AttenuationType.NONE, 0.0F, 0.0F,
|
||||
0.0F);
|
||||
}
|
||||
|
||||
public static PositionedSoundRecord create(ResourceLocation soundResource, float xPosition, float yPosition,
|
||||
float zPosition) {
|
||||
return new PositionedSoundRecord(soundResource, 4.0F, 1.0F, false, 0, ISound.AttenuationType.LINEAR, xPosition,
|
||||
yPosition, zPosition);
|
||||
}
|
||||
|
||||
public PositionedSoundRecord(ResourceLocation soundResource, float volume, float pitch, float xPosition,
|
||||
float yPosition, float zPosition) {
|
||||
this(soundResource, volume, pitch, false, 0, ISound.AttenuationType.LINEAR, xPosition, yPosition, zPosition);
|
||||
}
|
||||
|
||||
private PositionedSoundRecord(ResourceLocation soundResource, float volume, float pitch, boolean repeat,
|
||||
int repeatDelay, ISound.AttenuationType attenuationType, float xPosition, float yPosition,
|
||||
float zPosition) {
|
||||
super(soundResource);
|
||||
this.volume = volume;
|
||||
this.pitch = pitch;
|
||||
this.xPosF = xPosition;
|
||||
this.yPosF = yPosition;
|
||||
this.zPosF = zPosition;
|
||||
this.repeat = repeat;
|
||||
this.repeatDelay = repeatDelay;
|
||||
this.attenuationType = attenuationType;
|
||||
}
|
||||
}
|
||||
65
src/main/java/net/minecraft/client/audio/SoundCategory.java
Executable file
65
src/main/java/net/minecraft/client/audio/SoundCategory.java
Executable file
|
|
@ -0,0 +1,65 @@
|
|||
package net.minecraft.client.audio;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
/**+
|
||||
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
|
||||
*
|
||||
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
|
||||
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
|
||||
*
|
||||
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public enum SoundCategory {
|
||||
MASTER("master", 0), MUSIC("music", 1), RECORDS("record", 2), WEATHER("weather", 3), BLOCKS("block", 4),
|
||||
MOBS("hostile", 5), ANIMALS("neutral", 6), PLAYERS("player", 7), AMBIENT("ambient", 8), VOICE("voice", 9);
|
||||
|
||||
private static final Map<String, SoundCategory> NAME_CATEGORY_MAP = Maps.newHashMap();
|
||||
private static final Map<Integer, SoundCategory> ID_CATEGORY_MAP = Maps.newHashMap();
|
||||
private final String categoryName;
|
||||
private final int categoryId;
|
||||
|
||||
private SoundCategory(String name, int id) {
|
||||
this.categoryName = name;
|
||||
this.categoryId = id;
|
||||
}
|
||||
|
||||
public String getCategoryName() {
|
||||
return this.categoryName;
|
||||
}
|
||||
|
||||
public int getCategoryId() {
|
||||
return this.categoryId;
|
||||
}
|
||||
|
||||
public static SoundCategory getCategory(String name) {
|
||||
return (SoundCategory) NAME_CATEGORY_MAP.get(name);
|
||||
}
|
||||
|
||||
static {
|
||||
for (SoundCategory soundcategory : values()) {
|
||||
if (NAME_CATEGORY_MAP.containsKey(soundcategory.getCategoryName())
|
||||
|| ID_CATEGORY_MAP.containsKey(Integer.valueOf(soundcategory.getCategoryId()))) {
|
||||
throw new Error("Clash in Sound Category ID & Name pools! Cannot insert " + soundcategory);
|
||||
}
|
||||
|
||||
NAME_CATEGORY_MAP.put(soundcategory.getCategoryName(), soundcategory);
|
||||
ID_CATEGORY_MAP.put(Integer.valueOf(soundcategory.getCategoryId()), soundcategory);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
39
src/main/java/net/minecraft/client/audio/SoundEventAccessor.java
Executable file
39
src/main/java/net/minecraft/client/audio/SoundEventAccessor.java
Executable file
|
|
@ -0,0 +1,39 @@
|
|||
package net.minecraft.client.audio;
|
||||
|
||||
/**+
|
||||
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
|
||||
*
|
||||
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
|
||||
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
|
||||
*
|
||||
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class SoundEventAccessor implements ISoundEventAccessor<SoundPoolEntry> {
|
||||
private final SoundPoolEntry entry;
|
||||
private final int weight;
|
||||
|
||||
SoundEventAccessor(SoundPoolEntry entry, int weight) {
|
||||
this.entry = entry;
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
public int getWeight() {
|
||||
return this.weight;
|
||||
}
|
||||
|
||||
public SoundPoolEntry cloneEntry() {
|
||||
return new SoundPoolEntry(this.entry);
|
||||
}
|
||||
}
|
||||
91
src/main/java/net/minecraft/client/audio/SoundEventAccessorComposite.java
Executable file
91
src/main/java/net/minecraft/client/audio/SoundEventAccessorComposite.java
Executable file
|
|
@ -0,0 +1,91 @@
|
|||
package net.minecraft.client.audio;
|
||||
|
||||
import java.util.List;
|
||||
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
/**+
|
||||
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
|
||||
*
|
||||
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
|
||||
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
|
||||
*
|
||||
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class SoundEventAccessorComposite implements ISoundEventAccessor<SoundPoolEntry> {
|
||||
/**+
|
||||
* A composite (List) of ISoundEventAccessors
|
||||
*/
|
||||
private final List<ISoundEventAccessor<SoundPoolEntry>> soundPool = Lists.newArrayList();
|
||||
private final EaglercraftRandom rnd = new EaglercraftRandom();
|
||||
private final ResourceLocation soundLocation;
|
||||
private final SoundCategory category;
|
||||
private double eventPitch;
|
||||
private double eventVolume;
|
||||
|
||||
public SoundEventAccessorComposite(ResourceLocation soundLocation, double pitch, double volume,
|
||||
SoundCategory category) {
|
||||
this.soundLocation = soundLocation;
|
||||
this.eventVolume = volume;
|
||||
this.eventPitch = pitch;
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
public int getWeight() {
|
||||
int i = 0;
|
||||
|
||||
for (ISoundEventAccessor isoundeventaccessor : this.soundPool) {
|
||||
i += isoundeventaccessor.getWeight();
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
public SoundPoolEntry cloneEntry() {
|
||||
int i = this.getWeight();
|
||||
if (!this.soundPool.isEmpty() && i != 0) {
|
||||
int j = this.rnd.nextInt(i);
|
||||
|
||||
for (ISoundEventAccessor isoundeventaccessor : this.soundPool) {
|
||||
j -= isoundeventaccessor.getWeight();
|
||||
if (j < 0) {
|
||||
SoundPoolEntry soundpoolentry = (SoundPoolEntry) isoundeventaccessor.cloneEntry();
|
||||
soundpoolentry.setPitch(soundpoolentry.getPitch() * this.eventPitch);
|
||||
soundpoolentry.setVolume(soundpoolentry.getVolume() * this.eventVolume);
|
||||
return soundpoolentry;
|
||||
}
|
||||
}
|
||||
|
||||
return SoundHandler.missing_sound;
|
||||
} else {
|
||||
return SoundHandler.missing_sound;
|
||||
}
|
||||
}
|
||||
|
||||
public void addSoundToEventPool(ISoundEventAccessor<SoundPoolEntry> sound) {
|
||||
this.soundPool.add(sound);
|
||||
}
|
||||
|
||||
public ResourceLocation getSoundEventLocation() {
|
||||
return this.soundLocation;
|
||||
}
|
||||
|
||||
public SoundCategory getSoundCategory() {
|
||||
return this.category;
|
||||
}
|
||||
}
|
||||
276
src/main/java/net/minecraft/client/audio/SoundHandler.java
Executable file
276
src/main/java/net/minecraft/client/audio/SoundHandler.java
Executable file
|
|
@ -0,0 +1,276 @@
|
|||
package net.minecraft.client.audio;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.PlatformAudio;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
|
||||
import net.lax1dude.eaglercraft.v1_8.EaglercraftSoundManager;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.IOUtils;
|
||||
import net.lax1dude.eaglercraft.v1_8.json.JSONTypeProvider;
|
||||
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
|
||||
import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
|
||||
import net.minecraft.client.resources.IResource;
|
||||
import net.minecraft.client.resources.IResourceManager;
|
||||
import net.minecraft.client.resources.IResourceManagerReloadListener;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
/**+
|
||||
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
|
||||
*
|
||||
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
|
||||
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
|
||||
*
|
||||
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class SoundHandler implements IResourceManagerReloadListener, ITickable {
|
||||
private static final Logger logger = LogManager.getLogger();
|
||||
public static final SoundPoolEntry missing_sound = new SoundPoolEntry(new ResourceLocation("meta:missing_sound"),
|
||||
0.0D, 0.0D, false);
|
||||
private final SoundRegistry sndRegistry = new SoundRegistry();
|
||||
private final EaglercraftSoundManager sndManager;
|
||||
private final IResourceManager mcResourceManager;
|
||||
|
||||
public SoundHandler(IResourceManager manager, GameSettings gameSettingsIn) {
|
||||
this.mcResourceManager = manager;
|
||||
this.sndManager = new EaglercraftSoundManager(gameSettingsIn, this);
|
||||
}
|
||||
|
||||
public void onResourceManagerReload(IResourceManager iresourcemanager) {
|
||||
this.sndManager.reloadSoundSystem();
|
||||
this.sndRegistry.clearMap();
|
||||
|
||||
for (String s : iresourcemanager.getResourceDomains()) {
|
||||
try {
|
||||
for (IResource iresource : iresourcemanager.getAllResources(new ResourceLocation(s, "sounds.json"))) {
|
||||
try {
|
||||
Map map = this.getSoundMap(iresource.getInputStream());
|
||||
|
||||
for (Entry entry : (Set<Entry>) map.entrySet()) {
|
||||
this.loadSoundResource(new ResourceLocation(s, (String) entry.getKey()),
|
||||
(SoundList) entry.getValue());
|
||||
}
|
||||
} catch (RuntimeException runtimeexception) {
|
||||
logger.warn("Invalid sounds.json", runtimeexception);
|
||||
}
|
||||
}
|
||||
} catch (IOException var11) {
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class SoundMap {
|
||||
|
||||
protected final Map<String, SoundList> soundMap;
|
||||
|
||||
public SoundMap(Map<String, SoundList> soundMap) {
|
||||
this.soundMap = soundMap;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected Map<String, SoundList> getSoundMap(InputStream stream) {
|
||||
Map<String, SoundList> map = null;
|
||||
try {
|
||||
map = JSONTypeProvider.deserialize(IOUtils.inputStreamToString(stream, StandardCharsets.UTF_8),
|
||||
SoundMap.class).soundMap;
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Exception caught reading JSON", e);
|
||||
} finally {
|
||||
IOUtils.closeQuietly(stream);
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
private void loadSoundResource(ResourceLocation location, SoundList sounds) {
|
||||
boolean flag = !this.sndRegistry.containsKey(location);
|
||||
SoundEventAccessorComposite soundeventaccessorcomposite;
|
||||
if (!flag && !sounds.canReplaceExisting()) {
|
||||
soundeventaccessorcomposite = (SoundEventAccessorComposite) this.sndRegistry.getObject(location);
|
||||
} else {
|
||||
if (!flag) {
|
||||
logger.debug("Replaced sound event location {}", new Object[] { location });
|
||||
}
|
||||
|
||||
soundeventaccessorcomposite = new SoundEventAccessorComposite(location, 1.0D, 1.0D,
|
||||
sounds.getSoundCategory());
|
||||
this.sndRegistry.registerSound(soundeventaccessorcomposite);
|
||||
}
|
||||
|
||||
for (final SoundList.SoundEntry soundlist$soundentry : sounds.getSoundList()) {
|
||||
String s = soundlist$soundentry.getSoundEntryName();
|
||||
ResourceLocation resourcelocation = new ResourceLocation(s);
|
||||
final String s1 = s.contains(":") ? resourcelocation.getResourceDomain() : location.getResourceDomain();
|
||||
Object object;
|
||||
switch (soundlist$soundentry.getSoundEntryType()) {
|
||||
case FILE:
|
||||
ResourceLocation resourcelocation1 = new ResourceLocation(s1,
|
||||
"sounds/" + resourcelocation.getResourcePath() + ".ogg");
|
||||
InputStream inputstream = null;
|
||||
|
||||
try {
|
||||
inputstream = this.mcResourceManager.getResource(resourcelocation1).getInputStream();
|
||||
} catch (FileNotFoundException var18) {
|
||||
logger.warn("File {} does not exist, cannot add it to event {}",
|
||||
new Object[] { resourcelocation1, location });
|
||||
continue;
|
||||
} catch (IOException ioexception) {
|
||||
logger.warn(
|
||||
"Could not load sound file " + resourcelocation1 + ", cannot add it to event " + location,
|
||||
ioexception);
|
||||
continue;
|
||||
} finally {
|
||||
IOUtils.closeQuietly(inputstream);
|
||||
}
|
||||
|
||||
object = new SoundEventAccessor(new SoundPoolEntry(resourcelocation1,
|
||||
(double) soundlist$soundentry.getSoundEntryPitch(),
|
||||
(double) soundlist$soundentry.getSoundEntryVolume(), soundlist$soundentry.isStreaming()),
|
||||
soundlist$soundentry.getSoundEntryWeight());
|
||||
break;
|
||||
case SOUND_EVENT:
|
||||
object = new ISoundEventAccessor<SoundPoolEntry>() {
|
||||
final ResourceLocation field_148726_a = new ResourceLocation(s1,
|
||||
soundlist$soundentry.getSoundEntryName());
|
||||
|
||||
public int getWeight() {
|
||||
SoundEventAccessorComposite soundeventaccessorcomposite1 = (SoundEventAccessorComposite) SoundHandler.this.sndRegistry
|
||||
.getObject(this.field_148726_a);
|
||||
return soundeventaccessorcomposite1 == null ? 0 : soundeventaccessorcomposite1.getWeight();
|
||||
}
|
||||
|
||||
public SoundPoolEntry cloneEntry() {
|
||||
SoundEventAccessorComposite soundeventaccessorcomposite1 = (SoundEventAccessorComposite) SoundHandler.this.sndRegistry
|
||||
.getObject(this.field_148726_a);
|
||||
return soundeventaccessorcomposite1 == null ? SoundHandler.missing_sound
|
||||
: soundeventaccessorcomposite1.cloneEntry();
|
||||
}
|
||||
};
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException("IN YOU FACE");
|
||||
}
|
||||
|
||||
soundeventaccessorcomposite.addSoundToEventPool((ISoundEventAccessor<SoundPoolEntry>) object);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public SoundEventAccessorComposite getSound(ResourceLocation location) {
|
||||
return (SoundEventAccessorComposite) this.sndRegistry.getObject(location);
|
||||
}
|
||||
|
||||
/**+
|
||||
* Play a sound
|
||||
*/
|
||||
public void playSound(ISound sound) {
|
||||
this.sndManager.playSound(sound);
|
||||
}
|
||||
|
||||
/**+
|
||||
* Plays the sound in n ticks
|
||||
*/
|
||||
public void playDelayedSound(ISound sound, int delay) {
|
||||
this.sndManager.playDelayedSound(sound, delay);
|
||||
}
|
||||
|
||||
public void setListener(EntityPlayer player, float parFloat1) {
|
||||
this.sndManager.setListener(player, parFloat1);
|
||||
}
|
||||
|
||||
public void pauseSounds() {
|
||||
this.sndManager.pauseAllSounds();
|
||||
}
|
||||
|
||||
public void stopSounds() {
|
||||
this.sndManager.stopAllSounds();
|
||||
}
|
||||
|
||||
public void unloadSounds() {
|
||||
this.sndManager.unloadSoundSystem();
|
||||
}
|
||||
|
||||
/**+
|
||||
* Like the old updateEntity(), except more generic.
|
||||
*/
|
||||
public void update() {
|
||||
this.sndManager.updateAllSounds();
|
||||
}
|
||||
|
||||
public void resumeSounds() {
|
||||
this.sndManager.resumeAllSounds();
|
||||
}
|
||||
|
||||
public void setSoundLevel(SoundCategory category, float volume) {
|
||||
if (category == SoundCategory.MASTER && volume <= 0.0F) {
|
||||
this.stopSounds();
|
||||
}
|
||||
|
||||
if (category == SoundCategory.VOICE) {
|
||||
PlatformAudio.setMicVol(volume);
|
||||
}
|
||||
|
||||
this.sndManager.setSoundCategoryVolume(category, volume);
|
||||
}
|
||||
|
||||
public void stopSound(ISound parISound) {
|
||||
this.sndManager.stopSound(parISound);
|
||||
}
|
||||
|
||||
/**+
|
||||
* Returns a random sound from one or more categories
|
||||
*/
|
||||
public SoundEventAccessorComposite getRandomSoundFromCategories(SoundCategory... categories) {
|
||||
ArrayList arraylist = Lists.newArrayList();
|
||||
|
||||
for (ResourceLocation resourcelocation : this.sndRegistry.getKeys()) {
|
||||
SoundEventAccessorComposite soundeventaccessorcomposite = (SoundEventAccessorComposite) this.sndRegistry
|
||||
.getObject(resourcelocation);
|
||||
SoundCategory cat = soundeventaccessorcomposite.getSoundCategory();
|
||||
for (int i = 0; i < categories.length; ++i) {
|
||||
if (cat == categories[i]) {
|
||||
arraylist.add(soundeventaccessorcomposite);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (arraylist.isEmpty()) {
|
||||
return null;
|
||||
} else {
|
||||
return (SoundEventAccessorComposite) arraylist.get((new EaglercraftRandom()).nextInt(arraylist.size()));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isSoundPlaying(ISound sound) {
|
||||
return this.sndManager.isSoundPlaying(sound);
|
||||
}
|
||||
}
|
||||
128
src/main/java/net/minecraft/client/audio/SoundList.java
Executable file
128
src/main/java/net/minecraft/client/audio/SoundList.java
Executable file
|
|
@ -0,0 +1,128 @@
|
|||
package net.minecraft.client.audio;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
/**+
|
||||
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
|
||||
*
|
||||
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
|
||||
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
|
||||
*
|
||||
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class SoundList {
|
||||
private final List<SoundList.SoundEntry> soundList = Lists.newArrayList();
|
||||
private boolean replaceExisting;
|
||||
private SoundCategory category;
|
||||
|
||||
public List<SoundList.SoundEntry> getSoundList() {
|
||||
return this.soundList;
|
||||
}
|
||||
|
||||
public boolean canReplaceExisting() {
|
||||
return this.replaceExisting;
|
||||
}
|
||||
|
||||
public void setReplaceExisting(boolean parFlag) {
|
||||
this.replaceExisting = parFlag;
|
||||
}
|
||||
|
||||
public SoundCategory getSoundCategory() {
|
||||
return this.category;
|
||||
}
|
||||
|
||||
public void setSoundCategory(SoundCategory soundCat) {
|
||||
this.category = soundCat;
|
||||
}
|
||||
|
||||
public static class SoundEntry {
|
||||
private String name;
|
||||
private float volume = 1.0F;
|
||||
private float pitch = 1.0F;
|
||||
private int weight = 1;
|
||||
private SoundList.SoundEntry.Type type = SoundList.SoundEntry.Type.FILE;
|
||||
private boolean streaming = false;
|
||||
|
||||
public String getSoundEntryName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void setSoundEntryName(String nameIn) {
|
||||
this.name = nameIn;
|
||||
}
|
||||
|
||||
public float getSoundEntryVolume() {
|
||||
return this.volume;
|
||||
}
|
||||
|
||||
public void setSoundEntryVolume(float volumeIn) {
|
||||
this.volume = volumeIn;
|
||||
}
|
||||
|
||||
public float getSoundEntryPitch() {
|
||||
return this.pitch;
|
||||
}
|
||||
|
||||
public void setSoundEntryPitch(float pitchIn) {
|
||||
this.pitch = pitchIn;
|
||||
}
|
||||
|
||||
public int getSoundEntryWeight() {
|
||||
return this.weight;
|
||||
}
|
||||
|
||||
public void setSoundEntryWeight(int weightIn) {
|
||||
this.weight = weightIn;
|
||||
}
|
||||
|
||||
public SoundList.SoundEntry.Type getSoundEntryType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public void setSoundEntryType(SoundList.SoundEntry.Type typeIn) {
|
||||
this.type = typeIn;
|
||||
}
|
||||
|
||||
public boolean isStreaming() {
|
||||
return this.streaming;
|
||||
}
|
||||
|
||||
public void setStreaming(boolean isStreaming) {
|
||||
this.streaming = isStreaming;
|
||||
}
|
||||
|
||||
public static enum Type {
|
||||
FILE("file"), SOUND_EVENT("event");
|
||||
|
||||
private final String field_148583_c;
|
||||
|
||||
private Type(String parString2) {
|
||||
this.field_148583_c = parString2;
|
||||
}
|
||||
|
||||
public static SoundList.SoundEntry.Type getType(String parString1) {
|
||||
for (SoundList.SoundEntry.Type soundlist$soundentry$type : values()) {
|
||||
if (soundlist$soundentry$type.field_148583_c.equals(parString1)) {
|
||||
return soundlist$soundentry$type;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
85
src/main/java/net/minecraft/client/audio/SoundListSerializer.java
Executable file
85
src/main/java/net/minecraft/client/audio/SoundListSerializer.java
Executable file
|
|
@ -0,0 +1,85 @@
|
|||
package net.minecraft.client.audio;
|
||||
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.json.JSONTypeDeserializer;
|
||||
|
||||
/**+
|
||||
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
|
||||
*
|
||||
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
|
||||
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
|
||||
*
|
||||
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class SoundListSerializer implements JSONTypeDeserializer<JSONObject, SoundList> {
|
||||
public SoundList deserialize(JSONObject jsonobject) throws JSONException {
|
||||
SoundList soundlist = new SoundList();
|
||||
soundlist.setReplaceExisting(jsonobject.optBoolean("replace", false));
|
||||
SoundCategory soundcategory = SoundCategory
|
||||
.getCategory(jsonobject.optString("category", SoundCategory.MASTER.getCategoryName()));
|
||||
soundlist.setSoundCategory(soundcategory);
|
||||
Validate.notNull(soundcategory, "Invalid category", new Object[0]);
|
||||
if (jsonobject.has("sounds")) {
|
||||
JSONArray jsonarray = jsonobject.getJSONArray("sounds");
|
||||
|
||||
for (int i = 0; i < jsonarray.length(); ++i) {
|
||||
Object jsonelement = jsonarray.get(i);
|
||||
SoundList.SoundEntry soundlist$soundentry = new SoundList.SoundEntry();
|
||||
if (jsonelement instanceof String) {
|
||||
soundlist$soundentry.setSoundEntryName((String) jsonelement);
|
||||
} else if (jsonelement instanceof JSONObject) {
|
||||
JSONObject jsonobject1 = (JSONObject) jsonelement;
|
||||
soundlist$soundentry.setSoundEntryName(jsonobject1.getString("name"));
|
||||
if (jsonobject1.has("type")) {
|
||||
SoundList.SoundEntry.Type soundlist$soundentry$type = SoundList.SoundEntry.Type
|
||||
.getType(jsonobject1.getString("type"));
|
||||
Validate.notNull(soundlist$soundentry$type, "Invalid type", new Object[0]);
|
||||
soundlist$soundentry.setSoundEntryType(soundlist$soundentry$type);
|
||||
}
|
||||
|
||||
if (jsonobject1.has("volume")) {
|
||||
float f = jsonobject1.getFloat("volume");
|
||||
Validate.isTrue(f > 0.0F, "Invalid volume", new Object[0]);
|
||||
soundlist$soundentry.setSoundEntryVolume(f);
|
||||
}
|
||||
|
||||
if (jsonobject1.has("pitch")) {
|
||||
float f1 = jsonobject1.getFloat("pitch");
|
||||
Validate.isTrue(f1 > 0.0F, "Invalid pitch", new Object[0]);
|
||||
soundlist$soundentry.setSoundEntryPitch(f1);
|
||||
}
|
||||
|
||||
if (jsonobject1.has("weight")) {
|
||||
int j = jsonobject1.getInt("weight");
|
||||
Validate.isTrue(j > 0, "Invalid weight", new Object[0]);
|
||||
soundlist$soundentry.setSoundEntryWeight(j);
|
||||
}
|
||||
|
||||
if (jsonobject1.has("stream")) {
|
||||
soundlist$soundentry.setStreaming(jsonobject1.getBoolean("stream"));
|
||||
}
|
||||
}
|
||||
|
||||
soundlist.getSoundList().add(soundlist$soundentry);
|
||||
}
|
||||
}
|
||||
|
||||
return soundlist;
|
||||
}
|
||||
}
|
||||
68
src/main/java/net/minecraft/client/audio/SoundPoolEntry.java
Executable file
68
src/main/java/net/minecraft/client/audio/SoundPoolEntry.java
Executable file
|
|
@ -0,0 +1,68 @@
|
|||
package net.minecraft.client.audio;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
/**+
|
||||
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
|
||||
*
|
||||
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
|
||||
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
|
||||
*
|
||||
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class SoundPoolEntry {
|
||||
private final ResourceLocation location;
|
||||
private final boolean streamingSound;
|
||||
private double pitch;
|
||||
private double volume;
|
||||
|
||||
public SoundPoolEntry(ResourceLocation locationIn, double pitchIn, double volumeIn, boolean streamingSoundIn) {
|
||||
this.location = locationIn;
|
||||
this.pitch = pitchIn;
|
||||
this.volume = volumeIn;
|
||||
this.streamingSound = streamingSoundIn;
|
||||
}
|
||||
|
||||
public SoundPoolEntry(SoundPoolEntry locationIn) {
|
||||
this.location = locationIn.location;
|
||||
this.pitch = locationIn.pitch;
|
||||
this.volume = locationIn.volume;
|
||||
this.streamingSound = locationIn.streamingSound;
|
||||
}
|
||||
|
||||
public ResourceLocation getSoundPoolEntryLocation() {
|
||||
return this.location;
|
||||
}
|
||||
|
||||
public double getPitch() {
|
||||
return this.pitch;
|
||||
}
|
||||
|
||||
public void setPitch(double pitchIn) {
|
||||
this.pitch = pitchIn;
|
||||
}
|
||||
|
||||
public double getVolume() {
|
||||
return this.volume;
|
||||
}
|
||||
|
||||
public void setVolume(double volumeIn) {
|
||||
this.volume = volumeIn;
|
||||
}
|
||||
|
||||
public boolean isStreamingSound() {
|
||||
return this.streamingSound;
|
||||
}
|
||||
}
|
||||
49
src/main/java/net/minecraft/client/audio/SoundRegistry.java
Executable file
49
src/main/java/net/minecraft/client/audio/SoundRegistry.java
Executable file
|
|
@ -0,0 +1,49 @@
|
|||
package net.minecraft.client.audio;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import net.minecraft.util.RegistrySimple;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
/**+
|
||||
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
|
||||
*
|
||||
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
|
||||
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
|
||||
*
|
||||
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class SoundRegistry extends RegistrySimple<ResourceLocation, SoundEventAccessorComposite> {
|
||||
private Map<ResourceLocation, SoundEventAccessorComposite> soundRegistry;
|
||||
|
||||
protected Map<ResourceLocation, SoundEventAccessorComposite> createUnderlyingMap() {
|
||||
this.soundRegistry = Maps.newHashMap();
|
||||
return this.soundRegistry;
|
||||
}
|
||||
|
||||
public void registerSound(SoundEventAccessorComposite parSoundEventAccessorComposite) {
|
||||
this.putObject(parSoundEventAccessorComposite.getSoundEventLocation(), parSoundEventAccessorComposite);
|
||||
}
|
||||
|
||||
/**+
|
||||
* Reset the underlying sound map (Called on resource manager
|
||||
* reload)
|
||||
*/
|
||||
public void clearMap() {
|
||||
this.soundRegistry.clear();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue