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:
@@ -52,7 +52,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.util.AEAxisAlignedBB;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.client.render.effects.LightningFX;
|
||||
import appeng.client.render.effects.ParticleTypes;
|
||||
import appeng.client.render.renderable.ItemRenderable;
|
||||
import appeng.client.render.tesr.ModularTESR;
|
||||
import appeng.core.AEConfig;
|
||||
@@ -111,7 +111,7 @@ public class BlockCharger extends AEBaseTileBlock<TileCharger> {
|
||||
|
||||
for (int bolts = 0; bolts < 3; bolts++) {
|
||||
if (AppEng.proxy.shouldAddParticles(r)) {
|
||||
Minecraft.getInstance().particles.addParticle(LightningFX.TYPE, xOff + 0.5 + pos.getX(),
|
||||
Minecraft.getInstance().particles.addParticle(ParticleTypes.LIGHTNING, xOff + 0.5 + pos.getX(),
|
||||
yOff + 0.5 + pos.getY(), zOff + 0.5 + pos.getZ(), 0.0, 0.0, 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.effects.LightningFX;
|
||||
import appeng.client.render.effects.ParticleTypes;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.helpers.MetaRotation;
|
||||
@@ -164,7 +164,7 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock
|
||||
final double zOff = -0.3 * up.getZOffset();
|
||||
for (int bolts = 0; bolts < 3; bolts++) {
|
||||
if (AppEng.proxy.shouldAddParticles(r)) {
|
||||
w.addParticle(LightningFX.TYPE, xOff + 0.5 + pos.getX(), yOff + 0.5 + pos.getY(),
|
||||
w.addParticle(ParticleTypes.LIGHTNING, xOff + 0.5 + pos.getX(), yOff + 0.5 + pos.getY(),
|
||||
zOff + 0.5 + pos.getZ(), 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.client.render.effects.LightningFX;
|
||||
import appeng.client.render.effects.ParticleTypes;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.tile.misc.TileQuartzGrowthAccelerator;
|
||||
@@ -134,7 +134,7 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock<TileQuartzGrow
|
||||
ry += dz * forward.getYOffset();
|
||||
rz += dz * forward.getZOffset();
|
||||
|
||||
Minecraft.getInstance().particles.addParticle(LightningFX.TYPE, rx, ry, rz, 0.0D, 0.0D, 0.0D);
|
||||
Minecraft.getInstance().particles.addParticle(ParticleTypes.LIGHTNING, rx, ry, rz, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -235,6 +235,7 @@ public class BlockCableBus extends AEBaseTileBlock<TileCableBus> /* FIXME implem
|
||||
return true;
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Override
|
||||
public boolean addDestroyEffects(BlockState state, World world, BlockPos pos, ParticleManager effectRenderer) {
|
||||
ICableBusContainer cb = this.cb(world, pos);
|
||||
|
||||
@@ -25,6 +25,7 @@ import appeng.core.AppEng;
|
||||
import appeng.core.features.ActivityState;
|
||||
import appeng.core.features.BlockStackSrc;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.util.Platform;
|
||||
|
||||
/**
|
||||
* Used to define our tile entities and all of their properties that are
|
||||
@@ -47,7 +48,7 @@ public class TileEntityBuilder<T extends AEBaseTile> {
|
||||
private final Function<TileEntityType<T>, T> supplier;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private final TileEntityRendering<T> tileEntityRendering = new TileEntityRendering<T>();
|
||||
private TileEntityRendering<T> tileEntityRendering;
|
||||
|
||||
private final List<Block> blocks = new ArrayList<>();
|
||||
|
||||
@@ -59,6 +60,10 @@ public class TileEntityBuilder<T extends AEBaseTile> {
|
||||
this.registryName = registryName;
|
||||
this.tileClass = tileClass;
|
||||
this.supplier = supplier;
|
||||
|
||||
if (Platform.hasClientClasses()) {
|
||||
this.tileEntityRendering = new TileEntityRendering<>();
|
||||
}
|
||||
}
|
||||
|
||||
public TileEntityBuilder<T> features(AEFeature... features) {
|
||||
|
||||
@@ -183,7 +183,8 @@ public class ClientHelper extends ServerHelper {
|
||||
final double d1 = (Platform.getRandomFloat() - 0.5F) * 0.26D;
|
||||
final double d2 = (Platform.getRandomFloat() - 0.5F) * 0.26D;
|
||||
|
||||
Minecraft.getInstance().particles.addParticle(VibrantFX.TYPE, x + d0, y + d1, z + d2, 0.0D, 0.0D, 0.0D);
|
||||
Minecraft.getInstance().particles.addParticle(ParticleTypes.VIBRANT, x + d0, y + d1, z + d2, 0.0D, 0.0D,
|
||||
0.0D);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,7 +198,8 @@ public class ClientHelper extends ServerHelper {
|
||||
}
|
||||
|
||||
private void spawnLightning(final World world, final double posX, final double posY, final double posZ) {
|
||||
Minecraft.getInstance().particles.addParticle(LightningFX.TYPE, posX, posY + 0.3f, posZ, 0.0f, 0.0f, 0.0f);
|
||||
Minecraft.getInstance().particles.addParticle(ParticleTypes.LIGHTNING, posX, posY + 0.3f, posZ, 0.0f, 0.0f,
|
||||
0.0f);
|
||||
}
|
||||
|
||||
private void spawnLightningArc(final World world, final double posX, final double posY, final double posZ,
|
||||
|
||||
@@ -32,11 +32,6 @@ import appeng.core.AppEng;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class ChargedOreFX extends RedstoneParticle {
|
||||
public static final BasicParticleType TYPE = new BasicParticleType(false);
|
||||
|
||||
static {
|
||||
TYPE.setRegistryName(AppEng.MOD_ID, "charged_ore_fx");
|
||||
}
|
||||
|
||||
private static final RedstoneParticleData PARTICLE_DATA = new RedstoneParticleData(0.21f, 0.61f, 1.0f, 1.0f);
|
||||
|
||||
|
||||
@@ -39,12 +39,6 @@ import appeng.core.AppEng;
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class CraftingFx extends SpriteTexturedParticle {
|
||||
|
||||
public static final BasicParticleType TYPE = new BasicParticleType(false);
|
||||
|
||||
static {
|
||||
TYPE.setRegistryName(AppEng.MOD_ID, "crafting_fx");
|
||||
}
|
||||
|
||||
// Offset relative to center of block, is the starting point of the particle
|
||||
// movement
|
||||
private final float offsetX;
|
||||
|
||||
@@ -22,26 +22,16 @@ import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
|
||||
import net.minecraft.client.particle.*;
|
||||
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||
import net.minecraft.particles.BasicParticleType;
|
||||
import net.minecraft.particles.ParticleType;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.core.AppEng;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class EnergyFx extends SpriteTexturedParticle {
|
||||
|
||||
public static final ParticleType<EnergyParticleData> TYPE = new ParticleType<>(false,
|
||||
EnergyParticleData.DESERIALIZER);
|
||||
|
||||
static {
|
||||
TYPE.setRegistryName(AppEng.MOD_ID, "energy_fx");
|
||||
}
|
||||
|
||||
private final int startBlkX;
|
||||
private final int startBlkY;
|
||||
private final int startBlkZ;
|
||||
|
||||
@@ -63,7 +63,7 @@ public class EnergyParticleData implements IParticleData {
|
||||
|
||||
@Override
|
||||
public ParticleType<?> getType() {
|
||||
return EnergyFx.TYPE;
|
||||
return ParticleTypes.ENERGY;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,20 +24,14 @@ import net.minecraft.client.particle.IAnimatedSprite;
|
||||
import net.minecraft.client.particle.IParticleFactory;
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.particle.SpriteTexturedParticle;
|
||||
import net.minecraft.particles.ParticleType;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class LightningArcFX extends LightningFX {
|
||||
public static final ParticleType<LightningArcParticleData> TYPE = new ParticleType<>(false,
|
||||
LightningArcParticleData.DESERIALIZER);
|
||||
|
||||
static {
|
||||
TYPE.setRegistryName(AppEng.MOD_ID, "lightning_arc_fx");
|
||||
}
|
||||
|
||||
private static final Random RANDOM_GENERATOR = new Random();
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ public class LightningArcParticleData implements IParticleData {
|
||||
|
||||
@Override
|
||||
public ParticleType<?> getType() {
|
||||
return LightningArcFX.TYPE;
|
||||
return ParticleTypes.LIGHTNING_ARC;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -41,11 +41,6 @@ import appeng.core.AppEng;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class LightningFX extends SpriteTexturedParticle {
|
||||
public static final BasicParticleType TYPE = new BasicParticleType(false);
|
||||
|
||||
static {
|
||||
TYPE.setRegistryName(AppEng.MOD_ID, "lightning_fx");
|
||||
}
|
||||
|
||||
private static final Random RANDOM_GENERATOR = new Random();
|
||||
private static final int STEPS = 5;
|
||||
|
||||
@@ -29,12 +29,6 @@ import appeng.core.AppEng;
|
||||
|
||||
public class MatterCannonFX extends SpriteTexturedParticle {
|
||||
|
||||
public static final BasicParticleType TYPE = new BasicParticleType(false);
|
||||
|
||||
static {
|
||||
TYPE.setRegistryName(AppEng.MOD_ID, "matter_cannon_fx");
|
||||
}
|
||||
|
||||
public MatterCannonFX(final World par1World, final double x, final double y, final double z,
|
||||
IAnimatedSprite sprite) {
|
||||
super(par1World, x, y, z);
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package appeng.client.render.effects;
|
||||
|
||||
import net.minecraft.particles.BasicParticleType;
|
||||
import net.minecraft.particles.ParticleType;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
|
||||
public final class ParticleTypes {
|
||||
|
||||
private ParticleTypes() {
|
||||
}
|
||||
|
||||
public static final BasicParticleType CHARGED_ORE = new BasicParticleType(false);
|
||||
public static final BasicParticleType CRAFTING = new BasicParticleType(false);
|
||||
public static final ParticleType<EnergyParticleData> ENERGY = new ParticleType<>(false,
|
||||
EnergyParticleData.DESERIALIZER);
|
||||
public static final ParticleType<LightningArcParticleData> LIGHTNING_ARC = new ParticleType<>(false,
|
||||
LightningArcParticleData.DESERIALIZER);
|
||||
public static final BasicParticleType LIGHTNING = new BasicParticleType(false);
|
||||
public static final BasicParticleType MATTER_CANNON = new BasicParticleType(false);
|
||||
public static final BasicParticleType VIBRANT = new BasicParticleType(false);
|
||||
|
||||
static {
|
||||
CHARGED_ORE.setRegistryName(AppEng.MOD_ID, "charged_ore_fx");
|
||||
CRAFTING.setRegistryName(AppEng.MOD_ID, "crafting_fx");
|
||||
ENERGY.setRegistryName(AppEng.MOD_ID, "energy_fx");
|
||||
LIGHTNING_ARC.setRegistryName(AppEng.MOD_ID, "lightning_arc_fx");
|
||||
LIGHTNING.setRegistryName(AppEng.MOD_ID, "lightning_fx");
|
||||
MATTER_CANNON.setRegistryName(AppEng.MOD_ID, "matter_cannon_fx");
|
||||
VIBRANT.setRegistryName(AppEng.MOD_ID, "vibrant_fx");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -33,12 +33,6 @@ import appeng.core.AppEng;
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class VibrantFX extends SpriteTexturedParticle {
|
||||
|
||||
public static final BasicParticleType TYPE = new BasicParticleType(false);
|
||||
|
||||
static {
|
||||
TYPE.setRegistryName(AppEng.MOD_ID, "vibrant_fx");
|
||||
}
|
||||
|
||||
public VibrantFX(final World par1World, final double x, final double y, final double z, final double par8,
|
||||
final double par10, final double par12, IAnimatedSprite sprite) {
|
||||
super(par1World, x, y, z, par8, par10, par12);
|
||||
|
||||
@@ -11,6 +11,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.network.NetworkHooks;
|
||||
|
||||
@@ -111,7 +112,8 @@ public final class ContainerHelper<C extends AEBaseContainer, I> {
|
||||
// FIXME: Should move this up, because at this point, it's hard to know where
|
||||
// the terminal host came from (part or tile)
|
||||
if (locator.hasBlockPos()) {
|
||||
return world.getBlockState(locator.getBlockPos()).getBlock().getNameTextComponent();
|
||||
return new TranslationTextComponent(
|
||||
world.getBlockState(locator.getBlockPos()).getBlock().getTranslationKey());
|
||||
}
|
||||
|
||||
return new StringTextComponent("Unknown");
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -27,7 +27,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.client.render.effects.ChargedOreFX;
|
||||
import appeng.client.render.effects.ParticleTypes;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AppEng;
|
||||
|
||||
@@ -107,8 +107,8 @@ public class BlockChargedQuartzOre extends BlockQuartzOre {
|
||||
}
|
||||
|
||||
if (AppEng.proxy.shouldAddParticles(r)) {
|
||||
Minecraft.getInstance().particles.addParticle(ChargedOreFX.TYPE, pos.getX() + xOff, pos.getY() + yOff,
|
||||
pos.getZ() + zOff, 0.0f, 0.0f, 0.0f);
|
||||
Minecraft.getInstance().particles.addParticle(ParticleTypes.CHARGED_ORE, pos.getX() + xOff,
|
||||
pos.getY() + yOff, pos.getZ() + zOff, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.client.render.effects.VibrantFX;
|
||||
import appeng.client.render.effects.ParticleTypes;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AppEng;
|
||||
|
||||
@@ -48,7 +48,8 @@ public class BlockQuartzLamp extends BlockQuartzGlass {
|
||||
final double d1 = (r.nextFloat() - 0.5F) * 0.96D;
|
||||
final double d2 = (r.nextFloat() - 0.5F) * 0.96D;
|
||||
|
||||
w.addParticle(VibrantFX.TYPE, 0.5 + pos.getX() + d0, 0.5 + pos.getY() + d1, 0.5 + pos.getZ() + d2, 0, 0, 0);
|
||||
w.addParticle(ParticleTypes.VIBRANT, 0.5 + pos.getX() + d0, 0.5 + pos.getY() + d1, 0.5 + pos.getZ() + d2, 0,
|
||||
0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,7 +210,6 @@ public enum PartType {
|
||||
|
||||
private final Set<AEFeature> features;
|
||||
private final Set<IntegrationType> integrations;
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private final Set<ResourceLocation> models;
|
||||
|
||||
PartType(final Set<AEFeature> features, final Set<IntegrationType> integrations, final Class<? extends IPart> c) {
|
||||
|
||||
@@ -37,6 +37,11 @@ public class GrinderRecipe implements IRecipe<IInventory> {
|
||||
this.optionalResults = ImmutableList.copyOf(optionalResults);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroup() {
|
||||
return group;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(IInventory inv, World worldIn) {
|
||||
return this.ingredient.test(inv.getStackInSlot(0));
|
||||
|
||||
@@ -69,14 +69,36 @@ public class GrinderRecipeSerializer extends ForgeRegistryEntry<IRecipeSerialize
|
||||
@Nullable
|
||||
@Override
|
||||
public GrinderRecipe read(ResourceLocation recipeId, PacketBuffer buffer) {
|
||||
// FIXME NOT YET IMPLEMENTED
|
||||
throw new IllegalStateException();
|
||||
|
||||
String group = buffer.readString();
|
||||
Ingredient ingredient = Ingredient.read(buffer);
|
||||
int ingredientCount = buffer.readVarInt();
|
||||
ItemStack result = buffer.readItemStack();
|
||||
int turns = buffer.readVarInt();
|
||||
int optionalResultsCount = buffer.readVarInt();
|
||||
List<GrinderOptionalResult> optionalResults = new ArrayList<>(optionalResultsCount);
|
||||
for (int i = 0; i < optionalResultsCount; i++) {
|
||||
float chance = buffer.readFloat();
|
||||
ItemStack optionalResult = buffer.readItemStack();
|
||||
optionalResults.add(new GrinderOptionalResult(chance, optionalResult));
|
||||
}
|
||||
|
||||
return new GrinderRecipe(recipeId, group, ingredient, ingredientCount, result, turns, optionalResults);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(PacketBuffer buffer, GrinderRecipe recipe) {
|
||||
// FIXME NOT YET IMPLEMENTED
|
||||
throw new IllegalStateException();
|
||||
buffer.writeString(recipe.getGroup());
|
||||
recipe.getIngredient().write(buffer);
|
||||
buffer.writeVarInt(recipe.getIngredientCount());
|
||||
buffer.writeItemStack(recipe.getRecipeOutput());
|
||||
buffer.writeVarInt(recipe.getTurns());
|
||||
List<GrinderOptionalResult> optionalResults = recipe.getOptionalResults();
|
||||
buffer.writeVarInt(optionalResults.size());
|
||||
for (GrinderOptionalResult optionalResult : optionalResults) {
|
||||
buffer.writeFloat(optionalResult.getChance());
|
||||
buffer.writeItemStack(optionalResult.getResult());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,11 +19,11 @@ public class InscriberRecipe implements IRecipe<IInventory> {
|
||||
private final ResourceLocation id;
|
||||
private final String group;
|
||||
|
||||
private Ingredient middleInput;
|
||||
private Ingredient topOptional;
|
||||
private Ingredient bottomOptional;
|
||||
private ItemStack output;
|
||||
private InscriberProcessType processType;
|
||||
private final Ingredient middleInput;
|
||||
private final Ingredient topOptional;
|
||||
private final Ingredient bottomOptional;
|
||||
private final ItemStack output;
|
||||
private final InscriberProcessType processType;
|
||||
|
||||
public InscriberRecipe(ResourceLocation id, String group, Ingredient middleInput, ItemStack output,
|
||||
Ingredient topOptional, Ingredient bottomOptional, InscriberProcessType processType) {
|
||||
@@ -63,7 +63,7 @@ public class InscriberRecipe implements IRecipe<IInventory> {
|
||||
|
||||
@Override
|
||||
public IRecipeSerializer<?> getSerializer() {
|
||||
return GrinderRecipeSerializer.INSTANCE;
|
||||
return InscriberRecipeSerializer.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -100,4 +100,8 @@ public class InscriberRecipe implements IRecipe<IInventory> {
|
||||
return processType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroup() {
|
||||
return group;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,14 +67,24 @@ public class InscriberRecipeSerializer extends ForgeRegistryEntry<IRecipeSeriali
|
||||
@Nullable
|
||||
@Override
|
||||
public InscriberRecipe read(ResourceLocation recipeId, PacketBuffer buffer) {
|
||||
// FIXME NOT YET IMPLEMENTED
|
||||
throw new IllegalStateException();
|
||||
String group = buffer.readString();
|
||||
Ingredient middle = Ingredient.read(buffer);
|
||||
ItemStack result = buffer.readItemStack();
|
||||
Ingredient top = Ingredient.read(buffer);
|
||||
Ingredient bottom = Ingredient.read(buffer);
|
||||
InscriberProcessType mode = buffer.readEnumValue(InscriberProcessType.class);
|
||||
|
||||
return new InscriberRecipe(recipeId, group, middle, result, top, bottom, mode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(PacketBuffer buffer, InscriberRecipe recipe) {
|
||||
// FIXME NOT YET IMPLEMENTED
|
||||
throw new IllegalStateException();
|
||||
buffer.writeString(recipe.getGroup());
|
||||
recipe.getMiddleInput().write(buffer);
|
||||
buffer.writeItemStack(recipe.getRecipeOutput());
|
||||
recipe.getTopOptional().write(buffer);
|
||||
recipe.getBottomOptional().write(buffer);
|
||||
buffer.writeEnumValue(recipe.getProcessType());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,12 +26,18 @@ import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import net.minecraft.command.CommandSource;
|
||||
import net.minecraftforge.fml.server.ServerLifecycleHooks;
|
||||
|
||||
import appeng.api.features.AEFeature;
|
||||
import appeng.core.AEConfig;
|
||||
|
||||
public final class AECommand {
|
||||
|
||||
public void register(CommandDispatcher<CommandSource> dispatcher) {
|
||||
|
||||
LiteralArgumentBuilder<CommandSource> builder = literal("ae2");
|
||||
for (Commands command : Commands.values()) {
|
||||
if (command.test && !AEConfig.instance().isFeatureEnabled(AEFeature.TEST_COMMANDS)) {
|
||||
continue;
|
||||
}
|
||||
add(builder, command);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,16 +20,20 @@ package appeng.server;
|
||||
|
||||
import appeng.server.subcommands.ChunkLogger;
|
||||
import appeng.server.subcommands.Supporters;
|
||||
import appeng.server.subcommands.TestOreGenCommand;
|
||||
|
||||
public enum Commands {
|
||||
Chunklogger(4, new ChunkLogger()), Supporters(0, new Supporters());
|
||||
Chunklogger(4, new ChunkLogger(), false), Supporters(0, new Supporters(), false),
|
||||
TestOreGen(4, new TestOreGenCommand(), true);
|
||||
|
||||
public final int level;
|
||||
public final ISubCommand command;
|
||||
public boolean test;
|
||||
|
||||
Commands(final int level, final ISubCommand w) {
|
||||
Commands(final int level, final ISubCommand w, boolean test) {
|
||||
this.level = level;
|
||||
this.command = w;
|
||||
this.test = test;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,7 +23,5 @@ import net.minecraft.server.MinecraftServer;
|
||||
|
||||
public interface ISubCommand {
|
||||
|
||||
String getHelp(MinecraftServer srv);
|
||||
|
||||
void call(MinecraftServer srv, String[] args, CommandSource sender);
|
||||
}
|
||||
|
||||
@@ -64,11 +64,6 @@ public class ChunkLogger implements ISubCommand {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp(final MinecraftServer srv) {
|
||||
return "commands.ae2.ChunkLogger";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void call(final MinecraftServer srv, final String[] data, final CommandSource sender) {
|
||||
this.enabled = !this.enabled;
|
||||
|
||||
@@ -28,11 +28,6 @@ import appeng.server.ISubCommand;
|
||||
|
||||
public class Supporters implements ISubCommand {
|
||||
|
||||
@Override
|
||||
public String getHelp(final MinecraftServer srv) {
|
||||
return "commands.ae2.Supporters";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void call(final MinecraftServer srv, final String[] data, final CommandSource sender) {
|
||||
final String[] who = { "Stig Halvorsen", "Josh Ricker", "Jenny \"Othlon\" Sutherland", "Hristo Bogdanov",
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.server.subcommands;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.command.CommandSource;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.world.chunk.ChunkStatus;
|
||||
import net.minecraft.world.chunk.IChunk;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
|
||||
import appeng.core.Api;
|
||||
import appeng.server.ISubCommand;
|
||||
|
||||
/**
|
||||
* This is a testing command to validate quartz ore generation.
|
||||
*/
|
||||
public class TestOreGenCommand implements ISubCommand {
|
||||
|
||||
private final BlockState quartzOre;
|
||||
private final BlockState chargedQuartzOre;
|
||||
|
||||
public TestOreGenCommand() {
|
||||
quartzOre = Api.INSTANCE.definitions().blocks().quartzOre().block().getDefaultState();
|
||||
chargedQuartzOre = Api.INSTANCE.definitions().blocks().quartzOreCharged().block().getDefaultState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void call(final MinecraftServer srv, final String[] data, final CommandSource sender) {
|
||||
|
||||
int radius = 1000;
|
||||
|
||||
ServerWorld world = srv.getWorld(DimensionType.OVERWORLD);
|
||||
BlockPos center;
|
||||
try {
|
||||
ServerPlayerEntity player = sender.asPlayer();
|
||||
center = new BlockPos(player.getPosX(), 0, player.getPosZ());
|
||||
} catch (CommandSyntaxException e) {
|
||||
center = world.getSpawnPoint();
|
||||
}
|
||||
|
||||
ChunkPos tl = new ChunkPos(center.add(-radius, 0, -radius));
|
||||
ChunkPos br = new ChunkPos(center.add(radius, 0, radius));
|
||||
|
||||
Stats stats = new Stats();
|
||||
for (int cx = tl.x; cx <= br.x; cx++) {
|
||||
for (int cz = tl.z; cz <= br.z; cz++) {
|
||||
ChunkPos cp = new ChunkPos(cx, cz);
|
||||
checkChunk(sender, world, cp, stats);
|
||||
}
|
||||
}
|
||||
|
||||
sendLine(sender, "Checked %d chunks", stats.chunksChecked);
|
||||
sendLine(sender, "Total Ore: %d (%f per chunk)", stats.quartzOreCount,
|
||||
stats.quartzOreCount / (float) stats.chunksChecked);
|
||||
if (stats.quartzOreCount > 0) {
|
||||
sendLine(sender, "Charged ore: %d (%.1f%%)", stats.chargedOreCount,
|
||||
stats.chargedOreCount / (float) stats.quartzOreCount * 100);
|
||||
sendLine(sender, "Height range: %d-%d", stats.minHeight, stats.maxHeight);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkChunk(CommandSource sender, ServerWorld world, ChunkPos cp, Stats stats) {
|
||||
IChunk chunk = world.getChunk(cp.x, cp.z, ChunkStatus.FULL, false);
|
||||
if (chunk == null) {
|
||||
sendLine(sender, "Skipping chunk %s", cp);
|
||||
return;
|
||||
}
|
||||
|
||||
stats.chunksChecked++;
|
||||
|
||||
BlockPos.Mutable blockPos = new BlockPos.Mutable();
|
||||
sendLine(sender, "Checking chunk %s", cp);
|
||||
for (int x = cp.getXStart(); x <= cp.getXEnd(); x++) {
|
||||
blockPos.setX(x);
|
||||
for (int z = cp.getZStart(); z <= cp.getZEnd(); z++) {
|
||||
blockPos.setZ(z);
|
||||
for (int y = 0; y < world.getMaxHeight(); y++) {
|
||||
blockPos.setY(y);
|
||||
BlockState state = chunk.getBlockState(blockPos);
|
||||
if (state == quartzOre || state == chargedQuartzOre) {
|
||||
stats.minHeight = Math.min(stats.minHeight, y);
|
||||
stats.maxHeight = Math.max(stats.maxHeight, y);
|
||||
stats.quartzOreCount++;
|
||||
if (state == chargedQuartzOre) {
|
||||
stats.chargedOreCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void sendLine(CommandSource sender, String text, Object... args) {
|
||||
sender.sendFeedback(new StringTextComponent(String.format(Locale.ROOT, text, args)), true);
|
||||
}
|
||||
|
||||
private static class Stats {
|
||||
public int chunksChecked = 0;
|
||||
public int quartzOreCount = 0;
|
||||
public int chargedOreCount = 0;
|
||||
public int minHeight = Integer.MAX_VALUE;
|
||||
public int maxHeight = Integer.MIN_VALUE;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -45,7 +45,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.model.data.EmptyModelData;
|
||||
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
||||
|
||||
import appeng.client.render.effects.CraftingFx;
|
||||
import appeng.client.render.effects.ParticleTypes;
|
||||
import appeng.core.AppEng;
|
||||
|
||||
/**
|
||||
@@ -118,7 +118,7 @@ public class MolecularAssemblerRenderer extends TileEntityRenderer<TileMolecular
|
||||
|
||||
if (AppEng.proxy.shouldAddParticles(particleRandom)) {
|
||||
for (int x = 0; x < (int) Math.ceil(status.getSpeed() / 5.0); x++) {
|
||||
minecraft.particles.addParticle(CraftingFx.TYPE, centerX, centerY, centerZ, 0, 0, 0);
|
||||
minecraft.particles.addParticle(ParticleTypes.CRAFTING, centerX, centerY, centerZ, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package appeng.worldgen;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.mojang.datafixers.Dynamic;
|
||||
import com.mojang.datafixers.types.DynamicOps;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.world.gen.feature.IFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.ReplaceBlockConfig;
|
||||
|
||||
import appeng.core.AEConfig;
|
||||
|
||||
/**
|
||||
* Extends a {@link ReplaceBlockConfig} with a chance.
|
||||
*/
|
||||
public class ChargedQuartzOreConfig implements IFeatureConfig {
|
||||
|
||||
public final BlockState target;
|
||||
public final BlockState state;
|
||||
public final float chance;
|
||||
|
||||
public ChargedQuartzOreConfig(BlockState target, BlockState state, float chance) {
|
||||
this.target = target;
|
||||
this.state = state;
|
||||
this.chance = chance;
|
||||
}
|
||||
|
||||
public <T> Dynamic<T> serialize(DynamicOps<T> ops) {
|
||||
return new Dynamic<>(ops,
|
||||
ops.createMap(
|
||||
ImmutableMap.of(ops.createString("target"), BlockState.serialize(ops, this.target).getValue(),
|
||||
ops.createString("state"), BlockState.serialize(ops, this.state).getValue(),
|
||||
ops.createString("chance"), ops.createFloat(this.chance))));
|
||||
}
|
||||
|
||||
public static <T> ChargedQuartzOreConfig deserialize(Dynamic<T> p_214657_0_) {
|
||||
BlockState target = p_214657_0_.get("target").map(BlockState::deserialize).orElse(Blocks.AIR.getDefaultState());
|
||||
BlockState state = p_214657_0_.get("state").map(BlockState::deserialize).orElse(Blocks.AIR.getDefaultState());
|
||||
float chance = p_214657_0_.get("chance").asFloat(AEConfig.instance().getSpawnChargedChance());
|
||||
return new ChargedQuartzOreConfig(target, state, chance);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package appeng.worldgen;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.mojang.datafixers.Dynamic;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.chunk.IChunk;
|
||||
import net.minecraft.world.gen.ChunkGenerator;
|
||||
import net.minecraft.world.gen.GenerationSettings;
|
||||
import net.minecraft.world.gen.Heightmap;
|
||||
import net.minecraft.world.gen.feature.Feature;
|
||||
import net.minecraft.world.gen.feature.ReplaceBlockFeature;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
|
||||
/**
|
||||
* Extends {@link ReplaceBlockFeature} by also allowing for a replacement
|
||||
* chance. In addition, the feature will check every block in the chunk.
|
||||
*/
|
||||
public class ChargedQuartzOreFeature extends Feature<ChargedQuartzOreConfig> {
|
||||
|
||||
public static final ChargedQuartzOreFeature INSTANCE = new ChargedQuartzOreFeature(
|
||||
ChargedQuartzOreConfig::deserialize);
|
||||
|
||||
static {
|
||||
INSTANCE.setRegistryName(AppEng.MOD_ID, "charged_quartz_ore");
|
||||
}
|
||||
|
||||
public ChargedQuartzOreFeature(Function<Dynamic<?>, ? extends ChargedQuartzOreConfig> p_i51444_1_) {
|
||||
super(p_i51444_1_);
|
||||
}
|
||||
|
||||
public boolean place(IWorld worldIn, ChunkGenerator<? extends GenerationSettings> generator, Random rand,
|
||||
BlockPos pos, ChargedQuartzOreConfig config) {
|
||||
ChunkPos chunkPos = new ChunkPos(pos);
|
||||
|
||||
BlockPos.Mutable bpos = new BlockPos.Mutable();
|
||||
int height = worldIn.getHeight(Heightmap.Type.WORLD_SURFACE_WG, pos.getX(), pos.getZ());
|
||||
IChunk chunk = worldIn.getChunk(pos);
|
||||
for (int y = 0; y < height; y++) {
|
||||
bpos.setY(y);
|
||||
for (int x = chunkPos.getXStart(); x <= chunkPos.getXEnd(); x++) {
|
||||
bpos.setX(x);
|
||||
for (int z = chunkPos.getZStart(); z <= chunkPos.getZEnd(); z++) {
|
||||
bpos.setZ(z);
|
||||
if (chunk.getBlockState(bpos).getBlock() == config.target.getBlock()
|
||||
&& rand.nextFloat() < config.chance) {
|
||||
chunk.setBlockState(bpos, config.state, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,103 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.worldgen;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.mojang.datafixers.Dynamic;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.ChunkGenerator;
|
||||
import net.minecraft.world.gen.GenerationSettings;
|
||||
import net.minecraft.world.gen.feature.ReplaceBlockConfig;
|
||||
import net.minecraft.world.gen.feature.ReplaceBlockFeature;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.definitions.IBlockDefinition;
|
||||
import appeng.api.definitions.IBlocks;
|
||||
import appeng.api.features.IWorldGen.WorldGenType;
|
||||
import appeng.core.features.registries.WorldGenRegistry;
|
||||
|
||||
public final class QuartzWorldGen extends ReplaceBlockFeature {
|
||||
/*
|
||||
* private final WorldGenMinable oreNormal; private final WorldGenMinable
|
||||
* oreCharged;
|
||||
*/
|
||||
|
||||
public QuartzWorldGen(Function<Dynamic<?>, ? extends ReplaceBlockConfig> serializer) {
|
||||
super(serializer);
|
||||
final IBlocks blocks = AEApi.instance().definitions().blocks();
|
||||
final IBlockDefinition oreDefinition = blocks.quartzOre();
|
||||
final IBlockDefinition chargedDefinition = blocks.quartzOreCharged();
|
||||
|
||||
/*
|
||||
* this.oreNormal = oreDefinition.maybeBlock() .map( b -> new WorldGenMinable(
|
||||
* b.getDefaultState(), AEConfig.instance().getQuartzOresPerCluster() ) )
|
||||
* .orElse( null ); this.oreCharged = chargedDefinition.maybeBlock() .map( b ->
|
||||
* new WorldGenMinable( b.getDefaultState(),
|
||||
* AEConfig.instance().getQuartzOresPerCluster() ) ) .orElse( null );
|
||||
*/
|
||||
}
|
||||
|
||||
private static boolean shouldGenerate(final boolean isCharged, final World w) {
|
||||
return WorldGenRegistry.INSTANCE
|
||||
.isWorldGenEnabled(isCharged ? WorldGenType.CHARGED_CERTUS_QUARTZ : WorldGenType.CERTUS_QUARTZ, w);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean place(IWorld worldIn, ChunkGenerator<? extends GenerationSettings> generator, Random r, BlockPos pos,
|
||||
ReplaceBlockConfig config) {
|
||||
/*
|
||||
* if( this.oreNormal == null && this.oreCharged == null ) { return false; }
|
||||
*
|
||||
* World w = worldIn.getWorld();
|
||||
*
|
||||
* int seaLevel = w.getSeaLevel();
|
||||
*
|
||||
* ChunkPos chunkPos = new ChunkPos( pos );
|
||||
*
|
||||
* if( seaLevel < 20 ) { final int x = ( chunkPos.x << 4 ) + 8; final int z = (
|
||||
* chunkPos.z << 4 ) + 8; seaLevel = w.getHeight( Heightmap.Type.WORLD_SURFACE,
|
||||
* x, z ); }
|
||||
*
|
||||
* final int oreDepthMultiplier =
|
||||
* AEConfig.instance().getQuartzOresClusterAmount() * seaLevel / 64; final int
|
||||
* scale = (int) Math.round( r.nextGaussian() * Math.sqrt( oreDepthMultiplier )
|
||||
* + oreDepthMultiplier );
|
||||
*
|
||||
* for( int cnt = 0; cnt < ( r.nextBoolean() ? scale * 2 : scale ) / 2; ++cnt )
|
||||
* { boolean isCharged = false;
|
||||
*
|
||||
* if( this.oreCharged != null ) { isCharged = r.nextFloat() >
|
||||
* AEConfig.instance().getSpawnChargedChance(); }
|
||||
*
|
||||
* final WorldGenMinable whichOre = isCharged ? this.oreCharged :
|
||||
* this.oreNormal; if( whichOre != null && shouldGenerate( isCharged, w ) ) {
|
||||
* final int cx = chunkPos.x * 16 + r.nextInt( 16 ); final int cy = r.nextInt(
|
||||
* 40 * seaLevel / 64 ) + r.nextInt( 22 * seaLevel / 64 ) + 12 * seaLevel / 64;
|
||||
* final int cz = chunkPos.z * 16 + r.nextInt( 16 ); whichOre.generate( w, r,
|
||||
* new BlockPos( cx, cy, cz ) ); } }
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user