Initial port to 1.16.2
This commit is contained in:
+5
-4
@@ -9,13 +9,14 @@ artifact_basename=appliedenergistics2
|
||||
# Minecraft Versions #
|
||||
#########################################################
|
||||
minecraft_release=1.16
|
||||
minecraft_version=1.16.1
|
||||
minecraft_version=1.16.2
|
||||
mcp_mappings=20200723-1.16.1
|
||||
forge_version=32.0.108
|
||||
forge_version=33.0.2
|
||||
|
||||
#########################################################
|
||||
# Provided APIs #
|
||||
#########################################################
|
||||
jei_minecraft_version=1.16.1
|
||||
jei_version=7.0.0.6
|
||||
top_version=3.0.1-beta-4
|
||||
hwyla_version=1.10.8-B72_1.15.2
|
||||
@@ -24,8 +25,8 @@ ctm_version=MC1.15.2-1.1.0.9
|
||||
#########################################################
|
||||
# Deployment #
|
||||
#########################################################
|
||||
website_version=1.16.1
|
||||
curse_versions=1.16.1
|
||||
website_version=1.16.2
|
||||
curse_versions=1.16.2
|
||||
curseforge_project=223794
|
||||
|
||||
#########################################################
|
||||
|
||||
@@ -29,12 +29,12 @@ dependencies {
|
||||
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
|
||||
|
||||
// compile against provided APIs
|
||||
compileOnly "mezz.jei:jei-${minecraft_version}:${jei_version}:api"
|
||||
compileOnly "mezz.jei:jei-${jei_minecraft_version}:${jei_version}:api"
|
||||
compileOnly "mcjty.theoneprobe:TheOneProbe-${minecraft_release}:${minecraft_release}-${top_version}:api"
|
||||
|
||||
// Runtime, Mods
|
||||
runtimeOnly fg.deobf("mezz.jei:jei-${minecraft_version}:${jei_version}")
|
||||
runtimeOnly fg.deobf("mcjty.theoneprobe:TheOneProbe-${minecraft_release}:${minecraft_release}-${top_version}")
|
||||
// FIXME 1.16.2 runtimeOnly fg.deobf("mezz.jei:jei-${jei_minecraft_version}:${jei_version}")
|
||||
// FIXME 1.16.2 runtimeOnly fg.deobf("mcjty.theoneprobe:TheOneProbe-${minecraft_release}:${minecraft_release}-${top_version}")
|
||||
//runtimeOnly fg.deobf("team.chisel.ctm:CTM:${ctm_version}")
|
||||
|
||||
// unit test dependencies
|
||||
|
||||
@@ -27,13 +27,14 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.DimensionType;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* Represents a location in the Minecraft Universe
|
||||
*/
|
||||
public class DimensionalCoord extends WorldCoord {
|
||||
|
||||
private final IWorld world;
|
||||
private final World world;
|
||||
private final DimensionType dimension;
|
||||
|
||||
public DimensionalCoord(final DimensionalCoord coordinate) {
|
||||
@@ -48,13 +49,13 @@ public class DimensionalCoord extends WorldCoord {
|
||||
this.dimension = this.world.func_230315_m_();
|
||||
}
|
||||
|
||||
public DimensionalCoord(final IWorld world, final int x, final int y, final int z) {
|
||||
public DimensionalCoord(final World world, final int x, final int y, final int z) {
|
||||
super(x, y, z);
|
||||
this.world = world;
|
||||
this.dimension = world.func_230315_m_();
|
||||
}
|
||||
|
||||
public DimensionalCoord(final IWorld world, final BlockPos pos) {
|
||||
public DimensionalCoord(final World world, final BlockPos pos) {
|
||||
super(pos);
|
||||
this.world = world;
|
||||
this.dimension = world.func_230315_m_();
|
||||
@@ -84,7 +85,7 @@ public class DimensionalCoord extends WorldCoord {
|
||||
return this.world == world;
|
||||
}
|
||||
|
||||
public IWorld getWorld() {
|
||||
public World getWorld() {
|
||||
return this.world;
|
||||
}
|
||||
|
||||
|
||||
@@ -111,11 +111,6 @@ public abstract class AEBaseTileBlock<T extends AEBaseTileEntity> extends AEBase
|
||||
return this.tileEntityFactory.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropXpOnBlockBreak(World worldIn, BlockPos pos, int amount) {
|
||||
super.dropXpOnBlockBreak(worldIn, pos, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReplaced(BlockState state, World w, BlockPos pos, BlockState newState, boolean isMoving) {
|
||||
if (newState.getBlock() == state.getBlock()) {
|
||||
|
||||
@@ -22,6 +22,7 @@ import java.text.NumberFormat;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
@@ -72,14 +73,14 @@ public abstract class AEBaseMEScreen<T extends AEBaseContainer> extends AEBaseSc
|
||||
currentToolTip.add(ButtonToolTips.ItemsRequestable.text(formattedAmount));
|
||||
}
|
||||
|
||||
this.renderToolTip(matrixStack, currentToolTip, x, y, this.font);
|
||||
this.renderToolTip(matrixStack, Lists.transform(currentToolTip, ITextComponent::func_241878_f), x, y, this.font);
|
||||
|
||||
return;
|
||||
} else if (stack.getCount() > bigNumber) {
|
||||
final String formattedAmount = NumberFormat.getNumberInstance(Locale.US).format(stack.getCount());
|
||||
currentToolTip.add(ButtonToolTips.ItemsStored.text(formattedAmount).mergeStyle(TextFormatting.GRAY));
|
||||
|
||||
this.renderToolTip(matrixStack, currentToolTip, x, y, this.font);
|
||||
this.renderToolTip(matrixStack, Lists.transform(currentToolTip, ITextComponent::func_241878_f), x, y, this.font);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends ContainerS
|
||||
styledLines.add(lines.get(i).deepCopy().modifyStyle(s -> style));
|
||||
}
|
||||
|
||||
this.renderTooltip(matrices, styledLines, x, y);
|
||||
this.func_243308_b(matrices, styledLines, x, y);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ public final class ContainerLocator {
|
||||
public static ContainerLocator forPart(AEBasePart part) {
|
||||
IPartHost host = part.getHost();
|
||||
DimensionalCoord pos = host.getLocation();
|
||||
return new ContainerLocator(Type.PART, -1, pos.getWorld().getWorld(), pos.getBlockPos(), part.getSide());
|
||||
return new ContainerLocator(Type.PART, -1, pos.getWorld(), pos.getBlockPos(), part.getSide());
|
||||
}
|
||||
|
||||
public boolean hasItemIndex() {
|
||||
|
||||
@@ -18,41 +18,6 @@
|
||||
|
||||
package appeng.core;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.common.base.Stopwatch;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.entity.ItemRenderer;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.crafting.IRecipeSerializer;
|
||||
import net.minecraft.particles.ParticleType;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.gen.feature.Feature;
|
||||
import net.minecraft.world.gen.feature.structure.Structure;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
import net.minecraftforge.fml.ModLoadingContext;
|
||||
import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.config.ModConfig;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.minecraftforge.fml.event.server.FMLServerAboutToStartEvent;
|
||||
import net.minecraftforge.fml.event.server.FMLServerStoppedEvent;
|
||||
import net.minecraftforge.fml.event.server.FMLServerStoppingEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
|
||||
import appeng.bootstrap.components.IInitComponent;
|
||||
import appeng.bootstrap.components.IPostInitComponent;
|
||||
import appeng.capabilities.Capabilities;
|
||||
@@ -69,6 +34,37 @@ import appeng.hooks.TickHandler;
|
||||
import appeng.integration.Integrations;
|
||||
import appeng.parts.PartPlacement;
|
||||
import appeng.server.ServerHelper;
|
||||
import com.google.common.base.Stopwatch;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.entity.ItemRenderer;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.crafting.IRecipeSerializer;
|
||||
import net.minecraft.particles.ParticleType;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.fml.DeferredWorkQueue;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
import net.minecraftforge.fml.ModLoadingContext;
|
||||
import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.config.ModConfig;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.minecraftforge.fml.event.server.FMLServerAboutToStartEvent;
|
||||
import net.minecraftforge.fml.event.server.FMLServerStoppedEvent;
|
||||
import net.minecraftforge.fml.event.server.FMLServerStoppingEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Mod(AppEng.MOD_ID)
|
||||
public final class AppEng {
|
||||
@@ -101,6 +97,7 @@ public final class AppEng {
|
||||
|
||||
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
registration = new Registration();
|
||||
modEventBus.addListener(this::bootstrap);
|
||||
modEventBus.addGenericListener(Block.class, registration::registerBlocks);
|
||||
modEventBus.addGenericListener(Item.class, registration::registerItems);
|
||||
modEventBus.addGenericListener(EntityType.class, registration::registerEntities);
|
||||
@@ -108,9 +105,6 @@ public final class AppEng {
|
||||
modEventBus.addGenericListener(TileEntityType.class, registration::registerTileEntities);
|
||||
modEventBus.addGenericListener(ContainerType.class, registration::registerContainerTypes);
|
||||
modEventBus.addGenericListener(IRecipeSerializer.class, registration::registerRecipeSerializers);
|
||||
modEventBus.addGenericListener(Feature.class, registration::registerFeatures);
|
||||
modEventBus.addGenericListener(Structure.class, registration::registerStructures);
|
||||
modEventBus.addGenericListener(Biome.class, registration::registerBiomes);
|
||||
|
||||
modEventBus.addListener(Integrations::enqueueIMC);
|
||||
modEventBus.addListener(this::commonSetup);
|
||||
@@ -129,7 +123,15 @@ public final class AppEng {
|
||||
MinecraftForge.EVENT_BUS.register(new PartPlacement());
|
||||
}
|
||||
|
||||
private void bootstrap(RegistryEvent.NewRegistry e) {
|
||||
// This has to be here so it's not run in parallel with other registrations
|
||||
AppEngBootstrap.initialize();
|
||||
}
|
||||
|
||||
private void commonSetup(FMLCommonSetupEvent event) {
|
||||
// This must run here because the config is not available earlier
|
||||
DeferredWorkQueue.runLater(AppEngBootstrap::enhanceBiomes);
|
||||
|
||||
ApiDefinitions definitions = Api.INSTANCE.definitions();
|
||||
definitions.getRegistry().getBootstrapComponents(IInitComponent.class)
|
||||
.forEachRemaining(IInitComponent::initialize);
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
package appeng.core;
|
||||
|
||||
import appeng.api.features.AEFeature;
|
||||
import appeng.mixins.feature.ConfiguredFeaturesAccessor;
|
||||
import appeng.mixins.structure.ConfiguredStructureFeaturesAccessor;
|
||||
import appeng.mixins.structure.StructureFeatureAccessor;
|
||||
import appeng.spatial.SpatialStorageChunkGenerator;
|
||||
import appeng.spatial.SpatialStorageDimensionIds;
|
||||
import appeng.worldgen.BiomeModifier;
|
||||
import appeng.worldgen.ChargedQuartzOreConfig;
|
||||
import appeng.worldgen.ChargedQuartzOreFeature;
|
||||
import appeng.worldgen.meteorite.MeteoriteStructure;
|
||||
import appeng.worldgen.meteorite.MeteoriteStructurePiece;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.registry.WorldGenRegistries;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
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.OreFeatureConfig;
|
||||
import net.minecraft.world.gen.placement.NoPlacementConfig;
|
||||
import net.minecraft.world.gen.placement.Placement;
|
||||
import net.minecraft.world.gen.placement.TopSolidRangeConfig;
|
||||
|
||||
/**
|
||||
* Hooks into the very early bootstrapping phase to register things before the
|
||||
* first dynamic registry manager is created.
|
||||
*/
|
||||
public final class AppEngBootstrap {
|
||||
|
||||
private static boolean initialized;
|
||||
private static ConfiguredFeature<?, ?> quartzOreFeature;
|
||||
private static ConfiguredFeature<?, ?> chargedQuartzOreFeature;
|
||||
|
||||
private AppEngBootstrap() {
|
||||
}
|
||||
|
||||
public synchronized static void initialize() {
|
||||
if (initialized) {
|
||||
return;
|
||||
}
|
||||
initialized = true;
|
||||
|
||||
registerStructures();
|
||||
|
||||
quartzOreFeature = registerQuartzOreFeature();
|
||||
chargedQuartzOreFeature = registerChargedQuartzOreFeature();
|
||||
|
||||
registerDimension();
|
||||
}
|
||||
|
||||
public synchronized static void enhanceBiomes() {
|
||||
// add to all standard biomes
|
||||
// TODO: This means we'll not add these things to newly created biomes
|
||||
WorldGenRegistries.field_243657_i.forEach(b -> {
|
||||
addMeteoriteWorldGen(b);
|
||||
addQuartzWorldGen(b, quartzOreFeature, chargedQuartzOreFeature);
|
||||
});
|
||||
}
|
||||
|
||||
private static void registerStructures() {
|
||||
|
||||
MeteoriteStructurePiece.register();
|
||||
|
||||
// Registering into the registry alone is INSUFFICIENT!
|
||||
// There's a bidirectional map in the Structure class itself primarily for the
|
||||
// purposes of NBT serialization
|
||||
StructureFeatureAccessor.register(MeteoriteStructure.ID.toString(), MeteoriteStructure.INSTANCE,
|
||||
GenerationStage.Decoration.TOP_LAYER_MODIFICATION);
|
||||
|
||||
ConfiguredStructureFeaturesAccessor.register(MeteoriteStructure.ID.toString(),
|
||||
MeteoriteStructure.CONFIGURED_INSTANCE);
|
||||
}
|
||||
|
||||
private static void addMeteoriteWorldGen(Biome b) {
|
||||
if (!AEConfig.instance().isFeatureEnabled(AEFeature.METEORITE_WORLD_GEN)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (b.getCategory() == Biome.Category.THEEND || b.getCategory() == Biome.Category.NETHER) {
|
||||
return;
|
||||
}
|
||||
|
||||
BiomeModifier modifier = new BiomeModifier(b);
|
||||
modifier.addStructureFeature(MeteoriteStructure.CONFIGURED_INSTANCE);
|
||||
}
|
||||
|
||||
private static void addQuartzWorldGen(Biome b, ConfiguredFeature<?, ?> quartzOre,
|
||||
ConfiguredFeature<?, ?> chargedQuartz) {
|
||||
if (!AEConfig.instance().isFeatureEnabled(AEFeature.CERTUS_QUARTZ_WORLD_GEN)) {
|
||||
return;
|
||||
}
|
||||
|
||||
BiomeModifier modifier = new BiomeModifier(b);
|
||||
|
||||
modifier.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, quartzOre);
|
||||
|
||||
if (AEConfig.instance().isFeatureEnabled(AEFeature.CHARGED_CERTUS_ORE)) {
|
||||
modifier.addFeature(GenerationStage.Decoration.UNDERGROUND_DECORATION, chargedQuartz);
|
||||
}
|
||||
}
|
||||
|
||||
private static ConfiguredFeature<?, ?> registerQuartzOreFeature() {
|
||||
// Tell Minecraft about our configured quartz ore feature
|
||||
BlockState quartzOreState = Api.instance().definitions().blocks().quartzOre().block().getDefaultState();
|
||||
return ConfiguredFeaturesAccessor.register(AppEng.makeId("quartz_ore").toString(),
|
||||
Feature.ORE
|
||||
.withConfiguration(new OreFeatureConfig(OreFeatureConfig.FillerBlockType.field_241882_a, quartzOreState,
|
||||
AEConfig.instance().getQuartzOresPerCluster()))
|
||||
.withPlacement(Placement.field_242907_l/*RANGE*/.configure(new TopSolidRangeConfig(12, 12, 72))).func_242728_a/*spreadHorizontally*/()
|
||||
.func_242731_b/*repeat*/(AEConfig.instance().getQuartzOresClusterAmount()));
|
||||
}
|
||||
|
||||
private static ConfiguredFeature<?, ?> registerChargedQuartzOreFeature() {
|
||||
// Tell Minecraft about our configured charged quartz ore feature
|
||||
Registry.register(Registry.FEATURE, AppEng.makeId("charged_quartz_ore"), ChargedQuartzOreFeature.INSTANCE);
|
||||
|
||||
BlockState quartzOreState = Api.instance().definitions().blocks().quartzOre().block().getDefaultState();
|
||||
BlockState chargedQuartzOreState = Api.instance().definitions().blocks().quartzOreCharged().block()
|
||||
.getDefaultState();
|
||||
return ConfiguredFeaturesAccessor.register(AppEng.makeId("charged_quartz_ore").toString(),
|
||||
ChargedQuartzOreFeature.INSTANCE
|
||||
.withConfiguration(new ChargedQuartzOreConfig(quartzOreState, chargedQuartzOreState,
|
||||
AEConfig.instance().getSpawnChargedChance()))
|
||||
.withPlacement(Placement.NOPE.configure(NoPlacementConfig.field_236556_b_)));
|
||||
}
|
||||
|
||||
private static void registerDimension() {
|
||||
Registry.register(Registry.CHUNK_GENERATOR_CODEC, SpatialStorageDimensionIds.CHUNK_GENERATOR_ID,
|
||||
SpatialStorageChunkGenerator.CODEC);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -34,6 +34,7 @@ import net.minecraft.particles.ParticleType;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.registry.WorldGenRegistries;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.gen.GenerationStage;
|
||||
@@ -41,7 +42,6 @@ import net.minecraft.world.gen.feature.Feature;
|
||||
import net.minecraft.world.gen.feature.IFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.OreFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.structure.Structure;
|
||||
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;
|
||||
@@ -213,7 +213,6 @@ import appeng.me.cache.PathGridCache;
|
||||
import appeng.me.cache.SecurityCache;
|
||||
import appeng.me.cache.SpatialPylonCache;
|
||||
import appeng.me.cache.TickManagerCache;
|
||||
import appeng.mixins.StructureAccessor;
|
||||
import appeng.parts.automation.PlaneModelLoader;
|
||||
import appeng.recipes.game.DisassembleRecipe;
|
||||
import appeng.recipes.game.FacadeRecipe;
|
||||
@@ -682,73 +681,6 @@ final class Registration {
|
||||
new ResourceLocation(dimension));
|
||||
}
|
||||
|
||||
MeteoriteStructurePiece.register();
|
||||
|
||||
ForgeRegistries.BIOMES.forEach(b -> {
|
||||
addMeteoriteWorldGen(b);
|
||||
addQuartzWorldGen(b);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private static void addMeteoriteWorldGen(Biome b) {
|
||||
if (!AEConfig.instance().isFeatureEnabled(AEFeature.METEORITE_WORLD_GEN)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (b.getCategory() == Biome.Category.THEEND || b.getCategory() == Biome.Category.NETHER) {
|
||||
return;
|
||||
}
|
||||
|
||||
b.func_235063_a_(MeteoriteStructure.INSTANCE.func_236391_a_(IFeatureConfig.NO_FEATURE_CONFIG));
|
||||
}
|
||||
|
||||
private static void addQuartzWorldGen(Biome b) {
|
||||
if (!AEConfig.instance().isFeatureEnabled(AEFeature.CERTUS_QUARTZ_WORLD_GEN)) {
|
||||
return;
|
||||
}
|
||||
|
||||
BlockState quartzOre = Api.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 = Api.instance().definitions().blocks().quartzOreCharged().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)));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void registerFeatures(RegistryEvent.Register<Feature<?>> evt) {
|
||||
IForgeRegistry<Feature<?>> r = evt.getRegistry();
|
||||
|
||||
r.register(ChargedQuartzOreFeature.INSTANCE.setRegistryName(AppEng.makeId("charged_quartz_ore")));
|
||||
}
|
||||
|
||||
public void registerStructures(RegistryEvent.Register<Structure<?>> evt) {
|
||||
// Registering into the Forge registry is INSUFFICIENT!
|
||||
// There's a bidirectional map in the Structure class itself primarily for the
|
||||
// purposes of NBT serialization
|
||||
StructureAccessor.register(MeteoriteStructure.ID.toString(),
|
||||
MeteoriteStructure.INSTANCE.setRegistryName(MeteoriteStructure.ID),
|
||||
GenerationStage.Decoration.TOP_LAYER_MODIFICATION);
|
||||
|
||||
Registry.register(Registry.CHUNK_GENERATOR_CODEC, SpatialStorageDimensionIds.CHUNK_GENERATOR_ID,
|
||||
SpatialStorageChunkGenerator.CODEC);
|
||||
}
|
||||
|
||||
public void registerBiomes(RegistryEvent.Register<Biome> evt) {
|
||||
evt.getRegistry().register(SpatialStorageBiome.INSTANCE.setRegistryName(SpatialStorageDimensionIds.BIOME_ID));
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
|
||||
@@ -51,12 +51,12 @@ public class MovableTileRegistry implements IMovableRegistry {
|
||||
private final List<IMovableHandler> handlers = new ArrayList<>();
|
||||
private final DefaultSpatialHandler dsh = new DefaultSpatialHandler();
|
||||
private final IMovableHandler nullHandler = new DefaultSpatialHandler();
|
||||
private final ITag<Block> blockTagWhiteList;
|
||||
private final ITag<Block> blockTagBlackList;
|
||||
private final ITag.INamedTag<Block> blockTagWhiteList;
|
||||
private final ITag.INamedTag<Block> blockTagBlackList;
|
||||
|
||||
public MovableTileRegistry() {
|
||||
this.blockTagWhiteList = BlockTags.getCollection().getOrCreate(TAG_WHITELIST);
|
||||
this.blockTagBlackList = BlockTags.getCollection().getOrCreate(TAG_BLACKLIST);
|
||||
this.blockTagWhiteList = BlockTags.makeWrapperTag(TAG_WHITELIST.toString());
|
||||
this.blockTagBlackList = BlockTags.makeWrapperTag(TAG_BLACKLIST.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -71,7 +71,7 @@ public class BlockTransitionEffectPacket extends BasePacket {
|
||||
|
||||
data.writeInt(this.getPacketID());
|
||||
data.writeBlockPos(pos);
|
||||
int blockStateId = GameData.getBlockStateIDMap().get(blockState);
|
||||
int blockStateId = GameData.getBlockStateIDMap().getId(blockState);
|
||||
if (blockStateId == -1) {
|
||||
AELog.warn("Failed to find numeric id for block state %s", blockState);
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ public class MeteoritePlacerItem extends AEBaseItem {
|
||||
// is a debug tool, we'll not care about being terribly efficient here
|
||||
ChunkPos.getAllInBox(new ChunkPos(spawned.getPos()), 1).forEach(cp -> {
|
||||
Chunk c = world.getChunk(cp.x, cp.z);
|
||||
player.connection.sendPacket(new SChunkDataPacket(c, 65535, false)); // 65535 == full chunk
|
||||
player.connection.sendPacket(new SChunkDataPacket(c, 65535)); // 65535 == full chunk
|
||||
});
|
||||
|
||||
return ActionResultType.SUCCESS;
|
||||
|
||||
@@ -176,7 +176,7 @@ public class FluidTerminalScreen extends AEBaseMEScreen<FluidTerminalContainer>
|
||||
list.add(new StringTextComponent(formattedAmount));
|
||||
list.add(new StringTextComponent(modName));
|
||||
|
||||
this.renderTooltip(matrixStack, list, mouseX, mouseY);
|
||||
this.func_243308_b(matrixStack, list, mouseX, mouseY);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.tags.ITag;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
@@ -57,8 +56,8 @@ import appeng.util.Platform;
|
||||
|
||||
public class FluidAnnihilationPlanePart extends BasicStatePart implements IGridTickable {
|
||||
|
||||
public static final ResourceLocation TAG_BLACKLIST = new ResourceLocation(AppEng.MOD_ID,
|
||||
"blacklisted/fluid_annihilation_plane");
|
||||
public static final ITag.INamedTag<Fluid> TAG_BLACKLIST = FluidTags
|
||||
.makeWrapperTag(AppEng.makeId("blacklisted/fluid_annihilation_plane").toString());
|
||||
|
||||
private static final PlaneModels MODELS = new PlaneModels("part/fluid_annihilation_plane",
|
||||
"part/fluid_annihilation_plane_on");
|
||||
@@ -214,8 +213,7 @@ public class FluidAnnihilationPlanePart extends BasicStatePart implements IGridT
|
||||
}
|
||||
|
||||
private boolean isFluidBlacklisted(Fluid fluid) {
|
||||
ITag<Fluid> tag = FluidTags.getCollection().getOrCreate(TAG_BLACKLIST);
|
||||
return fluid.isIn(tag);
|
||||
return TAG_BLACKLIST.contains(fluid);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public class FacadeItem extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
/**
|
||||
* Block tag used to explicitly whitelist blocks for use in facades.
|
||||
*/
|
||||
private static final ResourceLocation TAG_WHITELISTED = new ResourceLocation(AppEng.MOD_ID, "whitelisted/facades");
|
||||
private static final ITag.INamedTag<Block> BLOCK_WHITELIST = BlockTags.makeWrapperTag(AppEng.makeId("whitelisted/facades").toString());
|
||||
|
||||
private static final String NBT_ITEM_ID = "item";
|
||||
|
||||
@@ -105,8 +105,7 @@ public class FacadeItem extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
BlockState blockState = block.getDefaultState();
|
||||
|
||||
final boolean areTileEntitiesEnabled = AEConfig.instance().isFeatureEnabled(AEFeature.TILE_ENTITY_FACADES);
|
||||
ITag<Block> whitelistTag = BlockTags.getCollection().getOrCreate(TAG_WHITELISTED);
|
||||
final boolean isWhiteListed = block.isIn(whitelistTag);
|
||||
final boolean isWhiteListed = BLOCK_WHITELIST.contains(block);
|
||||
final boolean isModel = blockState.getRenderType() == BlockRenderType.MODEL;
|
||||
|
||||
final BlockState defaultState = block.getDefaultState();
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package appeng.mixins;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
import net.minecraft.world.chunk.listener.IChunkStatusListener;
|
||||
import net.minecraft.world.server.ChunkManager;
|
||||
|
||||
@Mixin(ChunkManager.class)
|
||||
public interface ThreadedAnvilChunkStorageAccessor {
|
||||
|
||||
@Accessor("field_219266_t")
|
||||
IChunkStatusListener getWorldGenerationProgressListener();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package appeng.mixins.feature;
|
||||
|
||||
import net.minecraft.world.gen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.gen.feature.Features;
|
||||
import net.minecraft.world.gen.feature.IFeatureConfig;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||
|
||||
@Mixin(Features.class)
|
||||
public interface ConfiguredFeaturesAccessor {
|
||||
|
||||
@Invoker("func_243968_a")
|
||||
static <FC extends IFeatureConfig> ConfiguredFeature<FC, ?> register(String id,
|
||||
ConfiguredFeature<FC, ?> configuredFeature) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package appeng.mixins.spatial;
|
||||
|
||||
import appeng.spatial.SpatialStorageBiome;
|
||||
import appeng.spatial.SpatialStorageDimensionIds;
|
||||
import net.minecraft.util.registry.WorldGenRegistries;
|
||||
import net.minecraft.world.biome.BiomeRegistry;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
/**
|
||||
* This only needs to be here because the server-side will create a dynamic
|
||||
* registry manager long before our mod is initialized.
|
||||
*/
|
||||
@Mixin(BiomeRegistry.class)
|
||||
public class BiomesMixin {
|
||||
|
||||
@Inject(method = "<clinit>", at = @At("TAIL"))
|
||||
private static void registerBiomes(CallbackInfo ci) {
|
||||
WorldGenRegistries.func_243664_a(WorldGenRegistries.field_243657_i, SpatialStorageDimensionIds.BIOME_KEY.func_240901_a_(),
|
||||
SpatialStorageBiome.INSTANCE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,16 +1,14 @@
|
||||
package appeng.mixins.spatial;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import appeng.spatial.SpatialStorageDimensionIds;
|
||||
import net.minecraft.util.RegistryKey;
|
||||
import net.minecraft.world.Dimension;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
||||
|
||||
import net.minecraft.util.RegistryKey;
|
||||
import net.minecraft.world.Dimension;
|
||||
|
||||
import appeng.spatial.SpatialStorageDimensionIds;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* This Mixin tries to hide the screen that warns users about experimental
|
||||
@@ -35,4 +33,4 @@ public class DimensionOptionMixin {
|
||||
return dimensions;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,21 @@ package appeng.mixins.spatial;
|
||||
|
||||
import java.util.OptionalLong;
|
||||
|
||||
import appeng.spatial.SpatialStorageChunkGenerator;
|
||||
import com.mojang.serialization.Lifecycle;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.registry.DynamicRegistries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.registry.SimpleRegistry;
|
||||
import net.minecraft.world.Dimension;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.gen.DimensionSettings;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import net.minecraft.server.IDynamicRegistries;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.world.DimensionType;
|
||||
|
||||
@@ -21,12 +30,35 @@ import appeng.spatial.SpatialStorageDimensionIds;
|
||||
@Mixin(value = DimensionType.class)
|
||||
public class DimensionTypeMixin {
|
||||
|
||||
@Inject(method = "func_236027_a_", at = @At("TAIL"))
|
||||
private static void addRegistryDefaults(IDynamicRegistries.Impl registryTracker, CallbackInfoReturnable<?> cir) {
|
||||
@Invoker("<init>")
|
||||
static DimensionType create(OptionalLong fixedTime, boolean hasSkylight, boolean hasCeiling, boolean ultrawarm,
|
||||
boolean natural, double coordinateScale, boolean piglinSafe, boolean bedWorks, boolean respawnAnchorWorks,
|
||||
boolean hasRaids, int logicalHeight, ResourceLocation infiniburn, ResourceLocation skyProperties, float ambientLight) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
registryTracker.func_239774_a_(SpatialStorageDimensionIds.DIMENSION_TYPE_ID,
|
||||
new DimensionType(OptionalLong.of(12000), false, false, false, false, false, false, true, false, false,
|
||||
256, BlockTags.INFINIBURN_OVERWORLD.getName(), 1.0f));
|
||||
@Inject(method = "func_236027_a_", at = @At("TAIL"))
|
||||
private static void addRegistryDefaults(DynamicRegistries.Impl registryTracker,
|
||||
CallbackInfoReturnable<?> cir) {
|
||||
DimensionType dimensionType = create(OptionalLong.of(12000), false, false, false, false, 1.0, false, false,
|
||||
false, false, 256, BlockTags.INFINIBURN_OVERWORLD.getName(), SpatialStorageDimensionIds.SKY_PROPERTIES_ID,
|
||||
1.0f);
|
||||
|
||||
Registry.register(registryTracker.func_230520_a_(), SpatialStorageDimensionIds.DIMENSION_TYPE_ID.func_240901_a_(),
|
||||
dimensionType);
|
||||
}
|
||||
|
||||
@Inject(method = "func_242718_a", at = @At("RETURN"))
|
||||
private static void buildDimensionRegistry(Registry<DimensionType> dimensionTypes,
|
||||
Registry<Biome> biomes,
|
||||
Registry<DimensionSettings> dimensionSettings,
|
||||
long seed,
|
||||
CallbackInfoReturnable<SimpleRegistry<Dimension>> cir) {
|
||||
SimpleRegistry<Dimension> simpleregistry = cir.getReturnValue();
|
||||
|
||||
simpleregistry.register(SpatialStorageDimensionIds.DIMENSION_ID, new Dimension(() -> {
|
||||
return dimensionTypes.func_243576_d(SpatialStorageDimensionIds.DIMENSION_TYPE_ID);
|
||||
}, new SpatialStorageChunkGenerator(biomes)), Lifecycle.stable());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package appeng.mixins.spatial;
|
||||
|
||||
import appeng.spatial.SpatialStorageDimensionIds;
|
||||
import appeng.spatial.SpatialStorageHelper;
|
||||
import net.minecraft.block.PortalInfo;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
/**
|
||||
* This mixin sets the teleport destination, because otherwise Vanilla will not
|
||||
* move the player.
|
||||
*/
|
||||
@Mixin(Entity.class)
|
||||
public class EntityMixin {
|
||||
|
||||
@Inject(method = "func_241829_a", at = @At("HEAD"), cancellable = true, allow = 1)
|
||||
public void getTeleportTarget(ServerWorld destination, CallbackInfoReturnable<PortalInfo> cri) {
|
||||
// Check if a destination has been set for the entity currently being teleported
|
||||
if (destination.func_234923_W_() == SpatialStorageDimensionIds.WORLD_ID) {
|
||||
PortalInfo target = SpatialStorageHelper.getInstance().getTeleportTarget();
|
||||
if (target != null) {
|
||||
cri.setReturnValue(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,28 +1,25 @@
|
||||
package appeng.mixins.spatial;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import net.minecraft.client.world.DimensionRenderInfo;
|
||||
import net.minecraft.util.RegistryKey;
|
||||
import net.minecraft.world.DimensionType;
|
||||
|
||||
import appeng.spatial.SpatialStorageDimensionIds;
|
||||
import appeng.spatial.SpatialStorageSkyProperties;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectMap;
|
||||
import net.minecraft.client.world.DimensionRenderInfo;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(DimensionRenderInfo.class)
|
||||
public class SkyPropertiesMixin {
|
||||
|
||||
@Inject(method = "func_239215_a_", at = @At("HEAD"), cancellable = true)
|
||||
private static void byDimensionType(Optional<RegistryKey<DimensionType>> optional,
|
||||
CallbackInfoReturnable<DimensionRenderInfo> ci) {
|
||||
if (optional.orElse(null) == SpatialStorageDimensionIds.DIMENSION_TYPE_ID) {
|
||||
ci.setReturnValue(SpatialStorageSkyProperties.INSTANCE);
|
||||
}
|
||||
@Shadow
|
||||
private static Object2ObjectMap<ResourceLocation, DimensionRenderInfo> field_239208_a_/*BY_IDENTIFIER*/;
|
||||
|
||||
@Inject(method = "<clinit>", at = @At("TAIL"))
|
||||
private static void init(CallbackInfo ci) {
|
||||
field_239208_a_.put(SpatialStorageDimensionIds.SKY_PROPERTIES_ID, SpatialStorageSkyProperties.INSTANCE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public class SkyRenderMixin {
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
@Inject(method = "renderSky(Lcom/mojang/blaze3d/matrix/MatrixStack;F)V", at = @At("HEAD"), cancellable = true)
|
||||
public void renderSky(MatrixStack matrices, float tickDelta, CallbackInfo ci) {
|
||||
if (mc.world.func_234922_V_() == SpatialStorageDimensionIds.DIMENSION_TYPE_ID) {
|
||||
if (mc.world.func_234923_W_() == SpatialStorageDimensionIds.WORLD_ID) {
|
||||
SpatialSkyRender.getInstance().render(matrices);
|
||||
ci.cancel();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package appeng.mixins.structure;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.world.gen.feature.structure.Structure;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.gen.feature.StructureFeature;
|
||||
|
||||
/**
|
||||
* Allows access to the copy of _all_ structures that is maintained within each
|
||||
* instance of {@link Biome}, in order to add our new structure to it. Note that
|
||||
* this does not mean the structure will start _generating_ in this biome, it
|
||||
* will only continue to generate if an adjacent biome has started the structure
|
||||
* and it extends into this one.
|
||||
*/
|
||||
@Mixin(Biome.class)
|
||||
public interface BiomeAccessor {
|
||||
|
||||
@Accessor
|
||||
Map<Integer, List<Structure<?>>> getField_242421_g();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package appeng.mixins.structure;
|
||||
|
||||
import net.minecraft.world.gen.feature.IFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.structure.Structure;
|
||||
import net.minecraft.world.gen.feature.structure.StructureFeatures;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||
|
||||
import net.minecraft.world.gen.feature.StructureFeature;
|
||||
|
||||
@Mixin(StructureFeatures.class)
|
||||
public interface ConfiguredStructureFeaturesAccessor {
|
||||
|
||||
@Invoker("func_244162_a")
|
||||
static <FC extends IFeatureConfig, F extends Structure<FC>> StructureFeature<FC, F> register(
|
||||
String id, StructureFeature<FC, F> configuredStructureFeature) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package appeng.mixins;
|
||||
package appeng.mixins.structure;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package appeng.mixins.structure;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import net.minecraft.world.biome.BiomeGenerationSettings;
|
||||
import net.minecraft.world.gen.feature.StructureFeature;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
import net.minecraft.world.gen.feature.ConfiguredFeature;
|
||||
|
||||
/**
|
||||
* Allows the settings in a Biome's generation settings to be modified.
|
||||
*/
|
||||
@Mixin(BiomeGenerationSettings.class)
|
||||
public interface GenerationSettingsAccessor {
|
||||
|
||||
@Accessor("field_242484_f")
|
||||
List<List<Supplier<ConfiguredFeature<?, ?>>>> getFeatures();
|
||||
|
||||
@Accessor("field_242484_f")
|
||||
void setFeatures(List<List<Supplier<ConfiguredFeature<?, ?>>>> features);
|
||||
|
||||
@Accessor("field_242485_g")
|
||||
List<Supplier<StructureFeature<?, ?>>> getStructureFeatures();
|
||||
|
||||
@Accessor("field_242485_g")
|
||||
void setStructureFeatures(List<Supplier<StructureFeature<?, ?>>> structureFeatures);
|
||||
|
||||
}
|
||||
+5
-6
@@ -1,16 +1,15 @@
|
||||
package appeng.mixins;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||
package appeng.mixins.structure;
|
||||
|
||||
import net.minecraft.world.gen.GenerationStage;
|
||||
import net.minecraft.world.gen.feature.structure.Structure;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||
|
||||
@Mixin(Structure.class)
|
||||
public interface StructureAccessor {
|
||||
public interface StructureFeatureAccessor {
|
||||
|
||||
@Invoker("func_236394_a_")
|
||||
static <F extends Structure<?>> F register(String id, F feature, GenerationStage.Decoration defaultStage) {
|
||||
static <F extends Structure<?>> F register(String id, F structureFeature, GenerationStage.Decoration step) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ import net.minecraft.item.Items;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.tags.ITag;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.tags.Tag;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
@@ -82,6 +83,10 @@ public class AnnihilationPlanePart extends BasicStatePart implements IGridTickab
|
||||
public static final ResourceLocation TAG_BLACKLIST = new ResourceLocation(AppEng.MOD_ID,
|
||||
"blacklisted/annihilation_plane");
|
||||
|
||||
private static final ITag.INamedTag<Block> BLOCK_BLACKLIST = BlockTags.makeWrapperTag(TAG_BLACKLIST.toString());
|
||||
|
||||
private static final ITag.INamedTag<Item> ITEM_BLACKLIST = ItemTags.makeWrapperTag(TAG_BLACKLIST.toString());
|
||||
|
||||
private static final PlaneModels MODELS = new PlaneModels("part/annihilation_plane", "part/annihilation_plane_on");
|
||||
|
||||
@PartModels
|
||||
@@ -527,13 +532,11 @@ public class AnnihilationPlanePart extends BasicStatePart implements IGridTickab
|
||||
}
|
||||
|
||||
public static boolean isBlockBlacklisted(Block b) {
|
||||
ITag<Block> tag = BlockTags.getCollection().getOrCreate(TAG_BLACKLIST);
|
||||
return b.isIn(tag);
|
||||
return BLOCK_BLACKLIST.contains(b);
|
||||
}
|
||||
|
||||
public static boolean isItemBlacklisted(Item i) {
|
||||
ITag<Item> tag = ItemTags.getCollection().getOrCreate(TAG_BLACKLIST);
|
||||
return i.isIn(tag);
|
||||
return ITEM_BLACKLIST.contains(i);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -379,12 +379,12 @@ public class FormationPlanePart extends AbstractFormationPlanePart<IAEItemStack>
|
||||
|
||||
@Override
|
||||
public BlockPos getPos() {
|
||||
return this.rayTraceResult.getPos();
|
||||
return this.func_242401_i().getPos();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlace() {
|
||||
return this.world.getBlockState(this.rayTraceResult.getPos()).isReplaceable(this);
|
||||
return getWorld().getBlockState(this.getPos()).isReplaceable(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -110,7 +110,7 @@ public class SpatialStorageCommand implements ISubCommand {
|
||||
}
|
||||
}
|
||||
|
||||
throw new CommandException(ITextComponent.func_241827_a_("Couldn't find a plot for the current position."));
|
||||
throw new CommandException(ITextComponent.func_244388_a("Couldn't find a plot for the current position."));
|
||||
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ public class SpatialStorageCommand implements ISubCommand {
|
||||
TransitionInfo lastTransition = plot.getLastTransition();
|
||||
if (lastTransition == null) {
|
||||
throw new CommandException(
|
||||
ITextComponent.func_241827_a_("This plot doesn't have a last known transition."));
|
||||
ITextComponent.func_244388_a("This plot doesn't have a last known transition."));
|
||||
}
|
||||
|
||||
String command = getTeleportCommand(lastTransition.getWorldId(), lastTransition.getMin().add(0, 1, 0));
|
||||
@@ -212,7 +212,7 @@ public class SpatialStorageCommand implements ISubCommand {
|
||||
|
||||
if (!(cell.getItem() instanceof SpatialStorageCellItem)) {
|
||||
throw new CommandException(
|
||||
ITextComponent.func_241827_a_("Storage cell items don't implement the storage cell interface!"));
|
||||
ITextComponent.func_244388_a("Storage cell items don't implement the storage cell interface!"));
|
||||
}
|
||||
|
||||
SpatialStorageCellItem spatialCellItem = (SpatialStorageCellItem) cell.getItem();
|
||||
@@ -321,7 +321,7 @@ public class SpatialStorageCommand implements ISubCommand {
|
||||
}
|
||||
}
|
||||
|
||||
throw new CommandException(ITextComponent.func_241827_a_("Couldn't find a plot for the current position."));
|
||||
throw new CommandException(ITextComponent.func_244388_a("Couldn't find a plot for the current position."));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -172,8 +172,9 @@ public class TestMeteoritesCommand implements ISubCommand {
|
||||
msg.append(getClickablePosition(world, settings, pos)).append(restOfLine);
|
||||
|
||||
// Add a tooltip
|
||||
String biomeId = world.func_242406_i(pos).map(bk -> bk.func_240901_a_().toString()).orElse("unknown");
|
||||
ITextComponent tooltip = new StringTextComponent(settings.toString() + "\nBiome: ").deepCopy()
|
||||
.append(world.getBiome(pos).getDisplayName());
|
||||
.appendString(biomeId);
|
||||
msg.modifyStyle(style -> style.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, tooltip)));
|
||||
|
||||
sender.sendFeedback(msg, true);
|
||||
|
||||
@@ -31,8 +31,7 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.IServerWorld;
|
||||
import net.minecraft.world.chunk.IChunk;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
@@ -92,18 +91,14 @@ public final class CompassService {
|
||||
}
|
||||
}
|
||||
|
||||
public void tryUpdateArea(final IWorld w, ChunkPos chunkPos) {
|
||||
public void tryUpdateArea(final IServerWorld w, ChunkPos chunkPos) {
|
||||
// If this seems weird: during worldgen, WorldAccess is a specific region, but
|
||||
// getWorld is
|
||||
// still the server world. We do need to use the world access to get the chunk
|
||||
// in question
|
||||
// though, since during worldgen, it's not comitted to the actual world yet.
|
||||
World world = w.getWorld();
|
||||
if (!(world instanceof ServerWorld)) {
|
||||
return;
|
||||
}
|
||||
IChunk chunk = w.getChunk(chunkPos.x, chunkPos.z);
|
||||
updateArea((ServerWorld) world, chunk);
|
||||
updateArea(w.getWorld(), chunk);
|
||||
}
|
||||
|
||||
public void updateArea(final ServerWorld w, IChunk chunk) {
|
||||
|
||||
@@ -323,7 +323,7 @@ public class CachedPlane {
|
||||
|
||||
WorldData.instance().compassData().service().updateArea(this.getWorld(), c);
|
||||
|
||||
SChunkDataPacket cdp = new SChunkDataPacket(c, verticalBits, false);
|
||||
SChunkDataPacket cdp = new SChunkDataPacket(c, verticalBits);
|
||||
world.getChunkProvider().chunkManager.getTrackingPlayers(c.getPos(), false)
|
||||
.forEach(spe -> spe.connection.sendPacket(cdp));
|
||||
}
|
||||
|
||||
@@ -20,33 +20,24 @@ package appeng.spatial;
|
||||
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.BiomeAmbience;
|
||||
import net.minecraft.world.biome.BiomeGenerationSettings;
|
||||
import net.minecraft.world.biome.MobSpawnInfo;
|
||||
import net.minecraft.world.gen.surfacebuilders.ConfiguredSurfaceBuilder;
|
||||
import net.minecraft.world.gen.surfacebuilders.SurfaceBuilder;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
/**
|
||||
* The single biome used within the spatial storage world.
|
||||
*/
|
||||
public class SpatialStorageBiome extends Biome {
|
||||
public class SpatialStorageBiome {
|
||||
|
||||
public static final SpatialStorageBiome INSTANCE = new SpatialStorageBiome();
|
||||
|
||||
public SpatialStorageBiome() {
|
||||
super(new Biome.Builder()
|
||||
.surfaceBuilder(
|
||||
new ConfiguredSurfaceBuilder<>(SurfaceBuilder.NOPE, SurfaceBuilder.STONE_STONE_GRAVEL_CONFIG))
|
||||
.precipitation(RainType.NONE).category(Category.NONE).depth(0).scale(1)
|
||||
// Copied from the vanilla void biome
|
||||
.temperature(0.5F).downfall(0.5F).func_235097_a_(new BiomeAmbience.Builder().setWaterColor(4159204)
|
||||
.setWaterFogColor(329011).setFogColor(0).build())
|
||||
.parent(null));
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public int getSkyColor() {
|
||||
return 0x111111;
|
||||
}
|
||||
public static final Biome INSTANCE = new Biome.Builder()
|
||||
.func_242457_a(new BiomeGenerationSettings.Builder()
|
||||
.func_242517_a(new ConfiguredSurfaceBuilder<>(SurfaceBuilder.NOPE, SurfaceBuilder.STONE_STONE_GRAVEL_CONFIG))
|
||||
.func_242508_a())
|
||||
.precipitation(Biome.RainType.NONE).category(Biome.Category.NONE).depth(0).scale(1)
|
||||
// Copied from the vanilla void biome
|
||||
.temperature(0.5F).downfall(0.5F).func_235097_a_(new BiomeAmbience.Builder().setWaterColor(4159204)
|
||||
.setWaterFogColor(329011).setFogColor(0).func_242539_d(0x111111).build())
|
||||
.func_242458_a(new MobSpawnInfo.Builder().func_242572_a(0).func_242577_b()).func_242455_a();
|
||||
|
||||
}
|
||||
|
||||
@@ -18,20 +18,17 @@
|
||||
|
||||
package appeng.spatial;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Optional;
|
||||
|
||||
import appeng.core.Api;
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.registry.RegistryLookupCodec;
|
||||
import net.minecraft.world.Blockreader;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.BiomeManager;
|
||||
import net.minecraft.world.biome.provider.BiomeProvider;
|
||||
import net.minecraft.world.biome.provider.SingleBiomeProvider;
|
||||
import net.minecraft.world.chunk.IChunk;
|
||||
import net.minecraft.world.gen.ChunkGenerator;
|
||||
@@ -41,25 +38,36 @@ import net.minecraft.world.gen.WorldGenRegion;
|
||||
import net.minecraft.world.gen.feature.structure.StructureManager;
|
||||
import net.minecraft.world.gen.settings.DimensionStructuresSettings;
|
||||
|
||||
import appeng.core.Api;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Chunk generator the spatial storage world.
|
||||
*/
|
||||
public class SpatialStorageChunkGenerator extends ChunkGenerator {
|
||||
|
||||
/**
|
||||
* This codec is necessary to restore the actual instance of the Biome we use,
|
||||
* since it is sources from the dynamic registries and <em>must be the same
|
||||
* object as in the registry!</em>.
|
||||
* <p>
|
||||
* If it was not the same object, then the Object->ID lookup would fail since it
|
||||
* uses an identity hashmap internally.
|
||||
*/
|
||||
public static final Codec<SpatialStorageChunkGenerator> CODEC = RegistryLookupCodec.func_244331_a(Registry.BIOME_KEY)
|
||||
.xmap(SpatialStorageChunkGenerator::new, SpatialStorageChunkGenerator::getBiomeRegistry).stable().codec();
|
||||
|
||||
private final Registry<Biome> biomeRegistry;
|
||||
|
||||
private final Blockreader columnSample;
|
||||
|
||||
public static final SpatialStorageChunkGenerator INSTANCE = new SpatialStorageChunkGenerator();
|
||||
|
||||
public static final Codec<SpatialStorageChunkGenerator> CODEC = RecordCodecBuilder
|
||||
.create((instance) -> instance.stable(INSTANCE));
|
||||
|
||||
private final BlockState defaultBlockState;
|
||||
|
||||
private SpatialStorageChunkGenerator() {
|
||||
super(createBiomeProvider(), createSettings());
|
||||
public SpatialStorageChunkGenerator(Registry<Biome> biomeRegistry) {
|
||||
super(createBiomeSource(biomeRegistry), createSettings());
|
||||
this.defaultBlockState = Api.instance().definitions().blocks().matrixFrame().block().getDefaultState();
|
||||
this.biomeRegistry = biomeRegistry;
|
||||
|
||||
// Vertical sample is mostly used for Feature generation, for those purposes
|
||||
// we're all filled with matrix blocks
|
||||
@@ -73,8 +81,12 @@ public class SpatialStorageChunkGenerator extends ChunkGenerator {
|
||||
return CODEC;
|
||||
}
|
||||
|
||||
private static BiomeProvider createBiomeProvider() {
|
||||
return new SingleBiomeProvider(SpatialStorageBiome.INSTANCE);
|
||||
private static SingleBiomeProvider createBiomeSource(Registry<Biome> biomeRegistry) {
|
||||
return new SingleBiomeProvider(biomeRegistry.func_243576_d/*getOrThrow*/(SpatialStorageDimensionIds.BIOME_KEY));
|
||||
}
|
||||
|
||||
public Registry<Biome> getBiomeRegistry() {
|
||||
return biomeRegistry;
|
||||
}
|
||||
|
||||
private static DimensionStructuresSettings createSettings() {
|
||||
|
||||
@@ -9,6 +9,7 @@ import net.minecraft.world.World;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
import appeng.mixins.spatial.DimensionTypeMixin;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
/**
|
||||
* IDs for the spatial storage world related dimension objects.
|
||||
@@ -33,7 +34,8 @@ public final class SpatialStorageDimensionIds {
|
||||
* ID of the {@link net.minecraft.world.biome.Biome} used for the spatial
|
||||
* storage world.
|
||||
*/
|
||||
public static final ResourceLocation BIOME_ID = AppEng.makeId("spatial_storage");
|
||||
public static final RegistryKey<Biome> BIOME_KEY = RegistryKey.func_240903_a_(Registry.BIOME_KEY,
|
||||
AppEng.makeId("spatial_storage"));
|
||||
|
||||
/**
|
||||
* ID of the {@link Dimension} used for the spatial storage dimension.
|
||||
@@ -51,6 +53,12 @@ public final class SpatialStorageDimensionIds {
|
||||
public static final RegistryKey<World> WORLD_ID = RegistryKey.func_240903_a_(Registry.WORLD_KEY,
|
||||
AppEng.makeId("spatial_storage"));
|
||||
|
||||
/**
|
||||
* ID of the {@link net.minecraft.client.world.DimensionRenderInfo} used for the
|
||||
* spatial storage world.
|
||||
*/
|
||||
public static ResourceLocation SKY_PROPERTIES_ID = AppEng.makeId("spatial_storage");
|
||||
|
||||
private SpatialStorageDimensionIds() {
|
||||
}
|
||||
|
||||
|
||||
@@ -25,11 +25,13 @@ import java.util.function.Function;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.PortalInfo;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.ChunkStatus;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
@@ -50,6 +52,16 @@ public class SpatialStorageHelper {
|
||||
return instance;
|
||||
}
|
||||
|
||||
private final ThreadLocal<PortalInfo> teleportTarget = new ThreadLocal<>();
|
||||
|
||||
/**
|
||||
* If an entity is currently being teleported, this will return the target
|
||||
* within the target dimension.
|
||||
*/
|
||||
public PortalInfo getTeleportTarget() {
|
||||
return teleportTarget.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Mostly from dimensional doors.. which mostly got it form X-Comp.
|
||||
*
|
||||
@@ -98,11 +110,23 @@ public class SpatialStorageHelper {
|
||||
ChunkStatus.FULL, true);
|
||||
|
||||
if (entity instanceof ServerPlayerEntity
|
||||
&& link.dim.func_234922_V_() == SpatialStorageDimensionIds.DIMENSION_TYPE_ID) {
|
||||
&& link.dim.func_234923_W_() == SpatialStorageDimensionIds.WORLD_ID) {
|
||||
AppEng.instance().getAdvancementTriggers().getSpatialExplorer().trigger((ServerPlayerEntity) entity);
|
||||
}
|
||||
|
||||
entity.changeDimension(link.dim, new METeleporter(link));
|
||||
// Store in a threadlocal so that EntityMixin can return it for the Vanilla
|
||||
// logic to use
|
||||
teleportTarget.set(new PortalInfo(new Vector3d(link.x, link.y, link.z), Vector3d.ZERO, entity.rotationYaw, entity.rotationPitch));
|
||||
try {
|
||||
entity = entity.changeDimension(link.dim, new ITeleporter() {
|
||||
@Override
|
||||
public Entity placeEntity(Entity entity, ServerWorld currentWorld, ServerWorld destWorld, float yaw, Function<Boolean, Entity> repositionEntity) {
|
||||
return repositionEntity.apply(false);
|
||||
}
|
||||
});
|
||||
} finally {
|
||||
teleportTarget.remove();
|
||||
}
|
||||
|
||||
if (!passengersOnOtherSide.isEmpty()) {
|
||||
for (Entity passanger : passengersOnOtherSide) {
|
||||
@@ -238,22 +262,4 @@ public class SpatialStorageHelper {
|
||||
}
|
||||
}
|
||||
|
||||
private static class METeleporter implements ITeleporter {
|
||||
|
||||
private final TelDestination destination;
|
||||
|
||||
METeleporter(final TelDestination d) {
|
||||
this.destination = d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity placeEntity(Entity entity, ServerWorld currentWorld, ServerWorld destWorld, float yaw,
|
||||
Function<Boolean, Entity> repositionEntity) {
|
||||
Entity newEntity = repositionEntity.apply(false);
|
||||
newEntity.rotationYaw = yaw;
|
||||
newEntity.setPositionAndUpdate(this.destination.x, this.destination.y, this.destination.z);
|
||||
newEntity.setMotion(0, 0, 0);
|
||||
return newEntity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package appeng.worldgen;
|
||||
|
||||
import appeng.mixins.structure.BiomeAccessor;
|
||||
import appeng.mixins.structure.GenerationSettingsAccessor;
|
||||
import com.google.common.collect.Lists;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.gen.GenerationStage;
|
||||
import net.minecraft.world.gen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.gen.feature.StructureFeature;
|
||||
import net.minecraft.world.gen.feature.structure.Structure;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public final class BiomeModifier {
|
||||
|
||||
private final BiomeAccessor biomeAccessor;
|
||||
|
||||
private final GenerationSettingsAccessor generationSettingsAccessor;
|
||||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
public BiomeModifier(Biome biome) {
|
||||
this.biomeAccessor = (BiomeAccessor) (Object) biome;
|
||||
this.generationSettingsAccessor = (GenerationSettingsAccessor) biome.func_242440_e();
|
||||
}
|
||||
|
||||
public void addFeature(GenerationStage.Decoration step, ConfiguredFeature<?, ?> feature) {
|
||||
|
||||
int stepIndex = step.ordinal();
|
||||
List<List<Supplier<ConfiguredFeature<?, ?>>>> featuresByStep = new ArrayList<>(
|
||||
generationSettingsAccessor.getFeatures());
|
||||
|
||||
while (featuresByStep.size() <= stepIndex) {
|
||||
featuresByStep.add(Lists.newArrayList());
|
||||
}
|
||||
|
||||
List<Supplier<ConfiguredFeature<?, ?>>> features = new ArrayList<>(featuresByStep.get(stepIndex));
|
||||
features.add(() -> feature);
|
||||
featuresByStep.set(stepIndex, features);
|
||||
|
||||
generationSettingsAccessor.setFeatures(featuresByStep);
|
||||
|
||||
}
|
||||
|
||||
public void addStructureFeature(StructureFeature<?, ?> structure) {
|
||||
List<Supplier<StructureFeature<?, ?>>> features = new ArrayList<>(
|
||||
generationSettingsAccessor.getStructureFeatures());
|
||||
features.add(() -> structure);
|
||||
generationSettingsAccessor.setStructureFeatures(features);
|
||||
|
||||
// Add it to the structures that will generate pieces within this biome,
|
||||
// this is only half-correct since a structure can start in an adjacent biome
|
||||
// and extend into biomes that would usually not start the structure
|
||||
Map<Integer, List<Structure<?>>> structuresByStage = biomeAccessor.getField_242421_g();
|
||||
int step = structure.field_236268_b_.func_236396_f_().ordinal();
|
||||
if (!structuresByStage.containsKey(step)) {
|
||||
structuresByStage.put(step, new ArrayList<>());
|
||||
}
|
||||
structuresByStage.get(step).add(structure.field_236268_b_);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,7 +15,7 @@ public class ChargedQuartzOreConfig implements IFeatureConfig {
|
||||
public static final Codec<ChargedQuartzOreConfig> CODEC = RecordCodecBuilder.create((instance) -> instance
|
||||
.group(BlockState.BLOCKSTATE_CODEC.fieldOf("target").forGetter((config) -> config.target),
|
||||
BlockState.BLOCKSTATE_CODEC.fieldOf("state").forGetter((config) -> config.state),
|
||||
Codec.FLOAT.fieldOf("chance").withDefault(0f).forGetter((config) -> config.chance))
|
||||
Codec.FLOAT.fieldOf("chance").orElse(0f).forGetter((config) -> config.chance))
|
||||
.apply(instance, ChargedQuartzOreConfig::new));
|
||||
|
||||
public final BlockState target;
|
||||
|
||||
@@ -11,7 +11,6 @@ import net.minecraft.world.chunk.IChunk;
|
||||
import net.minecraft.world.gen.ChunkGenerator;
|
||||
import net.minecraft.world.gen.Heightmap;
|
||||
import net.minecraft.world.gen.feature.Feature;
|
||||
import net.minecraft.world.gen.feature.structure.StructureManager;
|
||||
|
||||
/**
|
||||
* Extends {@link net.minecraft.world.gen.feature.OreFeature} by also allowing
|
||||
@@ -27,8 +26,7 @@ public class ChargedQuartzOreFeature extends Feature<ChargedQuartzOreConfig> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_230362_a_(ISeedReader worldIn, StructureManager structureAccessor, ChunkGenerator generator,
|
||||
Random rand, BlockPos pos, ChargedQuartzOreConfig config) {
|
||||
public boolean func_241855_a(ISeedReader worldIn, ChunkGenerator generator, Random rand, BlockPos pos, ChargedQuartzOreConfig config) {
|
||||
ChunkPos chunkPos = new ChunkPos(pos);
|
||||
|
||||
BlockPos.Mutable bpos = new BlockPos.Mutable();
|
||||
|
||||
@@ -9,6 +9,7 @@ import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.provider.BiomeProvider;
|
||||
import net.minecraft.world.gen.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.NoFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.StructureFeature;
|
||||
import net.minecraft.world.gen.feature.structure.Structure;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
@@ -19,6 +20,9 @@ public class MeteoriteStructure extends Structure<NoFeatureConfig> {
|
||||
|
||||
public static final Structure<NoFeatureConfig> INSTANCE = new MeteoriteStructure(NoFeatureConfig.field_236558_a_);
|
||||
|
||||
public static final StructureFeature<NoFeatureConfig, ? extends Structure<NoFeatureConfig>> CONFIGURED_INSTANCE = INSTANCE
|
||||
.func_236391_a_(NoFeatureConfig.field_236559_b_);
|
||||
|
||||
public MeteoriteStructure(Codec<NoFeatureConfig> configCodec) {
|
||||
super(configCodec);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ import appeng.worldgen.meteorite.fallout.FalloutMode;
|
||||
public class MeteoriteStructurePiece extends StructurePiece {
|
||||
|
||||
public static final IStructurePieceType TYPE = IStructurePieceType.register(MeteoriteStructurePiece::new,
|
||||
"AE2MTRT");
|
||||
"ae2mtrt");
|
||||
|
||||
public static void register() {
|
||||
// THIS MUST BE CALLED otherwise the static initializer above will not run,
|
||||
|
||||
@@ -12,9 +12,9 @@ import net.minecraft.tags.ITag;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MutableBoundingBox;
|
||||
import net.minecraft.util.registry.DynamicRegistries;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.Biome.Category;
|
||||
import net.minecraft.world.biome.Biome.TempCategory;
|
||||
import net.minecraft.world.gen.ChunkGenerator;
|
||||
import net.minecraft.world.gen.Heightmap;
|
||||
import net.minecraft.world.gen.Heightmap.Type;
|
||||
@@ -27,17 +27,18 @@ import appeng.worldgen.meteorite.fallout.FalloutMode;
|
||||
|
||||
public class MeteoriteStructureStart extends StructureStart<NoFeatureConfig> {
|
||||
|
||||
private final ITag<Block> sandTag = BlockTags.getCollection().getOrCreate(new ResourceLocation("minecraft:sand"));
|
||||
private final ITag<Block> sandTag = BlockTags.getCollection().func_241834_b(new ResourceLocation("minecraft:sand"));
|
||||
private final ITag<Block> terracottaTag = BlockTags.getCollection()
|
||||
.getOrCreate(new ResourceLocation("forge:terracotta"));
|
||||
.func_241834_b(new ResourceLocation("forge:terracotta"));
|
||||
|
||||
public MeteoriteStructureStart(Structure<NoFeatureConfig> p_i225815_1_, int p_i225815_2_, int p_i225815_3_,
|
||||
MutableBoundingBox p_i225815_4_, int p_i225815_5_, long p_i225815_6_) {
|
||||
super(p_i225815_1_, p_i225815_2_, p_i225815_3_, p_i225815_4_, p_i225815_5_, p_i225815_6_);
|
||||
}
|
||||
|
||||
public void func_230364_a_(ChunkGenerator generator, TemplateManager templateManagerIn, int chunkX, int chunkZ,
|
||||
Biome biome, NoFeatureConfig config) {
|
||||
@Override
|
||||
public void func_230364_a_(DynamicRegistries dynamicRegistryManager, ChunkGenerator generator, TemplateManager templateManager, int chunkX, int chunkZ,
|
||||
Biome biome, NoFeatureConfig config) {
|
||||
final int centerX = chunkX * 16 + this.rand.nextInt(16);
|
||||
final int centerZ = chunkZ * 16 + this.rand.nextInt(16);
|
||||
final float meteoriteRadius = (this.rand.nextFloat() * 6.0f) + 2;
|
||||
@@ -75,7 +76,7 @@ public class MeteoriteStructureStart extends StructureStart<NoFeatureConfig> {
|
||||
boolean craterLake = this.locateWaterAroundTheCrater(generator, actualPos, meteoriteRadius);
|
||||
CraterType craterType = this.determineCraterType(spawnBiome);
|
||||
boolean pureCrater = this.rand.nextFloat() > .9f;
|
||||
FalloutMode fallout = getFalloutFromBaseBlock(spawnBiome.getSurfaceBuilderConfig().getTop());
|
||||
FalloutMode fallout = getFalloutFromBaseBlock(spawnBiome.func_242440_e().func_242502_e().getTop());
|
||||
|
||||
components.add(
|
||||
new MeteoriteStructurePiece(actualPos, meteoriteRadius, craterType, fallout, pureCrater, craterLake));
|
||||
@@ -118,7 +119,9 @@ public class MeteoriteStructureStart extends StructureStart<NoFeatureConfig> {
|
||||
}
|
||||
|
||||
private CraterType determineCraterType(Biome biome) {
|
||||
final TempCategory temp = biome.getTempCategory();
|
||||
// The temperature thresholds below are taken from older Vanilla code
|
||||
// (temperature categories)
|
||||
final float temp = biome.func_242445_k();
|
||||
final Category category = biome.getCategory();
|
||||
|
||||
// No craters in oceans
|
||||
@@ -135,7 +138,7 @@ public class MeteoriteStructureStart extends StructureStart<NoFeatureConfig> {
|
||||
}
|
||||
|
||||
// Warm biomes, higher chance for lava
|
||||
if (temp == TempCategory.WARM) {
|
||||
if (temp >= 1) {
|
||||
|
||||
// 50% chance to actually spawn as lava
|
||||
final boolean lava = rand.nextFloat() > .5f;
|
||||
@@ -158,7 +161,7 @@ public class MeteoriteStructureStart extends StructureStart<NoFeatureConfig> {
|
||||
}
|
||||
|
||||
// Temperate biomes. Water or maybe lava
|
||||
if (temp == TempCategory.MEDIUM) {
|
||||
if (temp < 1 && temp >= 0.2) {
|
||||
// 75% chance to actually spawn with a crater lake
|
||||
final boolean lake = rand.nextFloat() > .25f;
|
||||
// 20% to spawn with lava
|
||||
@@ -184,7 +187,7 @@ public class MeteoriteStructureStart extends StructureStart<NoFeatureConfig> {
|
||||
}
|
||||
|
||||
// Cold biomes, Snow or Ice, maybe water and very rarely lava.
|
||||
if (temp == TempCategory.COLD) {
|
||||
if (temp < 0.2) {
|
||||
// 75% chance to actually spawn with a crater lake
|
||||
final boolean lake = rand.nextFloat() > .25f;
|
||||
// 5% to spawn with lava
|
||||
|
||||
@@ -36,7 +36,7 @@ public class FalloutCopy extends Fallout {
|
||||
public FalloutCopy(final IWorld w, BlockPos pos, final MeteoriteBlockPutter putter, final BlockState skyStone) {
|
||||
super(putter, skyStone);
|
||||
this.putter = putter;
|
||||
this.block = w.getBiome(pos).getSurfaceBuilderConfig().getTop();
|
||||
this.block = w.getBiome(pos).func_242440_e().func_242502_e().getTop();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,6 +6,7 @@ displayURL="https://github.com/AppliedEnergistics/Applied-Energistics-2"
|
||||
logoFile="logo.png"
|
||||
#credits="Thanks for this example mod goes to Java"
|
||||
authors="TeamAppliedEnergistics"
|
||||
license="See GitHub repository for details"
|
||||
|
||||
[[mods]]
|
||||
modId="appliedenergistics2"
|
||||
@@ -16,13 +17,13 @@ description="A Mod about Matter, Energy and using them to conquer the world.."
|
||||
[[dependencies.appliedenergistics2]]
|
||||
modId="forge"
|
||||
mandatory=true
|
||||
versionRange="[32.0.108,33.0.0)"
|
||||
versionRange="[33.0.0,34.0.0)"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
|
||||
[[dependencies.appliedenergistics2]]
|
||||
modId="minecraft"
|
||||
mandatory=true
|
||||
versionRange="[1.16.1]"
|
||||
versionRange="[1.16.2]"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
|
||||
@@ -7,9 +7,14 @@
|
||||
"mixins": [
|
||||
"spatial.DimensionTypeMixin",
|
||||
"spatial.DimensionOptionMixin",
|
||||
"ThreadedAnvilChunkStorageAccessor",
|
||||
"DimensionStructuresSettingsMixin",
|
||||
"StructureAccessor"
|
||||
"spatial.EntityMixin",
|
||||
"spatial.BiomesMixin",
|
||||
"structure.DimensionStructuresSettingsMixin",
|
||||
"structure.ConfiguredStructureFeaturesAccessor",
|
||||
"structure.StructureFeatureAccessor",
|
||||
"structure.GenerationSettingsAccessor",
|
||||
"structure.BiomeAccessor",
|
||||
"feature.ConfiguredFeaturesAccessor"
|
||||
],
|
||||
"client": [
|
||||
"spatial.SkyRenderMixin",
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"type": "appliedenergistics2:spatial_storage",
|
||||
"generator": {
|
||||
"type": "appliedenergistics2:spatial_storage"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user