Skip to content

Commit

Permalink
Almost workable fission reactor (#2433)
Browse files Browse the repository at this point in the history
Co-authored-by: TechLord22 <37029404+TechLord22@users.noreply.github.com>
Co-authored-by: Serenibyss <10861407+serenibyss@users.noreply.github.com>
Co-authored-by: iouter <62897714+iouter@users.noreply.github.com>
Co-authored-by: DStrand1 <DStrand1@users.noreply.github.com>
Co-authored-by: alongstringofnumbers <sjensen793@gmail.com>
Co-authored-by: Tictim <ksw07149@gmail.com>
Co-authored-by: ALongStringOfNumbers <31759736+ALongStringOfNumbers@users.noreply.github.com>
Co-authored-by: M_W_K <31022105+M-W-K@users.noreply.github.com>
Co-authored-by: Ghzdude <44148655+ghzdude@users.noreply.github.com>
Co-authored-by: mtbo <111296252+loxoDev@users.noreply.github.com>
Co-authored-by: YoungOnion <39562198+YoungOnionMC@users.noreply.github.com>
Co-authored-by: Loxo <loxo.Minecraft@gmail.com>
Co-authored-by: htmlcsjs <46023024+htmlcsjs@users.noreply.github.com>
Co-authored-by: brachy84 <45517902+brachy84@users.noreply.github.com>
Co-authored-by: froot <66188216+kumquat-ir@users.noreply.github.com>
Co-authored-by: tier940 <tsubasa.ito@relightings.com>
  • Loading branch information
17 people committed Jun 2, 2024
1 parent 4f48a50 commit 785b3ff
Show file tree
Hide file tree
Showing 67 changed files with 2,084 additions and 430 deletions.
4 changes: 4 additions & 0 deletions src/main/java/gregtech/api/capability/GregtechDataCodes.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ public static int assignId() {
public static final int UPDATE_SOUND = assignId();
public static final int UPDATE_RADIUS = assignId();

// Fission Reactor
public static int SYNC_REACTOR_STATS = assignId();
public static int SYNC_LOCKING_STATE = assignId();

// ME Parts
public static final int UPDATE_AUTO_PULL = assignId();
public static final int UPDATE_ONLINE_STATUS = assignId();
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/gregtech/api/gui/widgets/SliderWidget.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,21 @@ public class SliderWidget extends Widget {
public static final BiFunction<String, Float, String> DEFAULT_TEXT_SUPPLIER = (name, value) -> I18n.format(name,
value.intValue());

private int sliderWidth = 8;
private TextureArea backgroundArea = GuiTextures.SLIDER_BACKGROUND;
private TextureArea sliderIcon = GuiTextures.SLIDER_ICON;
protected int sliderWidth = 8;
protected TextureArea backgroundArea = GuiTextures.SLIDER_BACKGROUND;
protected TextureArea sliderIcon = GuiTextures.SLIDER_ICON;
private final BiFunction<String, Float, String> textSupplier = DEFAULT_TEXT_SUPPLIER;
private int textColor = 0xFFFFFF;
protected int textColor = 0xFFFFFF;

private final float min;
private final float max;
protected final float min;
protected final float max;
private final String name;

private final FloatConsumer responder;
private boolean isPositionSent;

private String displayString;
private float sliderPosition;
protected String displayString;
protected float sliderPosition;
public boolean isMouseDown;

public SliderWidget(String name, int xPosition, int yPosition, int width, int height, float min, float max,
Expand Down
40 changes: 40 additions & 0 deletions src/main/java/gregtech/api/gui/widgets/UpdatedSliderWidget.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package gregtech.api.gui.widgets;

import gregtech.api.gui.IRenderContext;
import gregtech.api.util.Position;
import gregtech.api.util.Size;
import gregtech.api.util.function.FloatConsumer;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;

import java.util.function.Supplier;

public class UpdatedSliderWidget extends SliderWidget {

Supplier<Float> detector;

public UpdatedSliderWidget(String name, int xPosition, int yPosition, int width, int height, float min, float max,
float currentValue, FloatConsumer responder, Supplier<Float> detector) {
super(name, xPosition, yPosition, width, height, min, max, currentValue, responder);
this.detector = detector;
}

@Override
public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) {
Position pos = getPosition();
Size size = getSize();
if (backgroundArea != null) {
backgroundArea.draw(pos.x, pos.y, size.width, size.height);
}
sliderPosition = (detector.get() - min) / (max - min);
this.displayString = getDisplayString();

sliderIcon.draw(pos.x + (int) (this.sliderPosition * (float) (size.width - 8)), pos.y, sliderWidth,
size.height);
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
fontRenderer.drawString(displayString,
pos.x + size.width / 2 - fontRenderer.getStringWidth(displayString) / 2,
pos.y + size.height / 2 - fontRenderer.FONT_HEIGHT / 2, textColor);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package gregtech.api.metatileentity.multiblock;

public interface IControlRodPort {

byte getInsertionAmount();
// Allows for a special multiblock ability.
}
Loading

0 comments on commit 785b3ff

Please sign in to comment.