diff --git a/common/mekanism/client/ClientProxy.java b/common/mekanism/client/ClientProxy.java index 5b9a8fa05..8a093ce27 100644 --- a/common/mekanism/client/ClientProxy.java +++ b/common/mekanism/client/ClientProxy.java @@ -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(); - } } diff --git a/common/mekanism/client/ClientTickHandler.java b/common/mekanism/client/ClientTickHandler.java index f4576e76d..a40070143 100644 --- a/common/mekanism/client/ClientTickHandler.java +++ b/common/mekanism/client/ClientTickHandler.java @@ -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; diff --git a/common/mekanism/common/HolidayManager.java b/common/mekanism/client/HolidayManager.java similarity index 85% rename from common/mekanism/common/HolidayManager.java rename to common/mekanism/client/HolidayManager.java index e5212f1e0..1f4c168cd 100644 --- a/common/mekanism/common/HolidayManager.java +++ b/common/mekanism/client/HolidayManager.java @@ -1,4 +1,4 @@ -package mekanism.common; +package mekanism.client; import java.util.ArrayList; import java.util.Calendar; @@ -19,8 +19,11 @@ public final class HolidayManager public static void init() { - holidays.add(new Christmas()); - holidays.add(new NewYear()); + 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 diff --git a/common/mekanism/client/MekanismClient.java b/common/mekanism/client/MekanismClient.java index 2cf3a4e44..3aaaad10e 100644 --- a/common/mekanism/client/MekanismClient.java +++ b/common/mekanism/client/MekanismClient.java @@ -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; diff --git a/common/mekanism/client/sound/SoundHandler.java b/common/mekanism/client/sound/SoundHandler.java index 73be21581..a9281862e 100644 --- a/common/mekanism/client/sound/SoundHandler.java +++ b/common/mekanism/client/sound/SoundHandler.java @@ -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 listFiles(String path, String s) diff --git a/common/mekanism/client/sound/TileSound.java b/common/mekanism/client/sound/TileSound.java index cfeae3b23..56249bef6 100644 --- a/common/mekanism/client/sound/TileSound.java +++ b/common/mekanism/client/sound/TileSound.java @@ -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; } diff --git a/common/mekanism/common/Mekanism.java b/common/mekanism/common/Mekanism.java index f3cd22f5a..0e680526f 100644 --- a/common/mekanism/common/Mekanism.java +++ b/common/mekanism/common/Mekanism.java @@ -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); diff --git a/common/mekanism/common/block/BlockMachine.java b/common/mekanism/common/block/BlockMachine.java index e8600e108..f739f4e1d 100644 --- a/common/mekanism/common/block/BlockMachine.java +++ b/common/mekanism/common/block/BlockMachine.java @@ -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); } diff --git a/resources/assets/mekanism/sound/holiday/Nutcracker1.ogg b/resources/assets/mekanism/sound/holiday/Nutcracker1.ogg new file mode 100644 index 000000000..3a66b2712 Binary files /dev/null and b/resources/assets/mekanism/sound/holiday/Nutcracker1.ogg differ diff --git a/resources/assets/mekanism/sound/holiday/Nutcracker2.ogg b/resources/assets/mekanism/sound/holiday/Nutcracker2.ogg new file mode 100644 index 000000000..53ee10ced Binary files /dev/null and b/resources/assets/mekanism/sound/holiday/Nutcracker2.ogg differ diff --git a/resources/assets/mekanism/sound/holiday/Nutcracker3.ogg b/resources/assets/mekanism/sound/holiday/Nutcracker3.ogg new file mode 100644 index 000000000..e0572afe3 Binary files /dev/null and b/resources/assets/mekanism/sound/holiday/Nutcracker3.ogg differ diff --git a/resources/assets/mekanism/sound/holiday/Nutcracker4.ogg b/resources/assets/mekanism/sound/holiday/Nutcracker4.ogg new file mode 100644 index 000000000..7b7dfbc17 Binary files /dev/null and b/resources/assets/mekanism/sound/holiday/Nutcracker4.ogg differ diff --git a/resources/assets/mekanism/sound/holiday/Nutcracker5.ogg b/resources/assets/mekanism/sound/holiday/Nutcracker5.ogg new file mode 100644 index 000000000..78116bd45 Binary files /dev/null and b/resources/assets/mekanism/sound/holiday/Nutcracker5.ogg differ