Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* @see gregtech.api.fluids.attribute.FluidAttributes
* @see AttributedFluid
*/
public interface IPropertyFluidFilter extends IFilter<FluidStack> {
public interface IPropertyFluidFilter<R> extends IFilter<FluidStack> {

@Override
default boolean test(@NotNull FluidStack stack) {
Expand Down Expand Up @@ -79,7 +79,7 @@ default int getPriority() {
* @param attribute the attribute to change containment status for
* @param canContain whether the attribute can be contained
*/
void setCanContain(@NotNull FluidAttribute attribute, boolean canContain);
R setCanContain(@NotNull FluidAttribute attribute, boolean canContain);

@NotNull
@UnmodifiableView
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import java.util.Collection;

public class PropertyFluidFilter implements IPropertyFluidFilter {
public class PropertyFluidFilter implements IPropertyFluidFilter<PropertyFluidFilter> {

private final Object2BooleanMap<FluidAttribute> containmentPredicate = new Object2BooleanOpenHashMap<>();

Expand Down Expand Up @@ -48,8 +48,9 @@ public boolean canContain(@NotNull FluidAttribute attribute) {
}

@Override
public void setCanContain(@NotNull FluidAttribute attribute, boolean canContain) {
public PropertyFluidFilter setCanContain(@NotNull FluidAttribute attribute, boolean canContain) {
containmentPredicate.put(attribute, canContain);
return this;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,49 +81,55 @@ public int getBlastTemperature() {
return blastTemperature;
}

public void setBlastTemperature(int blastTemp) {
public BlastProperty setBlastTemperature(int blastTemp) {
if (blastTemp <= 0) throw new IllegalArgumentException("Blast Temperature must be greater than zero!");
this.blastTemperature = blastTemp;
return this;
}

public GasTier getGasTier() {
return gasTier;
}

public void setGasTier(@NotNull GasTier tier) {
public BlastProperty setGasTier(@NotNull GasTier tier) {
this.gasTier = tier;
return this;
}

public int getDurationOverride() {
return durationOverride;
}

public void setDurationOverride(int duration) {
public BlastProperty setDurationOverride(int duration) {
this.durationOverride = duration;
return this;
}

public int getEUtOverride() {
return eutOverride;
}

public void setEutOverride(int eut) {
public BlastProperty setEutOverride(int eut) {
this.eutOverride = eut;
return this;
}

public int getVacuumDurationOverride() {
return vacuumDurationOverride;
}

public void setVacuumDurationOverride(int duration) {
public BlastProperty setVacuumDurationOverride(int duration) {
this.vacuumDurationOverride = duration;
return this;
}

public int getVacuumEUtOverride() {
return vacuumEUtOverride;
}

public void setVacuumEutOverride(int eut) {
public BlastProperty setVacuumEutOverride(int eut) {
this.vacuumEUtOverride = eut;
return this;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,20 @@ public DustProperty() {
this(2, 0);
}

public void setHarvestLevel(int harvestLevel) {
public DustProperty setHarvestLevel(int harvestLevel) {
if (harvestLevel <= 0) throw new IllegalArgumentException("Harvest Level must be greater than zero!");
this.harvestLevel = harvestLevel;
return this;
}

public int getHarvestLevel() {
return this.harvestLevel;
}

public void setBurnTime(int burnTime) {
public DustProperty setBurnTime(int burnTime) {
if (burnTime < 0) throw new IllegalArgumentException("Burn Time cannot be negative!");
this.burnTime = burnTime;
return this;
}

public int getBurnTime() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ public OverrideToolProperty() {
}

// It does not make much sense to set these overrides:
public void setShouldIgnoreCraftingTools(boolean ignore) {
public OverrideToolProperty setShouldIgnoreCraftingTools(boolean ignore) {
throw new UnsupportedOperationException();
}

public void setUnbreakable(boolean isUnbreakable) {
public OverrideToolProperty setUnbreakable(boolean isUnbreakable) {
throw new UnsupportedOperationException();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import java.util.Collection;
import java.util.Objects;

public class FluidPipeProperties implements IMaterialProperty, IPropertyFluidFilter {
public class FluidPipeProperties implements IMaterialProperty, IPropertyFluidFilter<FluidPipeProperties> {

private final Object2BooleanMap<FluidAttribute> containmentPredicate = new Object2BooleanOpenHashMap<>();

Expand Down Expand Up @@ -73,17 +73,19 @@ public int getThroughput() {
return throughput;
}

public void setThroughput(int throughput) {
public FluidPipeProperties setThroughput(int throughput) {
this.throughput = throughput;
return this;
}

@Override
public int getMaxFluidTemperature() {
return maxFluidTemperature;
}

public void setMaxFluidTemperature(int maxFluidTemperature) {
public FluidPipeProperties setMaxFluidTemperature(int maxFluidTemperature) {
this.maxFluidTemperature = maxFluidTemperature;
return this;
}

@Override
Expand All @@ -101,8 +103,9 @@ public boolean canContain(@NotNull FluidAttribute attribute) {
}

@Override
public void setCanContain(@NotNull FluidAttribute attribute, boolean canContain) {
public FluidPipeProperties setCanContain(@NotNull FluidAttribute attribute, boolean canContain) {
this.containmentPredicate.put(attribute, canContain);
return this;
}

@Override
Expand All @@ -114,8 +117,9 @@ public boolean isGasProof() {
return gasProof;
}

public void setGasProof(boolean gasProof) {
public FluidPipeProperties setGasProof(boolean gasProof) {
this.gasProof = gasProof;
return this;
}

public boolean isAcidProof() {
Expand All @@ -126,16 +130,18 @@ public boolean isCryoProof() {
return cryoProof;
}

public void setCryoProof(boolean cryoProof) {
public FluidPipeProperties setCryoProof(boolean cryoProof) {
this.cryoProof = cryoProof;
return this;
}

public boolean isPlasmaProof() {
return plasmaProof;
}

public void setPlasmaProof(boolean plasmaProof) {
public FluidPipeProperties setPlasmaProof(boolean plasmaProof) {
this.plasmaProof = plasmaProof;
return this;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ public void store(@NotNull FluidStorageKey key, @NotNull Fluid fluid) {
/**
* @param primaryKey the key to use primarily
*/
public void setPrimaryKey(@NotNull FluidStorageKey primaryKey) {
public FluidProperty setPrimaryKey(@NotNull FluidStorageKey primaryKey) {
this.primaryKey = primaryKey;
return this;
}

@Override
Expand Down Expand Up @@ -116,7 +117,8 @@ public FluidStack solidifiesFrom(int amount) {
* @param solidifyingFluid The Fluid which solidifies into the material. If left null, it will be left as the
* default value: the material's liquid.
*/
public void setSolidifyingFluid(@Nullable Fluid solidifyingFluid) {
public FluidProperty setSolidifyingFluid(@Nullable Fluid solidifyingFluid) {
this.solidifyingFluid = solidifyingFluid;
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,33 +29,37 @@ public class IngotProperty implements IMaterialProperty {
@Nullable
private Material magneticMaterial;

public void setSmeltingInto(Material smeltInto) {
public IngotProperty setSmeltingInto(Material smeltInto) {
this.smeltInto = smeltInto;
return this;
}

public Material getSmeltingInto() {
return this.smeltInto;
}

public void setArcSmeltingInto(Material arcSmeltingInto) {
public IngotProperty setArcSmeltingInto(Material arcSmeltingInto) {
this.arcSmeltInto = arcSmeltingInto;
return this;
}

public Material getArcSmeltInto() {
return this.arcSmeltInto;
}

public void setMagneticMaterial(@Nullable Material magneticMaterial) {
public IngotProperty setMagneticMaterial(@Nullable Material magneticMaterial) {
this.magneticMaterial = magneticMaterial;
return this;
}

@Nullable
public Material getMagneticMaterial() {
return magneticMaterial;
}

public void setMacerateInto(Material macerateInto) {
public IngotProperty setMacerateInto(Material macerateInto) {
this.macerateInto = macerateInto;
return this;
}

public Material getMacerateInto() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ public int getPriority() {
/**
* Sets the Priority of the item pipe
*/
public void setPriority(int priority) {
public ItemPipeProperties setPriority(int priority) {
this.priority = priority;
return this;
}

/**
Expand All @@ -56,8 +57,9 @@ public float getTransferRate() {
*
* @param transferRate The transfer rate
*/
public void setTransferRate(float transferRate) {
public ItemPipeProperties setTransferRate(float transferRate) {
this.transferRate = transferRate;
return this;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,18 @@ public OreProperty() {
this(1, 1);
}

public void setOreMultiplier(int multiplier) {
public OreProperty setOreMultiplier(int multiplier) {
this.oreMultiplier = multiplier;
return this;
}

public int getOreMultiplier() {
return this.oreMultiplier;
}

public void setByProductMultiplier(int multiplier) {
public OreProperty setByProductMultiplier(int multiplier) {
this.byProductMultiplier = multiplier;
return this;
}

public int getByProductMultiplier() {
Expand All @@ -125,34 +127,39 @@ public boolean isEmissive() {
return emissive;
}

public void setEmissive(boolean emissive) {
public OreProperty setEmissive(boolean emissive) {
this.emissive = emissive;
return this;
}

public void setDirectSmeltResult(@Nullable Material m) {
public OreProperty setDirectSmeltResult(@Nullable Material m) {
this.directSmeltResult = m;
return this;
}

@Nullable
public Material getDirectSmeltResult() {
return this.directSmeltResult;
}

public void setWashedIn(@Nullable Material m) {
public OreProperty setWashedIn(@Nullable Material m) {
this.washedIn = m;
return this;
}

public void setWashedIn(@Nullable Material m, int washedAmount) {
public OreProperty setWashedIn(@Nullable Material m, int washedAmount) {
this.washedIn = m;
this.washedAmount = washedAmount;
return this;
}

public Pair<Material, Integer> getWashedIn() {
return Pair.of(this.washedIn, this.washedAmount);
}

public void setSeparatedInto(Material... materials) {
public OreProperty setSeparatedInto(Material... materials) {
this.separatedInto.addAll(Arrays.asList(materials));
return this;
}

@Nullable
Expand All @@ -165,27 +172,30 @@ public List<Material> getSeparatedInto() {
*
* @param materials the materials to use as byproducts
*/
public void setOreByProducts(@NotNull Material... materials) {
public OreProperty setOreByProducts(@NotNull Material... materials) {
setOreByProducts(Arrays.asList(materials));
return this;
}

/**
* Set the ore byproducts for this property
*
* @param materials the materials to use as byproducts
*/
public void setOreByProducts(@NotNull Collection<Material> materials) {
public OreProperty setOreByProducts(@NotNull Collection<Material> materials) {
this.oreByProducts.clear();
this.oreByProducts.addAll(materials);
return this;
}

/**
* Add ore byproducts to this property
*
* @param materials the materials to add as byproducts
*/
public void addOreByProducts(@NotNull Material... materials) {
public OreProperty addOreByProducts(@NotNull Material... materials) {
this.oreByProducts.addAll(Arrays.asList(materials));
return this;
}

public List<Material> getOreByProducts() {
Expand Down
Loading
Loading