Skip to content

Commit

Permalink
Merge branch 'master' into change-components
Browse files Browse the repository at this point in the history
  • Loading branch information
Rundas01 authored Oct 12, 2024
2 parents 5920afe + 63518f9 commit fcfd321
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ public void receiveCustomData(int dataId, PacketBuffer buf) {
this.minerLogic.receiveCustomData(dataId, buf);
}

@Override
@SideOnly(Side.CLIENT)
public Pair<TextureAtlasSprite, Integer> getParticleTexture() {
return Pair.of(Textures.STEAM_CASING_BRONZE.getSpriteOnSide(SimpleSidedCubeRenderer.RenderSide.TOP),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ private void updateCurrentTemperature() {
if (fuelBurnTimeLeft % 2 == 0 && currentTemperature < getMaxTemperate())
currentTemperature++;
fuelBurnTimeLeft -= isHighPressure ? 2 : 1;
if (fuelBurnTimeLeft == 0) {
if (fuelBurnTimeLeft <= 0) {
this.fuelMaxBurnTime = 0;
this.timeBeforeCoolingDown = getCooldownInterval();
// boiler has no fuel now, so queue burning state update
Expand Down Expand Up @@ -306,6 +306,10 @@ public double getTemperaturePercent() {
return currentTemperature / (getMaxTemperate() * 1.0);
}

public int getCurrentTemperature() {
return currentTemperature;
}

public double getFuelLeftPercent() {
return fuelMaxBurnTime == 0 ? 0.0 : fuelBurnTimeLeft / (fuelMaxBurnTime * 1.0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public WorldItemPipeNet getWorldPipeNet(World world) {
}

@Override
@SideOnly(Side.CLIENT)
protected Pair<TextureAtlasSprite, Integer> getParticleTexture(World world, BlockPos blockPos) {
return ItemPipeRenderer.INSTANCE.getParticleTexture((TileEntityItemPipe) world.getTileEntity(blockPos));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public BlockLaserPipe(@NotNull LaserPipeType pipeType) {
}

@Override
@SideOnly(Side.CLIENT)
protected Pair<TextureAtlasSprite, Integer> getParticleTexture(World world, BlockPos blockPos) {
return LaserPipeRenderer.INSTANCE.getParticleTexture((TileEntityLaserPipe) world.getTileEntity(blockPos));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public BlockOpticalPipe(@NotNull OpticalPipeType pipeType) {
}

@Override
@SideOnly(Side.CLIENT)
protected Pair<TextureAtlasSprite, Integer> getParticleTexture(@NotNull World world, BlockPos blockPos) {
return OpticalPipeRenderer.INSTANCE.getParticleTexture((TileEntityOpticalPipe) world.getTileEntity(blockPos));
}
Expand Down
27 changes: 22 additions & 5 deletions src/main/java/gregtech/integration/jei/recipe/GTRecipeWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import gregtech.api.util.AssemblyLineManager;
import gregtech.api.util.ClipboardUtil;
import gregtech.api.util.GTUtility;
import gregtech.api.util.LocalizationUtils;
import gregtech.api.util.TextFormattingUtil;
import gregtech.client.utils.TooltipHelper;
import gregtech.integration.RecipeCompatUtil;
Expand Down Expand Up @@ -309,15 +310,22 @@ public List<String> getTooltipStrings(int mouseX, int mouseY) {

@Override
public void initExtras() {
// do not add the X button if no tweaker mod is present
// do not add the info or X button if no tweaker mod is present
if (!RecipeCompatUtil.isTweakerLoaded()) return;

BooleanSupplier creativePlayerCtPredicate = () -> Minecraft.getMinecraft().player != null &&
BooleanSupplier creativePlayerPredicate = () -> Minecraft.getMinecraft().player != null &&
Minecraft.getMinecraft().player.isCreative();
BooleanSupplier creativeTweaker = () -> creativePlayerPredicate.getAsBoolean() &&
(recipe.getIsCTRecipe() || recipe.isGroovyRecipe());
BooleanSupplier creativeDefault = () -> creativePlayerPredicate.getAsBoolean() && !recipe.getIsCTRecipe() &&
!recipe.isGroovyRecipe();

// X Button
buttons.add(new JeiButton(166, 2, 10, 10)
.setTextures(GuiTextures.BUTTON_CLEAR_GRID)
.setTooltipBuilder(lines -> lines.add("Copies a " + RecipeCompatUtil.getTweakerName() +
" script, to remove this recipe, to the clipboard"))
.setTooltipBuilder(lines -> lines.add(
LocalizationUtils.format("gregtech.jei.remove_recipe.tooltip",
RecipeCompatUtil.getTweakerName())))
.setClickAction((minecraft, mouseX, mouseY, mouseButton) -> {
String recipeLine = RecipeCompatUtil.getRecipeRemoveLine(recipeMap, recipe);
String output = RecipeCompatUtil.getFirstOutputString(recipe);
Expand All @@ -330,7 +338,16 @@ public void initExtras() {
new TextComponentString("Copied [\u00A76" + recipeLine + "\u00A7r] to the clipboard"));
return true;
})
.setActiveSupplier(creativePlayerCtPredicate));
.setActiveSupplier(creativeDefault));

// CT/GS Info
buttons.add(new JeiButton(166, 2, 10, 10)
.setTextures(GuiTextures.INFO_ICON)
.setTooltipBuilder(lines -> lines.add(recipe.isGroovyRecipe() ?
LocalizationUtils.format("gregtech.jei.gs_recipe.tooltip") :
LocalizationUtils.format("gregtech.jei.ct_recipe.tooltip")))
.setClickAction((mc, x, y, button) -> false)
.setActiveSupplier(creativeTweaker));
}

public ChancedItemOutput getOutputChance(int slot) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer play
if (te instanceof IGregTechTileEntity igtte) {
MetaTileEntity mte = igtte.getMetaTileEntity();
if (mte instanceof SteamBoiler boiler) {
if (boiler.isBurning()) {
// Boiler is active
int steamOutput = boiler.getTotalSteamOutput();

int steamOutput = boiler.getTotalSteamOutput();
// If we are producing steam, or we have fuel
if (steamOutput > 0 || boiler.isBurning()) {
// Creating steam
if (steamOutput > 0 && boiler.hasWater()) {
probeInfo.text(TextStyleClass.INFO + "{*gregtech.top.energy_production*} " +
Expand All @@ -42,10 +41,18 @@ public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer play
Materials.Steam.getUnlocalizedName() + "*}");
}

// Cooling Down
if (!boiler.isBurning()) {
probeInfo.text(TextStyleClass.INFO.toString() + TextFormatting.RED +
"{*gregtech.top.steam_cooling_down*}");
}

// Initial heat-up
if (steamOutput <= 0) {
if (steamOutput <= 0 && boiler.getCurrentTemperature() > 0) {
// Current Temperature = the % until the boiler reaches 100
probeInfo.text(TextStyleClass.INFO.toString() + TextFormatting.RED +
"{*gregtech.top.steam_heating_up*}");
"{*gregtech.top.steam_heating_up*} " +
TextFormattingUtil.formatNumbers(boiler.getCurrentTemperature()) + "%");
}

// No water
Expand Down
7 changes: 6 additions & 1 deletion src/main/resources/assets/gregtech/lang/en_us.lang
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ death.attack.screwdriver_lv=%s had their screws removed by %s

enchantment.disjunction=Disjunction

gregtech.jei.remove_recipe.tooltip=Copies a %s Snippet to Remove this Recipe
gregtech.jei.ct_recipe.tooltip=CraftTweaker Recipe
gregtech.jei.gs_recipe.tooltip=GroovyScript Recipe

gregtech.machine.steam_grinder.name=Steam Grinder
gregtech.multiblock.steam_grinder.description=A Multiblock Macerator at the Steam Age. Requires at least 14 Bronze Casings to form. Cannot use normal Input/Output busses, nor Fluid Hatches other than the Steam Hatch.
gregtech.multiblock.steam.low_steam=Not enough Steam to run!
Expand All @@ -62,7 +66,8 @@ gregtech.top.transform_up=Step Up
gregtech.top.transform_down=Step Down
gregtech.top.transform_input=Input:
gregtech.top.transform_output=Output:
gregtech.top.steam_heating_up=Heating up
gregtech.top.steam_heating_up=Heating Up:
gregtech.top.steam_cooling_down=Cooling Down
gregtech.top.steam_no_water=No Water

gregtech.top.convert_eu=Converting §eEU§r -> §cFE§r
Expand Down

0 comments on commit fcfd321

Please sign in to comment.