mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-17 14:21:08 +00:00
add NetherFossilOptimization
This commit is contained in:
+42
@@ -0,0 +1,42 @@
|
|||||||
|
package com.dfsek.terra.fabric.mixin.fix;
|
||||||
|
|
||||||
|
import com.dfsek.terra.fabric.generation.FabricChunkGeneratorWrapper;
|
||||||
|
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.Blocks;
|
||||||
|
import net.minecraft.structure.NetherFossilGenerator;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.Direction;
|
||||||
|
import net.minecraft.util.math.random.ChunkRandom;
|
||||||
|
import net.minecraft.world.EmptyBlockView;
|
||||||
|
import net.minecraft.world.gen.HeightContext;
|
||||||
|
import net.minecraft.world.gen.chunk.VerticalBlockSample;
|
||||||
|
import net.minecraft.world.gen.heightprovider.HeightProvider;
|
||||||
|
import net.minecraft.world.gen.structure.NetherFossilStructure;
|
||||||
|
import net.minecraft.world.gen.structure.Structure;
|
||||||
|
import net.minecraft.world.gen.structure.Structure.Context;
|
||||||
|
import net.minecraft.world.gen.structure.Structure.StructurePosition;
|
||||||
|
import org.spongepowered.asm.mixin.Final;
|
||||||
|
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.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable fossil generation in Terra worlds, as they are very expensive due to consistently triggering cache misses.
|
||||||
|
*
|
||||||
|
* Currently, on Fabric, Terra cannot be specified as a Nether generator. TODO: logic to turn fossils back on if chunk generator is in nether.
|
||||||
|
*/
|
||||||
|
@Mixin(NetherFossilStructure.class)
|
||||||
|
public class NetherFossilOptimization {
|
||||||
|
@Inject(method = "getStructurePosition", at = @At("HEAD"), cancellable = true)
|
||||||
|
public void injectFossilPositions(Context context, CallbackInfoReturnable<Optional<StructurePosition>> cir) {
|
||||||
|
if(context.chunkGenerator() instanceof FabricChunkGeneratorWrapper) {
|
||||||
|
cir.setReturnValue(Optional.empty());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,52 +1,53 @@
|
|||||||
{
|
{
|
||||||
"required": true,
|
"required": true,
|
||||||
"minVersion": "0.8",
|
"minVersion": "0.8",
|
||||||
"package": "com.dfsek.terra.fabric.mixin",
|
"package": "com.dfsek.terra.fabric.mixin",
|
||||||
"compatibilityLevel": "JAVA_17",
|
"compatibilityLevel": "JAVA_17",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"access.MobSpawnerLogicAccessor",
|
"access.MobSpawnerLogicAccessor",
|
||||||
"access.StateAccessor",
|
"access.StateAccessor",
|
||||||
"access.StructureAccessorAccessor",
|
"access.StructureAccessorAccessor",
|
||||||
"cache.ChunkRegionMixin",
|
"cache.ChunkRegionMixin",
|
||||||
"cache.ProtoChunkMixin",
|
"cache.ProtoChunkMixin",
|
||||||
"compat.GenerationSettingsFloraFeaturesMixin",
|
"compat.GenerationSettingsFloraFeaturesMixin",
|
||||||
"implementations.BiomeMixin",
|
"fix.NetherFossilOptimization",
|
||||||
"implementations.HandleImplementationMixin",
|
"implementations.BiomeMixin",
|
||||||
"implementations.block.BlockMixin",
|
"implementations.HandleImplementationMixin",
|
||||||
"implementations.block.entity.BlockEntityMixin",
|
"implementations.block.BlockMixin",
|
||||||
"implementations.block.entity.LootableContainerBlockEntityMixin",
|
"implementations.block.entity.BlockEntityMixin",
|
||||||
"implementations.block.entity.MobSpawnerBlockEntityMixin",
|
"implementations.block.entity.LootableContainerBlockEntityMixin",
|
||||||
"implementations.block.entity.SignBlockEntityMixin",
|
"implementations.block.entity.MobSpawnerBlockEntityMixin",
|
||||||
"implementations.block.state.BlockStateMixin",
|
"implementations.block.entity.SignBlockEntityMixin",
|
||||||
"implementations.block.state.PropertyMixin",
|
"implementations.block.state.BlockStateMixin",
|
||||||
"implementations.chunk.ChunkRegionMixin",
|
"implementations.block.state.PropertyMixin",
|
||||||
"implementations.chunk.WorldChunkMixin",
|
"implementations.chunk.ChunkRegionMixin",
|
||||||
"implementations.chunk.data.ProtoChunkMixin",
|
"implementations.chunk.WorldChunkMixin",
|
||||||
"implementations.entity.EntityMixin",
|
"implementations.chunk.data.ProtoChunkMixin",
|
||||||
"implementations.entity.EntityTypeMixin",
|
"implementations.entity.EntityMixin",
|
||||||
"implementations.entity.PlayerEntityMixin",
|
"implementations.entity.EntityTypeMixin",
|
||||||
"implementations.entity.ServerCommandSourceMixin",
|
"implementations.entity.PlayerEntityMixin",
|
||||||
"implementations.inventory.LockableContainerBlockEntityMixin",
|
"implementations.entity.ServerCommandSourceMixin",
|
||||||
"implementations.inventory.item.ItemMixin",
|
"implementations.inventory.LockableContainerBlockEntityMixin",
|
||||||
"implementations.inventory.item.ItemStackMixin",
|
"implementations.inventory.item.ItemMixin",
|
||||||
"implementations.inventory.meta.EnchantmentMixin",
|
"implementations.inventory.item.ItemStackMixin",
|
||||||
"implementations.inventory.meta.ItemStackDamageableMixin",
|
"implementations.inventory.meta.EnchantmentMixin",
|
||||||
"implementations.inventory.meta.ItemStackMetaMixin",
|
"implementations.inventory.meta.ItemStackDamageableMixin",
|
||||||
"implementations.world.ChunkRegionMixin",
|
"implementations.inventory.meta.ItemStackMetaMixin",
|
||||||
"implementations.world.ServerWorldMixin",
|
"implementations.world.ChunkRegionMixin",
|
||||||
"lifecycle.DataPackContentsMixin",
|
"implementations.world.ServerWorldMixin",
|
||||||
"lifecycle.MinecraftServerMixin",
|
"lifecycle.DataPackContentsMixin",
|
||||||
"lifecycle.NoiseConfigMixin",
|
"lifecycle.MinecraftServerMixin",
|
||||||
"lifecycle.RegistryMixin"
|
"lifecycle.NoiseConfigMixin",
|
||||||
],
|
"lifecycle.RegistryMixin"
|
||||||
"client": [
|
],
|
||||||
"lifecycle.client.MinecraftClientMixin"
|
"client": [
|
||||||
],
|
"lifecycle.client.MinecraftClientMixin"
|
||||||
"server": [
|
],
|
||||||
"lifecycle.server.ServerMainMixin"
|
"server": [
|
||||||
],
|
"lifecycle.server.ServerMainMixin"
|
||||||
"injectors": {
|
],
|
||||||
"defaultRequire": 1
|
"injectors": {
|
||||||
},
|
"defaultRequire": 1
|
||||||
"refmap": "terra-refmap.json"
|
},
|
||||||
|
"refmap": "terra-refmap.json"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user