Update 12

This commit is contained in:
yuesha-yc 2021-09-01 23:34:40 +08:00
parent e7a2a4ca76
commit bb40a9aae2
No known key found for this signature in database
GPG key ID: 009D79A802D4ED01
6 changed files with 86 additions and 24 deletions

View file

@ -1,4 +1,60 @@
package com.teammoeg.steampowered;
import net.minecraftforge.common.ForgeConfigSpec;
public class SPConfig {
public static class Common {
public final ForgeConfigSpec.IntValue bronzeFlywheelCapacity;
public final ForgeConfigSpec.IntValue bronzeFlywheelSpeed;
public final ForgeConfigSpec.IntValue bronzeFlywheelSteamConsumptionPerTick;
public final ForgeConfigSpec.IntValue bronzeFlywheelSteamStorage;
public final ForgeConfigSpec.IntValue castIronFlywheelCapacity;
public final ForgeConfigSpec.IntValue castIronFlywheelSpeed;
public final ForgeConfigSpec.IntValue castIronFlywheelSteamConsumptionPerTick;
public final ForgeConfigSpec.IntValue castIronFlywheelSteamStorage;
public final ForgeConfigSpec.IntValue steelFlywheelCapacity;
public final ForgeConfigSpec.IntValue steelFlywheelSpeed;
public final ForgeConfigSpec.IntValue steelFlywheelSteamConsumptionPerTick;
public final ForgeConfigSpec.IntValue steelFlywheelSteamStorage;
public final ForgeConfigSpec.IntValue alternatorFeMaxIn;
public final ForgeConfigSpec.IntValue alternatorFeMaxOut;
public final ForgeConfigSpec.IntValue alternatorFeCapacity;
public final ForgeConfigSpec.IntValue alternatorImpact;
public final ForgeConfigSpec.DoubleValue alternatorEfficiency;
Common(ForgeConfigSpec.Builder builder) {
bronzeFlywheelCapacity = builder.defineInRange("bronzeFlywheelCapacity", 32, 0, 8192);
bronzeFlywheelSpeed = builder.defineInRange("bronzeFlywheelSpeed", 32, 0, 8192);
bronzeFlywheelSteamConsumptionPerTick = builder.defineInRange("bronzeFlywheelSteamConsumptionPerTick", 24, 0, 8192);
bronzeFlywheelSteamStorage = builder.defineInRange("bronzeFlywheelSteamStorage", 32000, 0, 1048576);
castIronFlywheelCapacity = builder.defineInRange("castIronFlywheelCapacity", 64, 0, 8192);
castIronFlywheelSpeed = builder.defineInRange("castIronFlywheelSpeed", 32, 0, 8192);
castIronFlywheelSteamConsumptionPerTick = builder.defineInRange("castIronFlywheelSteamConsumptionPerTick", 48, 0, 8192);
castIronFlywheelSteamStorage = builder.defineInRange("castIronFlywheelSteamStorage", 64000, 0, 1048576);
steelFlywheelCapacity = builder.defineInRange("steelFlywheelCapacity", 96, 0, 8192);
steelFlywheelSpeed = builder.defineInRange("steelFlywheelSpeed", 32, 0, 8192);
steelFlywheelSteamConsumptionPerTick = builder.defineInRange("steelFlywheelSteamConsumptionPerTick", 72, 0, 1048576);
steelFlywheelSteamStorage = builder.defineInRange("steelFlywheelSteamStorage", 96000, 0, 1048576);
alternatorFeMaxIn = builder.defineInRange("alternatorFeMaxIn", 0, 0, 8192);
alternatorFeMaxOut = builder.defineInRange("alternatorFeMaxOut", 256, 0, 8192);
alternatorFeCapacity = builder.defineInRange("alternatorFeCapacity", 2048, 0, 8192);
alternatorImpact = builder.defineInRange("alternatorImpact", 16, 0, 8192);
alternatorEfficiency = builder.defineInRange("alternatorEfficiency", 0.75D, 0, 1);
}
}
public static final ForgeConfigSpec COMMON_CONFIG;
public static final Common COMMON;
static {
ForgeConfigSpec.Builder COMMON_BUILDER = new ForgeConfigSpec.Builder();
COMMON = new Common(COMMON_BUILDER);
COMMON_CONFIG = COMMON_BUILDER.build();
}
}

View file

@ -13,7 +13,9 @@ import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.config.ModConfig;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
@ -61,6 +63,7 @@ public class SteamPowered {
SPTiles.register();
SPItems.register();
ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, SPConfig.COMMON_CONFIG);
PacketHandler.register();
}

View file

@ -3,6 +3,7 @@ package com.teammoeg.steampowered.tileentity;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
import com.simibubi.create.foundation.utility.Lang;
import com.teammoeg.steampowered.SPConfig;
import com.teammoeg.steampowered.SteamPowered;
import com.teammoeg.steampowered.block.AlternatorBlock;
import com.teammoeg.steampowered.item.Multimeter;
@ -33,16 +34,16 @@ public class AlternatorTileEntity extends KineticTileEntity {
private LazyOptional<IEnergyStorage> lazyEnergy;
private static final int
MAX_IN = 0,
MAX_OUT = 256, // FE Output
CAPACITY = 2048, // FE Storage
STRESS = 4096,
FE_RPM = 80; // Forge Energy conversion rate (in FE/t at max RPM).
private static final double EFFICIENCY = 0.75D;
MAX_FE_IN = SPConfig.COMMON.alternatorFeMaxIn.get(),
MAX_FE_OUT = SPConfig.COMMON.alternatorFeMaxOut.get(), // FE Output
FE_CAPACITY = SPConfig.COMMON.alternatorFeCapacity.get(), // FE Storage
IMPACT = SPConfig.COMMON.alternatorImpact.get(); // Impact on network
private static final double
EFFICIENCY = SPConfig.COMMON.alternatorEfficiency.get();
public AlternatorTileEntity(TileEntityType<?> typeIn) {
super(typeIn);
energy = new InternalEnergyStorage(CAPACITY, MAX_IN, MAX_OUT);
energy = new InternalEnergyStorage(FE_CAPACITY, MAX_FE_IN, MAX_FE_OUT);
lazyEnergy = LazyOptional.of(() -> energy);
}
@ -56,9 +57,8 @@ public class AlternatorTileEntity extends KineticTileEntity {
@Override
public float calculateStressApplied() {
float impact = STRESS / 256f;
this.lastStressApplied = impact;
return impact;
this.lastStressApplied = IMPACT;
return IMPACT;
}
@Override
@ -108,14 +108,14 @@ public class AlternatorTileEntity extends KineticTileEntity {
IEnergyStorage ies = getCachedEnergy(d);
if (ies == null)
continue;
int ext = energy.extractEnergy(ies.receiveEnergy(MAX_OUT, true), false);
int ext = energy.extractEnergy(ies.receiveEnergy(MAX_FE_OUT, true), false);
int rec = ies.receiveEnergy(ext, false);
}
}
public static int getEnergyProductionRate(int rpm) {
rpm = Math.abs(rpm);
return (int) ((double) FE_RPM * ((double) Math.abs(rpm) / 256d) * EFFICIENCY);
return (int) (Math.abs(rpm) * EFFICIENCY);
}
@Override

View file

@ -1,5 +1,6 @@
package com.teammoeg.steampowered.tileentity.engine;
import com.teammoeg.steampowered.SPConfig;
import com.teammoeg.steampowered.registrate.SPBlocks;
import net.minecraft.block.Block;
import net.minecraft.tileentity.TileEntityType;
@ -16,21 +17,21 @@ public class BronzeSteamEngineTileEntity extends SteamEngineTileEntity {
@Override
public float getGeneratingCapacity() {
return 32F;
return SPConfig.COMMON.bronzeFlywheelCapacity.get();
}
@Override
public float getGeneratingSpeed() {
return 32F;
return SPConfig.COMMON.bronzeFlywheelSpeed.get();
}
@Override
public int getSteamConsumptionPerTick() {
return 16;
return SPConfig.COMMON.bronzeFlywheelSteamConsumptionPerTick.get();
}
@Override
public int getSteamStorage() {
return 32000;
return SPConfig.COMMON.bronzeFlywheelSteamStorage.get();
}
}

View file

@ -1,5 +1,6 @@
package com.teammoeg.steampowered.tileentity.engine;
import com.teammoeg.steampowered.SPConfig;
import com.teammoeg.steampowered.registrate.SPBlocks;
import net.minecraft.block.Block;
import net.minecraft.tileentity.TileEntityType;
@ -16,21 +17,21 @@ public class CastIronSteamEngineTileEntity extends SteamEngineTileEntity {
@Override
public float getGeneratingCapacity() {
return 64F;
return SPConfig.COMMON.castIronFlywheelCapacity.get();
}
@Override
public float getGeneratingSpeed() {
return 32F;
return SPConfig.COMMON.castIronFlywheelSpeed.get();
}
@Override
public int getSteamConsumptionPerTick() {
return 48;
return SPConfig.COMMON.castIronFlywheelSteamConsumptionPerTick.get();
}
@Override
public int getSteamStorage() {
return 64000;
return SPConfig.COMMON.castIronFlywheelSteamStorage.get();
}
}

View file

@ -1,5 +1,6 @@
package com.teammoeg.steampowered.tileentity.engine;
import com.teammoeg.steampowered.SPConfig;
import com.teammoeg.steampowered.registrate.SPBlocks;
import net.minecraft.block.Block;
import net.minecraft.tileentity.TileEntityType;
@ -16,21 +17,21 @@ public class SteelSteamEngineTileEntity extends SteamEngineTileEntity {
@Override
public float getGeneratingCapacity() {
return 96F;
return SPConfig.COMMON.steelFlywheelCapacity.get();
}
@Override
public float getGeneratingSpeed() {
return 32F;
return SPConfig.COMMON.steelFlywheelSpeed.get();
}
@Override
public int getSteamConsumptionPerTick() {
return 64;
return SPConfig.COMMON.steelFlywheelSteamConsumptionPerTick.get();
}
@Override
public int getSteamStorage() {
return 96000;
return SPConfig.COMMON.steelFlywheelSteamStorage.get();
}
}