Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.16.4] My structure doesnt work
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 2
Klarks

[1.16.4] My structure doesnt work

By Klarks, January 19 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

Klarks    0

Klarks

Klarks    0

  • Stone Miner
  • Klarks
  • Members
  • 0
  • 95 posts
Posted January 19

When i tranna locate my structure minecraft says "Could not find that structure nearby ". What i did wrong

public class MyStructure {
    public static final DeferredRegister<Structure<?>> DEFERRED_REGISTRY_STRUCTURE = DeferredRegister.create(ForgeRegistries.STRUCTURE_FEATURES, Main.MODID);
    public static final RegistryObject<Structure<NoFeatureConfig>> RUN_DOWN_HOUSE = registerStructure("run_down_house", () -> (new MyPieces(NoFeatureConfig.field_236558_a_)));

    private static <T extends Structure<?>> RegistryObject<T> registerStructure(String name, Supplier<T> structure) {
        return DEFERRED_REGISTRY_STRUCTURE.register(name, structure);
    }

    public static void setupStructures() {
        setupMapSpacingAndLand(
                RUN_DOWN_HOUSE.get(),
                new StructureSeparationSettings(10 ,
                        5 ,
                        1234567890 ),
                true);
    }

    public static <F extends Structure<?>> void setupMapSpacingAndLand(
            F structure,
            StructureSeparationSettings structureSeparationSettings,
            boolean transformSurroundingLand)
    {
        Structure.NAME_STRUCTURE_BIMAP.put(structure.getRegistryName().toString(), structure);

        if(transformSurroundingLand)
            Structure.field_236384_t_.add(structure);





        DimensionStructuresSettings.field_236191_b_.put(structure, structureSeparationSettings);

    }

 

public class MyPieces extends Structure<NoFeatureConfig> {

    public MyPieces(Codec<NoFeatureConfig> codec) {
        super(codec);
    }

    @Override
    public IStartFactory<NoFeatureConfig> getStartFactory() {
        return MyPieces.Start::new;
    }

    @Override
    public GenerationStage.Decoration getDecorationStage() {
        return GenerationStage.Decoration.SURFACE_STRUCTURES;
    }

    public static class Start extends StructureStart<NoFeatureConfig>
    {
        public Start(Structure<NoFeatureConfig> p_i225876_1_, int p_i225876_2_, int p_i225876_3_, MutableBoundingBox p_i225876_4_, int p_i225876_5_, long p_i225876_6_) {
            super(p_i225876_1_, p_i225876_2_, p_i225876_3_, p_i225876_4_, p_i225876_5_, p_i225876_6_);
        }

        @Override
        public void func_230364_a_(DynamicRegistries dynamicRegistries, ChunkGenerator chunkGenerator, TemplateManager templateManager, int cx, int cy, Biome biome, NoFeatureConfig config) {
            int x = cx << 4;
            int z = cy << 4;

            BlockPos blockpos = new BlockPos(x, 0, z);

            JigsawManager.func_242837_a(
                    dynamicRegistries,new VillageConfig(() -> dynamicRegistries.getRegistry(Registry.JIGSAW_POOL_KEY).getOrDefault(new ResourceLocation(Main.MODID,"run_down_house/start_pool")),10),
                    AbstractVillagePiece::new,chunkGenerator,templateManager,blockpos,this.components,this.rand,false,true);

            this.components.forEach(piece -> piece.offset(0, 1, 0));
            this.components.forEach(piece -> piece.getBoundingBox().minY -= 1);

            this.recalculateStructureSize();

        }
    }



}

 

public class MyConfigStructures {
    public static StructureFeature<?, ?> CONFIGURED_RUN_DOWN_HOUSE = MyStructure.RUN_DOWN_HOUSE.get().withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG);

    public static void registerConfiguredStructures() {

        Registry<StructureFeature<?, ?>> registry = WorldGenRegistries.CONFIGURED_STRUCTURE_FEATURE;
        Registry.register(registry, new ResourceLocation(Main.MODID, "configured_run_down_house"), CONFIGURED_RUN_DOWN_HOUSE);
       Map<Structure<?>, StructureFeature<?, ?>> STR = ObfuscationReflectionHelper.getPrivateValue(FlatGenerationSettings.class,null,"STRUCTURES");
        STR.put(MyStructure.RUN_DOWN_HOUSE.get(), CONFIGURED_RUN_DOWN_HOUSE);
        ObfuscationReflectionHelper.setPrivateValue(FlatGenerationSettings.class,null,STR,"STRUCTURES");
        //Map<Structure<?>, StructureFeature<?, ?>> STR = ObfuscationReflectionHelper.getPrivateValue(FlatGenerationSettings.class,null,"field_202247_j");
        //STR.put(MyStructure.RUN_DOWN_HOUSE.get(), CONFIGURED_RUN_DOWN_HOUSE);
        //ObfuscationReflectionHelper.setPrivateValue(FlatGenerationSettings.class,null,STR,"field_202247_j");



    }
}

 

public Main() {

    IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus();
    MyStructure.DEFERRED_REGISTRY_STRUCTURE.register(bus);
   bus.addListener(this::setup);
   IEventBus forgeBus = MinecraftForge.EVENT_BUS;
   forgeBus.addListener(EventPriority.NORMAL, this::addDimensionalSpacing);
   forgeBus.addListener(EventPriority.HIGH, this::biomeModification);

}








private void setup (final FMLCommonSetupEvent event)
{
    Networking.RegMes();
   event.enqueueWork(() -> {

       
      MyStructure.setupStructures();
      MyConfigStructures.registerConfiguredStructures();

   });
}

public void biomeModification(final BiomeLoadingEvent event) {
    event.getGeneration().getStructures().add(() -> MyConfigStructures.CONFIGURED_RUN_DOWN_HOUSE);
}

public void addDimensionalSpacing(final WorldEvent.Load event) {
    if(event.getWorld() instanceof ServerWorld){
        ServerWorld serverWorld = (ServerWorld)event.getWorld();


        if(serverWorld.getChunkProvider().getChunkGenerator() instanceof FlatChunkGenerator &&
                serverWorld.getDimensionKey().equals(World.OVERWORLD)){
            return;
        }

        Map<Structure<?>, StructureSeparationSettings> tempMap = new HashMap<>(serverWorld.getChunkProvider().generator.func_235957_b_().func_236195_a_());
        tempMap.put(MyStructure.RUN_DOWN_HOUSE.get(), DimensionStructuresSettings.field_236191_b_.get(MyStructure.RUN_DOWN_HOUSE.get()));
        serverWorld.getChunkProvider().generator.func_235957_b_().func_236195_a_();
    }

 

 

  • Quote

Share this post


Link to post
Share on other sites

Klarks    0

Klarks

Klarks    0

  • Stone Miner
  • Klarks
  • Members
  • 0
  • 95 posts
Posted January 19

Help plz

  • Quote

Share this post


Link to post
Share on other sites

Klarks    0

Klarks

Klarks    0

  • Stone Miner
  • Klarks
  • Members
  • 0
  • 95 posts
Posted January 23

Someone please

  • Quote

Share this post


Link to post
Share on other sites

Beethoven92    75

Beethoven92

Beethoven92    75

  • Dragon Slayer
  • Beethoven92
  • Members
  • 75
  • 577 posts
Posted January 24

The problem seems to be this last line in your main class addDimensionalSpacing method:

serverWorld.getChunkProvider().generator.func_235957_b_().func_236195_a_();

You have created a tempMap where you put the structure settings but then you aren't using that tempMap at all. In fact that last line i quoted above just gets the map contained in DimensionStructureSettings and...leaves it floating in the air. Instead you are supposed to assign your tempMap to that map (which should be field_236193_d_ in DimensionStructureSettings class). You can see a lot of structure registration example here: https://github.com/Beethoven92/BetterEndForge/blob/master/src/main/java/mod/beethoven92/betterendforge/common/event/forge/WorldLoadHandler.java

  • Quote

Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port

A little fun project: https://www.curseforge.com/minecraft/mc-mods/two-players-one-horse

Share this post


Link to post
Share on other sites

Klarks    0

Klarks

Klarks    0

  • Stone Miner
  • Klarks
  • Members
  • 0
  • 95 posts
Posted January 26

Thanks for replying but field_236193_d_  now is private. How can i set it now

  • Quote

Share this post


Link to post
Share on other sites

Beethoven92    75

Beethoven92

Beethoven92    75

  • Dragon Slayer
  • Beethoven92
  • Members
  • 75
  • 577 posts
Posted January 26

Use access transformers

  • Quote

Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port

A little fun project: https://www.curseforge.com/minecraft/mc-mods/two-players-one-horse

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

    • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 2
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • cadbane86140
      Minecraft: Cereal UHC Season 2 Episode 5- THE FINALE!

      By cadbane86140 · Posted 3 hours ago

      Hello There! A bit of a late upload due to technical issues but ITS UP! So after a week of Cereal UHC we have finally reached the end of it! I am so thankful to be apart of this series and I can't wait for the next season! There are so many hilarious moments especially during the final battle! I hope you all enjoyed this series and if you did don't forget to like and sub for more!  
    • samjviana
      [1.16.5] How to make EnchantedBook go to Custom ItemGroup

      By samjviana · Posted 3 hours ago

      But how can i do that for an enchantment book, for normal items i was able to do that by calling the function "group" as you said, but with the enchantment seems to be different.
    • poopoodice
      [1.16.5] How to make EnchantedBook go to Custom ItemGroup

      By poopoodice · Posted 4 hours ago

      Just create an instance of ItemGroup, and set the group of the item in the item property builder.
    • poopoodice
      Trying to make a crop have an "X" shape model

      By poopoodice · Posted 4 hours ago

      Check the parent of their block model.
    • LexManos
      Forge says this file does not have an app associated with it.

      By LexManos · Posted 4 hours ago

      Some zip managers like to take control of the .jar file extension away from Java. Make sure you have Java installed and try running Jarfix once, then try the installer again.
  • Topics

    • cadbane86140
      0
      Minecraft: Cereal UHC Season 2 Episode 5- THE FINALE!

      By cadbane86140
      Started 3 hours ago

    • samjviana
      2
      [1.16.5] How to make EnchantedBook go to Custom ItemGroup

      By samjviana
      Started 6 hours ago

    • TheMajorN
      1
      Trying to make a crop have an "X" shape model

      By TheMajorN
      Started 5 hours ago

    • ESCCarp
      3
      Forge says this file does not have an app associated with it.

      By ESCCarp
      Started 8 hours ago

    • hammy3502
      0
      [1.16.4] Fluid Flowing Very Oddly

      By hammy3502
      Started 5 hours ago

  • Who's Online (See full list)

    • Lucipro71
    • woofer
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.16.4] My structure doesnt work
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community