This repository has been archived by the owner on Sep 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
117 additions
and
113 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
28 changes: 0 additions & 28 deletions
28
src/main/java/com/github/wohaopa/tc4helper/CommonProxy.java
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
src/main/java/com/github/wohaopa/tc4helper/GuiHandler.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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.github.wohaopa.tc4helper; | ||
|
||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.world.World; | ||
|
||
import cpw.mods.fml.common.network.IGuiHandler; | ||
import thaumcraft.client.gui.GuiResearchTable; | ||
import thaumcraft.common.container.ContainerResearchTable; | ||
import thaumcraft.common.tiles.TileResearchTable; | ||
|
||
public class GuiHandler implements IGuiHandler { | ||
|
||
private final IGuiHandler guiHandler; | ||
|
||
public GuiHandler(IGuiHandler guiHandler) { | ||
this.guiHandler = guiHandler; | ||
} | ||
|
||
@Override | ||
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { | ||
if (TC4Helper.enabled) { | ||
if (ID == 0) | ||
return new ContainerResearchTable(player.inventory, (TileResearchTable) world.getTileEntity(x, y, z)); | ||
|
||
return null; | ||
} else return guiHandler.getServerGuiElement(ID, player, world, x, y, z); | ||
} | ||
|
||
@Override | ||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { | ||
if (TC4Helper.enabled) { | ||
if (ID == 0) return new GuiResearchTable(player, (TileResearchTable) world.getTileEntity(x, y, z)); | ||
|
||
return null; | ||
} else return guiHandler.getClientGuiElement(ID, player, world, x, y, z); | ||
} | ||
} |
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
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
49 changes: 49 additions & 0 deletions
49
src/main/java/com/github/wohaopa/tc4helper/proxy/ClientProxy.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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.github.wohaopa.tc4helper.proxy; | ||
|
||
import java.lang.reflect.Field; | ||
import java.util.Map; | ||
|
||
import net.minecraftforge.client.ClientCommandHandler; | ||
|
||
import com.github.wohaopa.tc4helper.Command; | ||
import com.github.wohaopa.tc4helper.GuiHandler; | ||
|
||
import cpw.mods.fml.common.Loader; | ||
import cpw.mods.fml.common.ModContainer; | ||
import cpw.mods.fml.common.event.FMLLoadCompleteEvent; | ||
import cpw.mods.fml.common.event.FMLPostInitializationEvent; | ||
import cpw.mods.fml.common.network.IGuiHandler; | ||
import cpw.mods.fml.common.network.NetworkRegistry; | ||
|
||
public class ClientProxy implements IProxy { | ||
|
||
@Override | ||
public void postInit(FMLPostInitializationEvent event) { | ||
ClientCommandHandler.instance.registerCommand(new Command()); | ||
} | ||
|
||
@Override | ||
public void complete(FMLLoadCompleteEvent event) { | ||
if (Loader.isModLoaded("ThaumcraftResearchTweaks")) { | ||
|
||
try { | ||
Class<NetworkRegistry> clazz = NetworkRegistry.class; | ||
Field field = clazz.getDeclaredField("clientGuiHandlers"); | ||
field.setAccessible(true); | ||
Map<ModContainer, IGuiHandler> clientGuiHandlers = (Map<ModContainer, IGuiHandler>) field | ||
.get(NetworkRegistry.INSTANCE); | ||
ModContainer mc = Loader.instance() | ||
.getIndexedModList() | ||
.get("ThaumcraftResearchTweaks"); | ||
|
||
NetworkRegistry.INSTANCE | ||
.registerGuiHandler("ThaumcraftResearchTweaks", new GuiHandler(clientGuiHandlers.get(mc))); | ||
|
||
} catch (NoSuchFieldException | IllegalAccessException e) { | ||
throw new RuntimeException(e); | ||
} | ||
|
||
} | ||
|
||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/com/github/wohaopa/tc4helper/proxy/IProxy.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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.github.wohaopa.tc4helper.proxy; | ||
|
||
import cpw.mods.fml.common.event.FMLLoadCompleteEvent; | ||
import cpw.mods.fml.common.event.FMLPostInitializationEvent; | ||
|
||
public interface IProxy { | ||
|
||
default void postInit(FMLPostInitializationEvent event) {} | ||
|
||
default void complete(FMLLoadCompleteEvent event) {} | ||
} |
4 changes: 4 additions & 0 deletions
4
src/main/java/com/github/wohaopa/tc4helper/proxy/ServerProxy.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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package com.github.wohaopa.tc4helper.proxy; | ||
|
||
public class ServerProxy implements IProxy { | ||
} |
32 changes: 0 additions & 32 deletions
32
...ava/elan/tweaks/thaumcraft/research/frontend/integration/table/mixin/TableBlockMixin.java
This file was deleted.
Oops, something went wrong.