forked from AE2-UEL/AE2FluidCraft-Rework
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wireless interface terminal add edit button
- Loading branch information
Showing
12 changed files
with
201 additions
and
26 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
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
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
59 changes: 59 additions & 0 deletions
59
src/main/java/com/glodblock/github/coremod/transform/GuiRenamerTransformer.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,59 @@ | ||
package com.glodblock.github.coremod.transform; | ||
|
||
import org.objectweb.asm.ClassVisitor; | ||
import org.objectweb.asm.MethodVisitor; | ||
import org.objectweb.asm.Opcodes; | ||
|
||
import com.glodblock.github.coremod.FCClassTransformer; | ||
|
||
public class GuiRenamerTransformer extends FCClassTransformer.ClassMapper { | ||
|
||
public static final GuiRenamerTransformer INSTANCE = new GuiRenamerTransformer(); | ||
|
||
private GuiRenamerTransformer() { | ||
// NO-OP | ||
} | ||
|
||
@Override | ||
protected ClassVisitor getClassMapper(ClassVisitor downstream) { | ||
return new GuiRenamerTransformer.TransformGuiRenamer(Opcodes.ASM5, downstream); | ||
} | ||
|
||
private static class TransformGuiRenamer extends ClassVisitor { | ||
|
||
TransformGuiRenamer(int api, ClassVisitor cv) { | ||
super(api, cv); | ||
} | ||
|
||
@Override | ||
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { | ||
if (name.equals("keyTyped")) { | ||
return new GuiRenamerTransformer.TransformKeyTyped( | ||
api, | ||
super.visitMethod(access, name, desc, signature, exceptions)); | ||
} | ||
return super.visitMethod(access, name, desc, signature, exceptions); | ||
} | ||
} | ||
|
||
private static class TransformKeyTyped extends MethodVisitor { | ||
|
||
TransformKeyTyped(int api, MethodVisitor mv) { | ||
super(api, mv); | ||
} | ||
|
||
@Override | ||
public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) { | ||
super.visitMethodInsn(opcode, owner, name, desc, itf); | ||
if (owner.equals("net/minecraft/client/entity/EntityClientPlayerMP") && name.equals("closeScreen")) { | ||
super.visitMethodInsn( | ||
Opcodes.INVOKESTATIC, | ||
"com/glodblock/github/coremod/hooker/CoreModHooks", | ||
"reopenInterfaceTerminal", | ||
"()V", | ||
false); | ||
} | ||
} | ||
|
||
} | ||
} |
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
61 changes: 61 additions & 0 deletions
61
src/main/java/com/glodblock/github/network/CPacketRenamer.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,61 @@ | ||
package com.glodblock.github.network; | ||
|
||
import net.minecraft.entity.player.EntityPlayerMP; | ||
import net.minecraft.tileentity.TileEntity; | ||
import net.minecraftforge.common.DimensionManager; | ||
import net.minecraftforge.common.util.ForgeDirection; | ||
|
||
import appeng.core.sync.GuiBridge; | ||
import appeng.util.Platform; | ||
import cpw.mods.fml.common.network.simpleimpl.IMessage; | ||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; | ||
import cpw.mods.fml.common.network.simpleimpl.MessageContext; | ||
import io.netty.buffer.ByteBuf; | ||
|
||
public class CPacketRenamer implements IMessage { | ||
|
||
private int x; | ||
private int y; | ||
private int z; | ||
private int dim; | ||
private ForgeDirection side; | ||
|
||
public CPacketRenamer() {} | ||
|
||
public CPacketRenamer(int x, int y, int z, int dim, ForgeDirection side) { | ||
this.x = x; | ||
this.y = y; | ||
this.z = z; | ||
this.dim = dim; | ||
this.side = side; | ||
} | ||
|
||
@Override | ||
public void fromBytes(ByteBuf buf) { | ||
this.x = buf.readInt(); | ||
this.y = buf.readInt(); | ||
this.z = buf.readInt(); | ||
this.dim = buf.readInt(); | ||
this.side = ForgeDirection.getOrientation(buf.readInt()); | ||
} | ||
|
||
@Override | ||
public void toBytes(ByteBuf buf) { | ||
buf.writeInt(this.x); | ||
buf.writeInt(this.y); | ||
buf.writeInt(this.z); | ||
buf.writeInt(this.dim); | ||
buf.writeInt(side.ordinal()); | ||
} | ||
|
||
public static class Handler implements IMessageHandler<CPacketRenamer, IMessage> { | ||
|
||
@Override | ||
public IMessage onMessage(CPacketRenamer message, MessageContext ctx) { | ||
EntityPlayerMP player = ctx.getServerHandler().playerEntity; | ||
TileEntity tile = DimensionManager.getWorld(message.dim).getTileEntity(message.x, message.y, message.z); | ||
Platform.openGUI(player, tile, message.side, GuiBridge.GUI_RENAMER); | ||
return null; | ||
} | ||
} | ||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.