Skip to content

Commit

Permalink
Merge branch '1.20.1' into mi/fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mikerooni authored Mar 23, 2024
2 parents 11d7c16 + 272bd1d commit 809d99f
Show file tree
Hide file tree
Showing 26 changed files with 139 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@
],
"page": "gtceu:generation/andesite",
"position": [
-100,
100
-200,
50
],
"pre_nodes": [
"gtceu:generation/ore"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@
],
"page": "gtceu:generation/basalt",
"position": [
-100,
150
-150,
50
],
"pre_nodes": [
"gtceu:generation/ore"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
],
"page": "gtceu:generation/deepslate",
"position": [
-200,
-100,
150
],
"pre_nodes": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
],
"page": "gtceu:generation/diorite",
"position": [
-150,
-200,
100
],
"pre_nodes": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@
],
"page": "gtceu:generation/endstone",
"position": [
-50,
50
-100,
100
],
"pre_nodes": [
"gtceu:generation/ore"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@
],
"page": "gtceu:generation/granite",
"position": [
-200,
100
-150,
150
],
"pre_nodes": [
"gtceu:generation/ore"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@
],
"page": "gtceu:generation/netherrack",
"position": [
-50,
150
-150,
100
],
"pre_nodes": [
"gtceu:generation/ore"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
],
"page": "gtceu:generation/red_sand",
"position": [
-150,
-50,
150
],
"pre_nodes": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
],
"page": "gtceu:generation/sand",
"position": [
-100,
-50,
50
],
"pre_nodes": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
],
"page": "gtceu:generation/stone",
"position": [
-200,
-100,
50
],
"pre_nodes": [
Expand Down
11 changes: 9 additions & 2 deletions src/generated/resources/assets/gtceu/lang/en_ud.json
Original file line number Diff line number Diff line change
Expand Up @@ -1545,12 +1545,14 @@
"compass.node.gtceu.materials/block": "ʞɔoןᗺ",
"compass.node.gtceu.materials/bolt": "ʇןoᗺ",
"compass.node.gtceu.materials/chainsaw_head": "pɐǝH ʍɐsuıɐɥƆ",
"compass.node.gtceu.materials/chipped_gem": "ɯǝ⅁ pǝddıɥƆ",
"compass.node.gtceu.materials/crushed_ore": "ǝɹO pǝɥsnɹƆ",
"compass.node.gtceu.materials/dense_plate": "ǝʇɐןԀ ǝsuǝᗡ",
"compass.node.gtceu.materials/double_plate": "ǝʇɐןԀ ǝןqnoᗡ",
"compass.node.gtceu.materials/dust": "ʇsnᗡ",
"compass.node.gtceu.materials/exquisite_gem": "ɯǝ⅁ ǝʇısınbxƎ",
"compass.node.gtceu.materials/fine_wire": "ǝɹıM ǝuıℲ",
"compass.node.gtceu.materials/flawed_gem": "ɯǝ⅁ pǝʍɐןℲ",
"compass.node.gtceu.materials/flawless_gem": "ɯǝ⅁ ssǝןʍɐןℲ",
"compass.node.gtceu.materials/foil": "ןıoℲ",
"compass.node.gtceu.materials/frame": "ǝɯɐɹℲ",
Expand Down Expand Up @@ -2966,6 +2968,11 @@
"gtceu.multiblock.distillation_tower.distilling_fluid": "%s buıןןıʇsıᗡ",
"gtceu.multiblock.electric_blast_furnace.description": "˙ʎoןןɐ ɥɐpɐnbɐu puɐ 'ɯnıuɐʇıʇ 'ןǝǝʇs ssǝןuıɐʇs 'ɯnıuıɯnןɐ sɐ ɥɔns 'sןɐʇǝɯ puɐ sʎoןןɐ ɹǝıʇ-ɥbıɥ buıuıɐʇqo ɹoɟ pǝɹınbǝɹ sı ʇI ˙sǝɹo buıuıɟǝɹ puɐ sןɐʇǝɯ buıʞooɔ 'sʎoןןɐ buıʇןǝɯs ɹoɟ pǝsn ǝɹnʇɔnɹʇs ʞɔoןqıʇןnɯ ɐ sı )ℲᗺƎ( ǝɔɐuɹnℲ ʇsɐןᗺ ɔıɹʇɔǝןƎ ǝɥ⟘",
"gtceu.multiblock.extreme_combustion_engine.description": "˙ɹǝʍod ΛI ɹoɟ ɹoʇɐɹǝuǝ⅁ uoıʇsnqɯoƆ ɐ sɐ sʇɔɐ ʇɐɥʇ ǝɹnʇɔnɹʇs ʞɔoןqıʇןnɯ ɐ sı ǝuıbuƎ uoıʇsnqɯoƆ ǝɯǝɹʇxƎ ǝɥ⟘",
"gtceu.multiblock.fluid_rig.drilled_fluid": "%s :pınןℲ",
"gtceu.multiblock.fluid_rig.fluid_amount": "%s :ǝʇɐᴚ buıdɯnԀ",
"gtceu.multiblock.fluid_rig.no_fluid_in_area": "˙ɐǝɹⱯ uı ǝuoN",
"gtceu.multiblock.fluid_rig.vein_depleted": "˙pǝʇǝןdǝᗡ uıǝΛ",
"gtceu.multiblock.fluid_rig.vein_depletion": "%s :ǝzıS uıǝΛ",
"gtceu.multiblock.fusion_reactor.energy": "%d / %d :∩Ǝ",
"gtceu.multiblock.fusion_reactor.heat": "%d :ʇɐǝH",
"gtceu.multiblock.fusion_reactor.luv.description": "˙W09Ɩ ɟo ɯnɯıxɐɯ ɐ sɐɥ puɐ '∩Ǝ W0Ɩ ʎq sǝsɐǝɹɔuı ɹǝɟɟnq sʇı 'sɐɥ ʇı ɥɔʇɐH ʎɹǝʌǝ ɹoℲ ˙sǝɥɔʇɐH ʎbɹǝuƎ Λ∩ puɐ 'WԀZ 'ΛnꞀ ǝsn ʎןuo uɐɔ ʇI ˙sǝuo ɹǝıʌɐǝɥ oʇuı sʇuǝɯǝןǝ buısnɟ ɹoɟ pǝsn ǝɹnʇɔnɹʇs ʞɔoןqıʇןnɯ ǝbɹɐן ɐ sı Ɩ ʞW ɹoʇɔɐǝᴚ uoısnℲ ǝɥ⟘",
Expand Down Expand Up @@ -4919,9 +4926,9 @@
"metaitem.cover.digital.wireless.tooltip.1": "˙ʇı oʇ puıq ʎןǝʇoɯǝɹ oʇ ㄥ§ɹoʇıuoW ןɐɹʇuǝƆɟ§ ǝɥʇ uo ㄥ§ʞɔıןƆ ʇɥbıᴚɟ§",
"metaitem.cover.digital.wireless.tooltip.2": "˙buıpuıq ʇuǝɹɹnɔ ǝɥʇ ǝʌoɯǝɹ oʇ ㄥ§ʞɔıןƆ ʇɥbıᴚ ʞɐǝuSɟ§",
"metaitem.cover.digital.wireless.tooltip.3": "%sɟ§ :buıpuıᗺɐ§",
"metaitem.crushed.tooltip.purify": "ǝɹO pǝıɟıɹnԀ ʇǝb oʇ uoɹpןnɐƆ oʇuı ʍoɹɥ⟘",
"metaitem.crushed.tooltip.purify": "ǝɹO pǝıɟıɹnԀ ʇǝb oʇ uoɹpןnɐƆ ɐ ʞɔıןɔ ʇɥbıᴚ",
"metaitem.debug_scanner.tooltip": "ɹǝpɹoɔıɹ⟘",
"metaitem.dust.tooltip.purify": "ʇsnᗡ uɐǝןɔ ʇǝb oʇ uoɹpןnɐƆ oʇuı ʍoɹɥ⟘",
"metaitem.dust.tooltip.purify": "ʇsnᗡ uɐǝןɔ ʇǝb oʇ uoɹpןnɐƆ ɐ ʞɔıןɔ ʇɥbıᴚ",
"metaitem.electric.discharge_mode.disabled": "pǝןqɐsıᗡ ǝpoW ǝbɹɐɥɔsıᗡǝ§",
"metaitem.electric.discharge_mode.enabled": "pǝןqɐuƎ ǝpoW ǝbɹɐɥɔsıᗡǝ§",
"metaitem.electric.discharge_mode.tooltip": "ǝpoɯ ǝbɹɐɥɔsıp ǝןbboʇ oʇ buıʞɐǝus ǝןıɥʍ ǝs∩",
Expand Down
7 changes: 7 additions & 0 deletions src/generated/resources/assets/gtceu/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -1545,12 +1545,14 @@
"compass.node.gtceu.materials/block": "Block",
"compass.node.gtceu.materials/bolt": "Bolt",
"compass.node.gtceu.materials/chainsaw_head": "Chainsaw Head",
"compass.node.gtceu.materials/chipped_gem": "Chipped Gem",
"compass.node.gtceu.materials/crushed_ore": "Crushed Ore",
"compass.node.gtceu.materials/dense_plate": "Dense Plate",
"compass.node.gtceu.materials/double_plate": "Double Plate",
"compass.node.gtceu.materials/dust": "Dust",
"compass.node.gtceu.materials/exquisite_gem": "Exquisite Gem",
"compass.node.gtceu.materials/fine_wire": "Fine Wire",
"compass.node.gtceu.materials/flawed_gem": "Flawed Gem",
"compass.node.gtceu.materials/flawless_gem": "Flawless Gem",
"compass.node.gtceu.materials/foil": "Foil",
"compass.node.gtceu.materials/frame": "Frame",
Expand Down Expand Up @@ -2966,6 +2968,11 @@
"gtceu.multiblock.distillation_tower.distilling_fluid": "Distilling %s",
"gtceu.multiblock.electric_blast_furnace.description": "The Electric Blast Furnace (EBF) is a multiblock structure used for smelting alloys, cooking metals and refining ores. It is required for obtaining high-tier alloys and metals, such as aluminium, stainless steel, titanium, and naquadah alloy.",
"gtceu.multiblock.extreme_combustion_engine.description": "The Extreme Combustion Engine is a multiblock structure that acts as a Combustion Generator for IV power.",
"gtceu.multiblock.fluid_rig.drilled_fluid": "Fluid: %s",
"gtceu.multiblock.fluid_rig.fluid_amount": "Pumping Rate: %s",
"gtceu.multiblock.fluid_rig.no_fluid_in_area": "None in Area.",
"gtceu.multiblock.fluid_rig.vein_depleted": "Vein Depleted.",
"gtceu.multiblock.fluid_rig.vein_depletion": "Vein Size: %s",
"gtceu.multiblock.fusion_reactor.energy": "EU: %d / %d",
"gtceu.multiblock.fusion_reactor.heat": "Heat: %d",
"gtceu.multiblock.fusion_reactor.luv.description": "The Fusion Reactor MK 1 is a large multiblock structure used for fusing elements into heavier ones. It can only use LuV, ZPM, and UV Energy Hatches. For every Hatch it has, its buffer increases by 10M EU, and has a maximum of 160M.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
public interface IRecipeCapabilityHolder {

default boolean hasProxies() {
return !getCapabilitiesProxy().isEmpty() && !getCapabilitiesProxy().isEmpty();
return !getCapabilitiesProxy().isEmpty();
}

@Nonnull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class ChemicalHelper {
/** Used for custom material data for items that do not fall into the normal "prefix, material" pair */
public static final Map<ItemLike, ItemMaterialInfo> ITEM_MATERIAL_INFO = new ConcurrentHashMap<>();
/** Mapping of an item to a "prefix, material" pair */
public static final Set<Map.Entry<Supplier<? extends ItemLike>, UnificationEntry>> ITEM_UNIFICATION_ENTRY = new HashSet<>();
public static final Set<Map.Entry<Supplier<? extends ItemLike>, UnificationEntry>> ITEM_UNIFICATION_ENTRY = ConcurrentHashMap.newKeySet();
public static final Map<ItemLike, UnificationEntry> ITEM_UNIFICATION_ENTRY_COLLECTED = new ConcurrentHashMap<>();
/** Mapping of a tag to a "prefix, material" pair */
public static final Map<TagKey<Item>, UnificationEntry> TAG_UNIFICATION_ENTRY = new Object2ObjectLinkedOpenHashMap<>();
Expand Down Expand Up @@ -223,14 +223,22 @@ public static ItemStack getGem(MaterialStack materialStack) {

@Nullable
public static UnificationEntry getUnificationEntry(ItemLike itemLike) {
return ITEM_UNIFICATION_ENTRY_COLLECTED.computeIfAbsent(itemLike, item -> {
for (var entry : ITEM_UNIFICATION_ENTRY) {
if (entry.getKey().get().asItem() == itemLike.asItem()) {
return entry.getValue();
}
}
return UnificationEntry.EmptyMapMarkerEntry;
});
// asItem is a bit slow, avoid calling it multiple times
var itemKey = itemLike.asItem();
var unifyingEntry = ITEM_UNIFICATION_ENTRY_COLLECTED.get(itemKey);

if(unifyingEntry == null) {
// Resolve all the lazy suppliers once, rather than on each request. This avoids O(n) lookup performance
// for unification entries.
ITEM_UNIFICATION_ENTRY.removeIf(entry -> {
ITEM_UNIFICATION_ENTRY_COLLECTED.put(entry.getKey().get().asItem(), entry.getValue());
return true;
});

unifyingEntry = ITEM_UNIFICATION_ENTRY_COLLECTED.computeIfAbsent(itemKey, item -> UnificationEntry.EmptyMapMarkerEntry);
}

return unifyingEntry;
}

public static UnificationEntry getUnificationEntry(TagKey<Item> tag) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ public void fellTree(ItemStack stack, Level level, BlockState origin, BlockPos o
orderedBlocks.subList(durabilityLeft, orderedBlocks.size()).clear();
}


stack.hurtAndBreak(orderedBlocks.size(), serverPlayer, p -> p.broadcastBreakEvent(EquipmentSlot.MAINHAND));
ToolHelper.damageItem(stack, serverPlayer);

breakBlocksPerTick(serverPlayer, orderedBlocks, origin.getBlock());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ public List<Object> getContents() {
return Arrays.asList(ingredients.toArray());
}

@Override
public int getSize() {
return this.storage.getSlots();
}

@Override
public RecipeCapability<Ingredient> getCapability() {
return ItemRecipeCapability.CAP;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public class GTRecipeTypeUI {
private boolean JEIVisible = true;

private CompoundTag customUICache;
private Size jeiSize;

/**
* @param recipeType the recipemap corresponding to this ui
Expand Down Expand Up @@ -120,11 +121,16 @@ public boolean hasCustomUI() {

public void reloadCustomUI() {
this.customUICache = null;
this.jeiSize = null;
}

public Size getJEISize() {
Size size = createEditableUITemplate(false, false).createDefault().getSize();
return new Size(size.width, getPropertyHeightShift() + 5 + size.height);
Size size = this.jeiSize;
if(size == null) {
var originalSize = createEditableUITemplate(false, false).createDefault().getSize();
this.jeiSize = size = new Size(originalSize.width, getPropertyHeightShift() + 5 + originalSize.height);
}
return size;
}

public record RecipeHolder(DoubleSupplier progressSupplier, IItemTransfer importItems, IItemTransfer exportItems, IFluidTransfer importFluids, IFluidTransfer exportFluids, boolean isSteam, boolean isHighPressure) {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,13 @@
import com.gregtechceu.gtceu.api.machine.feature.IFancyUIMachine;
import com.gregtechceu.gtceu.api.machine.trait.NotifiableItemStackHandler;
import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic;
import com.gregtechceu.gtceu.api.recipe.GTRecipeType;
import com.gregtechceu.gtceu.api.recipe.ui.GTRecipeTypeUI;
import com.gregtechceu.gtceu.common.data.GTMachines;
import com.gregtechceu.gtceu.common.machine.trait.miner.MinerLogic;
import com.gregtechceu.gtceu.data.lang.LangHandler;
import com.lowdragmc.lowdraglib.gui.widget.ComponentPanelWidget;
import com.lowdragmc.lowdraglib.gui.widget.DraggableScrollableWidgetGroup;
import com.lowdragmc.lowdraglib.gui.widget.SlotWidget;
import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup;
import com.lowdragmc.lowdraglib.misc.FluidTransferList;
import com.lowdragmc.lowdraglib.misc.ItemStackTransfer;
import com.lowdragmc.lowdraglib.side.item.ItemTransferHelper;
import com.lowdragmc.lowdraglib.syncdata.ISubscription;
Expand Down Expand Up @@ -323,7 +320,7 @@ else if (playerIn.isCrouching())
else
getRecipeLogic().setCurrentRadius(Math.max(1, currentRadius - 1));

getRecipeLogic().resetArea();
getRecipeLogic().resetArea(true);

int workingArea = IMiner.getWorkingArea(getRecipeLogic().getCurrentRadius());
playerIn.sendSystemMessage(Component.translatable("gtceu.universal.tooltip.working_area", workingArea, workingArea));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,30 @@

import com.gregtechceu.gtceu.GTCEu;
import com.gregtechceu.gtceu.api.GTValues;
import com.gregtechceu.gtceu.api.capability.IEnergyContainer;
import com.gregtechceu.gtceu.api.capability.recipe.EURecipeCapability;
import com.gregtechceu.gtceu.api.capability.recipe.IO;
import com.gregtechceu.gtceu.api.data.tag.TagPrefix;
import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity;
import com.gregtechceu.gtceu.api.machine.feature.ITieredMachine;
import com.gregtechceu.gtceu.api.machine.multiblock.WorkableElectricMultiblockMachine;
import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic;
import com.gregtechceu.gtceu.api.misc.EnergyContainerList;
import com.gregtechceu.gtceu.common.data.GTBlocks;
import com.gregtechceu.gtceu.common.data.GTMaterials;
import com.gregtechceu.gtceu.common.machine.trait.FluidDrillLogic;
import com.gregtechceu.gtceu.utils.FormattingUtil;
import com.gregtechceu.gtceu.utils.GTUtil;
import lombok.Getter;
import net.minecraft.ChatFormatting;
import net.minecraft.MethodsReturnNonnullByDefault;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.HoverEvent;
import net.minecraft.network.chat.Style;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.material.Fluid;
import org.jetbrains.annotations.NotNull;

import javax.annotation.ParametersAreNonnullByDefault;
import java.util.List;
Expand All @@ -41,18 +52,48 @@ protected RecipeLogic createRecipeLogic(Object... args) {
return new FluidDrillLogic(this);
}

@NotNull
@Override
public FluidDrillLogic getRecipeLogic() {
return (FluidDrillLogic) super.getRecipeLogic();
}

public int getEnergyTier() {
return Math.min(this.tier + 1 , Math.max(this.tier, getOverclockTier()));
var energyContainer = this.getCapabilitiesProxy().get(IO.IN, EURecipeCapability.CAP);
if (energyContainer == null) return this.tier;
var energyCont = new EnergyContainerList(energyContainer.stream().filter(IEnergyContainer.class::isInstance).map(IEnergyContainer.class::cast).toList());

return Math.min(this.tier + 1, Math.max(this.tier, GTUtil.getFloorTierByVoltage(energyCont.getInputVoltage())));
}

@Override
public void addDisplayText(List<Component> textList) {
super.addDisplayText(textList);
if (isFormed()) {
int energyContainer = getEnergyTier();
long maxVoltage = GTValues.V[energyContainer];
String voltageName = GTValues.VNF[energyContainer];
textList.add(Component.translatable("gtceu.multiblock.max_energy_per_tick", maxVoltage, voltageName));

if (getRecipeLogic().getVeinFluid() != null) {
// Fluid name
Fluid drilledFluid = getRecipeLogic().getVeinFluid();
Component fluidInfo = drilledFluid.getFluidType().getDescription().copy().withStyle(ChatFormatting.GREEN);
textList.add(Component.translatable("gtceu.multiblock.fluid_rig.drilled_fluid", fluidInfo).withStyle(ChatFormatting.GRAY));

// Fluid amount
Component amountInfo = Component.literal(FormattingUtil.formatNumbers(
getRecipeLogic().getFluidToProduce() * 20L / FluidDrillLogic.MAX_PROGRESS) +
" mB/s").withStyle(ChatFormatting.BLUE);
textList.add(Component.translatable("gtceu.multiblock.fluid_rig.fluid_amount", amountInfo).withStyle(ChatFormatting.GRAY));
} else {
Component noFluid = Component.translatable("gtceu.multiblock.fluid_rig.no_fluid_in_area").withStyle(ChatFormatting.RED);
textList.add(Component.translatable("gtceu.multiblock.fluid_rig.drilled_fluid", noFluid).withStyle(ChatFormatting.GRAY));
}
} else {
Component tooltip = Component.translatable("gtceu.multiblock.invalid_structure.tooltip").withStyle(ChatFormatting.GRAY);
textList.add(Component.translatable("gtceu.multiblock.invalid_structure")
.withStyle(Style.EMPTY.withColor(ChatFormatting.RED)
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, tooltip))));
}
}

Expand Down Expand Up @@ -86,6 +127,7 @@ public static Block getCasingState(int tier) {
return GTBlocks.CASING_STEEL_SOLID.get();
}

@SuppressWarnings("DataFlowIssue")
public static Block getFrameState(int tier) {
if (tier == GTValues.MV)
return GTBlocks.MATERIAL_BLOCKS.get(TagPrefix.frameGt, GTMaterials.Steel).get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public InteractionResult onScrewdriverClick(Player playerIn, InteractionHand han
int workingArea = IMiner.getWorkingArea(getRecipeLogic().getCurrentRadius());
playerIn.sendSystemMessage(Component.translatable("gtceu.universal.tooltip.working_area", workingArea, workingArea));
}
getRecipeLogic().resetArea();
getRecipeLogic().resetArea(true);
} else {
playerIn.sendSystemMessage(Component.translatable("gtceu.multiblock.large_miner.errorradius"));
}
Expand Down
Loading

0 comments on commit 809d99f

Please sign in to comment.