Work on a little Christmas surprise
This commit is contained in:
parent
9498b01475
commit
fd26b9b11b
2 changed files with 24 additions and 2 deletions
common/mekanism
|
@ -14,9 +14,9 @@ import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipInputStream;
|
import java.util.zip.ZipInputStream;
|
||||||
|
|
||||||
import mekanism.api.Coord4D;
|
import mekanism.api.Coord4D;
|
||||||
|
import mekanism.common.HolidayManager;
|
||||||
import mekanism.common.Mekanism;
|
import mekanism.common.Mekanism;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
@ -246,7 +246,7 @@ public class SoundHandler
|
||||||
{
|
{
|
||||||
if(obj instanceof TileEntity)
|
if(obj instanceof TileEntity)
|
||||||
{
|
{
|
||||||
new TileSound(getIdentifier(), ((IHasSound)obj).getSoundPath(), (TileEntity)obj);
|
new TileSound(getIdentifier(), HolidayManager.filterSound(((IHasSound)obj).getSoundPath()), (TileEntity)obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,23 @@ public final class HolidayManager
|
||||||
} catch(Exception e) {}
|
} catch(Exception e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String filterSound(String sound)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
YearlyDate date = getDate();
|
||||||
|
|
||||||
|
for(Holiday holiday : holidays)
|
||||||
|
{
|
||||||
|
if(holiday.getDate().equals(date))
|
||||||
|
{
|
||||||
|
return holiday.filterSound(sound);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch(Exception e) {}
|
||||||
|
|
||||||
|
return sound;
|
||||||
|
}
|
||||||
|
|
||||||
private static YearlyDate getDate()
|
private static YearlyDate getDate()
|
||||||
{
|
{
|
||||||
return new YearlyDate(calendar.get(Calendar.MONTH)+1, calendar.get(Calendar.DAY_OF_MONTH));
|
return new YearlyDate(calendar.get(Calendar.MONTH)+1, calendar.get(Calendar.DAY_OF_MONTH));
|
||||||
|
@ -54,6 +71,11 @@ public final class HolidayManager
|
||||||
public abstract YearlyDate getDate();
|
public abstract YearlyDate getDate();
|
||||||
|
|
||||||
public abstract void onEvent(EntityPlayer player);
|
public abstract void onEvent(EntityPlayer player);
|
||||||
|
|
||||||
|
public String filterSound(String sound)
|
||||||
|
{
|
||||||
|
return sound;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class Christmas extends Holiday
|
private static class Christmas extends Holiday
|
||||||
|
|
Loading…
Add table
Reference in a new issue