Added test command for testing ore gen.
Started reimplementing quartz ore gen ontop of vanilla mechanics. Fixes several sidedness issues. Added recipe serialization for server->client sync.
This commit is contained in:
@@ -67,14 +67,8 @@ public final class AEConfig implements IConfigurableObject, IConfigManagerHost {
|
||||
|
||||
public static final ClientConfig CLIENT;
|
||||
public static final ForgeConfigSpec CLIENT_SPEC;
|
||||
|
||||
// Default Grindstone ores
|
||||
private static final String[] ORES_VANILLA = { "Obsidian", "Ender", "EnderPearl", "Coal", "Iron", "Gold",
|
||||
"Charcoal", "NetherQuartz" };
|
||||
private static final String[] ORES_AE = { "CertusQuartz", "Wheat", "Fluix" };
|
||||
private static final String[] ORES_COMMON = { "Copper", "Tin", "Silver", "Lead", "Bronze" };
|
||||
private static final String[] ORES_MISC = { "Brass", "Platinum", "Nickel", "Invar", "Aluminium", "Electrum",
|
||||
"Osmium", "Zinc" };
|
||||
public static final CommonConfig COMMON;
|
||||
public static final ForgeConfigSpec COMMON_SPEC;
|
||||
|
||||
// Default Energy Conversion Rates
|
||||
private static final double DEFAULT_IC2_EXCHANGE = 2.0;
|
||||
@@ -84,11 +78,15 @@ public final class AEConfig implements IConfigurableObject, IConfigManagerHost {
|
||||
final Pair<ClientConfig, ForgeConfigSpec> specPair = new ForgeConfigSpec.Builder().configure(ClientConfig::new);
|
||||
CLIENT_SPEC = specPair.getRight();
|
||||
CLIENT = specPair.getLeft();
|
||||
|
||||
final Pair<CommonConfig, ForgeConfigSpec> commonPair = new ForgeConfigSpec.Builder()
|
||||
.configure(CommonConfig::new);
|
||||
COMMON_SPEC = commonPair.getRight();
|
||||
COMMON = commonPair.getLeft();
|
||||
}
|
||||
|
||||
public static final String VERSION = "@version@";
|
||||
public static final String CHANNEL = "@aechannel@";
|
||||
public static final String PACKET_CHANNEL = "AE";
|
||||
|
||||
// Config instance
|
||||
private static final AEConfig instance = new AEConfig();
|
||||
@@ -119,8 +117,6 @@ public final class AEConfig implements IConfigurableObject, IConfigManagerHost {
|
||||
private double spatialPowerMultiplier;
|
||||
|
||||
// Grindstone
|
||||
private List<String> grinderOres;
|
||||
private Set<String> grinderBlackList;
|
||||
private float oreDoublePercentage;
|
||||
|
||||
// Batteries
|
||||
@@ -160,94 +156,13 @@ public final class AEConfig implements IConfigurableObject, IConfigManagerHost {
|
||||
public static void onModConfigEvent(final ModConfig.ModConfigEvent configEvent) {
|
||||
if (configEvent.getConfig().getSpec() == CLIENT_SPEC) {
|
||||
instance.syncConfig(CLIENT);
|
||||
} else if (configEvent.getConfig().getSpec() == COMMON_SPEC) {
|
||||
instance.syncConfig(COMMON);
|
||||
}
|
||||
}
|
||||
|
||||
private void syncConfig(ClientConfig config) {
|
||||
|
||||
PowerUnits.EU.conversionRatio = config.powerRatioIc2.get();
|
||||
PowerUnits.RF.conversionRatio = config.powerRatioForgeEnergy.get();
|
||||
PowerMultiplier.CONFIG.multiplier = config.powerUsageMultiplier.get();
|
||||
|
||||
CondenserOutput.MATTER_BALLS.requiredPower = config.condenserMatterBallsPower.get();
|
||||
CondenserOutput.SINGULARITY.requiredPower = config.condenserSingularityPower.get();
|
||||
|
||||
this.grinderOres = new ArrayList<>(config.grinderOres.get());
|
||||
this.grinderBlackList = new HashSet<>(config.grinderBlackList.get());
|
||||
this.oreDoublePercentage = config.oreDoublePercentage.get().floatValue();
|
||||
|
||||
// FIXME: why is this here exactly???
|
||||
this.settings.registerSetting(Settings.SEARCH_TOOLTIPS, YesNo.YES);
|
||||
this.settings.registerSetting(Settings.TERMINAL_STYLE, TerminalStyle.TALL);
|
||||
this.settings.registerSetting(Settings.SEARCH_MODE, SearchBoxMode.AUTOSEARCH);
|
||||
|
||||
this.spawnChargedChance = (float) (1.0 - config.spawnChargedChance.get());
|
||||
this.minMeteoriteDistance = config.minMeteoriteDistance.get();
|
||||
this.minMeteoriteDistanceSq = this.minMeteoriteDistance * this.minMeteoriteDistance;
|
||||
this.meteoriteClusterChance = config.meteoriteClusterChance.get();
|
||||
this.meteoriteMaximumSpawnHeight = config.meteoriteMaximumSpawnHeight.get();
|
||||
this.meteoriteDimensionWhitelist = new HashSet<>(config.meteoriteDimensionWhitelist.get());
|
||||
|
||||
this.quartzOresPerCluster = config.quartzOresPerCluster.get();
|
||||
this.quartzOresClusterAmount = config.quartzOresPerCluster.get();
|
||||
|
||||
this.wirelessBaseCost = config.wirelessBaseCost.get();
|
||||
this.wirelessCostMultiplier = config.wirelessCostMultiplier.get();
|
||||
this.wirelessBaseRange = config.wirelessBaseRange.get();
|
||||
this.wirelessBoosterRangeMultiplier = config.wirelessBoosterRangeMultiplier.get();
|
||||
this.wirelessBoosterExp = config.wirelessBoosterExp.get();
|
||||
this.wirelessTerminalDrainMultiplier = config.wirelessTerminalDrainMultiplier.get();
|
||||
|
||||
this.formationPlaneEntityLimit = config.formationPlaneEntityLimit.get();
|
||||
|
||||
this.wirelessTerminalBattery = config.wirelessTerminalBattery.get();
|
||||
this.chargedStaffBattery = config.chargedStaffBattery.get();
|
||||
this.entropyManipulatorBattery = config.entropyManipulatorBattery.get();
|
||||
this.portableCellBattery = config.portableCellBattery.get();
|
||||
this.colorApplicatorBattery = config.colorApplicatorBattery.get();
|
||||
this.matterCannonBattery = config.matterCannonBattery.get();
|
||||
|
||||
this.clientSync(config);
|
||||
|
||||
this.featureFlags.clear();
|
||||
for (final AEFeature feature : AEFeature.values()) {
|
||||
if (feature.isVisible()) {
|
||||
if (config.enabledFeatures.get(feature).get()) {
|
||||
this.featureFlags.add(feature);
|
||||
}
|
||||
} else {
|
||||
this.featureFlags.add(feature);
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME final ModContainer imb = net.minecraftforge.fml.common.Loader.instance().getIndexedModList().get( "ImmibisCore" );
|
||||
// FIXME if( imb != null )
|
||||
// FIXME {
|
||||
// FIXME final List<String> version = Arrays.asList( "59.0.0", "59.0.1", "59.0.2" );
|
||||
// FIXME if( version.contains( imb.getVersion() ) )
|
||||
// FIXME {
|
||||
// FIXME this.featureFlags.remove( AEFeature.ALPHA_PASS );
|
||||
// FIXME }
|
||||
// FIXME }
|
||||
|
||||
for (final TickRates tr : TickRates.values()) {
|
||||
tr.setMin(config.tickRateMin.get(tr).get());
|
||||
tr.setMax(config.tickRateMin.get(tr).get());
|
||||
}
|
||||
|
||||
this.spatialPowerMultiplier = config.spatialPowerMultiplier.get();
|
||||
this.spatialPowerExponent = config.spatialPowerExponent.get();
|
||||
|
||||
this.craftingCalculationTimePerTick = config.craftingCalculationTimePerTick.get();
|
||||
|
||||
this.updatable = true;
|
||||
}
|
||||
|
||||
public static AEConfig instance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
private void clientSync(ClientConfig config) {
|
||||
this.disableColoredCableRecipesInJEI = config.disableColoredCableRecipesInJEI.get();
|
||||
this.enableEffects = config.enableEffects.get();
|
||||
this.useLargeFonts = config.useLargeFonts.get();
|
||||
@@ -281,25 +196,90 @@ public final class AEConfig implements IConfigurableObject, IConfigManagerHost {
|
||||
// FIXME
|
||||
// FIXME this.settings.putSetting( e, value );
|
||||
// FIXME }
|
||||
|
||||
}
|
||||
|
||||
private String getListComment(final Enum value) {
|
||||
String comment = null;
|
||||
private void syncConfig(CommonConfig config) {
|
||||
|
||||
if (value != null) {
|
||||
final EnumSet set = EnumSet.allOf(value.getClass());
|
||||
// FIXME: why is this here exactly???
|
||||
this.settings.registerSetting(Settings.SEARCH_TOOLTIPS, YesNo.YES);
|
||||
this.settings.registerSetting(Settings.TERMINAL_STYLE, TerminalStyle.TALL);
|
||||
this.settings.registerSetting(Settings.SEARCH_MODE, SearchBoxMode.AUTOSEARCH);
|
||||
|
||||
for (final Object Oeg : set) {
|
||||
final Enum eg = (Enum) Oeg;
|
||||
if (comment == null) {
|
||||
comment = "Possible Values: " + eg.name();
|
||||
} else {
|
||||
comment += ", " + eg.name();
|
||||
PowerUnits.EU.conversionRatio = config.powerRatioIc2.get();
|
||||
PowerUnits.RF.conversionRatio = config.powerRatioForgeEnergy.get();
|
||||
PowerMultiplier.CONFIG.multiplier = config.powerUsageMultiplier.get();
|
||||
|
||||
CondenserOutput.MATTER_BALLS.requiredPower = config.condenserMatterBallsPower.get();
|
||||
CondenserOutput.SINGULARITY.requiredPower = config.condenserSingularityPower.get();
|
||||
|
||||
this.oreDoublePercentage = config.oreDoublePercentage.get().floatValue();
|
||||
|
||||
this.spawnChargedChance = config.spawnChargedChance.get().floatValue();
|
||||
this.minMeteoriteDistance = config.minMeteoriteDistance.get();
|
||||
this.minMeteoriteDistanceSq = this.minMeteoriteDistance * this.minMeteoriteDistance;
|
||||
this.meteoriteClusterChance = config.meteoriteClusterChance.get();
|
||||
this.meteoriteMaximumSpawnHeight = config.meteoriteMaximumSpawnHeight.get();
|
||||
this.meteoriteDimensionWhitelist = new HashSet<>(config.meteoriteDimensionWhitelist.get());
|
||||
|
||||
this.quartzOresPerCluster = config.quartzOresPerCluster.get();
|
||||
this.quartzOresClusterAmount = config.quartzOresPerCluster.get();
|
||||
|
||||
this.wirelessBaseCost = config.wirelessBaseCost.get();
|
||||
this.wirelessCostMultiplier = config.wirelessCostMultiplier.get();
|
||||
this.wirelessBaseRange = config.wirelessBaseRange.get();
|
||||
this.wirelessBoosterRangeMultiplier = config.wirelessBoosterRangeMultiplier.get();
|
||||
this.wirelessBoosterExp = config.wirelessBoosterExp.get();
|
||||
this.wirelessHighWirelessCount = config.wirelessHighWirelessCount.get();
|
||||
this.wirelessTerminalDrainMultiplier = config.wirelessTerminalDrainMultiplier.get();
|
||||
|
||||
this.formationPlaneEntityLimit = config.formationPlaneEntityLimit.get();
|
||||
|
||||
this.wirelessTerminalBattery = config.wirelessTerminalBattery.get();
|
||||
this.chargedStaffBattery = config.chargedStaffBattery.get();
|
||||
this.entropyManipulatorBattery = config.entropyManipulatorBattery.get();
|
||||
this.portableCellBattery = config.portableCellBattery.get();
|
||||
this.colorApplicatorBattery = config.colorApplicatorBattery.get();
|
||||
this.matterCannonBattery = config.matterCannonBattery.get();
|
||||
|
||||
this.featureFlags.clear();
|
||||
for (final AEFeature feature : AEFeature.values()) {
|
||||
if (feature.isVisible()) {
|
||||
if (config.enabledFeatures.get(feature).get()) {
|
||||
this.featureFlags.add(feature);
|
||||
}
|
||||
} else {
|
||||
this.featureFlags.add(feature);
|
||||
}
|
||||
}
|
||||
|
||||
return comment;
|
||||
// FIXME final ModContainer imb = net.minecraftforge.fml.common.Loader.instance().getIndexedModList().get( "ImmibisCore" );
|
||||
// FIXME if( imb != null )
|
||||
// FIXME {
|
||||
// FIXME final List<String> version = Arrays.asList( "59.0.0", "59.0.1", "59.0.2" );
|
||||
// FIXME if( version.contains( imb.getVersion() ) )
|
||||
// FIXME {
|
||||
// FIXME this.featureFlags.remove( AEFeature.ALPHA_PASS );
|
||||
// FIXME }
|
||||
// FIXME }
|
||||
|
||||
for (final TickRates tr : TickRates.values()) {
|
||||
tr.setMin(config.tickRateMin.get(tr).get());
|
||||
tr.setMax(config.tickRateMin.get(tr).get());
|
||||
}
|
||||
|
||||
this.spatialPowerMultiplier = config.spatialPowerMultiplier.get();
|
||||
this.spatialPowerExponent = config.spatialPowerExponent.get();
|
||||
|
||||
this.craftingCalculationTimePerTick = config.craftingCalculationTimePerTick.get();
|
||||
|
||||
this.removeCrashingItemsOnLoad = config.removeCrashingItemsOnLoad.get();
|
||||
|
||||
this.updatable = true;
|
||||
}
|
||||
|
||||
public static AEConfig instance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public boolean isFeatureEnabled(final AEFeature f) {
|
||||
@@ -341,9 +321,14 @@ public final class AEConfig implements IConfigurableObject, IConfigManagerHost {
|
||||
// FIXME }
|
||||
|
||||
public void save() {
|
||||
CLIENT.selectedPowerUnit.set(this.selectedPowerUnit);
|
||||
if (CLIENT_SPEC.isLoaded()) {
|
||||
CLIENT.selectedPowerUnit.set(this.selectedPowerUnit);
|
||||
CLIENT_SPEC.save();
|
||||
}
|
||||
|
||||
CLIENT_SPEC.save();
|
||||
if (COMMON_SPEC.isLoaded()) {
|
||||
COMMON_SPEC.save();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -478,14 +463,6 @@ public final class AEConfig implements IConfigurableObject, IConfigManagerHost {
|
||||
return this.spatialPowerMultiplier;
|
||||
}
|
||||
|
||||
public List<String> getGrinderOres() {
|
||||
return this.grinderOres;
|
||||
}
|
||||
|
||||
public Set<String> getGrinderBlackList() {
|
||||
return this.grinderBlackList;
|
||||
}
|
||||
|
||||
public float getOreDoublePercentage() {
|
||||
return this.oreDoublePercentage;
|
||||
}
|
||||
@@ -578,17 +555,11 @@ public final class AEConfig implements IConfigurableObject, IConfigManagerHost {
|
||||
|
||||
private static class ClientConfig {
|
||||
|
||||
// Feature toggles
|
||||
public final Map<AEFeature, BooleanValue> enabledFeatures = new EnumMap<>(AEFeature.class);
|
||||
|
||||
// Misc
|
||||
public final BooleanValue removeCrashingItemsOnLoad;
|
||||
public final ConfigValue<Integer> formationPlaneEntityLimit;
|
||||
public final BooleanValue enableEffects;
|
||||
public final BooleanValue useLargeFonts;
|
||||
public final BooleanValue useColoredCraftingStatus;
|
||||
public final BooleanValue disableColoredCableRecipesInJEI;
|
||||
public final ConfigValue<Integer> craftingCalculationTimePerTick;
|
||||
public final EnumValue<PowerUnits> selectedPowerUnit;
|
||||
|
||||
// GUI Buttons
|
||||
@@ -597,13 +568,52 @@ public final class AEConfig implements IConfigurableObject, IConfigManagerHost {
|
||||
public final List<ConfigValue<Integer>> priorityByStacks;
|
||||
public final List<ConfigValue<Integer>> levelByStacks;
|
||||
|
||||
public ClientConfig(ForgeConfigSpec.Builder builder) {
|
||||
builder.push("client");
|
||||
this.disableColoredCableRecipesInJEI = builder.comment("TODO").define("disableColoredCableRecipesInJEI",
|
||||
true);
|
||||
this.enableEffects = builder.comment("TODO").define("enableEffects", true);
|
||||
this.useLargeFonts = builder.comment("TODO").define("useTerminalUseLargeFont", false);
|
||||
this.useColoredCraftingStatus = builder.comment("TODO").define("useColoredCraftingStatus", true);
|
||||
this.selectedPowerUnit = builder.comment("Power unit shown in AE UIs").defineEnum("PowerUnit",
|
||||
PowerUnits.AE, PowerUnits.values());
|
||||
|
||||
this.craftByStacks = new ArrayList<>(4);
|
||||
this.priorityByStacks = new ArrayList<>(4);
|
||||
this.levelByStacks = new ArrayList<>(4);
|
||||
// load buttons..
|
||||
for (int btnNum = 0; btnNum < 4; btnNum++) {
|
||||
int defaultValue = BTN_BY_STACK_DEFAULTS[btnNum];
|
||||
final int buttonCap = (int) (Math.pow(10, btnNum + 1) - 1);
|
||||
|
||||
this.craftByStacks.add(builder.comment("Controls buttons on Crafting Screen")
|
||||
.defineInRange("craftByStacks" + btnNum, defaultValue, 1, buttonCap));
|
||||
this.priorityByStacks.add(builder.comment("Controls buttons on Priority Screen")
|
||||
.defineInRange("priorityByStacks" + btnNum, defaultValue, 1, buttonCap));
|
||||
this.levelByStacks.add(builder.comment("Controls buttons on Level Emitter Screen")
|
||||
.defineInRange("levelByStacks" + btnNum, defaultValue, 1, buttonCap));
|
||||
}
|
||||
|
||||
builder.pop();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class CommonConfig {
|
||||
|
||||
// Feature toggles
|
||||
public final Map<AEFeature, BooleanValue> enabledFeatures = new EnumMap<>(AEFeature.class);
|
||||
|
||||
// Misc
|
||||
public final BooleanValue removeCrashingItemsOnLoad;
|
||||
public final ConfigValue<Integer> formationPlaneEntityLimit;
|
||||
public final ConfigValue<Integer> craftingCalculationTimePerTick;
|
||||
|
||||
// Spatial IO/Dimension
|
||||
public final ConfigValue<Double> spatialPowerExponent;
|
||||
public final ConfigValue<Double> spatialPowerMultiplier;
|
||||
|
||||
// Grindstone
|
||||
public final ConfigValue<List<? extends String>> grinderOres;
|
||||
public final ConfigValue<List<? extends String>> grinderBlackList;
|
||||
public final DoubleValue oreDoublePercentage;
|
||||
|
||||
// Batteries
|
||||
@@ -632,6 +642,7 @@ public final class AEConfig implements IConfigurableObject, IConfigManagerHost {
|
||||
public final ConfigValue<Double> wirelessBaseRange;
|
||||
public final ConfigValue<Double> wirelessBoosterRangeMultiplier;
|
||||
public final ConfigValue<Double> wirelessBoosterExp;
|
||||
public final ConfigValue<Double> wirelessHighWirelessCount;
|
||||
|
||||
// Power Ratios
|
||||
public final ConfigValue<Double> powerRatioIc2;
|
||||
@@ -645,7 +656,7 @@ public final class AEConfig implements IConfigurableObject, IConfigManagerHost {
|
||||
public final Map<TickRates, ConfigValue<Integer>> tickRateMin = new HashMap<>();
|
||||
public final Map<TickRates, ConfigValue<Integer>> tickRateMax = new HashMap<>();
|
||||
|
||||
public ClientConfig(ForgeConfigSpec.Builder builder) {
|
||||
public CommonConfig(ForgeConfigSpec.Builder builder) {
|
||||
|
||||
// Feature switches
|
||||
builder.comment("Warning: Disabling a feature may disable other features depending on it.")
|
||||
@@ -679,33 +690,6 @@ public final class AEConfig implements IConfigurableObject, IConfigManagerHost {
|
||||
formationPlaneEntityLimit = builder.comment("TODO").define("formationPlaneEntityLimit", 128);
|
||||
builder.pop();
|
||||
|
||||
builder.push("client");
|
||||
this.disableColoredCableRecipesInJEI = builder.comment("TODO").define("disableColoredCableRecipesInJEI",
|
||||
true);
|
||||
this.enableEffects = builder.comment("TODO").define("enableEffects", true);
|
||||
this.useLargeFonts = builder.comment("TODO").define("useTerminalUseLargeFont", false);
|
||||
this.useColoredCraftingStatus = builder.comment("TODO").define("useColoredCraftingStatus", true);
|
||||
this.selectedPowerUnit = builder.comment("Power unit shown in AE UIs").defineEnum("PowerUnit",
|
||||
PowerUnits.AE, PowerUnits.values());
|
||||
|
||||
this.craftByStacks = new ArrayList<>(4);
|
||||
this.priorityByStacks = new ArrayList<>(4);
|
||||
this.levelByStacks = new ArrayList<>(4);
|
||||
// load buttons..
|
||||
for (int btnNum = 0; btnNum < 4; btnNum++) {
|
||||
int defaultValue = BTN_BY_STACK_DEFAULTS[btnNum];
|
||||
final int buttonCap = (int) (Math.pow(10, btnNum + 1) - 1);
|
||||
|
||||
this.craftByStacks.add(builder.comment("Controls buttons on Crafting Screen")
|
||||
.defineInRange("craftByStacks" + btnNum, defaultValue, 1, buttonCap));
|
||||
this.priorityByStacks.add(builder.comment("Controls buttons on Priority Screen")
|
||||
.defineInRange("priorityByStacks" + btnNum, defaultValue, 1, buttonCap));
|
||||
this.levelByStacks.add(builder.comment("Controls buttons on Level Emitter Screen")
|
||||
.defineInRange("levelByStacks" + btnNum, defaultValue, 1, buttonCap));
|
||||
}
|
||||
|
||||
builder.pop();
|
||||
|
||||
builder.push("craftingCPU");
|
||||
|
||||
this.craftingCalculationTimePerTick = builder.define("craftingCalculationTimePerTick", 5);
|
||||
@@ -717,20 +701,7 @@ public final class AEConfig implements IConfigurableObject, IConfigManagerHost {
|
||||
this.spatialPowerExponent = builder.define("spatialPowerExponent", 1.35);
|
||||
builder.pop();
|
||||
|
||||
builder.comment(
|
||||
"Creates recipe of the following pattern automatically: '1 oreTYPE => 2 dustTYPE' and '(1 ingotTYPE or 1 crystalTYPE or 1 gemTYPE) => 1 dustTYPE'")
|
||||
.push("GrindStone");
|
||||
|
||||
List<String> defaultGrinderOres = Stream.of(ORES_VANILLA, ORES_AE, ORES_COMMON, ORES_MISC)
|
||||
.flatMap(Arrays::stream).collect(Collectors.toList());
|
||||
this.grinderOres = builder
|
||||
.comment("The list of types to handle. Specify without a prefix like ore or dust.")
|
||||
.defineList("grinderOres", defaultGrinderOres, obj -> true); // FIXME: tag validation, is that even
|
||||
// possible???
|
||||
this.grinderBlackList = builder
|
||||
.comment("Blacklists the exact oredict name from being handled by any recipe.")
|
||||
.defineList("blacklist", Collections.emptyList(), obj -> true); // FIXME: tag validation, is that
|
||||
// even possible???
|
||||
builder.push("GrindStone");
|
||||
this.oreDoublePercentage = builder.comment("Chance to actually get an output with stacksize > 1.")
|
||||
.defineInRange("oreDoublePercentage", 90.0, 0.0, 100.0);
|
||||
builder.pop();
|
||||
@@ -766,6 +737,7 @@ public final class AEConfig implements IConfigurableObject, IConfigManagerHost {
|
||||
this.wirelessBaseRange = builder.define("wirelessBaseRange", 16.0);
|
||||
this.wirelessBoosterRangeMultiplier = builder.define("wirelessBoosterRangeMultiplier", 1.0);
|
||||
this.wirelessBoosterExp = builder.define("wirelessBoosterExp", 1.5);
|
||||
this.wirelessHighWirelessCount = builder.define("wirelessHighWirelessCount", 64.0);
|
||||
this.wirelessTerminalDrainMultiplier = builder.define("wirelessTerminalDrainMultiplier", 1.0);
|
||||
builder.pop();
|
||||
|
||||
|
||||
@@ -101,8 +101,6 @@ public final class AppEng {
|
||||
public static final String MOD_ID = "appliedenergistics2";
|
||||
public static final String MOD_NAME = "Applied Energistics 2";
|
||||
|
||||
public static final String ASSETS = "appliedenergistics2:";
|
||||
|
||||
// FIXME replicate this in mods.toml!
|
||||
// FIXME private static final String FORGE_CURRENT_VERSION =
|
||||
// ForgeVersion.getVersion();
|
||||
@@ -127,6 +125,7 @@ public final class AppEng {
|
||||
INSTANCE = this;
|
||||
|
||||
ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, AEConfig.CLIENT_SPEC);
|
||||
ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, AEConfig.COMMON_SPEC);
|
||||
|
||||
proxy = DistExecutor.runForDist(() -> ClientHelper::new, () -> ServerHelper::new);
|
||||
|
||||
@@ -150,25 +149,21 @@ public final class AppEng {
|
||||
modEventBus.addGenericListener(Feature.class, registration::registerWorldGen);
|
||||
modEventBus.addGenericListener(Biome.class, registration::registerBiomes);
|
||||
modEventBus.addGenericListener(ModDimension.class, registration::registerModDimension);
|
||||
modEventBus.addListener(registration::registerParticleFactories);
|
||||
modEventBus.addListener(registration::registerTextures);
|
||||
modEventBus.addListener(registration::registerCommands);
|
||||
|
||||
modEventBus.addListener(Integrations::enqueueIMC);
|
||||
|
||||
modEventBus.addListener(this::commonSetup);
|
||||
|
||||
// Register client-only events
|
||||
DistExecutor.runWhenOn(Dist.CLIENT, () -> registration::registerClientEvents);
|
||||
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> modEventBus.addListener(this::clientSetup));
|
||||
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> modEventBus.addListener(registration::modelRegistryEvent));
|
||||
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> modEventBus.addListener(registration::registerItemColors));
|
||||
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> modEventBus.addListener(registration::handleModelBake));
|
||||
|
||||
MinecraftForge.EVENT_BUS.addListener(TickHandler.INSTANCE::unloadWorld);
|
||||
MinecraftForge.EVENT_BUS.addListener(TickHandler.INSTANCE::onTick);
|
||||
MinecraftForge.EVENT_BUS.addListener(this::onServerAboutToStart);
|
||||
MinecraftForge.EVENT_BUS.addListener(this::serverStopped);
|
||||
MinecraftForge.EVENT_BUS.addListener(this::serverStopping);
|
||||
MinecraftForge.EVENT_BUS.addListener(registration::registerCommands);
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(new PartPlacement());
|
||||
}
|
||||
@@ -230,9 +225,10 @@ public final class AppEng {
|
||||
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private static <T extends IModelGeometry<T>> void addBuiltInModel(String id, Supplier<T> modelFactory) {
|
||||
ModelLoaderRegistry.registerLoader(new ResourceLocation(AppEng.MOD_ID, id),
|
||||
new SimpleModelLoader<T>(modelFactory));
|
||||
new SimpleModelLoader<>(modelFactory));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
@@ -20,8 +20,10 @@ package appeng.core;
|
||||
|
||||
import net.minecraft.advancements.CriteriaTriggers;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScreenManager;
|
||||
import net.minecraft.client.particle.ParticleManager;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -32,10 +34,10 @@ import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import net.minecraft.world.gen.GenerationStage;
|
||||
import net.minecraft.world.gen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.gen.feature.Feature;
|
||||
import net.minecraft.world.gen.feature.IFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.NoFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.*;
|
||||
import net.minecraft.world.gen.placement.CountRangeConfig;
|
||||
import net.minecraft.world.gen.placement.IPlacementConfig;
|
||||
import net.minecraft.world.gen.placement.Placement;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.event.ColorHandlerEvent;
|
||||
@@ -48,8 +50,10 @@ import net.minecraftforge.common.ModDimension;
|
||||
import net.minecraftforge.common.crafting.CraftingHelper;
|
||||
import net.minecraftforge.common.extensions.IForgeContainerType;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import net.minecraftforge.fml.loading.FMLEnvironment;
|
||||
import net.minecraftforge.fml.network.IContainerFactory;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
@@ -60,6 +64,7 @@ import appeng.api.config.Upgrades;
|
||||
import appeng.api.definitions.IBlocks;
|
||||
import appeng.api.definitions.IItems;
|
||||
import appeng.api.definitions.IParts;
|
||||
import appeng.api.features.AEFeature;
|
||||
import appeng.api.features.IRegistryContainer;
|
||||
import appeng.api.features.IWirelessTermHandler;
|
||||
import appeng.api.features.IWorldGen;
|
||||
@@ -113,13 +118,7 @@ import appeng.client.gui.implementations.GuiUpgradeable;
|
||||
import appeng.client.gui.implementations.GuiVibrationChamber;
|
||||
import appeng.client.gui.implementations.GuiWireless;
|
||||
import appeng.client.gui.implementations.GuiWirelessTerm;
|
||||
import appeng.client.render.effects.ChargedOreFX;
|
||||
import appeng.client.render.effects.CraftingFx;
|
||||
import appeng.client.render.effects.EnergyFx;
|
||||
import appeng.client.render.effects.LightningArcFX;
|
||||
import appeng.client.render.effects.LightningFX;
|
||||
import appeng.client.render.effects.MatterCannonFX;
|
||||
import appeng.client.render.effects.VibrantFX;
|
||||
import appeng.client.render.effects.*;
|
||||
import appeng.client.render.model.BiometricCardModel;
|
||||
import appeng.client.render.model.DriveModel;
|
||||
import appeng.client.render.model.MemoryCardModel;
|
||||
@@ -201,6 +200,8 @@ import appeng.spatial.StorageCellBiome;
|
||||
import appeng.spatial.StorageCellModDimension;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.crafting.MolecularAssemblerRenderer;
|
||||
import appeng.worldgen.ChargedQuartzOreConfig;
|
||||
import appeng.worldgen.ChargedQuartzOreFeature;
|
||||
import appeng.worldgen.MeteoriteWorldGen;
|
||||
|
||||
final class Registration {
|
||||
@@ -436,9 +437,6 @@ final class Registration {
|
||||
public void registerRecipeSerializers(RegistryEvent.Register<IRecipeSerializer<?>> event) {
|
||||
IForgeRegistry<IRecipeSerializer<?>> r = event.getRegistry();
|
||||
|
||||
// TODO: Do not use the internal API
|
||||
final ApiDefinitions definitions = Api.INSTANCE.definitions();
|
||||
|
||||
GrinderRecipe.TYPE = new AERecipeType<>(GrinderRecipeSerializer.INSTANCE.getRegistryName());
|
||||
InscriberRecipe.TYPE = new AERecipeType<>(InscriberRecipeSerializer.INSTANCE.getRegistryName());
|
||||
|
||||
@@ -459,36 +457,27 @@ final class Registration {
|
||||
|
||||
public void registerParticleTypes(RegistryEvent.Register<ParticleType<?>> event) {
|
||||
final IForgeRegistry<ParticleType<?>> registry = event.getRegistry();
|
||||
registry.register(ChargedOreFX.TYPE);
|
||||
registry.register(CraftingFx.TYPE);
|
||||
registry.register(EnergyFx.TYPE);
|
||||
registry.register(LightningArcFX.TYPE);
|
||||
registry.register(LightningFX.TYPE);
|
||||
registry.register(MatterCannonFX.TYPE);
|
||||
registry.register(VibrantFX.TYPE);
|
||||
registry.register(ParticleTypes.CHARGED_ORE);
|
||||
registry.register(ParticleTypes.CRAFTING);
|
||||
registry.register(ParticleTypes.ENERGY);
|
||||
registry.register(ParticleTypes.LIGHTNING_ARC);
|
||||
registry.register(ParticleTypes.LIGHTNING);
|
||||
registry.register(ParticleTypes.MATTER_CANNON);
|
||||
registry.register(ParticleTypes.VIBRANT);
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void registerParticleFactories(ParticleFactoryRegisterEvent event) {
|
||||
Minecraft.getInstance().particles.registerFactory(ChargedOreFX.TYPE, ChargedOreFX.Factory::new);
|
||||
Minecraft.getInstance().particles.registerFactory(CraftingFx.TYPE, CraftingFx.Factory::new);
|
||||
Minecraft.getInstance().particles.registerFactory(EnergyFx.TYPE, EnergyFx.Factory::new);
|
||||
Minecraft.getInstance().particles.registerFactory(LightningArcFX.TYPE, LightningArcFX.Factory::new);
|
||||
Minecraft.getInstance().particles.registerFactory(LightningFX.TYPE, LightningFX.Factory::new);
|
||||
Minecraft.getInstance().particles.registerFactory(MatterCannonFX.TYPE, MatterCannonFX.Factory::new);
|
||||
Minecraft.getInstance().particles.registerFactory(VibrantFX.TYPE, VibrantFX.Factory::new);
|
||||
ParticleManager particles = Minecraft.getInstance().particles;
|
||||
particles.registerFactory(ParticleTypes.CHARGED_ORE, ChargedOreFX.Factory::new);
|
||||
particles.registerFactory(ParticleTypes.CRAFTING, CraftingFx.Factory::new);
|
||||
particles.registerFactory(ParticleTypes.ENERGY, EnergyFx.Factory::new);
|
||||
particles.registerFactory(ParticleTypes.LIGHTNING_ARC, LightningArcFX.Factory::new);
|
||||
particles.registerFactory(ParticleTypes.LIGHTNING, LightningFX.Factory::new);
|
||||
particles.registerFactory(ParticleTypes.MATTER_CANNON, MatterCannonFX.Factory::new);
|
||||
particles.registerFactory(ParticleTypes.VIBRANT, VibrantFX.Factory::new);
|
||||
}
|
||||
|
||||
//
|
||||
// @SubscribeEvent
|
||||
// public void attachSpatialDimensionManager( AttachCapabilitiesEvent<World> event )
|
||||
// {
|
||||
// if( AEConfig.instance()
|
||||
// .isFeatureEnabled( AEFeature.SPATIAL_IO ) && event.getObject() == DimensionManager.getWorld( AEConfig.instance().getStorageDimensionID() ) )
|
||||
// {
|
||||
// event.addCapability( new ResourceLocation( "appliedenergistics2:spatial_dimension_manager" ), new SpatialDimensionManager( event.getObject() ) );
|
||||
// }
|
||||
// }
|
||||
|
||||
// FIXME LATER
|
||||
public static void postInit() {
|
||||
final IRegistryContainer registries = AEApi.instance().registries();
|
||||
@@ -498,8 +487,6 @@ final class Registration {
|
||||
final IBlocks blocks = definitions.blocks();
|
||||
final IItems items = definitions.items();
|
||||
|
||||
// FIXME this.registerSpatialDimension();
|
||||
|
||||
// default settings..
|
||||
((P2PTunnelRegistry) registries.p2pTunnel()).configure();
|
||||
|
||||
@@ -664,6 +651,31 @@ final class Registration {
|
||||
b.addFeature(GenerationStage.Decoration.TOP_LAYER_MODIFICATION,
|
||||
new ConfiguredFeature<NoFeatureConfig, Feature<NoFeatureConfig>>(MeteoriteWorldGen.INSTANCE,
|
||||
IFeatureConfig.NO_FEATURE_CONFIG));
|
||||
|
||||
b.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES,
|
||||
new ConfiguredFeature<NoFeatureConfig, Feature<NoFeatureConfig>>(MeteoriteWorldGen.INSTANCE,
|
||||
IFeatureConfig.NO_FEATURE_CONFIG));
|
||||
|
||||
if (AEConfig.instance().isFeatureEnabled(AEFeature.CERTUS_QUARTZ_WORLD_GEN)) {
|
||||
BlockState quartzOre = AEApi.instance().definitions().blocks().quartzOre().block().getDefaultState();
|
||||
b.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Feature.ORE
|
||||
.withConfiguration(new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE,
|
||||
quartzOre, AEConfig.instance().getQuartzOresPerCluster()))
|
||||
.withPlacement(Placement.COUNT_RANGE.configure(
|
||||
new CountRangeConfig(AEConfig.instance().getQuartzOresClusterAmount(), 12, 12, 72))));
|
||||
|
||||
if (AEConfig.instance().isFeatureEnabled(AEFeature.CHARGED_CERTUS_ORE)) {
|
||||
|
||||
BlockState chargedQuartzOre = AEApi.instance().definitions().blocks().quartzOre().block()
|
||||
.getDefaultState();
|
||||
b.addFeature(GenerationStage.Decoration.UNDERGROUND_DECORATION,
|
||||
ChargedQuartzOreFeature.INSTANCE
|
||||
.withConfiguration(new ChargedQuartzOreConfig(quartzOre, chargedQuartzOre,
|
||||
AEConfig.instance().getSpawnChargedChance()))
|
||||
.withPlacement(Placement.NOPE.configure(IPlacementConfig.NO_PLACEMENT_CONFIG)));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
@@ -672,6 +684,7 @@ final class Registration {
|
||||
IForgeRegistry<Feature<?>> r = evt.getRegistry();
|
||||
|
||||
r.register(MeteoriteWorldGen.INSTANCE);
|
||||
r.register(ChargedQuartzOreFeature.INSTANCE);
|
||||
}
|
||||
|
||||
public void registerBiomes(RegistryEvent.Register<Biome> evt) {
|
||||
@@ -682,6 +695,7 @@ final class Registration {
|
||||
evt.getRegistry().register(StorageCellModDimension.INSTANCE);
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void registerTextures(TextureStitchEvent.Pre event) {
|
||||
SkyChestTESR.registerTextures(event);
|
||||
InscriberTESR.registerTexture(event);
|
||||
@@ -707,4 +721,14 @@ final class Registration {
|
||||
.forEachRemaining(c -> c.onModelBakeEvent(event));
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void registerClientEvents() {
|
||||
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
|
||||
modEventBus.addListener(this::registerParticleFactories);
|
||||
modEventBus.addListener(this::registerTextures);
|
||||
modEventBus.addListener(this::modelRegistryEvent);
|
||||
modEventBus.addListener(this::registerItemColors);
|
||||
modEventBus.addListener(this::handleModelBake);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package appeng.core.sync.network;
|
||||
|
||||
public class ClientNetworkHandler {
|
||||
}
|
||||
@@ -28,6 +28,7 @@ import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import net.minecraftforge.fml.LogicalSidedProvider;
|
||||
import net.minecraftforge.fml.network.NetworkDirection;
|
||||
@@ -40,19 +41,19 @@ import appeng.core.sync.AppEngPacket;
|
||||
public class NetworkHandler {
|
||||
private static NetworkHandler instance;
|
||||
|
||||
private final EventNetworkChannel ec;
|
||||
private final ResourceLocation myChannelName;
|
||||
|
||||
private final IPacketHandler clientHandler;
|
||||
private final IPacketHandler serveHandler;
|
||||
private final IPacketHandler serverHandler;
|
||||
|
||||
public NetworkHandler(final ResourceLocation channelName) {
|
||||
ec = NetworkRegistry.ChannelBuilder.named(myChannelName = channelName).networkProtocolVersion(() -> "1")
|
||||
.clientAcceptedVersions(s -> true).serverAcceptedVersions(s -> true).eventNetworkChannel();
|
||||
EventNetworkChannel ec = NetworkRegistry.ChannelBuilder.named(myChannelName = channelName)
|
||||
.networkProtocolVersion(() -> "1").clientAcceptedVersions(s -> true).serverAcceptedVersions(s -> true)
|
||||
.eventNetworkChannel();
|
||||
ec.registerObject(this);
|
||||
|
||||
this.clientHandler = this.createClientSide();
|
||||
this.serveHandler = this.createServerSide();
|
||||
this.clientHandler = DistExecutor.unsafeRunForDist(() -> AppEngClientPacketHandler::new, () -> () -> null);
|
||||
this.serverHandler = this.createServerSide();
|
||||
}
|
||||
|
||||
public static void init(final ResourceLocation channelName) {
|
||||
@@ -63,14 +64,6 @@ public class NetworkHandler {
|
||||
return instance;
|
||||
}
|
||||
|
||||
private IPacketHandler createClientSide() {
|
||||
try {
|
||||
return new AppEngClientPacketHandler();
|
||||
} catch (final Throwable t) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private IPacketHandler createServerSide() {
|
||||
try {
|
||||
return new AppEngServerPacketHandler();
|
||||
@@ -81,13 +74,13 @@ public class NetworkHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void serverPacket(final NetworkEvent.ClientCustomPayloadEvent ev) {
|
||||
if (this.serveHandler != null) {
|
||||
if (this.serverHandler != null) {
|
||||
try {
|
||||
NetworkEvent.Context ctx = ev.getSource().get();
|
||||
ServerPlayNetHandler netHandler = (ServerPlayNetHandler) ctx.getNetworkManager().getNetHandler();
|
||||
ctx.setPacketHandled(true);
|
||||
ctx.enqueueWork(
|
||||
() -> this.serveHandler.onPacketData(null, netHandler, ev.getPayload(), netHandler.player));
|
||||
() -> this.serverHandler.onPacketData(null, netHandler, ev.getPayload(), netHandler.player));
|
||||
|
||||
} catch (final ThreadQuickExitException ignored) {
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package appeng.core.sync.network;
|
||||
|
||||
public class ServerNetworkHandler {
|
||||
}
|
||||
@@ -26,7 +26,7 @@ import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.client.render.effects.LightningFX;
|
||||
import appeng.client.render.effects.ParticleTypes;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
@@ -65,7 +65,8 @@ public class PacketLightning extends AppEngPacket {
|
||||
public void clientPacketData(final INetworkInfo network, final PlayerEntity player) {
|
||||
try {
|
||||
if (Platform.isClient() && AEConfig.instance().isEnableEffects()) {
|
||||
Minecraft.getInstance().world.addParticle(LightningFX.TYPE, this.x, this.y, this.z, 0.0f, 0.0f, 0.0f);
|
||||
Minecraft.getInstance().world.addParticle(ParticleTypes.LIGHTNING, this.x, this.y, this.z, 0.0f, 0.0f,
|
||||
0.0f);
|
||||
}
|
||||
} catch (final Exception ignored) {
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.client.render.effects.MatterCannonFX;
|
||||
import appeng.client.render.effects.ParticleTypes;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
|
||||
@@ -83,7 +83,7 @@ public class PacketMatterCannon extends AppEngPacket {
|
||||
public void clientPacketData(final INetworkInfo network, final PlayerEntity player) {
|
||||
try {
|
||||
for (int a = 1; a < this.len; a++) {
|
||||
Minecraft.getInstance().particles.addParticle(MatterCannonFX.TYPE, this.x + this.dx * a,
|
||||
Minecraft.getInstance().particles.addParticle(ParticleTypes.MATTER_CANNON, this.x + this.dx * a,
|
||||
this.y + this.dy * a, this.z + this.dz * a, 0, 0, 0);
|
||||
}
|
||||
} catch (final Exception ignored) {
|
||||
|
||||
Reference in New Issue
Block a user