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    72

Beethoven92

Beethoven92    72

  • Dragon Slayer
  • Beethoven92
  • Members
  • 72
  • 570 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    72

Beethoven92

Beethoven92    72

  • Dragon Slayer
  • Beethoven92
  • Members
  • 72
  • 570 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

    • JayNeedsHelp
      How can I fix this encoding issue?

      By JayNeedsHelp · Posted 2 hours ago

      Hey so I'm creating a forge mod and I'm trying to use the "§" character but I'm getting an illegal character error in the compiler. I've tried using the -encoding option in the compiler, I've also tried converting the file to UTF-8 without BOM, but it wasn't UTF-8 BOM in the first place. I was making a jar mod with mcp in eclipse and everything was working just fine with these characters, which I'm now moving to a forge mod. I'm using IntelliJ Community IDEA currently.   Here's a link to part of the error list: https://jay-hosts-a.dark-web.store/6AXsbJqG. Obviously the other errors were due to the illegal character error but I thought I might as well show it. I'm making a forge mod for 1.12.2, forgegradle is version 2.3-SNAPSHOT and I'm using mixingradle-0.6-SNAPSHOT.   I'm not sure how to fix this and any help would be greatly appreciated.
    • mchase
      Forge crashing

      By mchase · Posted 2 hours ago

      I downloaded and installed forge for 1.16.4 and it shows up in my installations and will start to open but then crashes and gives me "exit code 255". I am on MacOS if that makes a difference. it says The game crashed whilst initializing game Error: java.lang.IllegalStateException: GLFW error before init: [0x10008]Cocoa: Failed to find service port for display Exit Code: 255 does forge just not work on Mac? am I missing something? please help
    • MiToKonndria
      cant download pixelmon

      By MiToKonndria · Posted 2 hours ago

      when i click install on the Pixelmon modpack it gets to 42% and mod 3 out of 7 and then gives me the error message: Timeout attempting to download: "https://edge.forgecdn.net/files/3072/298/pixelmon-1.12.2-8.1.2-universal.jar"
    • lupicus
      can someone help with server crashing

      By lupicus · Posted 3 hours ago

      Looks like Wonderful Enchantments has problems, try and remove it.
    • Draco18s
      can someone help with server crashing

      By Draco18s · Posted 3 hours ago

      Surprise, accessing the client thread from the server thread isn't possible. Bitch at the author of wonderfulenchantments.
  • Topics

    • JayNeedsHelp
      0
      How can I fix this encoding issue?

      By JayNeedsHelp
      Started 2 hours ago

    • mchase
      0
      Forge crashing

      By mchase
      Started 2 hours ago

    • MiToKonndria
      0
      cant download pixelmon

      By MiToKonndria
      Started 2 hours ago

    • IRONDALEK
      3
      can someone help with server crashing

      By IRONDALEK
      Started 7 hours ago

    • Twu
      0
      Need help with Potion Brewing recipes

      By Twu
      Started 3 hours ago

  • Who's Online (See full list)

    • Ryutso
    • Spectere
    • Choonster
    • DavidM
    • NorthWestWind
    • Foofantastic
    • MiToKonndria
    • D_Captain
  • 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