forked from Dynious/SoundsCool
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Now using Simple Network Implementation. IMessage instead of IPacket.
- Loading branch information
Showing
27 changed files
with
1,215 additions
and
1,153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,64 @@ | ||
package com.dynious.soundscool; | ||
|
||
import com.dynious.soundscool.block.ModBlocks; | ||
import com.dynious.soundscool.command.CommandSoundsCool; | ||
import com.dynious.soundscool.creativetab.CreativeTabSoundsCool; | ||
import com.dynious.soundscool.handler.GuiHandler; | ||
import com.dynious.soundscool.handler.SoundHandler; | ||
import com.dynious.soundscool.lib.Reference; | ||
import com.dynious.soundscool.proxy.CommonProxy; | ||
import cpw.mods.fml.common.Mod; | ||
import cpw.mods.fml.common.Mod.EventHandler; | ||
import cpw.mods.fml.common.Mod.Instance; | ||
import cpw.mods.fml.common.SidedProxy; | ||
import cpw.mods.fml.common.event.FMLInitializationEvent; | ||
import cpw.mods.fml.common.event.FMLPreInitializationEvent; | ||
import cpw.mods.fml.common.event.FMLServerStartingEvent; | ||
import cpw.mods.fml.common.network.NetworkRegistry; | ||
import net.minecraft.creativetab.CreativeTabs; | ||
|
||
@Mod(modid = Reference.modid, name = Reference.name, version = Reference.version) | ||
public class SoundsCool | ||
{ | ||
@Instance(Reference.modid) | ||
public static SoundsCool instance; | ||
|
||
@SidedProxy(clientSide = Reference.clientProxy, serverSide = Reference.commonProxy) | ||
public static CommonProxy proxy; | ||
|
||
public static CreativeTabs tabSoundsCool = new CreativeTabSoundsCool(CreativeTabs.getNextID(), Reference.modid); | ||
|
||
@EventHandler | ||
public void preInit(FMLPreInitializationEvent event) | ||
{ | ||
proxy.soundSetup(); | ||
|
||
proxy.UISetup(); | ||
|
||
SoundHandler.findSounds(); | ||
|
||
ModBlocks.init(); | ||
|
||
proxy.initNetworking(); | ||
} | ||
|
||
@EventHandler | ||
public void init(FMLInitializationEvent event) | ||
{ | ||
|
||
proxy.initTileEntities(); | ||
|
||
NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler()); | ||
} | ||
|
||
@EventHandler | ||
public void serverStarting(FMLServerStartingEvent event) | ||
{ | ||
event.registerServerCommand(new CommandSoundsCool()); | ||
} | ||
} | ||
package com.dynious.soundscool; | ||
|
||
import net.minecraft.creativetab.CreativeTabs; | ||
|
||
import com.dynious.soundscool.block.ModBlocks; | ||
import com.dynious.soundscool.command.CommandSoundsCool; | ||
import com.dynious.soundscool.creativetab.CreativeTabSoundsCool; | ||
import com.dynious.soundscool.handler.GuiHandler; | ||
import com.dynious.soundscool.handler.SoundHandler; | ||
import com.dynious.soundscool.lib.Reference; | ||
import com.dynious.soundscool.proxy.CommonProxy; | ||
|
||
import cpw.mods.fml.common.Mod; | ||
import cpw.mods.fml.common.Mod.EventHandler; | ||
import cpw.mods.fml.common.Mod.Instance; | ||
import cpw.mods.fml.common.SidedProxy; | ||
import cpw.mods.fml.common.event.FMLInitializationEvent; | ||
import cpw.mods.fml.common.event.FMLPreInitializationEvent; | ||
import cpw.mods.fml.common.event.FMLServerStartingEvent; | ||
import cpw.mods.fml.common.network.NetworkRegistry; | ||
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; | ||
|
||
@Mod(modid = Reference.modid, name = Reference.name, version = Reference.version) | ||
public class SoundsCool | ||
{ | ||
@Instance(Reference.modid) | ||
public static SoundsCool instance; | ||
|
||
@SidedProxy(clientSide = Reference.clientProxy, serverSide = Reference.commonProxy) | ||
public static CommonProxy proxy; | ||
|
||
public static CreativeTabs tabSoundsCool = new CreativeTabSoundsCool(CreativeTabs.getNextID(), Reference.modid); | ||
|
||
public static SimpleNetworkWrapper network = NetworkRegistry.INSTANCE.newSimpleChannel("soundscool"); | ||
|
||
@EventHandler | ||
public void preInit(FMLPreInitializationEvent event) | ||
{ | ||
proxy.registerMessages(); | ||
|
||
proxy.soundSetup(); | ||
|
||
proxy.UISetup(); | ||
|
||
SoundHandler.findSounds(); | ||
|
||
ModBlocks.init(); | ||
} | ||
|
||
@EventHandler | ||
public void init(FMLInitializationEvent event) | ||
{ | ||
|
||
proxy.initTileEntities(); | ||
|
||
NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler()); | ||
} | ||
|
||
@EventHandler | ||
public void serverStarting(FMLServerStartingEvent event) | ||
{ | ||
event.registerServerCommand(new CommandSoundsCool()); | ||
} | ||
} |
148 changes: 75 additions & 73 deletions
148
java/com/dynious/soundscool/client/gui/GuiAdminPanel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,75 @@ | ||
package com.dynious.soundscool.client.gui; | ||
|
||
import com.dynious.soundscool.SoundsCool; | ||
import com.dynious.soundscool.network.packet.client.GetUploadedSoundsPacket; | ||
import net.minecraft.client.gui.GuiButton; | ||
import net.minecraft.client.gui.GuiScreen; | ||
import net.minecraft.client.gui.GuiTextField; | ||
import net.minecraft.client.resources.I18n; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
|
||
public class GuiAdminPanel extends GuiScreen | ||
{ | ||
private EntityPlayer player; | ||
private GuiTextField maxSounds; | ||
|
||
public GuiAdminPanel(EntityPlayer player) | ||
{ | ||
this.player = player; | ||
SoundsCool.proxy.getChannel().writeOutbound(new GetUploadedSoundsPacket(player)); | ||
} | ||
|
||
@Override | ||
public void initGui() | ||
{ | ||
super.initGui(); | ||
this.buttonList.add(new GuiButton(0, getWidth() / 2, getHeight() - 42, I18n.format("gui.done"))); | ||
maxSounds = new GuiTextField(fontRendererObj, getWidth()/2, getHeight()/2, 20, 15); | ||
} | ||
|
||
@Override | ||
public void updateScreen() | ||
{ | ||
super.updateScreen(); | ||
} | ||
|
||
@Override | ||
public void drawScreen(int p_571_1_, int p_571_2_, float p_571_3_) | ||
{ | ||
|
||
} | ||
|
||
@Override | ||
protected void actionPerformed(GuiButton button) | ||
{ | ||
if (button.enabled) | ||
{ | ||
switch (button.id) | ||
{ | ||
case 0: | ||
this.mc.displayGuiScreen(null); | ||
this.mc.setIngameFocus(); | ||
break; | ||
|
||
} | ||
} | ||
} | ||
|
||
public int getWidth() | ||
{ | ||
return width; | ||
} | ||
|
||
public int getHeight() | ||
{ | ||
return height; | ||
} | ||
|
||
@Override | ||
public boolean doesGuiPauseGame() | ||
{ | ||
return false; | ||
} | ||
} | ||
package com.dynious.soundscool.client.gui; | ||
|
||
import com.dynious.soundscool.SoundsCool; | ||
import com.dynious.soundscool.helper.NetworkHelper; | ||
import com.dynious.soundscool.network.packet.client.GetUploadedSoundsPacket; | ||
|
||
import net.minecraft.client.gui.GuiButton; | ||
import net.minecraft.client.gui.GuiScreen; | ||
import net.minecraft.client.gui.GuiTextField; | ||
import net.minecraft.client.resources.I18n; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
|
||
public class GuiAdminPanel extends GuiScreen | ||
{ | ||
private EntityPlayer player; | ||
private GuiTextField maxSounds; | ||
|
||
public GuiAdminPanel(EntityPlayer player) | ||
{ | ||
this.player = player; | ||
NetworkHelper.syncPlayerSounds(player); | ||
} | ||
|
||
@Override | ||
public void initGui() | ||
{ | ||
super.initGui(); | ||
this.buttonList.add(new GuiButton(0, getWidth() / 2, getHeight() - 42, I18n.format("gui.done"))); | ||
maxSounds = new GuiTextField(fontRendererObj, getWidth()/2, getHeight()/2, 20, 15); | ||
} | ||
|
||
@Override | ||
public void updateScreen() | ||
{ | ||
super.updateScreen(); | ||
} | ||
|
||
@Override | ||
public void drawScreen(int p_571_1_, int p_571_2_, float p_571_3_) | ||
{ | ||
|
||
} | ||
|
||
@Override | ||
protected void actionPerformed(GuiButton button) | ||
{ | ||
if (button.enabled) | ||
{ | ||
switch (button.id) | ||
{ | ||
case 0: | ||
this.mc.displayGuiScreen(null); | ||
this.mc.setIngameFocus(); | ||
break; | ||
|
||
} | ||
} | ||
} | ||
|
||
public int getWidth() | ||
{ | ||
return width; | ||
} | ||
|
||
public int getHeight() | ||
{ | ||
return height; | ||
} | ||
|
||
@Override | ||
public boolean doesGuiPauseGame() | ||
{ | ||
return false; | ||
} | ||
} |
Oops, something went wrong.