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.
Merge pull request #79 from asdflj/master
Universal wireless terminal support processing pattern terminal mode
- Loading branch information
Showing
26 changed files
with
723 additions
and
111 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
12 changes: 12 additions & 0 deletions
12
src/main/java/com/glodblock/github/client/gui/GuiFluidPatternExWireless.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,12 @@ | ||
package com.glodblock.github.client.gui; | ||
|
||
import net.minecraft.entity.player.InventoryPlayer; | ||
|
||
import com.glodblock.github.inventory.item.IWirelessTerminal; | ||
|
||
public class GuiFluidPatternExWireless extends GuiFluidPatternTerminalEx { | ||
|
||
public GuiFluidPatternExWireless(InventoryPlayer inventoryPlayer, IWirelessTerminal te) { | ||
super(inventoryPlayer, te); | ||
} | ||
} |
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
17 changes: 17 additions & 0 deletions
17
src/main/java/com/glodblock/github/client/gui/container/ContainerFluidPatternExWireless.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,17 @@ | ||
package com.glodblock.github.client.gui.container; | ||
|
||
import net.minecraft.entity.player.InventoryPlayer; | ||
|
||
import com.glodblock.github.inventory.item.IWirelessTerminal; | ||
|
||
public class ContainerFluidPatternExWireless extends ContainerFluidPatternTerminalEx { | ||
|
||
public ContainerFluidPatternExWireless(InventoryPlayer ip, IWirelessTerminal monitorable) { | ||
super(ip, monitorable); | ||
} | ||
|
||
@Override | ||
protected boolean isWirelessTerminal() { | ||
return true; | ||
} | ||
} |
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
60 changes: 60 additions & 0 deletions
60
src/main/java/com/glodblock/github/client/gui/container/base/FCBaseContainer.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,60 @@ | ||
package com.glodblock.github.client.gui.container.base; | ||
|
||
import net.minecraft.entity.player.InventoryPlayer; | ||
|
||
import appeng.api.storage.ITerminalHost; | ||
import appeng.container.AEBaseContainer; | ||
|
||
import com.glodblock.github.inventory.item.IFluidPortableCell; | ||
import com.glodblock.github.util.Util; | ||
|
||
public abstract class FCBaseContainer extends AEBaseContainer { | ||
|
||
private int ticks; | ||
private final double powerMultiplier = 0.5; | ||
private IFluidPortableCell host; | ||
private int slot = -1; | ||
private final InventoryPlayer ip; | ||
|
||
public FCBaseContainer(InventoryPlayer ip, ITerminalHost monitorable) { | ||
super(ip, monitorable); | ||
this.ip = ip; | ||
if (isWirelessTerminal()) { | ||
host = (IFluidPortableCell) monitorable; | ||
this.slot = lockSlot(); | ||
} | ||
} | ||
|
||
private int lockSlot() { | ||
if (isWirelessTerminal()) { | ||
if (this.host != null) { | ||
final int slotIndex = this.host.getInventorySlot(); | ||
this.lockPlayerInventorySlot(slotIndex); | ||
return slotIndex; | ||
} else { | ||
this.lockPlayerInventorySlot(ip.currentItem); | ||
} | ||
} | ||
return -1; | ||
} | ||
|
||
protected abstract boolean isWirelessTerminal(); | ||
|
||
public void detectAndSendChanges() { | ||
if (isWirelessTerminal()) { | ||
this.ticks = Util.drainItemPower( | ||
this, | ||
this.getPlayerInv(), | ||
this.slot, | ||
this.ticks, | ||
this.getPowerMultiplier(), | ||
this.host); | ||
} | ||
super.detectAndSendChanges(); | ||
} | ||
|
||
public double getPowerMultiplier() { | ||
return this.powerMultiplier; | ||
} | ||
|
||
} |
Oops, something went wrong.