Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Dream-Master authored Mar 4, 2025
2 parents 5d399e0 + d76a952 commit 9afdc61
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 82 deletions.
15 changes: 9 additions & 6 deletions src/main/java/gregtech/api/util/GTUtility.java
Original file line number Diff line number Diff line change
Expand Up @@ -1880,12 +1880,15 @@ public static ItemStack fillFluidContainer(FluidStack aFluid, ItemStack aStack,
}
return null;
}
if (aCheckIFluidContainerItems && aStack.getItem() instanceof IFluidContainerItem
&& ((IFluidContainerItem) aStack.getItem()).getFluid(aStack) == null
&& ((IFluidContainerItem) aStack.getItem()).getCapacity(aStack) <= aFluid.amount) {
if (aRemoveFluidDirectly) aFluid.amount -= ((IFluidContainerItem) aStack.getItem())
.fill(aStack = copyAmount(1, aStack), aFluid, true);
else((IFluidContainerItem) aStack.getItem()).fill(aStack = copyAmount(1, aStack), aFluid, true);
if (aCheckIFluidContainerItems && aStack.getItem() instanceof IFluidContainerItem fluidContainerItem
&& fluidContainerItem.getFluid(aStack) == null
&& fluidContainerItem.getCapacity(aStack) > 0
&& fluidContainerItem.getCapacity(aStack) <= aFluid.amount) {
if (aRemoveFluidDirectly) {
aFluid.amount -= fluidContainerItem.fill(aStack = copyAmount(1, aStack), aFluid, true);
} else {
fluidContainerItem.fill(aStack = copyAmount(1, aStack), aFluid, true);
}
return aStack;
}
Map<String, FluidContainerData> tFluidToContainer = sEmptyContainerToFluidToData.get(new GTItemStack(aStack));
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/gregtech/api/util/JubilanceMegaApiary.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package gregtech.api.util;

import net.minecraft.util.StatCollector;

import forestry.api.apiculture.IAlleleBeeSpecies;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
Expand All @@ -18,6 +20,6 @@ public boolean isJubilant(IAlleleBeeSpecies species, IBeeGenome genome, IBeeHous

@Override
public String getDescription() {
return "Will only be produced in mega Apiary";
return StatCollector.translateToLocal("GT5U.tooltip.mega_apiary.only_producer");
}
}
3 changes: 2 additions & 1 deletion src/main/java/gregtech/common/items/ItemComb.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;

Expand Down Expand Up @@ -124,7 +125,7 @@ public String getItemStackDisplayName(ItemStack stack) {

@Override
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean debugInfo) {
tooltip.add(EnumChatFormatting.DARK_RED + "Forestry can't process it");
tooltip.add(EnumChatFormatting.DARK_RED + StatCollector.translateToLocal("GT5U.tooltip.comb.ban_forestry"));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Stream;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
Expand Down Expand Up @@ -751,6 +753,34 @@ public CheckRecipeResult checkProcessing() {
protected ProcessingLogic createProcessingLogic() {
return new ProcessingLogic() {

@Nonnull
protected Stream<GTRecipe> findRecipeMatches(@Nullable RecipeMap<?> map) {
if (map == null) {
return Stream.empty();
}

recalculateDiscount();
// Allow recipes to start without having 100% of the catalyst required, aka discount > 0%
FluidStack[] queryFluids = new FluidStack[inputFluids.length];
for (int i = 0; i < inputFluids.length; i++) {
queryFluids[i] = new FluidStack(inputFluids[i].getFluid(), inputFluids[i].amount);
for (FluidStack fuel : valid_fuels) {
if (queryFluids[i].isFluidEqual(fuel)) {
queryFluids[i].amount = (int) Math
.min(Math.round(queryFluids[i].amount / discount), Integer.MAX_VALUE);
break;
}
}
}

return map.findRecipeQuery()
.items(inputItems)
.fluids(queryFluids)
.specialSlot(specialSlotItem)
.cachedRecipe(lastRecipe)
.findAll();
}

@Nonnull
@Override
protected OverclockCalculator createOverclockCalculator(@Nonnull GTRecipe recipe) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ protected void runMachine(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
super.runMachine(aBaseMetaTileEntity, aTick);
// Every 20 ticks, add all catalysts from the input bus to the internal inventory.
if (mMaxProgresstime > 0 && aTick % 20 == 0) {
startRecipeProcessing();
ArrayList<ItemStack> storedInputs = getStoredInputs();
// For each stack in the input, check if it is a valid catalyst item and if so consume it
for (ItemStack stack : storedInputs) {
Expand All @@ -487,6 +488,7 @@ protected void runMachine(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
// If we could not drain, stop the machine
if (!drained) {
stopMachine(ShutDownReasonRegistry.outOfFluid(inputCost));
endRecipeProcessing();
return;
}
// Now add the catalysts to the list, one by one since there may be multiples and we want to
Expand All @@ -499,6 +501,7 @@ protected void runMachine(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
this.depleteInput(stack);
}
}
endRecipeProcessing();

// Only do this check if we didn't find a correct combination yet
if (correctStartIndex != -1) return;
Expand Down
126 changes: 55 additions & 71 deletions src/main/java/gregtech/loaders/oreprocessing/ProcessingWire.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,93 +135,77 @@ public void registerOre(OrePrefixes aPrefix, Materials aMaterial, String aOreDic
case wireGt02 -> {
cableWidth = 2;
correspondingCable = OrePrefixes.cableGt02;
if (aMaterial.getProcessingMaterialTierEU() < TierEU.IV) {
// Shapeless crafting recipes
{
GTModHandler.addShapelessCraftingRecipe(
GTOreDictUnificator.get(OrePrefixes.wireGt01, aMaterial, 2L),
new Object[] { aOreDictName });

GTModHandler.addShapelessCraftingRecipe(
GTUtility.copyAmount(1, aStack),
new Object[] { OrePrefixes.wireGt01.get(aMaterial), OrePrefixes.wireGt01.get(aMaterial) });
}
}
// Shapeless crafting recipes
GTModHandler.addShapelessCraftingRecipe(
GTOreDictUnificator.get(OrePrefixes.wireGt01, aMaterial, 2L),
new Object[] { aOreDictName });

GTModHandler.addShapelessCraftingRecipe(
GTUtility.copyAmount(1, aStack),
new Object[] { OrePrefixes.wireGt01.get(aMaterial), OrePrefixes.wireGt01.get(aMaterial) });
}
case wireGt04 -> {
cableWidth = 4;
correspondingCable = OrePrefixes.cableGt04;
if (aMaterial.getProcessingMaterialTierEU() < TierEU.IV) {
// Shapeless crafting recipes
{
GTModHandler.addShapelessCraftingRecipe(
GTOreDictUnificator.get(OrePrefixes.wireGt01, aMaterial, 4L),
new Object[] { aOreDictName });
GTModHandler.addShapelessCraftingRecipe(
GTUtility.copyAmount(1, aStack),
new Object[] { OrePrefixes.wireGt01.get(aMaterial), OrePrefixes.wireGt01.get(aMaterial),
OrePrefixes.wireGt01.get(aMaterial), OrePrefixes.wireGt01.get(aMaterial) });
GTModHandler.addShapelessCraftingRecipe(
GTUtility.copyAmount(1, aStack),
new Object[] { OrePrefixes.wireGt02.get(aMaterial), OrePrefixes.wireGt02.get(aMaterial) });
}
}
// Shapeless crafting recipes
GTModHandler.addShapelessCraftingRecipe(
GTOreDictUnificator.get(OrePrefixes.wireGt01, aMaterial, 4L),
new Object[] { aOreDictName });

GTModHandler.addShapelessCraftingRecipe(
GTUtility.copyAmount(1, aStack),
new Object[] { OrePrefixes.wireGt01.get(aMaterial), OrePrefixes.wireGt01.get(aMaterial),
OrePrefixes.wireGt01.get(aMaterial), OrePrefixes.wireGt01.get(aMaterial) });
GTModHandler.addShapelessCraftingRecipe(
GTUtility.copyAmount(1, aStack),
new Object[] { OrePrefixes.wireGt02.get(aMaterial), OrePrefixes.wireGt02.get(aMaterial) });
}
case wireGt08 -> {
cableWidth = 8;
correspondingCable = OrePrefixes.cableGt08;
if (aMaterial.getProcessingMaterialTierEU() < TierEU.IV) {
// Shapeless crafting recipes
{
GTModHandler.addShapelessCraftingRecipe(
GTOreDictUnificator.get(OrePrefixes.wireGt01, aMaterial, 8L),
new Object[] { aOreDictName });
GTModHandler.addShapelessCraftingRecipe(
GTUtility.copyAmount(1, aStack),
new Object[] { OrePrefixes.wireGt01.get(aMaterial), OrePrefixes.wireGt01.get(aMaterial),
OrePrefixes.wireGt01.get(aMaterial), OrePrefixes.wireGt01.get(aMaterial),
OrePrefixes.wireGt01.get(aMaterial), OrePrefixes.wireGt01.get(aMaterial),
OrePrefixes.wireGt01.get(aMaterial), OrePrefixes.wireGt01.get(aMaterial) });
GTModHandler.addShapelessCraftingRecipe(
GTUtility.copyAmount(1, aStack),
new Object[] { OrePrefixes.wireGt04.get(aMaterial), OrePrefixes.wireGt04.get(aMaterial) });
}
}
// Shapeless crafting recipes
GTModHandler.addShapelessCraftingRecipe(
GTOreDictUnificator.get(OrePrefixes.wireGt01, aMaterial, 8L),
new Object[] { aOreDictName });

GTModHandler.addShapelessCraftingRecipe(
GTUtility.copyAmount(1, aStack),
new Object[] { OrePrefixes.wireGt01.get(aMaterial), OrePrefixes.wireGt01.get(aMaterial),
OrePrefixes.wireGt01.get(aMaterial), OrePrefixes.wireGt01.get(aMaterial),
OrePrefixes.wireGt01.get(aMaterial), OrePrefixes.wireGt01.get(aMaterial),
OrePrefixes.wireGt01.get(aMaterial), OrePrefixes.wireGt01.get(aMaterial) });
GTModHandler.addShapelessCraftingRecipe(
GTUtility.copyAmount(1, aStack),
new Object[] { OrePrefixes.wireGt04.get(aMaterial), OrePrefixes.wireGt04.get(aMaterial) });
}
case wireGt12 -> {
cableWidth = 12;
correspondingCable = OrePrefixes.cableGt12;
if (aMaterial.getProcessingMaterialTierEU() < TierEU.IV) {
// Shapeless crafting recipes
{
GTModHandler.addShapelessCraftingRecipe(
GTOreDictUnificator.get(OrePrefixes.wireGt01, aMaterial, 12L),
new Object[] { aOreDictName });
GTModHandler.addShapelessCraftingRecipe(
GTUtility.copyAmount(1, aStack),
new Object[] { OrePrefixes.wireGt08.get(aMaterial), OrePrefixes.wireGt04.get(aMaterial) });
}
}
// Shapeless crafting recipes
GTModHandler.addShapelessCraftingRecipe(
GTOreDictUnificator.get(OrePrefixes.wireGt01, aMaterial, 12L),
new Object[] { aOreDictName });

GTModHandler.addShapelessCraftingRecipe(
GTUtility.copyAmount(1, aStack),
new Object[] { OrePrefixes.wireGt08.get(aMaterial), OrePrefixes.wireGt04.get(aMaterial) });
}
case wireGt16 -> {
cableWidth = 16;
correspondingCable = OrePrefixes.cableGt16;
if (aMaterial.getProcessingMaterialTierEU() < TierEU.IV) {
// Shapeless crafting recipes
{
GTModHandler.addShapelessCraftingRecipe(
GTOreDictUnificator.get(OrePrefixes.wireGt01, aMaterial, 16L),
new Object[] { aOreDictName });
GTModHandler.addShapelessCraftingRecipe(
GTUtility.copyAmount(1, aStack),
new Object[] { OrePrefixes.wireGt08.get(aMaterial), OrePrefixes.wireGt08.get(aMaterial) });
GTModHandler.addShapelessCraftingRecipe(
GTUtility.copyAmount(1, aStack),
new Object[] { OrePrefixes.wireGt12.get(aMaterial), OrePrefixes.wireGt04.get(aMaterial) });
}

AE2addNewAttunement(aStack);
}
// Shapeless crafting recipes
GTModHandler.addShapelessCraftingRecipe(
GTOreDictUnificator.get(OrePrefixes.wireGt01, aMaterial, 16L),
new Object[] { aOreDictName });

GTModHandler.addShapelessCraftingRecipe(
GTUtility.copyAmount(1, aStack),
new Object[] { OrePrefixes.wireGt08.get(aMaterial), OrePrefixes.wireGt08.get(aMaterial) });
GTModHandler.addShapelessCraftingRecipe(
GTUtility.copyAmount(1, aStack),
new Object[] { OrePrefixes.wireGt12.get(aMaterial), OrePrefixes.wireGt04.get(aMaterial) });

AE2addNewAttunement(aStack);
}
default -> {
GTLog.err.println(
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/gtPlusPlus/core/item/food/BaseItemMetaFood.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;

import cpw.mods.fml.common.registry.GameRegistry;
Expand Down Expand Up @@ -48,15 +49,15 @@ public class BaseItemMetaFood extends ItemFood {
public static void registerMetaFoods() {
registerNewMetaFood(
0,
"I wouldn't eat this unless I was starving",
StatCollector.translateToLocal("GTPP.tooltip.meta_food.unless_starving"),
2,
0,
64,
getPotionEffectPackage(new EffectWeaknessModerate(80), new EffectSlownessModerate(80)),
getOreDictNamesAsArrayList("listAllmeatraw"));
registerNewMetaFood(
1,
"Doesn't look any better cooked",
StatCollector.translateToLocal("GTPP.tooltip.meta_food.better_cooked"),
4,
1,
64,
Expand Down Expand Up @@ -91,7 +92,7 @@ public static void registerMetaFoods() {
registerNewMetaFood(7, "", 4, 1, 64, getOreDictNamesAsArrayList("listAllmeatcooked"));
registerNewMetaFood(
8,
"Warm to the touch",
StatCollector.translateToLocal("GTPP.tooltip.meta_food.warm_touch"),
EnumRarity.uncommon,
4,
1,
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/assets/gregtech/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -2036,6 +2036,9 @@ GTPP.tooltip.block.mining_level=Mining Level: %d
GTPP.tooltip.block.contains=Contains:
GTPP.tooltip.meta_special.quantum_stability=Provides quantum stability
GTPP.tooltip.meta_special.quantum_modulation=Provides quantum modulation
GTPP.tooltip.meta_food.unless_starving=I wouldn't eat this unless I was starving
GTPP.tooltip.meta_food.better_cooked=Doesn't look any better cooked
GTPP.tooltip.meta_food.warm_touch=Warm to the touch

# GTPP structure hints
GTPP.tooltip.structure.anvil=Anvil
Expand Down Expand Up @@ -2076,6 +2079,9 @@ GT5U.tooltip.fluid.stat=State: %s
GT5U.tooltip.fluid.stat.gas=Gas
GT5U.tooltip.fluid.stat.liquid=Liquid

GT5U.tooltip.comb.ban_forestry=Forestry can't process it
GT5U.tooltip.mega_apiary.only_producer=Will only be produced in mega Apiary

# Achievements

# 4/2/19
Expand Down

0 comments on commit 9afdc61

Please sign in to comment.