Panel components update their color as soon as the value is changed in the GUI, rather than on closing the GUI
This commit is contained in:
parent
09161bce5f
commit
d3b84e6823
|
@ -13,6 +13,7 @@ import malte0811.industrialWires.controlpanel.IConfigurableComponent;
|
|||
import malte0811.industrialWires.controlpanel.PanelComponent;
|
||||
import malte0811.industrialWires.items.ItemPanelComponent;
|
||||
import malte0811.industrialWires.network.MessageItemSync;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
|
@ -206,8 +207,13 @@ public class GuiPanelComponent extends GuiContainer {
|
|||
for (GuiIntChooser choose : intChoosers) {
|
||||
choose.drawChooser();
|
||||
}
|
||||
for (GuiSliderIE choose : floatSliders) {
|
||||
choose.drawButton(mc, mouseX, mouseY, partialTicks);
|
||||
for (int i = 0; i < floatSliders.size(); i++) {
|
||||
GuiSliderIE slider = floatSliders.get(i);
|
||||
double oldV = slider.getValue();
|
||||
slider.drawButton(mc, mouseX, mouseY, partialTicks);
|
||||
if (oldV != slider.getValue()) {
|
||||
sync(i, (float) slider.getValue());
|
||||
}
|
||||
}
|
||||
GuiChannelPickerSmall openPicker = null;
|
||||
for (GuiChannelPicker pick : rsChannelChoosers) {
|
||||
|
@ -354,5 +360,6 @@ public class GuiPanelComponent extends GuiContainer {
|
|||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setTag("data", list);
|
||||
IndustrialWires.packetHandler.sendToServer(new MessageItemSync(container.hand, nbt));
|
||||
IndustrialWires.panelComponent.onChange(nbt, Minecraft.getMinecraft().player, container.hand);
|
||||
}
|
||||
}
|
|
@ -240,4 +240,9 @@ public class ItemPanelComponent extends Item implements INetGUIItem {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) {
|
||||
return !ItemStack.areItemsEqual(oldStack, newStack);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue