Minor fixes. Also fixes #1895
This commit is contained in:
@@ -4,6 +4,7 @@ import com.raoulvdberge.refinedstorage.api.network.grid.IGridTab;
|
||||
import com.raoulvdberge.refinedstorage.gui.GuiBase;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
@@ -113,6 +114,8 @@ public class TabList {
|
||||
int tx = x + ((IGridTab.TAB_WIDTH + 1) * num);
|
||||
int ty = y;
|
||||
|
||||
GlStateManager.enableAlpha();
|
||||
|
||||
gui.bindTexture("icons.png");
|
||||
|
||||
if (!isSelected) {
|
||||
|
||||
@@ -5,7 +5,6 @@ import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||
import com.raoulvdberge.refinedstorage.gui.GuiBase;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -17,9 +16,9 @@ public class GridStackFluid implements IGridStack {
|
||||
private boolean craftable;
|
||||
private boolean displayCraftText;
|
||||
|
||||
public GridStackFluid(Pair<Integer, FluidStack> data, @Nullable IStorageTracker.IStorageTrackerEntry entry, boolean craftable, boolean displayCraftText) {
|
||||
this.hash = data.getLeft();
|
||||
this.stack = data.getRight();
|
||||
public GridStackFluid(int hash, FluidStack stack, @Nullable IStorageTracker.IStorageTrackerEntry entry, boolean craftable, boolean displayCraftText) {
|
||||
this.hash = hash;
|
||||
this.stack = stack;
|
||||
this.entry = entry;
|
||||
this.craftable = craftable;
|
||||
this.displayCraftText = displayCraftText;
|
||||
|
||||
@@ -19,7 +19,7 @@ public class MessageGridFluidDelta implements IMessage, IMessageHandler<MessageG
|
||||
private FluidStack stack;
|
||||
private int delta;
|
||||
|
||||
private GridStackFluid clientStack;
|
||||
private GridStackFluid gridStack;
|
||||
|
||||
public MessageGridFluidDelta() {
|
||||
}
|
||||
@@ -32,7 +32,7 @@ public class MessageGridFluidDelta implements IMessage, IMessageHandler<MessageG
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
clientStack = new GridStackFluid(StackUtils.readFluidStack(buf), buf.readBoolean() ? new StorageTrackerEntry(buf) : null, buf.readBoolean(), false);
|
||||
gridStack = new GridStackFluid(buf.readInt(), StackUtils.readFluidStack(buf), buf.readBoolean() ? new StorageTrackerEntry(buf) : null, buf.readBoolean(), false);
|
||||
delta = buf.readInt();
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class MessageGridFluidDelta implements IMessage, IMessageHandler<MessageG
|
||||
@Override
|
||||
public IMessage onMessage(MessageGridFluidDelta message, MessageContext ctx) {
|
||||
GuiBase.executeLater(GuiGrid.class, grid -> {
|
||||
grid.getView().postChange(message.clientStack, message.delta);
|
||||
grid.getView().postChange(message.gridStack, message.delta);
|
||||
grid.getView().sort();
|
||||
});
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ public class MessageGridFluidUpdate implements IMessage, IMessageHandler<Message
|
||||
int items = buf.readInt();
|
||||
|
||||
for (int i = 0; i < items; ++i) {
|
||||
this.stacks.add(new GridStackFluid(StackUtils.readFluidStack(buf), buf.readBoolean() ? new StorageTrackerEntry(buf) : null, buf.readBoolean(), buf.readBoolean()));
|
||||
this.stacks.add(new GridStackFluid(buf.readInt(), StackUtils.readFluidStack(buf), buf.readBoolean() ? new StorageTrackerEntry(buf) : null, buf.readBoolean(), buf.readBoolean()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -95,7 +95,12 @@ public class ProxyCommon {
|
||||
API.instance().getCraftingTaskRegistry().add(CraftingTaskFactory.ID, new CraftingTaskFactory());
|
||||
|
||||
API.instance().getCraftingMonitorElementRegistry().add(CraftingMonitorElementItemRender.ID, buf -> new CraftingMonitorElementItemRender(StackUtils.readItemStack(buf), buf.readInt(), buf.readInt()));
|
||||
API.instance().getCraftingMonitorElementRegistry().add(CraftingMonitorElementFluidRender.ID, buf -> new CraftingMonitorElementFluidRender(StackUtils.readFluidStack(buf).getRight(), buf.readInt(), buf.readInt()));
|
||||
API.instance().getCraftingMonitorElementRegistry().add(CraftingMonitorElementFluidRender.ID, buf -> {
|
||||
// Consume hash
|
||||
buf.readInt();
|
||||
|
||||
return new CraftingMonitorElementFluidRender(StackUtils.readFluidStack(buf), buf.readInt(), buf.readInt());
|
||||
});
|
||||
API.instance().getCraftingMonitorElementRegistry().add(CraftingMonitorElementText.ID, buf -> new CraftingMonitorElementText(ByteBufUtils.readUTF8String(buf), buf.readInt()));
|
||||
API.instance().getCraftingMonitorElementRegistry().add(CraftingMonitorElementColor.ID, buf -> {
|
||||
int color = buf.readInt();
|
||||
|
||||
@@ -157,6 +157,7 @@ public final class RenderUtils {
|
||||
public void draw(Minecraft minecraft, int xPosition, int yPosition, FluidStack fluidStack) {
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.enableAlpha();
|
||||
GlStateManager.disableLighting();
|
||||
|
||||
drawFluid(minecraft, xPosition, yPosition, fluidStack);
|
||||
|
||||
|
||||
@@ -67,8 +67,8 @@ public final class StackUtils {
|
||||
ByteBufUtils.writeTag(buf, stack.tag);
|
||||
}
|
||||
|
||||
public static Pair<Integer, FluidStack> readFluidStack(ByteBuf buf) {
|
||||
return Pair.of(buf.readInt(), new FluidStack(FluidRegistry.getFluid(ByteBufUtils.readUTF8String(buf)), buf.readInt(), ByteBufUtils.readTag(buf)));
|
||||
public static FluidStack readFluidStack(ByteBuf buf) {
|
||||
return new FluidStack(FluidRegistry.getFluid(ByteBufUtils.readUTF8String(buf)), buf.readInt(), ByteBufUtils.readTag(buf));
|
||||
}
|
||||
|
||||
public static ItemStack nullToEmpty(@Nullable ItemStack stack) {
|
||||
|
||||
Reference in New Issue
Block a user