添加了配置扩展原版供应器的槽位容量配置选项
This commit is contained in:
parent
5b3664990b
commit
3ed6386f74
23
src/main/java/com/extendedae_plus/config/ModConfigs.java
Normal file
23
src/main/java/com/extendedae_plus/config/ModConfigs.java
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
package com.extendedae_plus.config;
|
||||
|
||||
import net.minecraftforge.common.ForgeConfigSpec;
|
||||
|
||||
public final class ModConfigs {
|
||||
public static final ForgeConfigSpec COMMON_SPEC;
|
||||
public static final ForgeConfigSpec.IntValue PAGE_MULTIPLIER;
|
||||
|
||||
static {
|
||||
ForgeConfigSpec.Builder builder = new ForgeConfigSpec.Builder();
|
||||
builder.push("extendedae_plus");
|
||||
PAGE_MULTIPLIER = builder
|
||||
.comment(
|
||||
"扩展样板供应器总槽位容量的倍率。",
|
||||
"基础为36,每页仍显示36格,倍率会增加总页数/总容量。",
|
||||
"建议范围 1-16")
|
||||
.defineInRange("pageMultiplier", 1, 1, 64);
|
||||
builder.pop();
|
||||
COMMON_SPEC = builder.build();
|
||||
}
|
||||
|
||||
private ModConfigs() {}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.extendedae_plus.mixin;
|
||||
|
||||
import com.extendedae_plus.config.ModConfigs;
|
||||
import com.glodblock.github.extendedae.common.parts.PartExPatternProvider;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyArg;
|
||||
|
||||
@Mixin(value = PartExPatternProvider.class, priority = 3000, remap = false)
|
||||
public abstract class PartExPatternProviderMixin {
|
||||
|
||||
@ModifyArg(
|
||||
method = "createLogic",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lappeng/helpers/patternprovider/PatternProviderLogic;<init>(Lappeng/api/networking/IManagedGridNode;Lappeng/helpers/patternprovider/PatternProviderLogicHost;I)V"
|
||||
),
|
||||
index = 2
|
||||
)
|
||||
private int extendedae_plus$multiplyCapacity(int original) {
|
||||
int mult = ModConfigs.PAGE_MULTIPLIER.get();
|
||||
if (mult < 1) mult = 1;
|
||||
if (mult > 64) mult = 64;
|
||||
return Math.max(1, original) * mult;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.extendedae_plus.mixin;
|
||||
|
||||
import com.extendedae_plus.config.ModConfigs;
|
||||
import com.glodblock.github.extendedae.common.tileentities.TileExPatternProvider;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyArg;
|
||||
|
||||
@Mixin(value = TileExPatternProvider.class, priority = 3000, remap = false)
|
||||
public abstract class TileExPatternProviderMixin {
|
||||
|
||||
@ModifyArg(
|
||||
method = "createLogic",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lappeng/helpers/patternprovider/PatternProviderLogic;<init>(Lappeng/api/networking/IManagedGridNode;Lappeng/helpers/patternprovider/PatternProviderLogicHost;I)V"
|
||||
),
|
||||
index = 2
|
||||
)
|
||||
private int extendedae_plus$multiplyCapacity(int original) {
|
||||
int mult = ModConfigs.PAGE_MULTIPLIER.get();
|
||||
if (mult < 1) mult = 1;
|
||||
if (mult > 64) mult = 64;
|
||||
return Math.max(1, original) * mult;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user