-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add PrimitiveBlastFurnaceRecipe, builder and map
- Loading branch information
exidex
committed
Apr 20, 2018
1 parent
ba9147b
commit 7ae78b0
Showing
10 changed files
with
167 additions
and
59 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#Sun Jun 11 18:36:34 KRAT 2017 | ||
#Fri Apr 20 14:59:31 CEST 2018 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
src/main/java/gregtech/api/recipes/builders/PrimitiveBlastFurnaceRecipeBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package gregtech.api.recipes.builders; | ||
|
||
import gregtech.api.recipes.Recipe; | ||
import gregtech.api.recipes.RecipeMaps; | ||
import gregtech.api.unification.stack.SimpleItemStack; | ||
import gregtech.api.util.EnumValidationResult; | ||
import gregtech.api.util.GTLog; | ||
import gregtech.api.util.ValidationResult; | ||
import net.minecraft.item.ItemStack; | ||
|
||
public class PrimitiveBlastFurnaceRecipeBuilder { | ||
|
||
private int duration = -1; | ||
private int fuelAmount = -1; | ||
|
||
private ItemStack output; | ||
|
||
private PrimitiveBlastFurnaceRecipeBuilder() { | ||
} | ||
|
||
public static PrimitiveBlastFurnaceRecipeBuilder start() { | ||
return new PrimitiveBlastFurnaceRecipeBuilder(); | ||
} | ||
|
||
public PrimitiveBlastFurnaceRecipeBuilder setDuration(int duration) { | ||
this.duration = duration; | ||
return this; | ||
} | ||
|
||
public PrimitiveBlastFurnaceRecipeBuilder setFuelAmount(int fuelAmount) { | ||
this.fuelAmount = fuelAmount; | ||
return this; | ||
} | ||
|
||
public PrimitiveBlastFurnaceRecipeBuilder setOutput(ItemStack output) { | ||
this.output = output; | ||
return this; | ||
} | ||
|
||
public ValidationResult<Recipe.PrimitiveBlastFurnaceRecipe> build() { | ||
return ValidationResult.newResult(validate(), | ||
new Recipe.PrimitiveBlastFurnaceRecipe(duration, fuelAmount, output)); | ||
} | ||
|
||
protected EnumValidationResult validate() { | ||
EnumValidationResult result = EnumValidationResult.VALID; | ||
|
||
if (output == null || output.isEmpty()) { | ||
GTLog.logger.error("Output ItemStack cannot be null or empty", new IllegalArgumentException()); | ||
result = EnumValidationResult.INVALID; | ||
} | ||
|
||
if (fuelAmount <= 0) { | ||
GTLog.logger.error("Research Time cannot be less or equal to 0", new IllegalArgumentException()); | ||
result = EnumValidationResult.INVALID; | ||
} | ||
if (duration <= 0) { | ||
GTLog.logger.error("Duration cannot be less or equal to 0", new IllegalArgumentException()); | ||
result = EnumValidationResult.INVALID; | ||
} | ||
|
||
return result; | ||
} | ||
|
||
public void buildAndRegister() { | ||
ValidationResult<Recipe.PrimitiveBlastFurnaceRecipe> result = build(); | ||
|
||
if (result.getType() == EnumValidationResult.VALID) { | ||
Recipe.PrimitiveBlastFurnaceRecipe recipe = result.getResult(); | ||
RecipeMaps.PRIMITIVE_BLAST_FURNACE.put(new SimpleItemStack(recipe.getOutput()), recipe); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters