-
Notifications
You must be signed in to change notification settings - Fork 55
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
9 changed files
with
186 additions
and
83 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
64 changes: 5 additions & 59 deletions
64
src/main/java/com/glodblock/github/client/container/ContainerFCCraftConfirm.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,79 +1,25 @@ | ||
package com.glodblock.github.client.container; | ||
|
||
import appeng.api.networking.IGrid; | ||
import appeng.api.networking.IGridNode; | ||
import appeng.api.networking.crafting.ICraftingGrid; | ||
import appeng.api.networking.crafting.ICraftingLink; | ||
import appeng.api.networking.security.IActionHost; | ||
import appeng.api.networking.security.IActionSource; | ||
import appeng.api.storage.ITerminalHost; | ||
import appeng.container.ContainerOpenContext; | ||
import appeng.container.implementations.ContainerCraftConfirm; | ||
import appeng.helpers.WirelessTerminalGuiObject; | ||
import appeng.me.helpers.PlayerSource; | ||
import com.glodblock.github.common.part.PartExtendedFluidPatternTerminal; | ||
import com.glodblock.github.common.part.PartFluidPatternTerminal; | ||
import com.glodblock.github.inventory.GuiType; | ||
import com.glodblock.github.inventory.InventoryHandler; | ||
import com.glodblock.github.loader.FCItems; | ||
import com.glodblock.github.util.Ae2Reflect; | ||
import net.minecraft.entity.player.InventoryPlayer; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.tileentity.TileEntity; | ||
import net.minecraft.util.math.BlockPos; | ||
|
||
public class ContainerFCCraftConfirm extends ContainerCraftConfirm { | ||
|
||
public ContainerFCCraftConfirm(InventoryPlayer ip, ITerminalHost te) { | ||
super(ip, te); | ||
} | ||
|
||
@Override | ||
public void startJob() { | ||
GuiType originalGui = null; | ||
IActionHost ah = this.getActionHost(); | ||
|
||
if (ah instanceof WirelessTerminalGuiObject) { | ||
ItemStack tool = ((WirelessTerminalGuiObject) ah).getItemStack(); | ||
if (tool.getItem() == FCItems.WIRELESS_FLUID_PATTERN_TERMINAL) { | ||
originalGui = GuiType.WIRELESS_FLUID_PATTERN_TERMINAL; | ||
} | ||
} | ||
|
||
if (ah instanceof PartFluidPatternTerminal) { | ||
originalGui = GuiType.FLUID_PATTERN_TERMINAL; | ||
} | ||
|
||
if (ah instanceof PartExtendedFluidPatternTerminal) { | ||
originalGui = GuiType.FLUID_EXTENDED_PATTERN_TERMINAL; | ||
} | ||
|
||
IActionHost h = (IActionHost)this.getTarget(); | ||
if (h != null) { | ||
IGridNode node = h.getActionableNode(); | ||
IGrid grid = node.getGrid(); | ||
if (Ae2Reflect.getCraftJob(this) != null && !this.isSimulation()) { | ||
ICraftingGrid cc = grid.getCache(ICraftingGrid.class); | ||
ICraftingLink g = cc.submitJob(Ae2Reflect.getCraftJob(this), null, this.getSelectedCpu() == -1 ? null : Ae2Reflect.getCraftingCPU(Ae2Reflect.getCPUs(this).get(this.getSelectedCpu())), true, this.getActionSrc()); | ||
this.setAutoStart(false); | ||
if (g == null) { | ||
this.setJob(cc.beginCraftingJob(this.getWorld(), grid, this.getActionSrc(), Ae2Reflect.getCraftJob(this).getOutput(), null)); | ||
} else if (originalGui != null && this.getOpenContext() != null) { | ||
ContainerOpenContext context = this.getOpenContext(); | ||
InventoryHandler.openGui( | ||
this.getInventoryPlayer().player, | ||
this.getInventoryPlayer().player.world, | ||
new BlockPos(Ae2Reflect.getContextX(context), Ae2Reflect.getContextY(context), Ae2Reflect.getContextZ(context)), | ||
this.getOpenContext().getSide().getFacing(), | ||
originalGui | ||
); | ||
} | ||
} | ||
} | ||
public IActionSource getActionSrc() { | ||
return new PlayerSource(this.getPlayerInv().player, (IActionHost)this.getTarget()); | ||
} | ||
|
||
private IActionSource getActionSrc() { | ||
return new PlayerSource(this.getPlayerInv().player, (IActionHost)this.getTarget()); | ||
@Override | ||
public IActionHost getActionHost() { | ||
return super.getActionHost(); | ||
} | ||
|
||
} |
33 changes: 33 additions & 0 deletions
33
src/main/java/com/glodblock/github/client/warn/WarnMessage.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,33 @@ | ||
package com.glodblock.github.client.warn; | ||
|
||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.util.text.TextComponentString; | ||
import net.minecraftforge.common.MinecraftForge; | ||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; | ||
import net.minecraftforge.fml.common.gameevent.TickEvent; | ||
import net.minecraftforge.fml.relauncher.Side; | ||
import net.minecraftforge.fml.relauncher.SideOnly; | ||
|
||
public class WarnMessage { | ||
|
||
public static WarnMessage INSTANCE = new WarnMessage(); | ||
private boolean finished = false; | ||
private WarnMessage() { | ||
// NO-OP | ||
} | ||
|
||
@SideOnly(Side.CLIENT) | ||
@SubscribeEvent(receiveCanceled = true) | ||
public void onTick(TickEvent.ClientTickEvent event) { | ||
if (!finished && Minecraft.getMinecraft().player != null) { | ||
EntityPlayer player = Minecraft.getMinecraft().player; | ||
finished = true; | ||
player.sendMessage(new TextComponentString("AE2FC 2.5.0-r is on beta test!")); | ||
player.sendMessage(new TextComponentString("If you encounter any bug or something not working")); | ||
player.sendMessage(new TextComponentString("Please report it to https://github.com/GlodBlock/AE2FluidCraft-Rework")); | ||
MinecraftForge.EVENT_BUS.unregister(this); | ||
} | ||
} | ||
|
||
} |
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
73 changes: 73 additions & 0 deletions
73
src/main/java/com/glodblock/github/coremod/transform/ContainerCraftConfirmTransformer.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,73 @@ | ||
package com.glodblock.github.coremod.transform; | ||
|
||
import com.glodblock.github.coremod.FCClassTransformer; | ||
import org.objectweb.asm.ClassVisitor; | ||
import org.objectweb.asm.ClassWriter; | ||
import org.objectweb.asm.Label; | ||
import org.objectweb.asm.MethodVisitor; | ||
import org.objectweb.asm.Opcodes; | ||
|
||
public class ContainerCraftConfirmTransformer extends FCClassTransformer.ClassMapper { | ||
|
||
public static ContainerCraftConfirmTransformer INSTANCE = new ContainerCraftConfirmTransformer(); | ||
|
||
private ContainerCraftConfirmTransformer() { | ||
// NO-OP | ||
} | ||
|
||
@Override | ||
protected ClassVisitor getClassMapper(ClassVisitor downstream) { | ||
return new TransformContainerCraftConfirm(Opcodes.ASM5, downstream); | ||
} | ||
|
||
@Override | ||
protected int getWriteFlags() { | ||
return ClassWriter.COMPUTE_FRAMES; | ||
} | ||
|
||
private static class TransformContainerCraftConfirm extends ClassVisitor { | ||
|
||
public TransformContainerCraftConfirm(int api, ClassVisitor cv) { | ||
super(api, cv); | ||
} | ||
|
||
@Override | ||
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { | ||
if (name.equals("startJob")) { | ||
return new TransformStartJob(api, super.visitMethod(access, name, desc, signature, exceptions)); | ||
} else { | ||
return super.visitMethod(access, name, desc, signature, exceptions); | ||
} | ||
} | ||
|
||
} | ||
|
||
private static class TransformStartJob extends MethodVisitor { | ||
|
||
Label L = new Label(); | ||
|
||
public TransformStartJob(int api, MethodVisitor mv) { | ||
super(api, mv); | ||
} | ||
|
||
@Override | ||
public void visitCode() { | ||
super.visitCode(); | ||
super.visitVarInsn(Opcodes.ALOAD, 0); | ||
super.visitInsn(Opcodes.DUP); | ||
super.visitFieldInsn(Opcodes.GETFIELD, "appeng/container/implementations/ContainerCraftConfirm", "cpus", "Ljava/util/ArrayList;"); | ||
super.visitVarInsn(Opcodes.ALOAD, 0); | ||
super.visitFieldInsn(Opcodes.GETFIELD, "appeng/container/implementations/ContainerCraftConfirm", "result", "Lappeng/api/networking/crafting/ICraftingJob;"); | ||
super.visitMethodInsn(Opcodes.INVOKESTATIC, | ||
"com/glodblock/github/coremod/CoreModHooks", | ||
"startJob", | ||
"(Lappeng/container/implementations/ContainerCraftConfirm;Ljava/util/ArrayList;Lappeng/api/networking/crafting/ICraftingJob;)Z", | ||
false); | ||
super.visitJumpInsn(Opcodes.IFEQ, L); | ||
super.visitInsn(Opcodes.RETURN); | ||
super.visitLabel(L); | ||
} | ||
|
||
} | ||
|
||
} |
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
Oops, something went wrong.