GT5-Unofficial/src/main/java/gregtech/common/GT_Client.java

467 lines
21 KiB
Java
Raw Normal View History

2015-04-23 16:14:22 +00:00
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3)
// Source File Name: GT_Client.java
package gregtech.common;
import codechicken.lib.vec.Rotation;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import gregtech.api.GregTech_API;
2015-10-22 02:06:25 +00:00
import gregtech.api.enums.GT_Values;
import gregtech.api.enums.Materials;
2015-04-23 16:14:22 +00:00
import gregtech.api.interfaces.tileentity.ICoverable;
import gregtech.api.interfaces.tileentity.ITurnable;
import gregtech.api.metatileentity.BaseMetaPipeEntity;
2015-10-22 02:06:25 +00:00
import gregtech.api.util.GT_Log;
import gregtech.api.util.GT_PlayedSound;
import gregtech.api.util.GT_Utility;
2015-04-23 16:14:22 +00:00
import gregtech.common.entities.GT_Entity_Arrow;
import gregtech.common.entities.GT_Entity_Arrow_Potion;
2015-10-22 02:06:25 +00:00
import gregtech.common.render.*;
2015-04-23 16:14:22 +00:00
import ic2.api.tile.IWrenchable;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.client.event.DrawBlockHighlightEvent;
import org.lwjgl.opengl.GL11;
2015-10-22 02:06:25 +00:00
import java.util.*;
2015-04-23 16:14:22 +00:00
// Referenced classes of package gregtech.common:
// GT_Proxy
public class GT_Client extends GT_Proxy
2015-10-22 02:06:25 +00:00
implements Runnable {
2015-04-23 16:14:22 +00:00
2015-10-22 02:06:25 +00:00
private static List ROTATABLE_VANILLA_BLOCKS;
2015-04-23 16:14:22 +00:00
2015-10-22 02:06:25 +00:00
static {
ROTATABLE_VANILLA_BLOCKS = Arrays.asList(new Block[]{
Blocks.piston, Blocks.sticky_piston, Blocks.furnace, Blocks.lit_furnace, Blocks.dropper, Blocks.dispenser, Blocks.chest, Blocks.trapped_chest, Blocks.ender_chest, Blocks.hopper,
Blocks.pumpkin, Blocks.lit_pumpkin
});
2015-04-23 16:14:22 +00:00
}
2015-10-22 02:06:25 +00:00
private final List mPosR;
private final List mPosG;
private final List mPosB;
private final List mPosA = Arrays.asList(new Object[0]);
private final List mNegR;
private final List mNegG;
private final List mNegB;
private final List mNegA = Arrays.asList(new Object[0]);
private final List mMoltenPosR;
private final List mMoltenPosG;
private final List mMoltenPosB;
private final List mMoltenPosA = Arrays.asList(new Object[0]);
private final List mMoltenNegR;
private final List mMoltenNegG;
private final List mMoltenNegB;
private final List mMoltenNegA = Arrays.asList(new Object[0]);
private long mAnimationTick;
private boolean mAnimationDirection;
public GT_Client() {
2015-04-23 16:14:22 +00:00
mAnimationTick = 0L;
mAnimationDirection = false;
2015-10-22 02:06:25 +00:00
mPosR = Arrays.asList(new Materials[]{
/**Materials.ChargedCertusQuartz, **/Materials.Enderium, Materials.Vinteum, Materials.Uranium235, Materials.InfusedGold, Materials.Plutonium241, Materials.NaquadahEnriched, Materials.Naquadria, Materials.InfusedOrder, Materials.Force,
Materials.Pyrotheum, Materials.Sunnarium, Materials.Glowstone, Materials.Thaumium, Materials.InfusedVis, Materials.InfusedAir, Materials.InfusedFire, Materials.FierySteel, Materials.Firestone
2015-04-23 16:14:22 +00:00
});
2015-10-22 02:06:25 +00:00
mPosG = Arrays.asList(new Materials[]{
/**Materials.ChargedCertusQuartz, **/Materials.Enderium, Materials.Vinteum, Materials.Uranium235, Materials.InfusedGold, Materials.Plutonium241, Materials.NaquadahEnriched, Materials.Naquadria, Materials.InfusedOrder, Materials.Force,
Materials.Pyrotheum, Materials.Sunnarium, Materials.Glowstone, Materials.InfusedAir, Materials.InfusedEarth
2015-04-23 16:14:22 +00:00
});
2015-10-22 02:06:25 +00:00
mPosB = Arrays.asList(new Materials[]{
/**Materials.ChargedCertusQuartz, **/Materials.Enderium, Materials.Vinteum, Materials.Uranium235, Materials.InfusedGold, Materials.Plutonium241, Materials.NaquadahEnriched, Materials.Naquadria, Materials.InfusedOrder, Materials.InfusedVis,
Materials.InfusedWater, Materials.Thaumium
2015-04-23 16:14:22 +00:00
});
2015-10-22 02:06:25 +00:00
mNegR = Arrays.asList(new Materials[]{
Materials.InfusedEntropy, Materials.NetherStar
2015-04-23 16:14:22 +00:00
});
2015-10-22 02:06:25 +00:00
mNegG = Arrays.asList(new Materials[]{
Materials.InfusedEntropy, Materials.NetherStar
2015-04-23 16:14:22 +00:00
});
2015-10-22 02:06:25 +00:00
mNegB = Arrays.asList(new Materials[]{
Materials.InfusedEntropy, Materials.NetherStar
2015-04-23 16:14:22 +00:00
});
2015-10-22 02:06:25 +00:00
mMoltenPosR = Arrays.asList(new Materials[]{
Materials.Enderium, Materials.NetherStar, Materials.Vinteum, Materials.Uranium235, Materials.InfusedGold, Materials.Plutonium241, Materials.NaquadahEnriched, Materials.Naquadria, Materials.InfusedOrder, Materials.Force,
Materials.Pyrotheum, Materials.Sunnarium, Materials.Glowstone, Materials.Thaumium, Materials.InfusedVis, Materials.InfusedAir, Materials.InfusedFire, Materials.FierySteel, Materials.Firestone
2015-04-23 16:14:22 +00:00
});
2015-10-22 02:06:25 +00:00
mMoltenPosG = Arrays.asList(new Materials[]{
Materials.Enderium, Materials.NetherStar, Materials.Vinteum, Materials.Uranium235, Materials.InfusedGold, Materials.Plutonium241, Materials.NaquadahEnriched, Materials.Naquadria, Materials.InfusedOrder, Materials.Force,
Materials.Pyrotheum, Materials.Sunnarium, Materials.Glowstone, Materials.InfusedAir, Materials.InfusedEarth
2015-04-23 16:14:22 +00:00
});
2015-10-22 02:06:25 +00:00
mMoltenPosB = Arrays.asList(new Materials[]{
Materials.Enderium, Materials.NetherStar, Materials.Vinteum, Materials.Uranium235, Materials.InfusedGold, Materials.Plutonium241, Materials.NaquadahEnriched, Materials.Naquadria, Materials.InfusedOrder, Materials.InfusedVis,
Materials.InfusedWater, Materials.Thaumium
2015-04-23 16:14:22 +00:00
});
2015-10-22 02:06:25 +00:00
mMoltenNegR = Arrays.asList(new Materials[]{
Materials.InfusedEntropy
2015-04-23 16:14:22 +00:00
});
2015-10-22 02:06:25 +00:00
mMoltenNegG = Arrays.asList(new Materials[]{
Materials.InfusedEntropy
2015-04-23 16:14:22 +00:00
});
2015-10-22 02:06:25 +00:00
mMoltenNegB = Arrays.asList(new Materials[]{
Materials.InfusedEntropy
2015-04-23 16:14:22 +00:00
});
}
2015-10-22 02:06:25 +00:00
private static void drawGrid(DrawBlockHighlightEvent aEvent) {
GL11.glPushMatrix();
GL11.glTranslated(-(aEvent.player.lastTickPosX + (aEvent.player.posX - aEvent.player.lastTickPosX) * (double) aEvent.partialTicks), -(aEvent.player.lastTickPosY + (aEvent.player.posY - aEvent.player.lastTickPosY) * (double) aEvent.partialTicks), -(aEvent.player.lastTickPosZ + (aEvent.player.posZ - aEvent.player.lastTickPosZ) * (double) aEvent.partialTicks));
GL11.glTranslated((float) aEvent.target.blockX + 0.5F, (float) aEvent.target.blockY + 0.5F, (float) aEvent.target.blockZ + 0.5F);
Rotation.sideRotations[aEvent.target.sideHit].glApply();
GL11.glTranslated(0.0D, -0.501D, 0.0D);
GL11.glLineWidth(2.0F);
GL11.glColor4f(0.0F, 0.0F, 0.0F, 0.5F);
GL11.glBegin(1);
GL11.glVertex3d(0.5D, 0.0D, -0.25D);
GL11.glVertex3d(-0.5D, 0.0D, -0.25D);
GL11.glVertex3d(0.5D, 0.0D, 0.25D);
GL11.glVertex3d(-0.5D, 0.0D, 0.25D);
GL11.glVertex3d(0.25D, 0.0D, -0.5D);
GL11.glVertex3d(0.25D, 0.0D, 0.5D);
GL11.glVertex3d(-0.25D, 0.0D, -0.5D);
GL11.glVertex3d(-0.25D, 0.0D, 0.5D);
GL11.glEnd();
GL11.glPopMatrix();
}
public boolean isServerSide() {
return true;
}
public boolean isClientSide() {
return true;
}
public boolean isBukkitSide() {
return false;
}
public EntityPlayer getThePlayer() {
return Minecraft.getMinecraft().thePlayer;
}
public int addArmor(String aPrefix) {
return RenderingRegistry.addNewArmourRendererPrefix(aPrefix);
}
public void onPreLoad() {
2015-04-23 16:14:22 +00:00
super.onPreLoad();
(new Thread(this)).start();
}
2015-10-22 02:06:25 +00:00
public void onLoad() {
super.onLoad();
new GT_Renderer_Block();
new GT_MetaGenerated_Item_Renderer();
new GT_MetaGenerated_Tool_Renderer();
new GT_Renderer_Entity_Arrow(GT_Entity_Arrow.class, "arrow");
new GT_Renderer_Entity_Arrow(GT_Entity_Arrow_Potion.class, "arrow_potions");
}
public void onPostLoad() {
2015-04-23 16:14:22 +00:00
super.onPostLoad();
2016-08-13 09:10:11 +00:00
try {
label0:
for (int i = 1; i < GregTech_API.METATILEENTITIES.length; i++)
2015-10-22 02:06:25 +00:00
do {
if (i >= GregTech_API.METATILEENTITIES.length)
2015-04-23 16:14:22 +00:00
continue label0;
2015-10-22 02:06:25 +00:00
if (GregTech_API.METATILEENTITIES[i] != null)
2015-04-23 16:14:22 +00:00
GregTech_API.METATILEENTITIES[i].getStackForm(1L).getTooltip(null, true);
i++;
2015-10-22 02:06:25 +00:00
} while (true);
2016-08-13 09:10:11 +00:00
} catch (Throwable e) {e.printStackTrace(GT_Log.err);}
2015-04-23 16:14:22 +00:00
2015-10-22 02:06:25 +00:00
// super.onPostLoad();
2015-10-22 02:06:25 +00:00
//
2015-06-23 22:29:05 +00:00
// for (int i = 1; i < GregTech_API.METATILEENTITIES.length; i++) {
// try {
// for (; i < GregTech_API.METATILEENTITIES.length; i++) if (GregTech_API.METATILEENTITIES[i] != null) GregTech_API.METATILEENTITIES[i].getStackForm(1L).getTooltip(null, true);
// } catch (Throwable e) {
// e.printStackTrace(GT_Log.err);
// }
// }
2015-04-23 16:14:22 +00:00
}
2015-10-22 02:06:25 +00:00
public void run() {
2016-08-14 02:50:59 +00:00
//skip - dead code, rly, txt files on server is now empty
2015-10-22 02:06:25 +00:00
try {
2016-08-14 02:50:59 +00:00
GT_Log.out.println("Skip: GT_Mod: Downloading Cape List.");
/*@*//*SuppressWarnings("resource")*/
//Scanner tScanner = new Scanner(new URL("http://gregtech.overminddl1.com/com/gregoriust/gregtech/supporterlist.txt").openStream());
//while (tScanner.hasNextLine()) {
//String tName = tScanner.nextLine();
//if (!this.mCapeList.contains(tName.toLowerCase())) {
//this.mCapeList.add(tName.toLowerCase());
//}
//}
2015-10-22 02:06:25 +00:00
} catch (Throwable e) {
2015-04-23 16:14:22 +00:00
}
2015-10-22 02:06:25 +00:00
try {
2016-08-14 02:50:59 +00:00
GT_Log.out.println("Skip: GT_Mod: Downloading News.");
/*@*//*SuppressWarnings("resource")*/
//Scanner tScanner = new Scanner(new URL("http://files.minecraftforge.net/maven/com/gregoriust/gregtech/message.txt").openStream());
//while (tScanner.hasNextLine()) {
//this.mMessage = (this.mMessage + tScanner.nextLine() + " ");
//}
2015-10-22 02:06:25 +00:00
} catch (Throwable e) {
2015-04-23 16:14:22 +00:00
}
}
2015-10-22 02:06:25 +00:00
@SubscribeEvent
public void onPlayerTickEventClient(TickEvent.PlayerTickEvent aEvent) {
2016-08-14 02:50:59 +00:00
if ((aEvent.side.isClient()) && (aEvent.phase == TickEvent.Phase.END) && (!aEvent.player.isDead)) {
2015-10-22 02:06:25 +00:00
ArrayList<GT_PlayedSound> tList = new ArrayList();
for (Map.Entry<GT_PlayedSound, Integer> tEntry : GT_Utility.sPlayedSoundMap.entrySet()) {
2016-08-14 02:50:59 +00:00
if (tEntry.getValue().intValue() < 0) {//Integer -> Integer -> int? >_<, fix
2015-10-22 02:06:25 +00:00
tList.add(tEntry.getKey());
} else {
2016-08-14 02:50:59 +00:00
tEntry.setValue(Integer.valueOf(tEntry.getValue().intValue() - 1));
2015-10-22 02:06:25 +00:00
}
}
GT_PlayedSound tKey;
for (Iterator i$ = tList.iterator(); i$.hasNext(); GT_Utility.sPlayedSoundMap.remove(tKey)) {
tKey = (GT_PlayedSound) i$.next();
}
2016-08-14 02:50:59 +00:00
//wut, every tick? baaad, not need (and other) -> dead code
/*if ((this.isFirstClientPlayerTick) && (aEvent.player == GT_Values.GT.getThePlayer())) {
2015-10-22 02:06:25 +00:00
this.isFirstClientPlayerTick = false;
GT_FluidStack.fixAllThoseFuckingFluidIDs();
if ((this.mMessage.length() > 5) && (GregTech_API.sSpecialFile.get(ConfigCategories.news, this.mMessage, true))) {
aEvent.player.addChatComponentMessage(new ChatComponentText(this.mMessage));
}
try {
int tVersion = Integer.parseInt(((String) Class.forName("ic2.core.IC2").getField("VERSION").get(null)).substring(4, 7));
if (GT_Values.D1) {
GT_Log.out.println("Industrialcraft Version: " + tVersion);
}
if (tVersion < 624) {
aEvent.player.addChatComponentMessage(new ChatComponentText("GregTech: Please update your IndustrialCraft here:"));
aEvent.player.addChatComponentMessage(new ChatComponentText("ic2api.player.to:8080/job/IC2_experimental/" + (GT_Mod.MAX_IC2 < Integer.MAX_VALUE ? GT_Mod.MAX_IC2 : 624) + "/"));
} else if (tVersion > GT_Mod.MAX_IC2) {
aEvent.player.addChatComponentMessage(new ChatComponentText("GregTech: Please downgrade your IndustrialCraft here:"));
aEvent.player.addChatComponentMessage(new ChatComponentText("ic2api.player.to:8080/job/IC2_experimental/" + GT_Mod.MAX_IC2 + "/"));
}
} catch (Throwable e) {
aEvent.player.addChatComponentMessage(new ChatComponentText("GregTech: Please get the recommended Version of IndustrialCraft here:"));
aEvent.player.addChatComponentMessage(new ChatComponentText("ic2api.player.to:8080/job/IC2_experimental/" + (GT_Mod.MAX_IC2 < Integer.MAX_VALUE ? GT_Mod.MAX_IC2 : 624) + "/"));
}
2016-08-14 02:50:59 +00:00
}*/
2015-04-23 16:14:22 +00:00
}
}
2015-10-22 02:06:25 +00:00
@SubscribeEvent
public void onDrawBlockHighlight(DrawBlockHighlightEvent aEvent) {
if (GT_Utility.isStackValid(aEvent.currentItem)) {
Block aBlock = aEvent.player.worldObj.getBlock(aEvent.target.blockX, aEvent.target.blockY, aEvent.target.blockZ);
TileEntity aTileEntity = aEvent.player.worldObj.getTileEntity(aEvent.target.blockX, aEvent.target.blockY, aEvent.target.blockZ);
try {
Class.forName("codechicken.lib.vec.Rotation");
if (((aTileEntity instanceof BaseMetaPipeEntity)) && (((ICoverable) aTileEntity).getCoverIDAtSide((byte) aEvent.target.sideHit) == 0) && ((GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sCovers.keySet())) || (GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sCrowbarList)) || (GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sScrewdriverList)))) {
drawGrid(aEvent);
return;
}
if ((((aTileEntity instanceof ITurnable)) || (ROTATABLE_VANILLA_BLOCKS.contains(aBlock)) || ((aTileEntity instanceof IWrenchable))) && (GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sWrenchList))) {
drawGrid(aEvent);
return;
}
} catch (Throwable e) {
if (GT_Values.D1) {
e.printStackTrace(GT_Log.err);
}
}
}
2015-04-23 16:14:22 +00:00
}
@SubscribeEvent
2015-10-22 02:06:25 +00:00
public void receiveRenderEvent(net.minecraftforge.client.event.RenderPlayerEvent.Pre aEvent) {
if (GT_Utility.getFullInvisibility(aEvent.entityPlayer)) {
2015-04-23 16:14:22 +00:00
aEvent.setCanceled(true);
return;
2015-10-22 02:06:25 +00:00
} else {
2015-04-23 16:14:22 +00:00
return;
}
}
@SubscribeEvent
2015-10-22 02:06:25 +00:00
public void onClientTickEvent(cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent aEvent) {
if (aEvent.phase == cpw.mods.fml.common.gameevent.TickEvent.Phase.END) {
2015-04-23 16:14:22 +00:00
mAnimationTick++;
2015-10-22 02:06:25 +00:00
if (mAnimationTick % 50L == 0L)
2016-08-14 02:50:59 +00:00
{mAnimationDirection = !mAnimationDirection;}
2015-04-23 16:14:22 +00:00
int tDirection = mAnimationDirection ? 1 : -1;
2015-10-22 02:06:25 +00:00
for (Iterator i$ = mPosR.iterator(); i$.hasNext(); ) {
Materials tMaterial = (Materials) i$.next();
2015-04-23 16:14:22 +00:00
tMaterial.mRGBa[0] += tDirection;
}
2015-10-22 02:06:25 +00:00
for (Iterator i$ = mPosG.iterator(); i$.hasNext(); ) {
Materials tMaterial = (Materials) i$.next();
2015-04-23 16:14:22 +00:00
tMaterial.mRGBa[1] += tDirection;
}
2015-10-22 02:06:25 +00:00
for (Iterator i$ = mPosB.iterator(); i$.hasNext(); ) {
Materials tMaterial = (Materials) i$.next();
2015-04-23 16:14:22 +00:00
tMaterial.mRGBa[2] += tDirection;
}
2015-10-22 02:06:25 +00:00
for (Iterator i$ = mPosA.iterator(); i$.hasNext(); ) {
Materials tMaterial = (Materials) i$.next();
2015-04-23 16:14:22 +00:00
tMaterial.mRGBa[3] += tDirection;
}
2015-10-22 02:06:25 +00:00
for (Iterator i$ = mNegR.iterator(); i$.hasNext(); ) {
Materials tMaterial = (Materials) i$.next();
2015-04-23 16:14:22 +00:00
tMaterial.mRGBa[0] -= tDirection;
}
2015-10-22 02:06:25 +00:00
for (Iterator i$ = mNegG.iterator(); i$.hasNext(); ) {
Materials tMaterial = (Materials) i$.next();
2015-04-23 16:14:22 +00:00
tMaterial.mRGBa[1] -= tDirection;
}
2015-10-22 02:06:25 +00:00
for (Iterator i$ = mNegB.iterator(); i$.hasNext(); ) {
Materials tMaterial = (Materials) i$.next();
2015-04-23 16:14:22 +00:00
tMaterial.mRGBa[2] -= tDirection;
}
2015-10-22 02:06:25 +00:00
for (Iterator i$ = mNegA.iterator(); i$.hasNext(); ) {
Materials tMaterial = (Materials) i$.next();
2015-04-23 16:14:22 +00:00
tMaterial.mRGBa[3] -= tDirection;
}
2015-10-22 02:06:25 +00:00
for (Iterator i$ = mMoltenPosR.iterator(); i$.hasNext(); ) {
Materials tMaterial = (Materials) i$.next();
2015-04-23 16:14:22 +00:00
tMaterial.mMoltenRGBa[0] += tDirection;
}
2015-10-22 02:06:25 +00:00
for (Iterator i$ = mMoltenPosG.iterator(); i$.hasNext(); ) {
Materials tMaterial = (Materials) i$.next();
2015-04-23 16:14:22 +00:00
tMaterial.mMoltenRGBa[1] += tDirection;
}
2015-10-22 02:06:25 +00:00
for (Iterator i$ = mMoltenPosB.iterator(); i$.hasNext(); ) {
Materials tMaterial = (Materials) i$.next();
2015-04-23 16:14:22 +00:00
tMaterial.mMoltenRGBa[2] += tDirection;
}
2015-10-22 02:06:25 +00:00
for (Iterator i$ = mMoltenPosA.iterator(); i$.hasNext(); ) {
Materials tMaterial = (Materials) i$.next();
2015-04-23 16:14:22 +00:00
tMaterial.mMoltenRGBa[3] += tDirection;
}
2015-10-22 02:06:25 +00:00
for (Iterator i$ = mMoltenNegR.iterator(); i$.hasNext(); ) {
Materials tMaterial = (Materials) i$.next();
2015-04-23 16:14:22 +00:00
tMaterial.mMoltenRGBa[0] -= tDirection;
}
2015-10-22 02:06:25 +00:00
for (Iterator i$ = mMoltenNegG.iterator(); i$.hasNext(); ) {
Materials tMaterial = (Materials) i$.next();
2015-04-23 16:14:22 +00:00
tMaterial.mMoltenRGBa[1] -= tDirection;
}
2015-10-22 02:06:25 +00:00
for (Iterator i$ = mMoltenNegB.iterator(); i$.hasNext(); ) {
Materials tMaterial = (Materials) i$.next();
2015-04-23 16:14:22 +00:00
tMaterial.mMoltenRGBa[2] -= tDirection;
}
2015-10-22 02:06:25 +00:00
for (Iterator i$ = mMoltenNegA.iterator(); i$.hasNext(); ) {
Materials tMaterial = (Materials) i$.next();
2015-04-23 16:14:22 +00:00
tMaterial.mMoltenRGBa[3] -= tDirection;
}
}
}
2015-10-22 02:06:25 +00:00
public void doSonictronSound(ItemStack aStack, World aWorld, double aX, double aY, double aZ) {
if (GT_Utility.isStackInvalid(aStack))
2015-04-23 16:14:22 +00:00
return;
String tString = "note.harp";
int i = 0;
int j = mSoundItems.size();
2015-10-22 02:06:25 +00:00
do {
if (i >= j)
2015-04-23 16:14:22 +00:00
break;
2015-10-22 02:06:25 +00:00
if (GT_Utility.areStacksEqual((ItemStack) mSoundItems.get(i), aStack)) {
tString = (String) mSoundNames.get(i);
2015-04-23 16:14:22 +00:00
break;
}
i++;
2015-10-22 02:06:25 +00:00
} while (true);
if (tString.startsWith("random.explode"))
if (aStack.stackSize == 3)
2015-04-23 16:14:22 +00:00
tString = "random.fuse";
2015-10-22 02:06:25 +00:00
else if (aStack.stackSize == 2)
2015-04-23 16:14:22 +00:00
tString = "random.old_explode";
2015-10-22 02:06:25 +00:00
if (tString.startsWith("streaming."))
switch (aStack.stackSize) {
case 1: // '\001'
tString = (new StringBuilder()).append(tString).append("13").toString();
break;
case 2: // '\002'
tString = (new StringBuilder()).append(tString).append("cat").toString();
break;
case 3: // '\003'
tString = (new StringBuilder()).append(tString).append("blocks").toString();
break;
case 4: // '\004'
tString = (new StringBuilder()).append(tString).append("chirp").toString();
break;
case 5: // '\005'
tString = (new StringBuilder()).append(tString).append("far").toString();
break;
case 6: // '\006'
tString = (new StringBuilder()).append(tString).append("mall").toString();
break;
case 7: // '\007'
tString = (new StringBuilder()).append(tString).append("mellohi").toString();
break;
case 8: // '\b'
tString = (new StringBuilder()).append(tString).append("stal").toString();
break;
case 9: // '\t'
tString = (new StringBuilder()).append(tString).append("strad").toString();
break;
case 10: // '\n'
tString = (new StringBuilder()).append(tString).append("ward").toString();
break;
case 11: // '\013'
tString = (new StringBuilder()).append(tString).append("11").toString();
break;
case 12: // '\f'
tString = (new StringBuilder()).append(tString).append("wait").toString();
break;
default:
tString = (new StringBuilder()).append(tString).append("wherearewenow").toString();
break;
2015-04-23 16:14:22 +00:00
}
2015-10-22 02:06:25 +00:00
if (tString.startsWith("streaming."))
aWorld.playRecord(tString.substring(10, tString.length()), (int) aX, (int) aY, (int) aZ);
2015-04-23 16:14:22 +00:00
else
2015-10-22 02:06:25 +00:00
aWorld.playSound(aX, aY, aZ, tString, 3F, tString.startsWith("note.") ? (float) Math.pow(2D, (double) (aStack.stackSize - 13) / 12D) : 1.0F, false);
2015-04-23 16:14:22 +00:00
}
}