Merge branch 'master' into development

Conflicts:
	common/mekanism/client/ClientProxy.java
	common/mekanism/client/HolidayManager.java
	common/mekanism/client/sound/SoundHandler.java
	common/mekanism/client/sound/TileSound.java
This commit is contained in:
Aidan C. Brady 2013-12-24 14:44:17 -05:00
commit d63628bebc
13 changed files with 71 additions and 40 deletions

View file

@ -5,8 +5,6 @@ import java.io.File;
import java.util.HashMap;
import mekanism.client.gui.GuiChemicalFormulator;
import mekanism.client.gui.GuiChemicalInfuser;
import mekanism.client.gui.GuiChemicalInjectionChamber;
import mekanism.client.gui.GuiCombiner;
import mekanism.client.gui.GuiConfiguration;
import mekanism.client.gui.GuiCredits;
@ -35,12 +33,10 @@ import mekanism.client.gui.GuiRobitSmelting;
import mekanism.client.gui.GuiRotaryCondensentrator;
import mekanism.client.gui.GuiTeleporter;
import mekanism.client.render.MekanismRenderer;
import mekanism.client.render.RenderPartTransmitter;
import mekanism.client.render.RenderTickHandler;
import mekanism.client.render.block.BasicRenderingHandler;
import mekanism.client.render.block.MachineRenderingHandler;
import mekanism.client.render.block.TransmitterRenderingHandler;
import mekanism.client.render.entity.RenderBalloon;
import mekanism.client.render.entity.RenderObsidianTNTPrimed;
import mekanism.client.render.entity.RenderRobit;
import mekanism.client.render.item.ItemRenderingHandler;
@ -65,10 +61,8 @@ import mekanism.client.render.tileentity.RenderUniversalCable;
import mekanism.client.sound.Sound;
import mekanism.client.sound.SoundHandler;
import mekanism.common.CommonProxy;
import mekanism.common.EntityBalloon;
import mekanism.common.EntityObsidianTNT;
import mekanism.common.EntityRobit;
import mekanism.common.HolidayManager;
import mekanism.common.IElectricChest;
import mekanism.common.IInvConfiguration;
import mekanism.common.Mekanism;
@ -80,8 +74,6 @@ import mekanism.common.tileentity.TileEntityAdvancedFactory;
import mekanism.common.tileentity.TileEntityBin;
import mekanism.common.tileentity.TileEntityChargepad;
import mekanism.common.tileentity.TileEntityChemicalFormulator;
import mekanism.common.tileentity.TileEntityChemicalInfuser;
import mekanism.common.tileentity.TileEntityChemicalInjectionChamber;
import mekanism.common.tileentity.TileEntityCombiner;
import mekanism.common.tileentity.TileEntityCrusher;
import mekanism.common.tileentity.TileEntityDigitalMiner;
@ -146,7 +138,8 @@ public class ClientProxy extends CommonProxy
Mekanism.configuration.load();
MekanismClient.enableSounds = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EnableSounds", true).getBoolean(true);
MekanismClient.fancyUniversalCableRender = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "FancyUniversalCableRender", true).getBoolean(true);
MekanismClient.baseSoundVolume = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "SoundVolume", 1.0D).getDouble(1.0D);
MekanismClient.holidays = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "Holidays", true).getBoolean(true);
MekanismClient.baseSoundVolume = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "SoundVolume", 1).getDouble(1);
Mekanism.configuration.save();
}
@ -270,18 +263,14 @@ public class ClientProxy extends CommonProxy
ClientRegistry.registerTileEntity(TileEntityDigitalMiner.class, "DigitalMiner", new RenderDigitalMiner());
ClientRegistry.registerTileEntity(TileEntityRotaryCondensentrator.class, "RotaryCondensentrator", new RenderRotaryCondensentrator());
ClientRegistry.registerTileEntity(TileEntityTeleporter.class, "MekanismTeleporter", new RenderTeleporter());
ClientRegistry.registerTileEntity(TileEntityChemicalInjectionChamber.class, "ChemicalInjectionChamber", new RenderConfigurableMachine());
}
@Override
public void registerRenderInformation()
{
RenderPartTransmitter.init();
//Register entity rendering handlers
RenderingRegistry.registerEntityRenderingHandler(EntityObsidianTNT.class, new RenderObsidianTNTPrimed());
RenderingRegistry.registerEntityRenderingHandler(EntityRobit.class, new RenderRobit());
RenderingRegistry.registerEntityRenderingHandler(EntityBalloon.class, new RenderBalloon());
//Register item handler
ItemRenderingHandler handler = new ItemRenderingHandler();
@ -295,10 +284,6 @@ public class ClientProxy extends CommonProxy
MinecraftForgeClient.registerItemRenderer(Mekanism.obsidianTNTID, handler);
MinecraftForgeClient.registerItemRenderer(Mekanism.basicBlockID, handler);
MinecraftForgeClient.registerItemRenderer(Mekanism.Jetpack.itemID, handler);
MinecraftForgeClient.registerItemRenderer(Mekanism.PartTransmitter.itemID, handler);
MinecraftForgeClient.registerItemRenderer(Mekanism.GasMask.itemID, handler);
MinecraftForgeClient.registerItemRenderer(Mekanism.ScubaTank.itemID, handler);
MinecraftForgeClient.registerItemRenderer(Mekanism.Balloon.itemID, handler);
//Register block handlers
RenderingRegistry.registerBlockHandler(new MachineRenderingHandler());
@ -389,10 +374,6 @@ public class ClientProxy extends CommonProxy
return new GuiRobitRepair(player.inventory, world, x);
case 29:
return new GuiChemicalFormulator(player.inventory, (TileEntityChemicalFormulator)tileEntity);
case 30:
return new GuiChemicalInfuser(player.inventory, (TileEntityChemicalInfuser)tileEntity);
case 31:
return new GuiChemicalInjectionChamber(player.inventory, (TileEntityAdvancedElectricMachine)tileEntity);
}
return null;
@ -486,12 +467,4 @@ public class ClientProxy extends CommonProxy
{
return Minecraft.getMinecraft().mcDataDir;
}
@Override
public void onConfigSync()
{
super.onConfigSync();
MekanismClient.voiceClient.start();
}
}

View file

@ -12,7 +12,6 @@ import mekanism.api.EnumColor;
import mekanism.api.IClientTicker;
import mekanism.client.sound.GasMaskSound;
import mekanism.client.sound.JetpackSound;
import mekanism.common.HolidayManager;
import mekanism.common.Mekanism;
import mekanism.common.ObfuscatedNames;
import mekanism.common.PacketHandler;

View file

@ -1,4 +1,4 @@
package mekanism.common;
package mekanism.client;
import java.util.ArrayList;
import java.util.Calendar;
@ -18,9 +18,12 @@ public final class HolidayManager
private static List<Holiday> holidaysNotified = new ArrayList<Holiday>();
public static void init()
{
if(MekanismClient.holidays)
{
holidays.add(new Christmas());
holidays.add(new NewYear());
}
System.out.println("[Mekanism] Initialized HolidayManager.");
}
@ -46,6 +49,11 @@ public final class HolidayManager
public static String filterSound(String sound)
{
if(!MekanismClient.holidays)
{
return sound;
}
try {
YearlyDate date = getDate();
@ -80,6 +88,8 @@ public final class HolidayManager
private static class Christmas extends Holiday
{
private String[] nutcracker = new String[] {"holiday/Nutcracker1.ogg", "holiday/Nutcracker2.ogg", "holiday/Nutcracker3.ogg", "holiday/Nutcracker4.ogg", "holiday/Nutcracker5.ogg"};
@Override
public YearlyDate getDate()
{
@ -98,6 +108,33 @@ public final class HolidayManager
player.sendChatToPlayer(ChatMessageComponent.createFromText(EnumColor.DARK_GREY + "-aidancbrady"));
player.sendChatToPlayer(ChatMessageComponent.createFromText(themedLines + EnumColor.DARK_BLUE + "[=======]" + themedLines));
}
@Override
public String filterSound(String sound)
{
if(sound.equals("Chamber.ogg"))
{
return nutcracker[0];
}
else if(sound.equals("MetallurgicInfuser.ogg"))
{
return nutcracker[1];
}
else if(sound.equals("PurificationChamber.ogg"))
{
return nutcracker[2];
}
else if(sound.equals("Smelter.ogg"))
{
return nutcracker[3];
}
else if(sound.equals("HeatGenerator.ogg"))
{
return nutcracker[4];
}
return sound;
}
}
private static class NewYear extends Holiday

View file

@ -24,6 +24,7 @@ public class MekanismClient extends Mekanism
//General Configuration
public static boolean enableSounds = true;
public static boolean fancyUniversalCableRender = true;
public static boolean holidays = true;
public static double baseSoundVolume = 1;
public static long ticksPassed = 0;

View file

@ -14,7 +14,8 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import mekanism.api.Coord4D;
import mekanism.common.HolidayManager;
import mekanism.client.HolidayManager;
import mekanism.client.MekanismClient;
import mekanism.common.Mekanism;
import net.minecraft.client.Minecraft;
import net.minecraft.tileentity.TileEntity;
@ -62,7 +63,7 @@ public class SoundHandler
for(String s : listings)
{
if(s.contains("etc"))
if(s.contains("etc") || s.contains("holiday"))
{
continue;
}
@ -90,6 +91,26 @@ public class SoundHandler
}
System.out.println("[Mekanism] Initialized " + listings.size() + " sound effects.");
if(MekanismClient.holidays)
{
listings = listFiles(corePath.replace("%20", " ").replace(".jar!", ".jar").replace("file:", ""), "assets/mekanism/sound/holiday");
for(String s : listings)
{
if(s.contains("/mekanism/sound/"))
{
s = s.split("/mekanism/sound/")[1];
}
if(!s.contains("holiday"))
{
s = "holiday/" + s;
}
preloadSound(s);
}
}
}
private List<String> listFiles(String path, String s)

View file

@ -1,6 +1,7 @@
package mekanism.client.sound;
import mekanism.api.Pos3D;
import mekanism.client.HolidayManager;
import mekanism.common.IActiveState;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
@ -57,7 +58,7 @@ public class TileSound extends Sound
{
return false;
}
else if(!((IHasSound)tileEntity).getSoundPath().equals(soundPath))
else if(!HolidayManager.filterSound(((IHasSound)tileEntity).getSoundPath()).equals(soundPath))
{
return false;
}

View file

@ -920,6 +920,7 @@ public class Mekanism
voiceManager.stop();
}
//Clear all cache data
teleporters.clear();
dynamicInventories.clear();
ic2Registered.clear();
@ -979,9 +980,6 @@ public class Mekanism
//Get data from server.
new ThreadGetData();
//Initiate the HolidayManager for seasonal greetings.
HolidayManager.init();
//Register to receive subscribed events
MinecraftForge.EVENT_BUS.register(this);

View file

@ -822,6 +822,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds
if(((IUpgradeManagement)itemStack.getItem()).supportsUpgrades(itemStack))
{
IUpgradeManagement upgrade = (IUpgradeManagement)itemStack.getItem();
upgrade.setEnergyMultiplier(((IUpgradeManagement)tileEntity).getEnergyMultiplier(), itemStack);
upgrade.setSpeedMultiplier(((IUpgradeManagement)tileEntity).getSpeedMultiplier(), itemStack);
}