Preload sounds on game startup, immediately fire updateScreen() on OreDict filter calculation, added restriction transporter recipe
This commit is contained in:
parent
2b37fe367a
commit
a00a557f2b
5 changed files with 48 additions and 7 deletions
|
@ -28,6 +28,8 @@ public class ClientTickHandler implements ITickHandler
|
|||
{
|
||||
public boolean hasNotified = false;
|
||||
|
||||
public boolean preloadedSounds = false;
|
||||
|
||||
public Minecraft mc = FMLClientHandler.instance().getClient();
|
||||
|
||||
public static final String MIKE_CAPE = "https://dl.dropboxusercontent.com/s/ji06yflixnszcby/cape.png";
|
||||
|
@ -41,6 +43,18 @@ public class ClientTickHandler implements ITickHandler
|
|||
@Override
|
||||
public void tickStart(EnumSet<TickType> type, Object... tickData)
|
||||
{
|
||||
if(!preloadedSounds && mc.sndManager.sndSystem != null)
|
||||
{
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
preloadedSounds = true;
|
||||
MekanismClient.audioHandler.preloadSounds();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
if(!hasNotified && mc.theWorld != null && Mekanism.latestVersionNumber != null && Mekanism.recentNews != null)
|
||||
{
|
||||
MekanismUtils.checkForUpdates(mc.thePlayer);
|
||||
|
|
|
@ -456,6 +456,7 @@ public class GuiLogisticalSorter extends GuiMekanism
|
|||
}
|
||||
|
||||
stackSwitch = 0;
|
||||
updateScreen();
|
||||
oreDictStacks.get(filter).stackIndex = -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package mekanism.client.sound;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
@ -42,9 +43,37 @@ public class SoundHandler
|
|||
public SoundHandler()
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
|
||||
System.out.println("[Mekanism] Successfully set up SoundHandler.");
|
||||
}
|
||||
|
||||
public void preloadSounds()
|
||||
{
|
||||
URL url = getClass().getClassLoader().getResource("assets/mekanism/sound");
|
||||
File dir = new File(url.getFile());
|
||||
|
||||
for(File file : dir.listFiles())
|
||||
{
|
||||
if(!file.isDirectory() && file.getName().endsWith(".ogg"))
|
||||
{
|
||||
preloadSound(file.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void preloadSound(String sound)
|
||||
{
|
||||
String id = "pre_" + sound;
|
||||
URL url = getClass().getClassLoader().getResource("assets/mekanism/sound/" + sound);
|
||||
|
||||
if(getSoundSystem() != null)
|
||||
{
|
||||
getSoundSystem().newSource(false, id, url, sound, true, 0, 0, 0, 0, 16F);
|
||||
getSoundSystem().activate(id);
|
||||
getSoundSystem().removeSource(id);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ticks the sound handler. Should be called every Minecraft tick, or 20 times per second.
|
||||
*/
|
||||
|
|
|
@ -414,11 +414,14 @@ public class Mekanism
|
|||
" O", "SCS", " S ", Character.valueOf('O'), "ingotOsmium", Character.valueOf('S'), "ingotSteel", Character.valueOf('C'), "circuitBasic"
|
||||
}));
|
||||
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(Transmitter, 8, 3), new Object[] {
|
||||
"S S", Character.valueOf('S'), "ingotSteel"
|
||||
"SCS", Character.valueOf('S'), "ingotSteel", Character.valueOf('C'), "circuitBasic"
|
||||
}));
|
||||
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(MachineBlock, 1, 15), new Object[] {
|
||||
"IPI", "ICI", "III", Character.valueOf('I'), Item.ingotIron, Character.valueOf('P'), Block.pistonBase, Character.valueOf('C'), "circuitBasic"
|
||||
}));
|
||||
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(Transmitter, 8, 4), new Object[] {
|
||||
"SBS", Character.valueOf('S'), "ingotSteel", Character.valueOf('B'), Block.fenceIron
|
||||
}));
|
||||
|
||||
//Factory Recipes
|
||||
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(MekanismUtils.getFactory(FactoryTier.BASIC, RecipeType.SMELTING), new Object[] {
|
||||
|
|
|
@ -78,12 +78,6 @@ public class ItemConfigurator extends ItemEnergized
|
|||
return true;
|
||||
}
|
||||
}
|
||||
else if(world.getBlockTileEntity(x, y, z) instanceof TileEntityLogisticalTransporter)
|
||||
{
|
||||
TileEntityLogisticalTransporter transporter = (TileEntityLogisticalTransporter)world.getBlockTileEntity(x, y, z);
|
||||
transporter.insert(new Object3D(x, y, z).getFromSide(ForgeDirection.getOrientation(side)), new ItemStack(Item.appleRed), EnumColor.RED);
|
||||
return true;
|
||||
}
|
||||
else if(world.getBlockTileEntity(x, y, z) instanceof ITransmitter)
|
||||
{
|
||||
((ITransmitter)world.getBlockTileEntity(x, y, z)).fixTransmitterNetwork();
|
||||
|
|
Loading…
Reference in a new issue