Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix error on client when opening multiblock UI for the first time #1042

Merged
merged 2 commits into from
Mar 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Version: 1.1.4.b
### ADDITIONS:

### FIXES:
- fixed client error when opening multiblock UI for the first time
- fixed Large assembler & circuit assembler being able to have >1 energy hatch
- fix server crash in LDlib

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ default ModularUI createUI(Player entityPlayer) {
var screen = new DraggableScrollableWidgetGroup(7, 4, 162, 121).setBackground(getScreenTexture());
screen.addWidget(new LabelWidget(4, 5, self().getBlockState().getBlock().getDescriptionId()));
screen.addWidget(new ComponentPanelWidget(4, 17, this::addDisplayText)
.textSupplier(this.self().getLevel().isClientSide ? null : this::addDisplayText)
.setMaxWidthLimit(150)
.clickHandler(this::handleDisplayClick));
return new ModularUI(176, 216, this, entityPlayer)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@
import com.gregtechceu.gtceu.utils.GTUtil;
import com.lowdragmc.lowdraglib.gui.modular.ModularUI;
import com.lowdragmc.lowdraglib.gui.widget.*;
import net.minecraft.ChatFormatting;
import net.minecraft.MethodsReturnNonnullByDefault;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.Style;
import net.minecraft.world.entity.player.Player;

import javax.annotation.ParametersAreNonnullByDefault;
Expand Down Expand Up @@ -97,6 +95,7 @@ public Widget createUIWidget() {
group.addWidget(new DraggableScrollableWidgetGroup(4, 4, 182, 117).setBackground(getScreenTexture())
.addWidget(new LabelWidget(4, 5, self().getBlockState().getBlock().getDescriptionId()))
.addWidget(new ComponentPanelWidget(4, 17, this::addDisplayText)
.textSupplier(this.getLevel().isClientSide ? null : this::addDisplayText)
.setMaxWidthLimit(150)
.clickHandler(this::handleDisplayClick)));
group.setBackground(GuiTextures.BACKGROUND_INVERSE);
Expand Down Expand Up @@ -146,7 +145,9 @@ public void setOverclockTier(int tier) {

@Override
public long getOverclockVoltage() {
IEnergyContainer energyContainer = this.energyContainer;
if (this.energyContainer == null) {
this.energyContainer = getEnergyContainer();
}
if (energyContainer instanceof EnergyContainerList) {
long voltage;
long amperage;
Expand Down Expand Up @@ -208,7 +209,6 @@ public IEnergyContainer getEnergyContainer() {
}

public long getMaxVoltage() {
IEnergyContainer energyContainer = this.energyContainer;
if (this.energyContainer == null) {
this.energyContainer = getEnergyContainer();
}
Expand Down
Loading