automatic RBMK control rod functions completed, control panel GUI tex

This commit is contained in:
Bob 2021-05-04 23:58:04 +02:00
parent cf29733200
commit 1625ef2211
4 changed files with 34 additions and 32 deletions

View File

@ -10,7 +10,6 @@ import com.hbm.tileentity.machine.rbmk.TileEntityRBMKBoiler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.nbt.NBTTagCompound;
@ -59,6 +58,7 @@ public class GUIRBMKBoiler extends GuiInfoContainer {
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
}
@SuppressWarnings("incomplete-switch") //shut up
@Override
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);
@ -68,7 +68,7 @@ public class GUIRBMKBoiler extends GuiInfoContainer {
int i = boiler.feed.getFill() * 58 / boiler.feed.getMaxFill();
drawTexturedModalRect(guiLeft + 126, guiTop + 82 - i, 176, 58 - i, 14, i);
int j = boiler.feed.getFill() * 22 / boiler.feed.getMaxFill();
int j = boiler.feed.getFill() * 22 / boiler.steam.getMaxFill();
if(j > 0) j++;
if(j > 22) j++;

View File

@ -6,7 +6,6 @@ import org.lwjgl.opengl.GL11;
import com.hbm.inventory.container.ContainerRBMKControlAuto;
import com.hbm.lib.RefStrings;
import com.hbm.packet.AuxButtonPacket;
import com.hbm.packet.NBTControlPacket;
import com.hbm.packet.PacketDispatcher;
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKControlAuto;
@ -68,12 +67,21 @@ public class GUIRBMKControlAuto extends GuiInfoContainer {
String func = "Function: ";
switch(rod.function) {
case LINEAR: func += " Linear"; break;
case QUAD_UP: func += " Quadratic"; break;
case QUAD_DOWN: func += " Negative Quadratic"; break;
case LINEAR: func += "Linear"; break;
case QUAD_UP: func += "Quadratic"; break;
case QUAD_DOWN: func += "Inverse Quadratic"; break;
}
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 69, guiTop + 27, 26, 19, mouseX, mouseY, new String[]{ func } );
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 58, guiTop + 26, 28, 19, mouseX, mouseY, new String[]{ func } );
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 61, guiTop + 48, 22, 10, mouseX, mouseY, new String[]{ "Select linear interpolation" } );
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 61, guiTop + 59, 22, 10, mouseX, mouseY, new String[]{ "Select quadratic interpolation" } );
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 61, guiTop + 70, 22, 10, mouseX, mouseY, new String[]{ "Select inverse quadratic interpolation" } );
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 28, guiTop + 26, 30, 10, mouseX, mouseY, new String[]{ "Level at max heat", "Should be smaller than level at min heat" } );
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 28, guiTop + 37, 30, 10, mouseX, mouseY, new String[]{ "Level at min heat", "Should be larger than level at min heat" } );
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 28, guiTop + 48, 30, 10, mouseX, mouseY, new String[]{ "Max heat", "Must be larger than min heat" } );
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 28, guiTop + 59, 30, 10, mouseX, mouseY, new String[]{ "Min heat", "Must be smaller than max heat" } );
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 28, guiTop + 70, 30, 10, mouseX, mouseY, new String[]{ "Save parameters" } );
}
@Override

View File

@ -5,6 +5,7 @@ import com.hbm.tileentity.machine.rbmk.TileEntityRBMKControlManual.RBMKColor;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
public class TileEntityRBMKControlAuto extends TileEntityRBMKControl implements IControlReceiver {
@ -32,34 +33,27 @@ public class TileEntityRBMKControlAuto extends TileEntityRBMKControl implements
double fauxLevel = 0;
if(this.heat < heatLower) {
fauxLevel = this.levelLower;
} else if(this.heat > heatUpper) {
fauxLevel = this.levelUpper;
} else {
switch(this.function) {
case LINEAR:
//my brain hasn't been this challenged since my math finals in '19
fauxLevel = (this.heat - this.heatLower) * ((this.levelUpper - this.levelLower) / (this.heatUpper - this.heatLower)) + this.heatLower;
break;
//TODO: all this bullshit
case QUAD_UP:
//TODO: there's some chaos that needs limiting
//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
//this.targetLevel = Math.pow((this.heat - this.heatLower) / 100, 2) * (this.levelUpper - this.levelLower) + this.levelLower;
break;
case QUAD_DOWN:
break;
}
switch(this.function) {
case LINEAR:
// my brain hasn't been this challenged since my math finals in
// '19
fauxLevel = (this.heat - this.heatLower) * ((this.levelUpper - this.levelLower) / (this.heatUpper - this.heatLower)) + this.levelLower;
break;
case QUAD_UP:
// so this is how we roll, huh?
fauxLevel = Math.pow((this.heat - this.heatLower) / (this.heatUpper - this.heatLower), 2) * (this.levelUpper - this.levelLower) + this.levelLower;
break;
case QUAD_DOWN:
// sometimes my genius is almost frightening
fauxLevel = Math.pow((this.heat - this.heatUpper) / (this.heatLower - this.heatUpper), 2) * (this.levelLower - this.levelUpper) + this.levelUpper;
break;
}
this.targetLevel = fauxLevel * 0.01D;
this.targetLevel = MathHelper.clamp_double(this.targetLevel, 0D, 1D);
}
super.updateEntity();

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB