Merge pull request #2048 from Lazzzycatwastaken/ttttt

RT gaynator new ui
This commit is contained in:
HbmMods 2025-04-06 22:59:09 +02:00 committed by GitHub
commit e6bd1fef4a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 58 additions and 60 deletions

View File

@ -13,60 +13,60 @@ public class ContainerMachineRTG extends Container {
private TileEntityMachineRTG testNuke; private TileEntityMachineRTG testNuke;
private int heat; private int heat;
public ContainerMachineRTG(InventoryPlayer invPlayer, TileEntityMachineRTG tedf) { public ContainerMachineRTG(InventoryPlayer invPlayer, TileEntityMachineRTG tedf) {
heat = 0; heat = 0;
testNuke = tedf; testNuke = tedf;
this.addSlotToContainer(new Slot(tedf, 0, 26, 17)); this.addSlotToContainer(new Slot(tedf, 0, 16, 18));
this.addSlotToContainer(new Slot(tedf, 1, 44, 17)); this.addSlotToContainer(new Slot(tedf, 1, 34, 18));
this.addSlotToContainer(new Slot(tedf, 2, 62, 17)); this.addSlotToContainer(new Slot(tedf, 2, 52, 18));
this.addSlotToContainer(new Slot(tedf, 3, 80, 17)); this.addSlotToContainer(new Slot(tedf, 3, 70, 18));
this.addSlotToContainer(new Slot(tedf, 4, 98, 17)); this.addSlotToContainer(new Slot(tedf, 4, 88, 18));
this.addSlotToContainer(new Slot(tedf, 5, 26, 35)); this.addSlotToContainer(new Slot(tedf, 5, 16, 36));
this.addSlotToContainer(new Slot(tedf, 6, 44, 35)); this.addSlotToContainer(new Slot(tedf, 6, 34, 36));
this.addSlotToContainer(new Slot(tedf, 7, 62, 35)); this.addSlotToContainer(new Slot(tedf, 7, 52, 36));
this.addSlotToContainer(new Slot(tedf, 8, 80, 35)); this.addSlotToContainer(new Slot(tedf, 8, 70, 36));
this.addSlotToContainer(new Slot(tedf, 9, 98, 35)); this.addSlotToContainer(new Slot(tedf, 9, 88, 36));
this.addSlotToContainer(new Slot(tedf, 10, 26, 53)); this.addSlotToContainer(new Slot(tedf, 10, 16, 54));
this.addSlotToContainer(new Slot(tedf, 11, 44, 53)); this.addSlotToContainer(new Slot(tedf, 11, 34, 54));
this.addSlotToContainer(new Slot(tedf, 12, 62, 53)); this.addSlotToContainer(new Slot(tedf, 12, 52, 54));
this.addSlotToContainer(new Slot(tedf, 13, 80, 53)); this.addSlotToContainer(new Slot(tedf, 13, 70, 54));
this.addSlotToContainer(new Slot(tedf, 14, 98, 53)); this.addSlotToContainer(new Slot(tedf, 14, 88, 54));
for(int i = 0; i < 3; i++) for(int i = 0; i < 3; i++)
{ {
for(int j = 0; j < 9; j++) for(int j = 0; j < 9; j++)
{ {
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 106 + i * 18));
} }
} }
for(int i = 0; i < 9; i++) for(int i = 0; i < 9; i++)
{ {
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142)); this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 164));
} }
} }
@Override @Override
public void addCraftingToCrafters(ICrafting crafting) { public void addCraftingToCrafters(ICrafting crafting) {
super.addCraftingToCrafters(crafting); super.addCraftingToCrafters(crafting);
crafting.sendProgressBarUpdate(this, 0, this.testNuke.heat); crafting.sendProgressBarUpdate(this, 0, this.testNuke.heat);
} }
@Override @Override
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2)
{ {
ItemStack var3 = null; ItemStack var3 = null;
Slot var4 = (Slot) this.inventorySlots.get(par2); Slot var4 = (Slot) this.inventorySlots.get(par2);
if (var4 != null && var4.getHasStack()) if (var4 != null && var4.getHasStack())
{ {
ItemStack var5 = var4.getStack(); ItemStack var5 = var4.getStack();
var3 = var5.copy(); var3 = var5.copy();
if (par2 <= 14) { if (par2 <= 14) {
if (!this.mergeItemStack(var5, 15, this.inventorySlots.size(), true)) if (!this.mergeItemStack(var5, 15, this.inventorySlots.size(), true))
{ {
return null; return null;
@ -74,9 +74,9 @@ public class ContainerMachineRTG extends Container {
} }
else if (!this.mergeItemStack(var5, 0, 15, false)) else if (!this.mergeItemStack(var5, 0, 15, false))
{ {
return null; return null;
} }
if (var5.stackSize == 0) if (var5.stackSize == 0)
{ {
var4.putStack((ItemStack) null); var4.putStack((ItemStack) null);
@ -86,19 +86,19 @@ public class ContainerMachineRTG extends Container {
var4.onSlotChanged(); var4.onSlotChanged();
} }
} }
return var3; return var3;
} }
@Override @Override
public boolean canInteractWith(EntityPlayer player) { public boolean canInteractWith(EntityPlayer player) {
return testNuke.isUseableByPlayer(player); return testNuke.isUseableByPlayer(player);
} }
@Override @Override
public void detectAndSendChanges() { public void detectAndSendChanges() {
super.detectAndSendChanges(); super.detectAndSendChanges();
for(int i = 0; i < this.crafters.size(); i++) for(int i = 0; i < this.crafters.size(); i++)
{ {
ICrafting par1 = (ICrafting)this.crafters.get(i); ICrafting par1 = (ICrafting)this.crafters.get(i);
@ -111,7 +111,7 @@ public class ContainerMachineRTG extends Container {
this.heat = this.testNuke.heat; this.heat = this.testNuke.heat;
} }
@Override @Override
public void updateProgressBar(int i, int j) { public void updateProgressBar(int i, int j) {
if(i == 0) if(i == 0)

View File

@ -19,61 +19,59 @@ public class GUIMachineRTG extends GuiInfoContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_rtg.png"); private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_rtg.png");
private TileEntityMachineRTG rtg; private TileEntityMachineRTG rtg;
public GUIMachineRTG(InventoryPlayer invPlayer, TileEntityMachineRTG tedf) { public GUIMachineRTG(InventoryPlayer invPlayer, TileEntityMachineRTG tedf) {
super(new ContainerMachineRTG(invPlayer, tedf)); super(new ContainerMachineRTG(invPlayer, tedf));
rtg = tedf; rtg = tedf;
this.xSize = 176; this.xSize = 176;
this.ySize = 166; this.ySize = 188;
} }
@Override @Override
public void drawScreen(int mouseX, int mouseY, float f) { public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f); super.drawScreen(mouseX, mouseY, f);
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 69 - 52, 16, 52, rtg.power, rtg.powerMax); this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 146, guiTop + 9, 16, 51, rtg.power, rtg.powerMax);
String[] heatText = I18nUtil.resolveKeyArray("desc.gui.rtg.heat", rtg.heat); String[] heatText = I18nUtil.resolveKeyArray("desc.gui.rtg.heat", rtg.heat);
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 134, guiTop + 17, 16, 52, mouseX, mouseY, heatText); this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 124, guiTop + 9, 16, 51, mouseX, mouseY, heatText);
List<ItemRTGPellet> pellets = ItemRTGPellet.pelletList; List<ItemRTGPellet> pellets = ItemRTGPellet.pelletList;
String[] pelletText = new String[pellets.size() + 1]; String[] pelletText = new String[pellets.size() + 1];
pelletText[0] = I18nUtil.resolveKey("desc.gui.rtg.pellets"); pelletText[0] = I18nUtil.resolveKey("desc.gui.rtg.pellets");
for(int i = 0; i < pellets.size(); i++) { for(int i = 0; i < pellets.size(); i++) {
ItemRTGPellet pellet = pellets.get(i); ItemRTGPellet pellet = pellets.get(i);
pelletText[i + 1] = I18nUtil.resolveKey("desc.gui.rtg.pelletPower", I18nUtil.resolveKey(pellet.getUnlocalizedName() + ".name"), pellet.getHeat() * 5); pelletText[i + 1] = I18nUtil.resolveKey("desc.gui.rtg.pelletPower", I18nUtil.resolveKey(pellet.getUnlocalizedName() + ".name"), pellet.getHeat() * 5);
} }
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36, 16, 16, guiLeft - 8, guiTop + 36 + 16, pelletText); this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 12, guiTop + 25, 16, 16, guiLeft - 8, guiTop + 36 + 16, pelletText);
} }
@Override @Override
protected void drawGuiContainerForegroundLayer( int i, int j) { protected void drawGuiContainerForegroundLayer( int i, int j) {
String name = this.rtg.hasCustomInventoryName() ? this.rtg.getInventoryName() : I18n.format(this.rtg.getInventoryName()); String name = this.rtg.hasCustomInventoryName() ? this.rtg.getInventoryName() : I18n.format(this.rtg.getInventoryName());
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752); this.fontRendererObj.drawString(name, 13 ,7, 10925486);
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752); this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
} }
@Override @Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture); Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
if(rtg.hasHeat()) if (rtg.hasHeat()) {
{ int i = rtg.getHeatScaled(51); // was 50
int i = rtg.getHeatScaled(52); drawTexturedModalRect(guiLeft + 124, guiTop + 61 - i, 176, 10 + (51 - i), 16, i);
drawTexturedModalRect(guiLeft + 134, guiTop + 69 - i, 176, 52 - i, 16, i);
} }
if(rtg.hasPower())
{ if (rtg.hasPower()) {
int i = (int)rtg.getPowerScaled(52); int i = (int) rtg.getPowerScaled(51); // was 50
drawTexturedModalRect(guiLeft + 152, guiTop + 69 - i, 192, 52 - i, 16, i); drawTexturedModalRect(guiLeft + 146, guiTop + 61 - i, 192, 10 + (51 - i), 16, i);
} }
this.drawInfoPanel(guiLeft - 16, guiTop + 36, 16, 16, 2); this.drawInfoPanel(guiLeft - 12, guiTop + 25, 16, 16, 2);
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB