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
@@ -45,7 +45,6 @@ public class GuiFluidSlot extends GuiCustomSlot
final IAEFluidStack fs = this.getFluidStack();
if( fs != null )
{
RenderSystem.disableLighting();
RenderSystem.disableBlend();
final Fluid fluid = fs.getFluid();
final FluidAttributes attributes = fluid.getAttributes();
@@ -52,7 +52,6 @@ public class GuiFluidTank extends Widget implements ITooltip
if( this.visible )
{
RenderSystem.disableBlend();
RenderSystem.disableLighting();
fill( this.x, this.y, this.x + this.width, this.y + this.height, AEColor.GRAY.blackVariant | 0xFF000000 );
@@ -60,7 +60,6 @@ public class FluidStackSizeRenderer
{
final String stackSize = this.getToBeRenderedStackSize( aeStack.getStackSize() );
RenderSystem.disableLighting();
RenderSystem.disableDepthTest();
RenderSystem.disableBlend();
RenderSystem.pushMatrix();
@@ -69,7 +68,6 @@ public class FluidStackSizeRenderer
final int Y = (int) ( ( (float) yPos + offset + 16.0f - 7.0f * scaleFactor ) * inverseScaleFactor );
fontRenderer.drawStringWithShadow( stackSize, X, Y, 16777215 );
RenderSystem.popMatrix();
RenderSystem.enableLighting();
RenderSystem.enableDepthTest();
RenderSystem.enableBlend();
}
@@ -110,43 +110,6 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
return fluid;
}
public static IAEFluidStack fromPacket( final PacketBuffer buffer ) throws IOException
{
final byte mask = buffer.readByte();
final byte stackType = (byte) ( ( mask & 0x0C ) >> 2 );
final byte countReqType = (byte) ( ( mask & 0x30 ) >> 4 );
final boolean isCraftable = ( mask & 0x40 ) > 0;
final boolean hasTagCompound = ( mask & 0x80 ) > 0;
// don't send this...
final CompoundNBT d = new CompoundNBT();
d.putString( "FluidName", buffer.readString() );
d.putByte( "Amount", (byte) 0 );
if( hasTagCompound )
{
d.put( "Tag", buffer.readCompoundTag() );
}
final long stackSize = getPacketValue( stackType, buffer );
final long countRequestable = getPacketValue( countReqType, buffer );
final FluidStack fluidStack = FluidStack.loadFluidStackFromNBT( d );
if( fluidStack == null )
{
return null;
}
final AEFluidStack fluid = AEFluidStack.fromFluidStack( fluidStack );
// fluid.priority = (int) priority;
fluid.setStackSize( stackSize );
fluid.setCountRequestable( countRequestable );
fluid.setCraftable( isCraftable );
return fluid;
}
@Override
public void add( final IAEFluidStack option )
{
@@ -299,8 +262,45 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
return ItemStack.EMPTY;
}
public static IAEFluidStack fromPacket( final PacketBuffer buffer )
{
final byte mask = buffer.readByte();
final byte stackType = (byte) ( ( mask & 0x0C ) >> 2 );
final byte countReqType = (byte) ( ( mask & 0x30 ) >> 4 );
final boolean isCraftable = ( mask & 0x40 ) > 0;
final boolean hasTagCompound = ( mask & 0x80 ) > 0;
// don't send this...
final CompoundNBT d = new CompoundNBT();
d.putString( "FluidName", buffer.readString() );
d.putByte( "Amount", (byte) 0 );
if( hasTagCompound )
{
d.put( "Tag", buffer.readCompoundTag() );
}
final long stackSize = getPacketValue( stackType, buffer );
final long countRequestable = getPacketValue( countReqType, buffer );
final FluidStack fluidStack = FluidStack.loadFluidStackFromNBT( d );
if( fluidStack == null )
{
return null;
}
final AEFluidStack fluid = AEFluidStack.fromFluidStack( fluidStack );
// fluid.priority = (int) priority;
fluid.setStackSize( stackSize );
fluid.setCountRequestable( countRequestable );
fluid.setCraftable( isCraftable );
return fluid;
}
@Override
public void writeToPacket( final PacketBuffer buffer ) throws IOException
public void writeToPacket( final PacketBuffer buffer )
{
final byte mask = (byte) ( ( this.getType( this.getStackSize() ) << 2 ) | ( this
.getType( this.getCountRequestable() ) << 4 ) | ( (byte) ( this.isCraftable() ? 1 : 0 ) << 6 ) | ( this.hasTagCompound() ? 1 : 0 ) << 7 );
@@ -313,7 +313,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
this.putPacketValue( buffer, this.getCountRequestable() );
}
private void writeToStream( final PacketBuffer buffer ) throws IOException
private void writeToStream( final PacketBuffer buffer )
{
buffer.writeString( fluid.getRegistryName().toString() );
if( this.hasTagCompound() )