Dev_S

Untitled

Jan 23rd, 2021
1,204
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package net.devtech.orecentration.mixin;
  2.  
  3. import net.devtech.orecentration.OreCentration;
  4. import org.spongepowered.asm.mixin.Mixin;
  5. import org.spongepowered.asm.mixin.injection.At;
  6. import org.spongepowered.asm.mixin.injection.Redirect;
  7.  
  8. import net.minecraft.block.Block;
  9. import net.minecraft.world.gen.carver.Carver;
  10. import net.minecraft.world.gen.carver.NetherCaveCarver;
  11. import net.minecraft.world.gen.carver.UnderwaterCaveCarver;
  12. import net.minecraft.world.gen.carver.UnderwaterRavineCarver;
  13. import net.minecraft.world.gen.chunk.ChunkGeneratorSettings;
  14. import net.minecraft.world.gen.feature.ConfiguredFeatures;
  15. import net.minecraft.world.gen.feature.Feature;
  16. import net.minecraft.world.gen.feature.LakeFeature;
  17. import net.minecraft.world.gen.feature.VoidStartPlatformFeature;
  18. import net.minecraft.world.gen.surfacebuilder.SurfaceBuilder;
  19.  
  20. @Mixin({
  21.         Feature.class,
  22.         SurfaceBuilder.class,
  23.         ChunkGeneratorSettings.class,
  24.         UnderwaterRavineCarver.class,
  25.         UnderwaterCaveCarver.class,
  26.         NetherCaveCarver.class,
  27.         Carver.class,
  28.         ConfiguredFeatures.class,
  29.         ConfiguredFeatures.Configs.class,
  30.         ConfiguredFeatures.States.class,
  31.         LakeFeature.class,
  32.         VoidStartPlatformFeature.class
  33. })
  34. public class StoneReplaceMixin {
  35.     @Redirect(method = {
  36.             "<init>(Lcom/mojang/serialization/Codec;I)V",
  37.             "<init>(Lcom/mojang/serialization/Codec;)V",
  38.             "generate(Lnet/minecraft/world/StructureWorldAccess;Lnet/minecraft/world/gen/chunk/ChunkGenerator;Ljava/util/Random;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/world/gen/feature/DefaultFeatureConfig;)Z"
  39.     }, at = @At(value = "FIELD", target = "Lnet/minecraft/block/Blocks;STONE:Lnet/minecraft/block/Block;"), require = 0)
  40.     public Block getStone() {
  41.         return OreCentration.NATURAL_STONE;
  42.     }
  43.  
  44.     @Redirect(method = {
  45.             "isStone(Lnet/minecraft/block/Block;)Z",
  46.             "<clinit>()V",
  47.             "createSurfaceSettings(Lnet/minecraft/world/gen/chunk/StructuresConfig;ZLnet/minecraft/util/Identifier;)Lnet/minecraft/world/gen/chunk/ChunkGeneratorSettings;",
  48.     }, at = @At(value = "FIELD", target = "Lnet/minecraft/block/Blocks;STONE:Lnet/minecraft/block/Block;"), require = 0)
  49.     private static Block getStoneStatic() {
  50.         return OreCentration.NATURAL_STONE;
  51.     }
  52. }
  53.  
RAW Paste Data