-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Space Race Manager screen not rendering as it should (#321)
* fix: Space Race Manager screen rendering out of order * fix: Space Race Manager screen animation not respecting framerate * chore: combine Space Race Manager button renderers * fix: button renderer * refactor: convert Space Race Manager buttons to widgets * refactor: better Space Race Manager menu switching * feat: team color menu and customize flag button * feat: Space Race menu translations * wip: draw flag when confirming after drag+drop * fix: license header in ConfirmFlagScreen.java * feat: draw flag in space race menu * fix: pose stack usage in ConfirmFlagScreen.java * fix: use the right function in SpaceRaceScreen.java Co-authored-by: marcus8448 <[email protected]> --------- Co-authored-by: marcus8448 <[email protected]>
- Loading branch information
1 parent
3f46476
commit 350fdd4
Showing
5 changed files
with
328 additions
and
241 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/main/java/dev/galacticraft/mod/client/gui/screen/ingame/ConfirmFlagScreen.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright (c) 2019-2024 Team Galacticraft | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
package dev.galacticraft.mod.client.gui.screen.ingame; | ||
|
||
import it.unimi.dsi.fastutil.booleans.BooleanConsumer; | ||
import net.minecraft.client.gui.GuiGraphics; | ||
import net.minecraft.client.gui.screens.ConfirmScreen; | ||
import net.minecraft.network.chat.Component; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.util.Mth; | ||
|
||
public class ConfirmFlagScreen extends ConfirmScreen { | ||
protected final ResourceLocation imageLocation; | ||
public ConfirmFlagScreen(BooleanConsumer booleanConsumer, ResourceLocation flagImage, Component component, Component component2) { | ||
super(booleanConsumer, component, component2); | ||
this.imageLocation = flagImage; | ||
} | ||
|
||
private int titleTop() { | ||
int i = this.height/2; | ||
return Mth.clamp(i - 20 - this.font.lineHeight, 10, 80); | ||
} | ||
|
||
private int flagTop() { | ||
return this.titleTop() + 20; | ||
} | ||
|
||
@Override | ||
public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) { | ||
super.render(graphics, mouseX, mouseY, delta); | ||
graphics.blit(this.imageLocation, this.width/2 - 24, this.flagTop(), 0, 0, 0, 48, 32, 48, 32); | ||
} | ||
} |
Oops, something went wrong.