Skip to content

Commit

Permalink
Merge branch 'GregTechCEu:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
MrKono authored Nov 18, 2023
2 parents 6e615d9 + 190fc3a commit 99c1890
Show file tree
Hide file tree
Showing 337 changed files with 10,019 additions and 1,952 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//version: 1695527071
//version: 1699743071
/*
* DO NOT CHANGE THIS FILE!
* Also, you may replace this file at any time if there is an update available.
Expand Down Expand Up @@ -456,7 +456,7 @@ configurations {
}
}

String mixinProviderSpec = 'zone.rong:mixinbooter:8.3'
String mixinProviderSpec = 'zone.rong:mixinbooter:8.9'
dependencies {
if (usesMixins.toBoolean()) {
annotationProcessor 'org.ow2.asm:asm-debug-all:5.2'
Expand Down
11 changes: 11 additions & 0 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ dependencies {
compileOnlyApi "curse.maven:xaeros-263420:4516832" // Xaero's Minimap 23.4.1
compileOnlyApi rfg.deobf("curse.maven:hwyla-253449:2568751") // HWYLA 1.8.26-B41
compileOnlyApi rfg.deobf("curse.maven:baubles-227083:2518667") // Baubles 1.5.2
compileOnlyApi rfg.deobf("curse.maven:forestry-59751:2684780") // Forestry 5.8.2.387

// Mods with Soft compat but which have no need to be in code, such as isModLoaded() checks and getModItem() recipes.
// Uncomment any of these to test them in-game.

// runtimeOnly rfg.deobf("curse.maven:beebetteratbees-244516:2627215") // BeeBetterAtBees 2.0.3 (recommended to enable when testing Forestry compat)
// runtimeOnly rfg.deobf("curse.maven:jei-bees-248370:2490058") // JEIBees 0.9.0.5 (recommended to enable when testing Forestry compat)
// runtimeOnly rfg.deobf("curse.maven:binnies-mods-223525:2916129") // Binnie 2.5.1.203
// runtimeOnly rfg.deobf("curse.maven:magic-bees-65764:2855061") // Magic Bees 3.2.25
// runtimeOnly rfg.deobf("curse.maven:gendustry-70492:2516215") // Gendustry 1.6.5.8
// runtimeOnly rfg.deobf("curse.maven:bdlib-70496:2518031") // BdLib 1.14.3.12
}

minecraft {
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/gregtech/GregTechMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
+ "required-after:codechickenlib@[3.2.3,);"
+ "after:appliedenergistics2;"
+ "after:forestry;"
+ "after:extrabees;"
+ "after:extratrees;"
+ "after:genetics;"
+ "after:magicbees;"
+ "after:jei@[4.15.0,);"
+ "after:crafttweaker@[4.1.20,);"
+ "after:groovyscript@[0.6.0,);"
Expand Down
13 changes: 12 additions & 1 deletion src/main/java/gregtech/api/GTValues.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,18 @@ public class GTValues {
MODID_XAERO_MINIMAP = "xaerominimap",
MODID_HWYLA = "hwyla",
MODID_BAUBLES = "baubles",
MODID_TOP_ADDONS = "topaddons";
MODID_TOP_ADDONS = "topaddons",
MODID_IC2 = "ic2",
MODID_GTFO = "gregtechfoodoption",
MODID_BINNIE = "binniecore",
MODID_XU2 = "extrautils2",
MODID_TR = "techreborn",
MODID_MB = "magicbees",
MODID_EB = "extrabees",
MODID_ET = "extratrees",
MODID_GENETICS = "genetics",
MODID_BOP = "biomesoplenty",
MODID_TCON = "tconstruct";

private static Boolean isClient;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
Expand Down Expand Up @@ -184,4 +185,10 @@ public CreativeTabs[] getCreativeTabs() {
tabs[tabs.length - 1] = getCreativeTab();
return tabs;
}

@Override
public int getItemStackLimit(@Nonnull ItemStack stack) {
MetaTileEntity metaTileEntity = GTUtility.getMetaTileEntity(stack);
return metaTileEntity != null ? metaTileEntity.getItemStackLimit(stack) : super.getItemStackLimit(stack);
}
}
7 changes: 7 additions & 0 deletions src/main/java/gregtech/api/capability/GregtechDataCodes.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,19 @@ public class GregtechDataCodes {
// HPCA / Research Station
public static final int DAMAGE_STATE = 222;
public static final int LOCK_OBJECT_HOLDER = 223;
public static final int CACHED_CWU = 224;

// NBT Keys

// From MetaTileEntityHolder
public static final String CUSTOM_NAME = "CustomName";

// From MetaTileEntity
public static final String TAG_KEY_PAINTING_COLOR = "PaintingColor";
public static final String TAG_KEY_FRAGILE = "Fragile";
public static final String TAG_KEY_MUFFLED = "Muffled";


// MTE Trait Names

public static final String ABSTRACT_WORKABLE_TRAIT = "RecipeMapWorkable";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package gregtech.api.capability;

import gregtech.api.gui.resources.TextureArea;

public interface IHPCAComponentHatch {

/**
Expand Down Expand Up @@ -41,4 +43,9 @@ default void setDamaged(boolean damaged) {
* If this component allows for bridging HPCAs to Network Switches.
*/
boolean isBridge();

/**
* The icon for this component in the HPCA's UI. Should be a 13x13 px sprite.
*/
TextureArea getComponentIcon();
}
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,7 @@ protected void updateRecipeProgress() {

FluidStack drainedWater = getBoilerFluidFromContainer(getInputTank(), (int) amount);
if (amount != 0 && (drainedWater == null || drainedWater.amount < amount)) {
//noinspection IntegerDivisionInFloatingPointContext
getMetaTileEntity().explodeMultiblock((currentHeat / getMaximumHeat()) * 8);
getMetaTileEntity().explodeMultiblock((1.0f * currentHeat / getMaximumHeat()) * 8.0f);
} else {
setLastTickSteam(generatedSteam);
getOutputTank().fill(Materials.Steam.getFluid(generatedSteam), true);
Expand Down
10 changes: 7 additions & 3 deletions src/main/java/gregtech/api/capability/impl/FluidDrillLogic.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ private boolean acquireNewFluid() {
return this.veinFluid != null;
}

public Fluid getDrilledFluid() {
return veinFluid;
}

protected void depleteVein() {
int chance = metaTileEntity.getDepletionChance();

Expand All @@ -108,7 +112,7 @@ protected void depleteVein() {
BedrockFluidVeinHandler.depleteVein(metaTileEntity.getWorld(), getChunkX(), getChunkZ(), 0, false);
}

private int getFluidToProduce() {
public int getFluidToProduce() {
int depletedYield = BedrockFluidVeinHandler.getDepletedFluidYield(metaTileEntity.getWorld(), getChunkX(), getChunkZ());
int regularYield = BedrockFluidVeinHandler.getFluidYield(metaTileEntity.getWorld(), getChunkX(), getChunkZ());
int remainingOperations = BedrockFluidVeinHandler.getOperationsRemaining(metaTileEntity.getWorld(), getChunkX(), getChunkZ());
Expand Down Expand Up @@ -157,11 +161,11 @@ protected boolean checkCanDrain() {
return false;
}

private int getChunkX() {
public int getChunkX() {
return metaTileEntity.getPos().getX() / 16;
}

private int getChunkZ() {
public int getChunkZ() {
return metaTileEntity.getPos().getZ() / 16;
}

Expand Down
34 changes: 34 additions & 0 deletions src/main/java/gregtech/api/gui/GuiTextures.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class GuiTextures {
public static final TextureArea CLIPBOARD_PAPER_BACKGROUND = TextureArea.fullImage("textures/gui/base/clipboard_paper_background.png");

public static final TextureArea BLANK = AdoptableTextureArea.fullImage("textures/gui/base/blank.png", 1, 1, 0, 0);
public static final TextureArea BLANK_TRANSPARENT = AdoptableTextureArea.fullImage("textures/gui/base/blank_transparent.png", 1, 1, 0, 0);
public static final TextureArea DISPLAY = AdoptableTextureArea.fullImage("textures/gui/base/display.png", 143, 75, 2, 2);
public static final SteamTexture DISPLAY_STEAM = SteamTexture.fullImage("textures/gui/base/display_%s.png", 143, 75, 2, 2);
public static final TextureArea FLUID_SLOT = AdoptableTextureArea.fullImage("textures/gui/base/fluid_slot.png", 18, 18, 1, 1);
Expand Down Expand Up @@ -225,6 +226,22 @@ public class GuiTextures {
public static final TextureArea PROGRESS_BAR_RESEARCH_STATION_1 = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_research_station_1.png");
public static final TextureArea PROGRESS_BAR_RESEARCH_STATION_2 = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_research_station_2.png");
public static final TextureArea PROGRESS_BAR_RESEARCH_STATION_BASE = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_research_station_base.png");
public static final TextureArea PROGRESS_BAR_FUSION_ENERGY = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_fusion_energy.png");
public static final TextureArea PROGRESS_BAR_FUSION_HEAT = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_fusion_heat.png");
public static final TextureArea PROGRESS_BAR_MULTI_ENERGY_YELLOW = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_multi_energy_yellow.png");
public static final TextureArea PROGRESS_BAR_HPCA_COMPUTATION = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_hpca_computation.png");
public static final TextureArea PROGRESS_BAR_LCE_FUEL = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_lce_fuel.png");
public static final TextureArea PROGRESS_BAR_LCE_LUBRICANT = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_lce_lubricant.png");
public static final TextureArea PROGRESS_BAR_LCE_OXYGEN = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_lce_oxygen.png");
public static final TextureArea PROGRESS_BAR_TURBINE_ROTOR_SPEED = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_turbine_rotor_speed.png");
public static final TextureArea PROGRESS_BAR_TURBINE_ROTOR_DURABILITY = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_turbine_rotor_durability.png");
public static final TextureArea PROGRESS_BAR_FLUID_RIG_DEPLETION = TextureArea.fullImage("textures/gui/progress_bar/progress_bar_fluid_rig_depletion.png");

// Fusion reactor diagram progress bar parts
public static final TextureArea PROGRESS_BAR_FUSION_REACTOR_DIAGRAM_BL = TextureArea.fullImage("textures/gui/progress_bar/fusion_diagram/bottom_left.png");
public static final TextureArea PROGRESS_BAR_FUSION_REACTOR_DIAGRAM_BR = TextureArea.fullImage("textures/gui/progress_bar/fusion_diagram/bottom_right.png");
public static final TextureArea PROGRESS_BAR_FUSION_REACTOR_DIAGRAM_TL = TextureArea.fullImage("textures/gui/progress_bar/fusion_diagram/top_left.png");
public static final TextureArea PROGRESS_BAR_FUSION_REACTOR_DIAGRAM_TR = TextureArea.fullImage("textures/gui/progress_bar/fusion_diagram/top_right.png");

//JEI
public static final TextureArea INFO_ICON = TextureArea.fullImage("textures/gui/widget/information.png");
Expand Down Expand Up @@ -282,4 +299,21 @@ public class GuiTextures {
public static final TextureArea CONFIG_ARROW_DARK = TextureArea.fullImage("textures/gui/widget/config_arrow_dark.png");
public static final TextureArea SELECT_BOX = TextureArea.fullImage("textures/gui/widget/select_box.png");

// Fusion Reactor custom images
public static final TextureArea FUSION_REACTOR_MK1_TITLE = TextureArea.fullImage("textures/gui/widget/fusion_reactor_mk1_title.png");
public static final TextureArea FUSION_REACTOR_MK2_TITLE = TextureArea.fullImage("textures/gui/widget/fusion_reactor_mk2_title.png");
public static final TextureArea FUSION_REACTOR_MK3_TITLE = TextureArea.fullImage("textures/gui/widget/fusion_reactor_mk3_title.png");
public static final TextureArea FUSION_REACTOR_DIAGRAM = TextureArea.fullImage("textures/gui/widget/fusion_reactor_diagram.png");
public static final TextureArea FUSION_REACTOR_LEGEND = TextureArea.fullImage("textures/gui/widget/fusion_reactor_legend.png");

// HPCA Component icons
public static final TextureArea HPCA_COMPONENT_OUTLINE = TextureArea.fullImage("textures/gui/widget/hpca/component_outline.png");
public static final TextureArea HPCA_ICON_EMPTY_COMPONENT = TextureArea.fullImage("textures/gui/widget/hpca/empty_component.png");
public static final TextureArea HPCA_ICON_ADVANCED_COMPUTATION_COMPONENT = TextureArea.fullImage("textures/gui/widget/hpca/advanced_computation_component.png");
public static final TextureArea HPCA_ICON_BRIDGE_COMPONENT = TextureArea.fullImage("textures/gui/widget/hpca/bridge_component.png");
public static final TextureArea HPCA_ICON_COMPUTATION_COMPONENT = TextureArea.fullImage("textures/gui/widget/hpca/computation_component.png");
public static final TextureArea HPCA_ICON_ACTIVE_COOLER_COMPONENT = TextureArea.fullImage("textures/gui/widget/hpca/active_cooler_component.png");
public static final TextureArea HPCA_ICON_HEAT_SINK_COMPONENT = TextureArea.fullImage("textures/gui/widget/hpca/heat_sink_component.png");
public static final TextureArea HPCA_ICON_DAMAGED_ADVANCED_COMPUTATION_COMPONENT = TextureArea.fullImage("textures/gui/widget/hpca/damaged_advanced_computation_component.png");
public static final TextureArea HPCA_ICON_DAMAGED_COMPUTATION_COMPONENT = TextureArea.fullImage("textures/gui/widget/hpca/damaged_computation_component.png");
}
7 changes: 7 additions & 0 deletions src/main/java/gregtech/api/gui/widgets/ImageWidget.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,13 @@ public ImageWidget setIgnoreColor(boolean ignore) {
return this;
}

protected IGuiTexture getArea() {
return area;
}

@Override
public void updateScreen() {
IGuiTexture area = getArea();
if (area != null) {
area.updateTick();
}
Expand All @@ -91,6 +96,7 @@ public void readUpdateInfo(int id, PacketBuffer buffer) {
@Override
@SideOnly(Side.CLIENT)
public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) {
IGuiTexture area = getArea();
if (!this.isVisible || area == null) return;
if (ignoreColor) GlStateManager.color(1, 1, 1, 1);
Position position = getPosition();
Expand All @@ -103,6 +109,7 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender

@Override
public void drawInForeground(int mouseX, int mouseY) {
IGuiTexture area = getArea();
if (this.isVisible && tooltipText != null && area != null && isMouseOverElement(mouseX, mouseY)) {
List<String> hoverList = Arrays.asList(LocalizationUtils.formatLines(tooltipText));
drawHoveringText(ItemStack.EMPTY, hoverList, 300, mouseX, mouseY);
Expand Down
80 changes: 78 additions & 2 deletions src/main/java/gregtech/api/gui/widgets/ProgressWidget.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,15 @@
import gregtech.api.util.Position;
import gregtech.api.util.Size;
import gregtech.common.ConfigHolder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.text.ITextComponent;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.DoubleSupplier;

public class ProgressWidget extends Widget {
Expand All @@ -22,7 +29,9 @@ public enum MoveType {
/** Fills the progress bar clockwise in a circle, starting from the bottom left */
CIRCULAR,
/** Fills the progress bar downwards, from the top */
VERTICAL_DOWNWARDS
VERTICAL_DOWNWARDS,
/** Fills the progress bar right to left */
HORIZONTAL_BACKWARDS
}

public final DoubleSupplier progressSupplier;
Expand All @@ -32,6 +41,10 @@ public enum MoveType {

private double lastProgressValue;

private List<ITextComponent> hoverText = new ArrayList<>();
private Consumer<List<ITextComponent>> textSupplier;
private boolean ignoreColor;

// TODO Clean up these constructors when Steam Machine UIs are cleaned up
public ProgressWidget(DoubleSupplier progressSupplier, int x, int y, int width, int height) {
super(new Position(x, y), new Size(width, height));
Expand Down Expand Up @@ -74,10 +87,21 @@ public ProgressWidget setProgressBar(TextureArea emptyBarArea, TextureArea fille
return this;
}

public ProgressWidget setHoverTextConsumer(Consumer<List<ITextComponent>> supplier) {
this.textSupplier = supplier;
return this;
}

public ProgressWidget setIgnoreColor(boolean ignore) {
this.ignoreColor = ignore;
return this;
}

@Override
public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRenderContext context) {
Position pos = getPosition();
Size size = getSize();
if (ignoreColor) GlStateManager.color(1, 1, 1, 1);
if (emptyBarArea != null) {
emptyBarArea.draw(pos.x, pos.y, size.width, size.height);
}
Expand All @@ -96,6 +120,19 @@ public void drawInBackground(int mouseX, int mouseY, float partialTicks, IRender
0.0,
drawnWidth,
1.0);
} else if (moveType == MoveType.HORIZONTAL_BACKWARDS) {
double width = size.width * lastProgressValue;
if (!smooth) width = (int) width;
double drawnWidth = smooth ? lastProgressValue : width / (size.width * 1.0);
filledBarArea[0].drawSubArea(
pos.x + size.width - width,
pos.y,
width,
size.height,
1.0 - drawnWidth,
0.0,
drawnWidth,
1.0);
} else if (moveType == MoveType.VERTICAL) {
double height = size.height * lastProgressValue;
if (!smooth) height = (int) height;
Expand Down Expand Up @@ -217,12 +254,47 @@ public void detectAndSendChanges() {
this.lastProgressValue = actualValue;
writeUpdateInfo(0, buffer -> buffer.writeDouble(actualValue));
}

if (textSupplier != null) {
List<ITextComponent> textBuffer = new ArrayList<>();
textSupplier.accept(textBuffer);
if (!hoverText.equals(textBuffer)) {
this.hoverText = textBuffer;
writeUpdateInfo(1, buffer -> {
buffer.writeVarInt(hoverText.size());
for (ITextComponent textComponent : hoverText) {
buffer.writeString(ITextComponent.Serializer.componentToJson(textComponent));
}
});
}
}
}

@Override
public void readUpdateInfo(int id, PacketBuffer buffer) {
if (id == 0) {
this.lastProgressValue = buffer.readDouble();
} else if (id == 1) {
this.hoverText.clear();
int count = buffer.readVarInt();
for (int i = 0; i < count; i++) {
String jsonText = buffer.readString(32767);
this.hoverText.add(ITextComponent.Serializer.jsonToComponent(jsonText));
}
}
}

@Override
public void drawInForeground(int mouseX, int mouseY) {
super.drawInForeground(mouseX, mouseY);
if (isMouseOverElement(mouseX, mouseY) && hoverText != null && !hoverText.isEmpty()) {
List<String> hoverList = new ArrayList<>();
for (ITextComponent component : hoverText) {
Collections.addAll(hoverList, component.getFormattedText());
}
if (!hoverList.isEmpty()) {
drawHoveringText(ItemStack.EMPTY, hoverList, 300, mouseX, mouseY);
}
}
}

Expand All @@ -231,7 +303,7 @@ public static class TimedProgressSupplier implements DoubleSupplier {
private final int msPerCycle;
private final int maxValue;
private final boolean countDown;
private final long startTime;
private long startTime;

public TimedProgressSupplier(int ticksPerCycle, int maxValue, boolean countDown) {
this.msPerCycle = ticksPerCycle * 50;
Expand All @@ -240,6 +312,10 @@ public TimedProgressSupplier(int ticksPerCycle, int maxValue, boolean countDown)
this.startTime = System.currentTimeMillis();
}

public void resetCountdown() {
startTime = System.currentTimeMillis();
}

@Override
public double getAsDouble() {
return calculateTime();
Expand Down
Loading

0 comments on commit 99c1890

Please sign in to comment.