Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 76ae078d24 | |||
| 0fae87afc7 | |||
| ee1b6bb0d7 | |||
| 36ca8b9f0a |
@@ -25,8 +25,11 @@ import java.util.EnumMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
import appeng.client.gui.AEBaseGui;
|
||||||
|
import appeng.container.interfaces.IJEIGhostIngredients;
|
||||||
import appeng.helpers.HighlighterHandler;
|
import appeng.helpers.HighlighterHandler;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.client.settings.KeyBinding;
|
import net.minecraft.client.settings.KeyBinding;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@@ -36,10 +39,7 @@ import net.minecraft.util.EnumHand;
|
|||||||
import net.minecraft.util.math.RayTraceResult;
|
import net.minecraft.util.math.RayTraceResult;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.client.event.MouseEvent;
|
import net.minecraftforge.client.event.*;
|
||||||
import net.minecraftforge.client.event.RenderLivingEvent;
|
|
||||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
|
||||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
|
||||||
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||||
import net.minecraftforge.common.ForgeModContainer;
|
import net.minecraftforge.common.ForgeModContainer;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
@@ -75,6 +75,7 @@ import appeng.hooks.TickHandler;
|
|||||||
import appeng.hooks.TickHandler.PlayerColor;
|
import appeng.hooks.TickHandler.PlayerColor;
|
||||||
import appeng.server.ServerHelper;
|
import appeng.server.ServerHelper;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
import org.lwjgl.input.Mouse;
|
||||||
|
|
||||||
|
|
||||||
public class ClientHelper extends ServerHelper
|
public class ClientHelper extends ServerHelper
|
||||||
@@ -315,6 +316,28 @@ public class ClientHelper extends ServerHelper
|
|||||||
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
|
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void MouseClickEvent( final GuiScreenEvent.MouseInputEvent.Pre me )
|
||||||
|
{
|
||||||
|
final Minecraft mc = Minecraft.getMinecraft();
|
||||||
|
if( mc.currentScreen instanceof IJEIGhostIngredients )
|
||||||
|
{
|
||||||
|
AEBaseGui gui = ( (AEBaseGui) mc.currentScreen );
|
||||||
|
Object ingredient = gui.getBookmarkedIngredient();
|
||||||
|
if( ingredient != null )
|
||||||
|
{
|
||||||
|
if( GuiScreen.isShiftKeyDown() )
|
||||||
|
{
|
||||||
|
me.setCanceled( true );
|
||||||
|
}
|
||||||
|
else if( Mouse.isButtonDown( 0 ) )
|
||||||
|
{
|
||||||
|
me.setCanceled( true );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void wheelEvent( final MouseEvent me )
|
public void wheelEvent( final MouseEvent me )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,12 +32,15 @@ import java.util.List;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import appeng.container.slot.*;
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
import com.google.common.base.Stopwatch;
|
import com.google.common.base.Stopwatch;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import mezz.jei.api.gui.IGhostIngredientHandler;
|
import mezz.jei.api.gui.IGhostIngredientHandler;
|
||||||
import net.minecraft.client.gui.Gui;
|
import net.minecraft.client.gui.Gui;
|
||||||
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
import net.minecraftforge.fluids.FluidUtil;
|
||||||
import net.minecraftforge.fml.common.Optional;
|
import net.minecraftforge.fml.common.Optional;
|
||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
import org.lwjgl.input.Mouse;
|
import org.lwjgl.input.Mouse;
|
||||||
@@ -72,17 +75,7 @@ import appeng.client.me.SlotDisconnected;
|
|||||||
import appeng.client.me.SlotME;
|
import appeng.client.me.SlotME;
|
||||||
import appeng.client.render.StackSizeRenderer;
|
import appeng.client.render.StackSizeRenderer;
|
||||||
import appeng.container.AEBaseContainer;
|
import appeng.container.AEBaseContainer;
|
||||||
import appeng.container.slot.AppEngCraftingSlot;
|
|
||||||
import appeng.container.slot.AppEngSlot;
|
|
||||||
import appeng.container.slot.AppEngSlot.hasCalculatedValidness;
|
import appeng.container.slot.AppEngSlot.hasCalculatedValidness;
|
||||||
import appeng.container.slot.IOptionalSlot;
|
|
||||||
import appeng.container.slot.SlotCraftingTerm;
|
|
||||||
import appeng.container.slot.SlotDisabled;
|
|
||||||
import appeng.container.slot.SlotFake;
|
|
||||||
import appeng.container.slot.SlotInaccessible;
|
|
||||||
import appeng.container.slot.SlotOutput;
|
|
||||||
import appeng.container.slot.SlotPatternTerm;
|
|
||||||
import appeng.container.slot.SlotRestrictedInput;
|
|
||||||
import appeng.core.AELog;
|
import appeng.core.AELog;
|
||||||
import appeng.core.AppEng;
|
import appeng.core.AppEng;
|
||||||
import appeng.core.sync.network.NetworkHandler;
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
@@ -110,6 +103,22 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
|
|||||||
private Stopwatch dbl_clickTimer = Stopwatch.createStarted();
|
private Stopwatch dbl_clickTimer = Stopwatch.createStarted();
|
||||||
private ItemStack dbl_whichItem = ItemStack.EMPTY;
|
private ItemStack dbl_whichItem = ItemStack.EMPTY;
|
||||||
private Slot bl_clicked;
|
private Slot bl_clicked;
|
||||||
|
private Stopwatch lastClicked = Stopwatch.createStarted();
|
||||||
|
private List<IGhostIngredientHandler.Target<Object>> hoveredIngredientTargets = new ArrayList<>();
|
||||||
|
private Object bookmarkedIngredient;
|
||||||
|
private boolean isDraggingJeiGhostItem;
|
||||||
|
|
||||||
|
public void setJeiGhostItem( boolean jeiGhostItem )
|
||||||
|
{
|
||||||
|
isJeiGhostItem = jeiGhostItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isJeiGhostItem;
|
||||||
|
|
||||||
|
public Object getBookmarkedIngredient()
|
||||||
|
{
|
||||||
|
return bookmarkedIngredient;
|
||||||
|
}
|
||||||
|
|
||||||
public List<GuiCustomSlot> getGuiSlots()
|
public List<GuiCustomSlot> getGuiSlots()
|
||||||
{
|
{
|
||||||
@@ -198,15 +207,49 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
|
|||||||
this.drawTooltip( (ITooltip) c, mouseX, mouseY );
|
this.drawTooltip( (ITooltip) c, mouseX, mouseY );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
GlStateManager.enableDepth();
|
||||||
if ( isPointInRegion( -guiLeft,-guiTop, mc.displayWidth, mc.displayHeight, mouseX,mouseY)){
|
bookmarkedJEIghostItem(mouseX,mouseY);
|
||||||
Object o = runtime.getBookmarkOverlay().getIngredientUnderMouse();
|
|
||||||
if (o != null) {
|
|
||||||
List<IGhostIngredientHandler.Target<Object>> hoveredIngredientTargets = aeGuiHandler.getTargets( this, o, false );
|
|
||||||
if (hoveredIngredientTargets.size() > 0 )
|
|
||||||
{
|
|
||||||
GlStateManager.disableLighting();
|
|
||||||
GlStateManager.disableDepth();
|
GlStateManager.disableDepth();
|
||||||
|
}
|
||||||
|
|
||||||
|
void bookmarkedJEIghostItem(final int mouseX, final int mouseY) {
|
||||||
|
|
||||||
|
if (!isJeiGhostItem)
|
||||||
|
{
|
||||||
|
bookmarkedIngredient = runtime.getBookmarkOverlay().getIngredientUnderMouse();
|
||||||
|
}
|
||||||
|
|
||||||
|
if( bookmarkedIngredient != null )
|
||||||
|
{
|
||||||
|
hoveredIngredientTargets = aeGuiHandler.getTargets( this, bookmarkedIngredient, false );
|
||||||
|
ItemStack dragItem = ItemStack.EMPTY;
|
||||||
|
if( hoveredIngredientTargets.size() > 0 )
|
||||||
|
{
|
||||||
|
if( isShiftKeyDown() && Mouse.isButtonDown( 0 ) && this.lastClicked.elapsed( TimeUnit.MILLISECONDS ) > 200 )
|
||||||
|
{
|
||||||
|
this.lastClicked = Stopwatch.createStarted();
|
||||||
|
aeGuiHandler.getTargets( this, bookmarkedIngredient, true );
|
||||||
|
}
|
||||||
|
else if( Mouse.isButtonDown( 0 ) && this.lastClicked.elapsed( TimeUnit.MILLISECONDS ) > 200 )
|
||||||
|
{
|
||||||
|
this.lastClicked = Stopwatch.createStarted();
|
||||||
|
if( bookmarkedIngredient instanceof ItemStack )
|
||||||
|
{
|
||||||
|
dragItem = ( (ItemStack) bookmarkedIngredient );
|
||||||
|
}
|
||||||
|
else if( bookmarkedIngredient instanceof FluidStack )
|
||||||
|
{
|
||||||
|
dragItem = FluidUtil.getFilledBucket( ( (FluidStack) bookmarkedIngredient ) );
|
||||||
|
}
|
||||||
|
mc.player.inventory.setItemStack( dragItem.copy() );
|
||||||
|
this.isJeiGhostItem = true;
|
||||||
|
}
|
||||||
|
drawTargets( mouseX, mouseY );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void drawTargets(int mouseX, int mouseY) {
|
||||||
|
GlStateManager.disableLighting();
|
||||||
for( IGhostIngredientHandler.Target target : hoveredIngredientTargets )
|
for( IGhostIngredientHandler.Target target : hoveredIngredientTargets )
|
||||||
{
|
{
|
||||||
Rectangle area = target.getArea();
|
Rectangle area = target.getArea();
|
||||||
@@ -222,11 +265,7 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
|
|||||||
Gui.drawRect( area.x, area.y, area.x + area.width, area.y + area.height, color.getRGB() );
|
Gui.drawRect( area.x, area.y, area.x + area.width, area.y + area.height, color.getRGB() );
|
||||||
}
|
}
|
||||||
GlStateManager.color( 1f, 1f, 1f, 1f );
|
GlStateManager.color( 1f, 1f, 1f, 1f );
|
||||||
aeGuiHandler.getTargets( this, o, true );
|
GlStateManager.enableDepth();
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void drawGuiSlot( GuiCustomSlot slot, int mouseX, int mouseY, float partialTicks )
|
protected void drawGuiSlot( GuiCustomSlot slot, int mouseX, int mouseY, float partialTicks )
|
||||||
@@ -359,7 +398,6 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
|
|||||||
{
|
{
|
||||||
slot.drawBackground( ox, oy );
|
slot.drawBackground( ox, oy );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -468,18 +506,56 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
|
|||||||
{
|
{
|
||||||
final EntityPlayer player = Minecraft.getMinecraft().player;
|
final EntityPlayer player = Minecraft.getMinecraft().player;
|
||||||
|
|
||||||
if( slot instanceof SlotFake )
|
if( this.isJeiGhostItem && isDraggingJeiGhostItem)
|
||||||
{
|
{
|
||||||
final InventoryAction action = mouseButton == 1 ? InventoryAction.SPLIT_OR_PLACE_SINGLE : InventoryAction.PICKUP_OR_SET_DOWN;
|
for( IGhostIngredientHandler.Target target : hoveredIngredientTargets )
|
||||||
|
{
|
||||||
|
Rectangle area = target.getArea();
|
||||||
|
final int x = Mouse.getEventX() * this.width / this.mc.displayWidth;
|
||||||
|
final int y = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
|
||||||
|
|
||||||
|
if( area.contains( x, y ) )
|
||||||
|
{
|
||||||
|
target.accept( bookmarkedIngredient );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.isJeiGhostItem = false;
|
||||||
|
this.isDraggingJeiGhostItem = false;
|
||||||
|
|
||||||
|
ItemStack dragItem = ItemStack.EMPTY;
|
||||||
|
if( runtime.getBookmarkOverlay().getIngredientUnderMouse() != null )
|
||||||
|
{
|
||||||
|
bookmarkedJEIghostItem( Mouse.getX(), this.mc.displayHeight - Mouse.getY() );
|
||||||
|
if( bookmarkedIngredient instanceof ItemStack )
|
||||||
|
{
|
||||||
|
dragItem = ( (ItemStack) bookmarkedIngredient );
|
||||||
|
}
|
||||||
|
else if( bookmarkedIngredient instanceof FluidStack )
|
||||||
|
{
|
||||||
|
dragItem = FluidUtil.getFilledBucket( ( (FluidStack) bookmarkedIngredient ) );
|
||||||
|
}
|
||||||
|
mc.player.inventory.setItemStack( dragItem.copy() );
|
||||||
|
this.isJeiGhostItem = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mc.player.inventory.setItemStack( dragItem );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if( slot instanceof SlotFake )
|
||||||
|
{
|
||||||
|
final InventoryAction action;
|
||||||
|
action = mouseButton == 1 ? InventoryAction.SPLIT_OR_PLACE_SINGLE : InventoryAction.PICKUP_OR_SET_DOWN;
|
||||||
|
|
||||||
if( this.drag_click.size() > 1 )
|
if( this.drag_click.size() > 1 )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final PacketInventoryAction p = new PacketInventoryAction( action, slotIdx, 0 );
|
PacketInventoryAction p = new PacketInventoryAction( action, slotIdx, 0 );
|
||||||
NetworkHandler.instance().sendToServer( p );
|
NetworkHandler.instance().sendToServer( p );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -599,14 +675,13 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
|
|||||||
InventoryAction action = null;
|
InventoryAction action = null;
|
||||||
IAEItemStack stack = null;
|
IAEItemStack stack = null;
|
||||||
|
|
||||||
switch( clickType )
|
switch ( clickType )
|
||||||
{
|
{
|
||||||
case PICKUP: // pickup / set-down.
|
case PICKUP: // pickup / set-down.
|
||||||
action = ( mouseButton == 1 ) ? InventoryAction.SPLIT_OR_PLACE_SINGLE : InventoryAction.PICKUP_OR_SET_DOWN;
|
action = ( mouseButton == 1 ) ? InventoryAction.SPLIT_OR_PLACE_SINGLE : InventoryAction.PICKUP_OR_SET_DOWN;
|
||||||
stack = ( (SlotME) slot ).getAEStack();
|
stack = ( (SlotME) slot ).getAEStack();
|
||||||
|
|
||||||
if( stack != null && action == InventoryAction.PICKUP_OR_SET_DOWN && stack.getStackSize() == 0 && player.inventory.getItemStack()
|
if( stack != null && action == InventoryAction.PICKUP_OR_SET_DOWN && stack.getStackSize() == 0 && player.inventory.getItemStack().isEmpty() )
|
||||||
.isEmpty() )
|
|
||||||
{
|
{
|
||||||
action = InventoryAction.AUTO_CRAFT;
|
action = InventoryAction.AUTO_CRAFT;
|
||||||
}
|
}
|
||||||
@@ -673,9 +748,7 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
|
|||||||
final List<Slot> slots = this.getInventorySlots();
|
final List<Slot> slots = this.getInventorySlots();
|
||||||
for( final Slot inventorySlot : slots )
|
for( final Slot inventorySlot : slots )
|
||||||
{
|
{
|
||||||
if( inventorySlot != null && inventorySlot.canTakeStack(
|
if( inventorySlot != null && inventorySlot.canTakeStack( this.mc.player ) && inventorySlot.getHasStack() && inventorySlot.isSameInventory( slot ) && Container.canAddItemToSlot( inventorySlot, this.dbl_whichItem, true ) )
|
||||||
this.mc.player ) && inventorySlot.getHasStack() && inventorySlot.isSameInventory( slot ) && Container.canAddItemToSlot(
|
|
||||||
inventorySlot, this.dbl_whichItem, true ) )
|
|
||||||
{
|
{
|
||||||
this.handleMouseClick( inventorySlot, inventorySlot.slotNumber, 0, ClickType.QUICK_MOVE );
|
this.handleMouseClick( inventorySlot, inventorySlot.slotNumber, 0, ClickType.QUICK_MOVE );
|
||||||
}
|
}
|
||||||
@@ -686,6 +759,11 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
|
|||||||
this.disableShiftClick = false;
|
this.disableShiftClick = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (clickType == ClickType.PICKUP && isJeiGhostItem && !isDraggingJeiGhostItem) {
|
||||||
|
this.isDraggingJeiGhostItem = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
super.handleMouseClick( slot, slotIdx, mouseButton, clickType );
|
super.handleMouseClick( slot, slotIdx, mouseButton, clickType );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1113,4 +1191,5 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import appeng.fluids.client.gui.widgets.GuiFluidSlot;
|
|||||||
import mezz.jei.api.gui.IAdvancedGuiHandler;
|
import mezz.jei.api.gui.IAdvancedGuiHandler;
|
||||||
import mezz.jei.api.gui.IGhostIngredientHandler;
|
import mezz.jei.api.gui.IGhostIngredientHandler;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
import org.lwjgl.input.Mouse;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -101,7 +102,7 @@ public class AEGuiHandler implements IAdvancedGuiHandler<AEBaseGui>, IGhostIngre
|
|||||||
List<Target<?>> phantomTargets = g.getPhantomTargets( ingredient );
|
List<Target<?>> phantomTargets = g.getPhantomTargets( ingredient );
|
||||||
targets.addAll( (List<Target<I>>) (Object) phantomTargets );
|
targets.addAll( (List<Target<I>>) (Object) phantomTargets );
|
||||||
}
|
}
|
||||||
if( doStart && GuiScreen.isShiftKeyDown() )
|
if( doStart && GuiScreen.isShiftKeyDown() && Mouse.isButtonDown( 0 ) )
|
||||||
{
|
{
|
||||||
if( gui instanceof GuiUpgradeable || gui instanceof GuiPatternTerm )
|
if( gui instanceof GuiUpgradeable || gui instanceof GuiPatternTerm )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ import java.util.List;
|
|||||||
|
|
||||||
import appeng.client.gui.widgets.GuiCustomSlot;
|
import appeng.client.gui.widgets.GuiCustomSlot;
|
||||||
import appeng.container.interfaces.IJEIGhostIngredients;
|
import appeng.container.interfaces.IJEIGhostIngredients;
|
||||||
import appeng.container.slot.AppEngSlot;
|
|
||||||
import appeng.container.slot.IJEITargetSlot;
|
import appeng.container.slot.IJEITargetSlot;
|
||||||
import appeng.container.slot.SlotFake;
|
import appeng.container.slot.SlotFake;
|
||||||
import appeng.core.sync.packets.PacketInventoryAction;
|
import appeng.core.sync.packets.PacketInventoryAction;
|
||||||
|
|||||||
@@ -22,16 +22,16 @@ package appeng.core.sync.packets;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import appeng.api.storage.data.IAEFluidStack;
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
import appeng.client.gui.implementations.GuiUpgradeable;
|
|
||||||
import appeng.client.gui.widgets.GuiCustomSlot;
|
|
||||||
import appeng.container.slot.IJEITargetSlot;
|
import appeng.container.slot.IJEITargetSlot;
|
||||||
import appeng.container.slot.SlotFake;
|
import appeng.container.slot.SlotFake;
|
||||||
|
import appeng.core.AELog;
|
||||||
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
import appeng.fluids.client.gui.widgets.GuiFluidSlot;
|
import appeng.fluids.client.gui.widgets.GuiFluidSlot;
|
||||||
|
import appeng.fluids.container.ContainerFluidConfigurable;
|
||||||
import appeng.fluids.util.AEFluidStack;
|
import appeng.fluids.util.AEFluidStack;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -193,9 +193,11 @@ public class PacketInventoryAction extends AppEngPacket
|
|||||||
{
|
{
|
||||||
if( sender.openContainer.inventorySlots.get( this.slot ) instanceof SlotFake )
|
if( sender.openContainer.inventorySlots.get( this.slot ) instanceof SlotFake )
|
||||||
{
|
{
|
||||||
if( this.slotItem != null ) {
|
if( this.slotItem != null )
|
||||||
sender.openContainer.inventorySlots.get( this.slot ).putStack( this.slotItem.asItemStackRepresentation() );
|
{
|
||||||
if (sender.openContainer.inventorySlots.get( this.slot ).getStack().isEmpty()){
|
sender.openContainer.inventorySlots.get( this.slot ).putStack( this.slotItem.createItemStack() );
|
||||||
|
if( sender.openContainer.inventorySlots.get( this.slot ).getStack().isEmpty() )
|
||||||
|
{
|
||||||
IAEFluidStack aefs = AEFluidStack.fromNBT( this.slotItem.getDefinition().getTagCompound() );
|
IAEFluidStack aefs = AEFluidStack.fromNBT( this.slotItem.getDefinition().getTagCompound() );
|
||||||
if( aefs != null )
|
if( aefs != null )
|
||||||
{
|
{
|
||||||
@@ -205,26 +207,24 @@ public class PacketInventoryAction extends AppEngPacket
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else sender.openContainer.inventorySlots.get( this.slot ).putStack( ItemStack.EMPTY );
|
else sender.openContainer.inventorySlots.get( this.slot ).putStack( ItemStack.EMPTY );
|
||||||
|
try
|
||||||
|
{
|
||||||
|
NetworkHandler.instance().sendTo( new PacketInventoryAction( InventoryAction.UPDATE_HAND, 0, AEItemStack.fromItemStack( ItemStack.EMPTY ) ), sender );
|
||||||
}
|
}
|
||||||
if( Minecraft.getMinecraft().currentScreen instanceof GuiUpgradeable )
|
catch( final IOException e )
|
||||||
{
|
{
|
||||||
GuiUpgradeable cs = ( (GuiUpgradeable) Minecraft.getMinecraft().currentScreen );
|
AELog.debug( e );
|
||||||
if( cs.getGuiSlots().size() > 0 )
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( sender.openContainer instanceof ContainerFluidConfigurable )
|
||||||
{
|
{
|
||||||
GuiCustomSlot ct = cs.getGuiSlots().get( this.slot );
|
|
||||||
GuiFluidSlot gfs = (GuiFluidSlot) ct;
|
|
||||||
if( this.slotItem != null )
|
if( this.slotItem != null )
|
||||||
{
|
{
|
||||||
IAEFluidStack aefs = AEFluidStack.fromNBT( this.slotItem.getDefinition().getTagCompound() );
|
IAEFluidStack aefs = AEFluidStack.fromNBT( this.slotItem.getDefinition().getTagCompound() );
|
||||||
if( aefs != null )
|
if( aefs != null )
|
||||||
{
|
{
|
||||||
FluidStack fluid = aefs.getFluidStack();
|
( (ContainerFluidConfigurable) sender.openContainer ).getFluidConfigInventory().setFluidInSlot( this.slot, aefs );
|
||||||
gfs.setFluidStack( AEFluidStack.fromFluidStack( fluid ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gfs.setFluidStack( null );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -149,6 +149,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
|||||||
private int isWorking = -1;
|
private int isWorking = -1;
|
||||||
private final Accessor accessor = new Accessor();
|
private final Accessor accessor = new Accessor();
|
||||||
private GTCEInventoryAdaptor GTad;
|
private GTCEInventoryAdaptor GTad;
|
||||||
|
EnumSet<EnumFacing> visitedFaces = EnumSet.noneOf( EnumFacing.class );
|
||||||
|
|
||||||
public DualityInterface( final AENetworkProxy networkProxy, final IInterfaceHost ih )
|
public DualityInterface( final AENetworkProxy networkProxy, final IInterfaceHost ih )
|
||||||
{
|
{
|
||||||
@@ -939,8 +940,12 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
|||||||
final World w = tile.getWorld();
|
final World w = tile.getWorld();
|
||||||
|
|
||||||
final EnumSet<EnumFacing> possibleDirections = this.iHost.getTargets();
|
final EnumSet<EnumFacing> possibleDirections = this.iHost.getTargets();
|
||||||
|
|
||||||
for( final EnumFacing s : possibleDirections )
|
for( final EnumFacing s : possibleDirections )
|
||||||
{
|
{
|
||||||
|
if (visitedFaces.contains( s ))
|
||||||
|
continue;
|
||||||
|
|
||||||
final TileEntity te = w.getTileEntity( tile.getPos().offset( s ) );
|
final TileEntity te = w.getTileEntity( tile.getPos().offset( s ) );
|
||||||
if( te instanceof IInterfaceHost )
|
if( te instanceof IInterfaceHost )
|
||||||
{
|
{
|
||||||
@@ -964,6 +969,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
|||||||
{
|
{
|
||||||
if( cm.pushPattern( patternDetails, table, s.getOpposite() ) )
|
if( cm.pushPattern( patternDetails, table, s.getOpposite() ) )
|
||||||
{
|
{
|
||||||
|
visitedFaces.add( s );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
@@ -1004,10 +1010,12 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.pushItemsOut( possibleDirections );
|
this.pushItemsOut( possibleDirections );
|
||||||
|
visitedFaces.add( s );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
visitedFaces.clear();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
|||||||
private final List<TileCraftingTile> storage = new ArrayList<>();
|
private final List<TileCraftingTile> storage = new ArrayList<>();
|
||||||
private final List<TileCraftingMonitorTile> status = new ArrayList<>();
|
private final List<TileCraftingMonitorTile> status = new ArrayList<>();
|
||||||
private final HashMap<IMEMonitorHandlerReceiver<IAEItemStack>, Object> listeners = new HashMap<>();
|
private final HashMap<IMEMonitorHandlerReceiver<IAEItemStack>, Object> listeners = new HashMap<>();
|
||||||
|
private final Map<ICraftingPatternDetails,List<ICraftingMedium>> visitedMediums = new HashMap<>();
|
||||||
private ICraftingLink myLastLink;
|
private ICraftingLink myLastLink;
|
||||||
private String myName = "";
|
private String myName = "";
|
||||||
private boolean isDestroyed = false;
|
private boolean isDestroyed = false;
|
||||||
@@ -653,6 +654,23 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (visitedMediums.containsKey( details ))
|
||||||
|
{
|
||||||
|
if( visitedMediums.get( details ).containsAll( cc.getMediums( e.getKey() ) ) )
|
||||||
|
{
|
||||||
|
visitedMediums.clear();
|
||||||
|
visitedMediums.put( details, new ArrayList<>() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
visitedMediums.putIfAbsent( details, new ArrayList<>() );
|
||||||
|
|
||||||
|
if( visitedMediums.get( details ).contains( m ) )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
visitedMediums.get( details ).add( m );
|
||||||
|
|
||||||
if( !m.isBusy() )
|
if( !m.isBusy() )
|
||||||
{
|
{
|
||||||
if( ic == null )
|
if( ic == null )
|
||||||
|
|||||||
Reference in New Issue
Block a user