evilcraft

This commit is contained in:
Halbear
2026-08-05 14:56:49 +01:00
parent bb39b9e837
commit 2b706b0687
@@ -22,6 +22,7 @@ import org.jspecify.annotations.NonNull;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentLinkedQueue;
public class SelectionScreen extends Screen {
@@ -31,6 +32,8 @@ public class SelectionScreen extends Screen {
private final List<String> availableItems = new ArrayList<>(List.of("Test1", "Test2", "Test3", "Test4"));
private final List<String> selectedItems = new ArrayList<>(List.of("Test5"));
private final ConcurrentLinkedQueue<Button> transferButtons = new ConcurrentLinkedQueue<Button>();
private SelectionPanelList leftList;
private SelectionPanelList rightList;
@@ -66,6 +69,12 @@ public class SelectionScreen extends Screen {
}
private void refreshListData() {
Button TransferBtn;
while ((TransferBtn = transferButtons.poll()) != null) {
renderables.remove(TransferBtn);
}
this.leftList.clearEntries();
this.rightList.clearEntries();
@@ -80,19 +89,20 @@ public class SelectionScreen extends Screen {
@Override
public void extractBackground(GuiGraphicsExtractor guiGraphics, int mouseX, int mouseY, float partialTick) {
super.extractBackground(guiGraphics, mouseX, mouseY, partialTick);
guiGraphics.pose().pushMatrix();
guiGraphics.text(this.font, this.title, this.width / 2 - this.font.width(this.title)/2, 8, 0xFFFFFFFF,true);
guiGraphics.text(this.font, "Drag and drop sprites inside...", this.width / 2 - this.font.width("Drag and drop sprites inside...")/2, 20, 0xFFFFFFFF,true);
guiGraphics.pose().popMatrix();
// NeoForge.EVENT_BUS.post(new ScreenEvent.Render.Post(this,guiGraphicsExtractor, mouseX, mouseY,partialTick));
//SkyboxMod.LOGGER.debug("\n this font: " + this.font + "\n this width:" + this.width + "\n this Title: " + this.title + "\n this title width: " + this.font.width(this.title));
}
@Override
public void extractRenderState(GuiGraphicsExtractor guiGraphicsExtractor, int mouseX, int mouseY, float partialTick){
super.extractRenderState(guiGraphicsExtractor,mouseX,mouseY,partialTick);
guiGraphicsExtractor.pose().pushMatrix();
guiGraphicsExtractor.text(this.font, this.title, this.width / 2 - this.font.width(this.title)/2, 8, 0xFFFFFF,false);
guiGraphicsExtractor.text(this.font, "Drag and drop sprites inside...", this.width / 2 - this.font.width("Drag and drop sprites inside...")/2, 20, 0x808080,false);
guiGraphicsExtractor.pose().popMatrix();
// NeoForge.EVENT_BUS.post(new ScreenEvent.Render.Post(this,guiGraphicsExtractor, mouseX, mouseY,partialTick));
SkyboxMod.LOGGER.debug("\n this font: " + this.font + "\n this width:" + this.width + "\n this Title: " + this.title + "\n this title width: " + this.font.width(this.title));
}
@Override
@@ -102,13 +112,17 @@ public class SelectionScreen extends Screen {
private class SelectionPanelList extends ObjectSelectionList<TextRowEntry> {
public SelectionPanelList(Minecraft minecraft, int width, int height, int y, int itemHeight) {
super(minecraft, width, height, y, itemHeight);
}
public void AddEntry(TextRowEntry entry){
this.addEntry(entry);
}
@Override
public int getRowWidth() {
return getWidth() - this.scrollbarWidth();
}
public void ClearChildren(){
this.clearEntries();
@@ -135,6 +149,8 @@ public class SelectionScreen extends Screen {
}
refreshListData();
}).bounds(0, 0, 20, 20).build();
transferButtons.add(this.transferButton);
Parent.addRenderableWidget(this.transferButton);
}
@Override
@@ -144,11 +160,13 @@ public class SelectionScreen extends Screen {
int rowWidth = this.getWidth();
int rowHeight = this.getHeight();
graphics.pose().pushMatrix();
this.transferButton.setX(left + rowWidth - (transferButton.getWidth() + 2));
this.transferButton.setY(top + rowHeight/2 - transferButton.getWidth()/2);
graphics.pose().translate((float)left, (float)top);
// SkyboxMod.LOGGER.debug("\n this font: " + Parent.getFont() + "\n this rowWidth:" + rowWidth + "\n this Text: " + this.textValue + "\n this Position: " + left +"_"+top);
graphics.blit( Identifier.fromNamespaceAndPath(SkyboxMod.MODID, "textures/no_texture.png"),0, 0, 20, 20,0,1,0,1);
graphics.text(Parent.getFont(), this.textValue, 24, 6, 0xFFFFFFFF, true);
this.transferButton.extractRenderState(graphics, mouseX, mouseY, partialTick);
SkyboxMod.LOGGER.debug("\n this font: " + Parent.getFont() + "\n this rowWidth:" + rowWidth + "\n this Text: " + this.textValue + "\n this Position: " + left +"_"+top);
graphics.blit( Identifier.fromNamespaceAndPath(SkyboxMod.MODID, "textures/no_texture.png"),0, 0,0 + 20, 0 + 20,0,1,0,1);
graphics.text(Parent.getFont(), this.textValue, 0 + 4, 0 + 6, 0xFFFFFF, true);
graphics.pose().popMatrix();
}