Generic Gui handler that now passes the getGuiElement calls to the respective client/server proxies (meant to minimize the number of uncommon classes we have). Might have to reconsider this if the proxies become too bloated.

First stab at a SoundHandler using the new Forge 3.1.2.95 sound hooks
Bumped the minimum required Forge version to the 3.1.3 branch
This commit is contained in:
pahimar 2012-04-27 12:38:54 -04:00
parent cdc0b94b98
commit 8937db07bc
7 changed files with 88 additions and 9 deletions

View file

@ -3,10 +3,12 @@ package net.minecraft.src.ee3.client;
import java.io.File;
import net.minecraft.client.Minecraft;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.ModLoader;
import net.minecraft.src.NetworkManager;
import net.minecraft.src.World;
import net.minecraft.src.ee3.core.IProxy;
import net.minecraft.src.forge.MinecraftForgeClient;
public class EEProxy implements IProxy {
@ -53,4 +55,16 @@ public class EEProxy implements IProxy {
public void handleControl(NetworkManager network, int key) { }
public void handlePedestalPacket(int x, int y, int z, int itemId, boolean activated) { }
public void handleTEPacket(int x, int y, int z, byte direction, String player) { }
@Override
public void registerSoundHandler() {
MinecraftForgeClient.registerSoundHandler(new SoundHandler());
}
@Override
// TODO Client side: Handle GUI call
public Object handleGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
return null;
}
}

View file

@ -0,0 +1,50 @@
package net.minecraft.src.ee3.client;
import net.minecraft.src.SoundManager;
import net.minecraft.src.SoundPoolEntry;
import net.minecraft.src.forge.ISoundHandler;
public class SoundHandler implements ISoundHandler {
@Override
public void onSetupAudio(SoundManager soundManager) {
// TODO Auto-generated method stub
}
@Override
public void onLoadSoundSettings(SoundManager soundManager) {
// TODO Auto-generated method stub
}
@Override
public SoundPoolEntry onPlayBackgroundMusic(SoundManager soundManager,
SoundPoolEntry entry) {
// TODO Auto-generated method stub
return null;
}
@Override
public SoundPoolEntry onPlayStreaming(SoundManager soundManager,
SoundPoolEntry entry, String soundName, float x, float y, float z) {
// TODO Auto-generated method stub
return null;
}
@Override
public SoundPoolEntry onPlaySound(SoundManager soundManager,
SoundPoolEntry entry, String soundName, float x, float y, float z,
float volume, float pitch) {
// TODO Auto-generated method stub
return null;
}
@Override
public SoundPoolEntry onPlaySoundEffect(SoundManager soundManager,
SoundPoolEntry entry, String soundName, float volume, float pitch) {
// TODO Auto-generated method stub
return null;
}
}

View file

@ -2,8 +2,10 @@ package net.minecraft.src.ee3.core;
import java.io.File;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.NetworkManager;
import net.minecraft.src.World;
import net.minecraft.src.forge.IGuiHandler;
public interface IProxy {
@ -21,9 +23,13 @@ public interface IProxy {
public abstract String getMinecraftVersion();
public abstract void registerSoundHandler();
public abstract void handleControl(NetworkManager network, int key);
public abstract void handlePedestalPacket(int x, int y, int z, int itemId, boolean activated);
public abstract void handleTEPacket(int x, int y, int z, byte direction, String player);
public abstract Object handleGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z);
}

View file

@ -18,7 +18,7 @@ public class Version {
public static final int REQ_FORGE_MAJOR = 3;
public static final int REQ_FORGE_MINOR = 1;
public static final int REQ_FORGE_REVISION = 2;
public static final int REQ_FORGE_REVISION = 3;
private static final String REMOTE_VERSION_FILE = "http://dl.dropbox.com/u/25591134/EE2/version.txt";

View file

@ -2,6 +2,7 @@ package net.minecraft.src.ee3.gui;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.World;
import net.minecraft.src.mod_EE3;
import net.minecraft.src.ee3.core.GuiIds;
import net.minecraft.src.forge.IGuiHandler;
@ -9,13 +10,6 @@ public class GuiHandler implements IGuiHandler {
@Override
public Object getGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
return null;
}
/*
* Returns true of the GuiId id is for a item and not a Block/TE in the world
*/
private static boolean isItemGui(int id) {
return ((id == GuiIds.PORT_CRAFTING) || (id == GuiIds.MERCURIAL_EYE) || (id == GuiIds.PORT_TRANS_TABLE) || (id == GuiIds.ALCH_BAG));
return mod_EE3.proxy.handleGuiElement(ID, player, world, x, y, z);
}
}

View file

@ -34,6 +34,9 @@ public class mod_EE3 extends NetworkMod {
// Bind GUI Handler
MinecraftForge.setGuiHandler(this, new GuiHandler());
// Bind Sound Handler
this.proxy.registerSoundHandler();
}
@Override

View file

@ -2,6 +2,7 @@ package net.minecraft.src.ee3.server;
import java.io.File;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.ModLoader;
import net.minecraft.src.NetworkManager;
import net.minecraft.src.World;
@ -52,4 +53,15 @@ public class EEProxy implements IProxy {
public void handleControl(NetworkManager network, int key) { }
public void handlePedestalPacket(int x, int y, int z, int itemId, boolean activated) { }
public void handleTEPacket(int x, int y, int z, byte direction, String player) { }
@Override
// Stub, no need for a Sound Handler on the server
public void registerSoundHandler() { }
@Override
// TODO Server side: Handle GUI call
public Object handleGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
return null;
}
}