-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow the PRASS to use all 5 casings yet and improve its JEI preview (#…
…11) * Use all 5 casings and have a better JEI preview * Erm, add ULV casings to the CoAL Remove some stuff I don't think I need Make the PRASS use machine casings and have a tier based on them * It works, weird bug with spamming buttons * Fix the PRASS being able so somehow do precise recipes on normal mode
- Loading branch information
Showing
39 changed files
with
592 additions
and
156 deletions.
There are no files selected for viewing
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
82 changes: 82 additions & 0 deletions
82
.../java/com/zorbatron/zbgt/api/metatileentity/LaserCapableMultiMapMultiblockController.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,82 @@ | ||
package com.zorbatron.zbgt.api.metatileentity; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
import net.minecraft.util.ResourceLocation; | ||
|
||
import com.zorbatron.zbgt.ZBGTConfig; | ||
|
||
import gregtech.api.capability.IEnergyContainer; | ||
import gregtech.api.capability.impl.EnergyContainerList; | ||
import gregtech.api.metatileentity.multiblock.MultiMapMultiblockController; | ||
import gregtech.api.metatileentity.multiblock.MultiblockAbility; | ||
import gregtech.api.pattern.TraceabilityPredicate; | ||
import gregtech.api.recipes.RecipeMap; | ||
|
||
public abstract class LaserCapableMultiMapMultiblockController extends MultiMapMultiblockController { | ||
|
||
private final boolean allowSubstationHatches; | ||
|
||
public LaserCapableMultiMapMultiblockController(ResourceLocation metaTileEntityId, RecipeMap<?>[] recipeMaps) { | ||
this(metaTileEntityId, recipeMaps, true); | ||
} | ||
|
||
public LaserCapableMultiMapMultiblockController(ResourceLocation metaTileEntityId, RecipeMap<?>[] recipeMaps, | ||
boolean allowSubstationHatches) { | ||
super(metaTileEntityId, recipeMaps); | ||
this.allowSubstationHatches = allowSubstationHatches; | ||
} | ||
|
||
public boolean allowsSubstationHatches() { | ||
return this.allowSubstationHatches && ZBGTConfig.multiblockSettings.allowSubstationHatches; | ||
} | ||
|
||
@Override | ||
protected void initializeAbilities() { | ||
super.initializeAbilities(); | ||
|
||
List<IEnergyContainer> list = new ArrayList<>(); | ||
list.addAll(getAbilities(MultiblockAbility.INPUT_ENERGY)); | ||
list.addAll(getAbilities(MultiblockAbility.INPUT_LASER)); | ||
if (allowsSubstationHatches()) { | ||
list.addAll(getAbilities(MultiblockAbility.SUBSTATION_INPUT_ENERGY)); | ||
} | ||
|
||
this.energyContainer = new EnergyContainerList(Collections.unmodifiableList(list)); | ||
} | ||
|
||
@Override | ||
public TraceabilityPredicate autoAbilities(boolean checkEnergyIn, boolean checkMaintenance, boolean checkItemIn, | ||
boolean checkItemOut, boolean checkFluidIn, boolean checkFluidOut, | ||
boolean checkMuffler) { | ||
TraceabilityPredicate predicate = super.autoAbilities(false, checkMaintenance, checkItemIn, checkItemOut, | ||
checkFluidIn, checkFluidOut, checkMuffler); | ||
|
||
if (checkEnergyIn) { | ||
predicate = predicate.or(autoEnergyInputs()); | ||
} | ||
|
||
return predicate; | ||
} | ||
|
||
public TraceabilityPredicate autoEnergyInputs(int min, int max, int previewCount) { | ||
if (allowsSubstationHatches()) { | ||
return new TraceabilityPredicate(abilities(MultiblockAbility.INPUT_ENERGY, MultiblockAbility.INPUT_LASER, | ||
MultiblockAbility.SUBSTATION_INPUT_ENERGY) | ||
.setMinGlobalLimited(min).setMaxGlobalLimited(max).setPreviewCount(previewCount)); | ||
} else { | ||
return new TraceabilityPredicate(abilities(MultiblockAbility.INPUT_ENERGY, MultiblockAbility.INPUT_LASER) | ||
.setMinGlobalLimited(min).setMaxGlobalLimited(max).setPreviewCount(previewCount)); | ||
} | ||
} | ||
|
||
public TraceabilityPredicate autoEnergyInputs(int min, int max) { | ||
return autoEnergyInputs(min, max, 2); | ||
} | ||
|
||
public TraceabilityPredicate autoEnergyInputs() { | ||
return autoEnergyInputs(1, 3); | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
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
64 changes: 64 additions & 0 deletions
64
src/main/java/com/zorbatron/zbgt/api/recipes/builders/PreciseAssemblerRecipeBuilder.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,64 @@ | ||
package com.zorbatron.zbgt.api.recipes.builders; | ||
|
||
import org.apache.commons.lang3.builder.ToStringBuilder; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import com.zorbatron.zbgt.api.recipes.properties.PreciseAssemblerProperty; | ||
import com.zorbatron.zbgt.api.util.ZBGTLog; | ||
|
||
import gregtech.api.recipes.Recipe; | ||
import gregtech.api.recipes.RecipeBuilder; | ||
import gregtech.api.recipes.RecipeMap; | ||
import gregtech.api.util.EnumValidationResult; | ||
|
||
public class PreciseAssemblerRecipeBuilder extends RecipeBuilder<PreciseAssemblerRecipeBuilder> { | ||
|
||
public PreciseAssemblerRecipeBuilder() {} | ||
|
||
public PreciseAssemblerRecipeBuilder(Recipe recipe, RecipeMap<PreciseAssemblerRecipeBuilder> recipeMap) { | ||
super(recipe, recipeMap); | ||
} | ||
|
||
public PreciseAssemblerRecipeBuilder(RecipeBuilder<PreciseAssemblerRecipeBuilder> recipeBuilder) { | ||
super(recipeBuilder); | ||
} | ||
|
||
@Override | ||
public PreciseAssemblerRecipeBuilder copy() { | ||
return new PreciseAssemblerRecipeBuilder(this); | ||
} | ||
|
||
@Override | ||
public boolean applyProperty(@NotNull String key, Object value) { | ||
if (key.equals(PreciseAssemblerProperty.KEY)) { | ||
this.CasingTier(((Number) value).intValue()); | ||
return true; | ||
} | ||
|
||
return super.applyProperty(key, value); | ||
} | ||
|
||
public PreciseAssemblerRecipeBuilder CasingTier(int tier) { | ||
if (tier < 0) { | ||
ZBGTLog.logger.error("Casing tier cannot be less than 0!", new IllegalArgumentException()); | ||
this.recipeStatus = EnumValidationResult.INVALID; | ||
} | ||
|
||
this.applyProperty(PreciseAssemblerProperty.getInstance(), tier); | ||
|
||
return this; | ||
} | ||
|
||
public int getCasingTier() { | ||
return this.recipePropertyStorage == null ? 0 : | ||
this.recipePropertyStorage.getRecipePropertyValue(PreciseAssemblerProperty.getInstance(), 0); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return new ToStringBuilder(this) | ||
.append(super.toString()) | ||
.append(PreciseAssemblerProperty.getInstance().getKey(), getCasingTier()) | ||
.toString(); | ||
} | ||
} |
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
Oops, something went wrong.