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:
parent
cdc0b94b98
commit
e6a091c897
6 changed files with 38 additions and 9 deletions
|
@ -3,10 +3,12 @@ package net.minecraft.src.ee3.client;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.src.EntityPlayer;
|
||||||
import net.minecraft.src.ModLoader;
|
import net.minecraft.src.ModLoader;
|
||||||
import net.minecraft.src.NetworkManager;
|
import net.minecraft.src.NetworkManager;
|
||||||
import net.minecraft.src.World;
|
import net.minecraft.src.World;
|
||||||
import net.minecraft.src.ee3.core.IProxy;
|
import net.minecraft.src.ee3.core.IProxy;
|
||||||
|
import net.minecraft.src.forge.MinecraftForgeClient;
|
||||||
|
|
||||||
public class EEProxy implements IProxy {
|
public class EEProxy implements IProxy {
|
||||||
|
|
||||||
|
@ -53,4 +55,16 @@ public class EEProxy implements IProxy {
|
||||||
public void handleControl(NetworkManager network, int key) { }
|
public void handleControl(NetworkManager network, int key) { }
|
||||||
public void handlePedestalPacket(int x, int y, int z, int itemId, boolean activated) { }
|
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) { }
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,10 @@ package net.minecraft.src.ee3.core;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
|
import net.minecraft.src.EntityPlayer;
|
||||||
import net.minecraft.src.NetworkManager;
|
import net.minecraft.src.NetworkManager;
|
||||||
import net.minecraft.src.World;
|
import net.minecraft.src.World;
|
||||||
|
import net.minecraft.src.forge.IGuiHandler;
|
||||||
|
|
||||||
public interface IProxy {
|
public interface IProxy {
|
||||||
|
|
||||||
|
@ -21,9 +23,13 @@ public interface IProxy {
|
||||||
|
|
||||||
public abstract String getMinecraftVersion();
|
public abstract String getMinecraftVersion();
|
||||||
|
|
||||||
|
public abstract void registerSoundHandler();
|
||||||
|
|
||||||
public abstract void handleControl(NetworkManager network, int key);
|
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 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 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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ public class Version {
|
||||||
|
|
||||||
public static final int REQ_FORGE_MAJOR = 3;
|
public static final int REQ_FORGE_MAJOR = 3;
|
||||||
public static final int REQ_FORGE_MINOR = 1;
|
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";
|
private static final String REMOTE_VERSION_FILE = "http://dl.dropbox.com/u/25591134/EE2/version.txt";
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package net.minecraft.src.ee3.gui;
|
||||||
|
|
||||||
import net.minecraft.src.EntityPlayer;
|
import net.minecraft.src.EntityPlayer;
|
||||||
import net.minecraft.src.World;
|
import net.minecraft.src.World;
|
||||||
|
import net.minecraft.src.mod_EE3;
|
||||||
import net.minecraft.src.ee3.core.GuiIds;
|
import net.minecraft.src.ee3.core.GuiIds;
|
||||||
import net.minecraft.src.forge.IGuiHandler;
|
import net.minecraft.src.forge.IGuiHandler;
|
||||||
|
|
||||||
|
@ -9,13 +10,6 @@ public class GuiHandler implements IGuiHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
public Object getGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||||
return null;
|
return mod_EE3.proxy.handleGuiElement(ID, player, world, x, y, z);
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,9 @@ public class mod_EE3 extends NetworkMod {
|
||||||
|
|
||||||
// Bind GUI Handler
|
// Bind GUI Handler
|
||||||
MinecraftForge.setGuiHandler(this, new GuiHandler());
|
MinecraftForge.setGuiHandler(this, new GuiHandler());
|
||||||
|
|
||||||
|
// Bind Sound Handler
|
||||||
|
this.proxy.registerSoundHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -2,6 +2,7 @@ package net.minecraft.src.ee3.server;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
|
import net.minecraft.src.EntityPlayer;
|
||||||
import net.minecraft.src.ModLoader;
|
import net.minecraft.src.ModLoader;
|
||||||
import net.minecraft.src.NetworkManager;
|
import net.minecraft.src.NetworkManager;
|
||||||
import net.minecraft.src.World;
|
import net.minecraft.src.World;
|
||||||
|
@ -52,4 +53,15 @@ public class EEProxy implements IProxy {
|
||||||
public void handleControl(NetworkManager network, int key) { }
|
public void handleControl(NetworkManager network, int key) { }
|
||||||
public void handlePedestalPacket(int x, int y, int z, int itemId, boolean activated) { }
|
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) { }
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue