GUI Rendering and various fixes

This commit is contained in:
Sebastian Hartte
2020-06-07 03:29:57 +02:00
parent 97f04922b9
commit 46b1d1ffdc
72 changed files with 650 additions and 552 deletions
+33 -66
View File
@@ -92,26 +92,6 @@ public abstract class AEBaseGui<T extends AEBaseContainer> extends ContainerScre
super(container, playerInventory, title);
}
protected static String join( final Collection<String> toolTip, final String delimiter )
{
final Joiner joiner = Joiner.on( delimiter );
return joiner.join( toolTip );
}
protected int getQty( final Button btn )
{
try
{
final DecimalFormat df = new DecimalFormat( "+#;-#" );
return df.parse( btn.getMessage() ).intValue();
}
catch( final ParseException e )
{
return 0;
}
}
@Override
public void init()
{
@@ -157,6 +137,7 @@ public abstract class AEBaseGui<T extends AEBaseContainer> extends ContainerScre
this.drawTooltip( c, mouseX - this.guiLeft, mouseY - this.guiTop );
}
RenderSystem.popMatrix();
RenderSystem.enableDepthTest();
this.renderHoveredToolTip( mouseX, mouseY );
@@ -182,11 +163,9 @@ public abstract class AEBaseGui<T extends AEBaseContainer> extends ContainerScre
if( this.isPointInRegion( left, top, slot.getWidth(), slot.getHeight(), mouseX, mouseY ) && slot.canClick( this.minecraft.player ) )
{
RenderSystem.disableLighting();
RenderSystem.colorMask( true, true, true, false );
this.fillGradient( left, top, right, bottom, -2130706433, -2130706433 );
RenderSystem.colorMask( true, true, true, true );
RenderSystem.enableLighting();
}
}
}
@@ -390,45 +369,38 @@ public abstract class AEBaseGui<T extends AEBaseContainer> extends ContainerScre
return;
}
// FIXME if( slot instanceof SlotPatternTerm )
// FIXME {
// FIXME if( mouseButton == 6 )
// FIXME {
// FIXME return; // prevent weird double clicks..
// FIXME }
// FIXME
// FIXME try
// FIXME {
// FIXME NetworkHandler.instance().sendToServer( ( (SlotPatternTerm) slot ).getRequest( hasShiftDown() ) );
// FIXME }
// FIXME catch( final IOException e )
// FIXME {
// FIXME AELog.debug( e );
// FIXME }
// FIXME }
// FIXME else if( slot instanceof SlotCraftingTerm )
// FIXME {
// FIXME if( mouseButton == 6 )
// FIXME {
// FIXME return; // prevent weird double clicks..
// FIXME }
// FIXME
// FIXME InventoryAction action = null;
// FIXME if( hasShiftDown() )
// FIXME {
// FIXME action = InventoryAction.CRAFT_SHIFT;
// FIXME }
// FIXME else
// FIXME {
// FIXME // Craft stack on right-click, craft single on left-click
// FIXME action = ( mouseButton == 1 ) ? InventoryAction.CRAFT_STACK : InventoryAction.CRAFT_ITEM;
// FIXME }
// FIXME
// FIXME final PacketInventoryAction p = new PacketInventoryAction( action, slotIdx, 0 );
// FIXME NetworkHandler.instance().sendToServer( p );
// FIXME
// FIXME return;
// FIXME }
if( slot instanceof SlotPatternTerm )
{
if( mouseButton == 6 )
{
return; // prevent weird double clicks..
}
NetworkHandler.instance().sendToServer( ( (SlotPatternTerm) slot ).getRequest( hasShiftDown() ) );
}
else if( slot instanceof SlotCraftingTerm )
{
if( mouseButton == 6 )
{
return; // prevent weird double clicks..
}
InventoryAction action = null;
if( hasShiftDown() )
{
action = InventoryAction.CRAFT_SHIFT;
}
else
{
// Craft stack on right-click, craft single on left-click
action = ( mouseButton == 1 ) ? InventoryAction.CRAFT_STACK : InventoryAction.CRAFT_ITEM;
}
final PacketInventoryAction p = new PacketInventoryAction( action, slotIdx, 0 );
NetworkHandler.instance().sendToServer( p );
return;
}
if( InputMappings.isKeyDown(Minecraft.getInstance().getMainWindow().getHandle(), GLFW.GLFW_KEY_SPACE) )
{
@@ -777,7 +749,6 @@ public abstract class AEBaseGui<T extends AEBaseContainer> extends ContainerScre
if( fs != null && this.isPowered() )
{
RenderSystem.disableLighting();
RenderSystem.disableBlend();
final Fluid fluid = fs.getFluid();
FluidAttributes fluidAttributes = fluid.getAttributes();
@@ -793,7 +764,6 @@ public abstract class AEBaseGui<T extends AEBaseContainer> extends ContainerScre
RenderSystem.color3f( red, green, blue );
blit(s.xPos, s.yPos, 0 /* FIXME: Validate this was previous the controls zindex */, 16, 16, sprite);
RenderSystem.enableLighting();
RenderSystem.enableBlend();
this.fluidStackSizeRenderer.renderStackSize( this.font, fs, s.xPos, s.yPos );
@@ -823,7 +793,6 @@ public abstract class AEBaseGui<T extends AEBaseContainer> extends ContainerScre
final int uv_x = aes.getIcon() - uv_y * 16;
RenderSystem.enableBlend();
RenderSystem.disableLighting();
RenderSystem.enableTexture();
RenderSystem.blendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA );
RenderSystem.color4f( 1.0f, 1.0f, 1.0f, 1.0f );
@@ -897,9 +866,7 @@ public abstract class AEBaseGui<T extends AEBaseContainer> extends ContainerScre
// FIXME this.zLevel = 100.0F;
this.itemRenderer.zLevel = 100.0F;
RenderSystem.disableLighting();
fill( s.xPos, s.yPos, 16 + s.xPos, 16 + s.yPos, 0x66ff6666 );
RenderSystem.enableLighting();
// FIXME this.zLevel = 0.0F;
this.itemRenderer.zLevel = 0.0F;
@@ -19,7 +19,6 @@
package appeng.client.gui.implementations;
import java.io.IOException;
import java.util.List;
import appeng.container.implementations.ContainerCraftingStatus;
@@ -107,6 +106,7 @@ public class GuiMEMonitorable<T extends ContainerMEMonitorable> extends AEBaseME
final GuiScrollbar scrollbar = new GuiScrollbar();
this.setScrollBar( scrollbar );
this.repo = new ItemRepo( scrollbar, this );
setScrollBar();
this.xSize = 185;
this.ySize = 204;
@@ -333,11 +333,11 @@ public class GuiMEMonitorable<T extends ContainerMEMonitorable> extends AEBaseME
craftingGridOffsetX = Integer.MAX_VALUE;
craftingGridOffsetY = Integer.MAX_VALUE;
for( final Object s : this.container.inventorySlots )
for( final Slot s : this.container.inventorySlots )
{
if( s instanceof AppEngSlot )
{
if( ( (Slot) s ).xPos < 197 )
if( s.xPos < 197 )
{
this.repositionSlot( (AppEngSlot) s );
}
@@ -345,11 +345,10 @@ public class GuiMEMonitorable<T extends ContainerMEMonitorable> extends AEBaseME
if( s instanceof SlotCraftingMatrix || s instanceof SlotFakeCraftingMatrix )
{
final Slot g = (Slot) s;
if( g.xPos > 0 && g.yPos > 0 )
if( s.xPos > 0 && s.yPos > 0 )
{
craftingGridOffsetX = Math.min( craftingGridOffsetX, g.xPos );
craftingGridOffsetY = Math.min( craftingGridOffsetY, g.yPos );
craftingGridOffsetX = Math.min( craftingGridOffsetX, s.xPos );
craftingGridOffsetY = Math.min( craftingGridOffsetY, s.yPos );
}
}
}
@@ -457,8 +456,7 @@ public class GuiMEMonitorable<T extends ContainerMEMonitorable> extends AEBaseME
protected void repositionSlot( final AppEngSlot s )
{
// FIXME .... it's final now, WHAT DO WE DO ARGH
// s.yPos = s.getY() + this.ySize - 78 - 5;
s.yPos = s.getY() + this.ySize - 78 - 5;
}
@Override
@@ -149,6 +149,6 @@ public class GuiPatternTerm extends GuiMEMonitorable<ContainerPatternTerm>
{
final int offsetPlayerSide = s.isPlayerSide() ? 5 : 3;
// FIXME OH NOOOOO WE CANNOT, ITS FINAL s.yPos = s.getY() + this.ySize - 78 - offsetPlayerSide;
s.yPos = s.getY() + this.ySize - 78 - offsetPlayerSide;
}
}
@@ -163,6 +163,7 @@ public class MEGuiTextField extends TextFieldWidget
tessellator.draw();
RenderSystem.disableColorLogicOp();
RenderSystem.enableTexture();
RenderSystem.color4f( 1, 1, 1, 1 );
}
}