Skip to content

Commit 2c8e7d1

Browse files
committed
drop some features for GregTech 2.4.3 compat
1 parent 757e3a8 commit 2c8e7d1

7 files changed

Lines changed: 128 additions & 11 deletions

File tree

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ buildscript {
99
}
1010
apply plugin: 'net.minecraftforge.gradle.forge'
1111

12-
version = "1.12.2-1.8.0"
12+
version = "1.12.2-1.8.1"
1313
group = "bruberu"
1414
archivesBaseName = "GregTech Food Option"
1515

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
package com.cleanroommc.groovyscript.api;
2+
3+
import net.minecraft.item.ItemStack;
4+
import net.minecraft.item.crafting.Ingredient;
5+
import net.minecraftforge.fluids.FluidStack;
6+
7+
import javax.annotation.Nullable;
8+
import java.util.function.Predicate;
9+
10+
/**
11+
* Base ingredient class for every ingredient. Most useful for item stacks and ore dicts.
12+
*/
13+
public interface IIngredient extends IResourceStack, Predicate<ItemStack> {
14+
15+
IIngredient exactCopy();
16+
17+
Ingredient toMcIngredient();
18+
19+
ItemStack[] getMatchingStacks();
20+
21+
default ItemStack applyTransform(ItemStack matchedInput) {
22+
return matchedInput.getItem().hasContainerItem(matchedInput) ? matchedInput.getItem().getContainerItem(matchedInput) : ItemStack.EMPTY;
23+
}
24+
25+
default boolean test(FluidStack fluidStack) {
26+
return false;
27+
}
28+
29+
/**
30+
* An empty ingredient with stack size 0, that matches empty item stacks
31+
*/
32+
IIngredient EMPTY = new IIngredient() {
33+
@Override
34+
public int getAmount() {
35+
return 0;
36+
}
37+
38+
@Override
39+
public void setAmount(int amount) {
40+
}
41+
42+
@Override
43+
public IIngredient exactCopy() {
44+
return this;
45+
}
46+
47+
@Override
48+
public Ingredient toMcIngredient() {
49+
return Ingredient.EMPTY;
50+
}
51+
52+
@Override
53+
public ItemStack[] getMatchingStacks() {
54+
return new ItemStack[]{ItemStack.EMPTY};
55+
}
56+
57+
@Override
58+
public boolean test(ItemStack stack) {
59+
return stack.isEmpty();
60+
}
61+
};
62+
63+
/**
64+
* An ingredient with stack size 1, that matches any item stack
65+
*/
66+
IIngredient ANY = new IIngredient() {
67+
68+
@Override
69+
public IIngredient exactCopy() {
70+
return this;
71+
}
72+
73+
@Override
74+
public Ingredient toMcIngredient() {
75+
return new Ingredient() {
76+
@Override
77+
public boolean apply(@Nullable ItemStack p_apply_1_) {
78+
return true;
79+
}
80+
};
81+
}
82+
83+
@Override
84+
public ItemStack[] getMatchingStacks() {
85+
return new ItemStack[0];
86+
}
87+
88+
@Override
89+
public int getAmount() {
90+
return 1;
91+
}
92+
93+
@Override
94+
public void setAmount(int amount) {
95+
}
96+
97+
@Override
98+
public boolean test(ItemStack stack) {
99+
return true;
100+
}
101+
};
102+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.cleanroommc.groovyscript.api;
2+
3+
/**
4+
* An object that has an amount.
5+
* Can use '*' in groovy to set amount.
6+
*/
7+
public interface IResourceStack {
8+
9+
int getAmount();
10+
11+
void setAmount(int amount);
12+
13+
default IResourceStack withAmount(int amount) {
14+
setAmount(amount);
15+
return this;
16+
}
17+
18+
/**
19+
* enables groovy to use '*' operator
20+
*/
21+
default IResourceStack multiply(Number n) {
22+
return withAmount(n.intValue());
23+
}
24+
}

src/main/java/gregtechfoodoption/machines/multiblock/MetaTileEntityBakingOven.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,6 @@ public MetaTileEntityBakingOven(ResourceLocation metaTileEntityId) {
3535
super(metaTileEntityId, GTFORecipeMaps.BAKING_OVEN_RECIPES);
3636
}
3737

38-
@Override
39-
public int getLightValueForPart(IMultiblockPart sourcePart) {
40-
return sourcePart == null && recipeMapWorkable.isActive() ? 15 : 0;
41-
}
42-
4338
protected IBlockState getCasingState() {
4439
return GTFOMetaBlocks.GTFO_CASING.getState(GTFOBlockCasing.CasingType.ADOBE_BRICKS);
4540
}

src/main/java/gregtechfoodoption/machines/multiblock/MetaTileEntityElectricBakingOven.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -318,11 +318,6 @@ public boolean checkRecipe(Recipe recipe, boolean consumeIfSuccess) {
318318
return recipe.getProperty(ElectricBakingOvenRecipeBuilder.TemperatureProperty.getInstance(), 0) == temp;
319319
}
320320

321-
@Override
322-
public int getLightValueForPart(IMultiblockPart sourcePart) {
323-
return sourcePart == null && temp > 300 ? 15 : 0;
324-
}
325-
326321
private class ElectricBakingOvenLogic extends MultiblockRecipeLogic {
327322
public ElectricBakingOvenLogic(RecipeMapMultiblockController tileEntity) {
328323
super(tileEntity);

src/main/java/gregtechfoodoption/recipe/chain/DyeChain.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import static gregtech.api.unification.material.Materials.*;
1111
import static gregtech.api.unification.ore.OrePrefix.dust;
1212
import static gregtechfoodoption.GTFOMaterialHandler.*;
13+
import static gregtechfoodoption.GTFOMaterialHandler.ArsenicTrioxide;
1314

1415
// It's alive...
1516
public class DyeChain {

0 commit comments

Comments
 (0)