Compare commits

..
4 changed files with 39 additions and 7 deletions

No files matched your search

@@ -42,6 +42,12 @@ public class ItemPacketRender implements IItemRenderer {
GL11.glEnable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
final boolean entity = type.equals(ItemRenderType.ENTITY);
if (entity) {
GL11.glPushMatrix();
GL11.glRotated(90.0D, 0.0D, 1.0D, 0.0D);
GL11.glTranslated(-0.5D, -0.6D, 0.0D);
}
FluidStack fluid = ItemFluidPacket.getFluidStack(item);
int RGB = fluid == null ? 0xFFFFFF : fluid.getFluid().getColor(fluid);
@@ -65,6 +71,9 @@ public class ItemPacketRender implements IItemRenderer {
0.0625F);
}
if (entity) {
GL11.glPopMatrix();
}
GL11.glDisable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_ALPHA_TEST);
}
@@ -28,6 +28,7 @@ import appeng.container.ContainerOpenContext;
import appeng.container.PrimaryGui;
import appeng.container.interfaces.IContainerSubGui;
import appeng.helpers.ICustomButtonProvider;
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;
@@ -75,7 +76,7 @@ public class CPacketSwitchGuis implements IMessage {
// switch terminal
if (message.switchTerminal) {
ImmutablePair<Integer, ItemStack> temp = Util.getUltraWirelessTerm(player);
ImmutablePair<Integer, ItemStack> temp = getTerminalToSwitch(player, cont);
if (temp != null && temp.getRight().getItem() instanceof ItemWirelessUltraTerminal iwut) {
if (message.mode != null && cont instanceof AEBaseContainer abc) {
abc.setSwitchAbleGuiNext(message.mode.ordinal());
@@ -118,6 +119,21 @@ public class CPacketSwitchGuis implements IMessage {
}
return null;
}
private static ImmutablePair<Integer, ItemStack> getTerminalToSwitch(EntityPlayerMP player, Container cont) {
if (cont instanceof AEBaseContainer aeBaseContainer) {
final int slot = aeBaseContainer.getTargetSlotIndex();
if (slot == Integer.MIN_VALUE) return null;
final ItemStack terminal = Platform.getItemFromPlayerInventoryBySlotIndex(player, slot);
return terminal != null && terminal.getItem() instanceof ItemWirelessUltraTerminal
? new ImmutablePair<>(slot, terminal)
: null;
}
// Global terminal hotkeys have no open item GUI from which to obtain an exact slot.
return Util.getUltraWirelessTerm(player);
}
}
}
@@ -191,6 +191,8 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
}
private IMEMonitor<IAEFluidStack> getFluidGrid() {
if (!this.gridProxy.isActive()) return null;
try {
return gridProxy.getGrid().<IStorageGrid>getCache(IStorageGrid.class).getFluidInventory();
} catch (GridAccessException e) {
@@ -160,11 +160,12 @@ public final class Util {
}
public static ImmutablePair<Integer, ItemStack> getUltraWirelessTerm(EntityPlayer player) {
int invSize = player.inventory.getSizeInventory();
final ImmutablePair<Integer, ItemStack> baublesTerminal = getBaublesUltraWirelessTerm(player);
return baublesTerminal != null ? baublesTerminal : getInventoryUltraWirelessTerm(player);
}
if (invSize <= 0) {
return null;
}
private static ImmutablePair<Integer, ItemStack> getInventoryUltraWirelessTerm(EntityPlayer player) {
final int invSize = player.inventory.getSizeInventory();
for (int i = 0; i < invSize; ++i) {
ItemStack is = player.inventory.getStackInSlot(i);
if (is != null && is.getItem() instanceof ItemWirelessUltraTerminal) {
@@ -172,10 +173,14 @@ public final class Util {
}
}
return null;
}
private static ImmutablePair<Integer, ItemStack> getBaublesUltraWirelessTerm(EntityPlayer player) {
if (ModAndClassUtil.BAUBLES) {
IInventory handler = BaublesApi.getBaubles(player);
final IInventory handler = BaublesApi.getBaubles(player);
if (handler != null) {
invSize = handler.getSizeInventory();
final int invSize = handler.getSizeInventory();
for (int i = 0; i < invSize; ++i) {
ItemStack is = handler.getStackInSlot(i);
if (is != null && is.getItem() instanceof ItemWirelessUltraTerminal) {