Jump to content

Recommended Posts

Posted

hello, I searched where is this structure in a mod bu i didn't found so please help 
code :

"FireTowerStructure.class"

package net.mcreator.test.world.structure; import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.WorldGenRegistries; import net.minecraft.world.gen.placement.IPlacementConfig; import net.minecraft.world.gen.placement.Placement; import net.minecraft.world.gen.feature.IFeatureConfig; import net.minecraft.world.gen.feature.template.Template; import net.minecraft.util.RegistryKey; import net.minecraft.world.IServerWorld; import net.minecraft.util.math.ChunkPos; import net.minecraft.world.gen.feature.template.StructureProcessor; import net.minecraft.world.gen.feature.template.BlockIgnoreStructureProcessor; import net.minecraft.world.gen.feature.template.PlacementSettings; import net.minecraft.util.ResourceLocation; import net.minecraft.util.Mirror; import net.minecraft.util.Rotation; import net.minecraft.world.gen.Heightmap; import net.minecraft.world.World; import net.minecraft.util.math.BlockPos; import java.util.Random; import net.minecraft.world.gen.ChunkGenerator; import net.minecraft.world.ISeedReader; import com.mojang.serialization.Codec; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraft.world.gen.GenerationStage; import net.minecraftforge.event.world.BiomeLoadingEvent; import net.minecraft.world.gen.feature.ConfiguredFeature; import net.minecraft.world.gen.feature.NoFeatureConfig; import net.minecraft.world.gen.feature.Feature; import net.minecraftforge.fml.common.Mod; @Mod.EventBusSubscriber public class FireTowerStructure { private static Feature<NoFeatureConfig> feature; private static ConfiguredFeature<?, ?> configuredFeature; @SubscribeEvent public static void addFeatureToBiomes(final BiomeLoadingEvent event) { event.getGeneration().getFeatures(GenerationStage.Decoration.SURFACE_STRUCTURES).add(() -> FireTowerStructure.configuredFeature); } static { FireTowerStructure.feature = null; FireTowerStructure.configuredFeature = null; } @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) private static class FeatureRegisterHandler { @SubscribeEvent public static void registerFeature(final RegistryEvent.Register<Feature<?>> event) { FireTowerStructure.feature = new Feature<NoFeatureConfig>(NoFeatureConfig.field_236558_a_) { public boolean generate(final ISeedReader world, final ChunkGenerator generator, final Random random, final BlockPos pos, final NoFeatureConfig config) { final int ci = pos.func_177958_n() >> 4 << 4; final int ck = pos.func_177952_p() >> 4 << 4; final RegistryKey<World> dimensionType = (RegistryKey<World>)world.func_201672_e().func_234923_W_(); boolean dimensionCriteria = false; if (dimensionType == World.field_234919_h_) { dimensionCriteria = true; } if (!dimensionCriteria) { return false; } if (random.nextInt(1000000) + 1 <= 3000) { for (int count = random.nextInt(1) + 1, a = 0; a < count; ++a) { final int i = ci + random.nextInt(16); final int k = ck + random.nextInt(16); int j = world.func_201676_a(Heightmap.Type.OCEAN_FLOOR_WG, i, k); --j; final Rotation rotation = Rotation.values()[random.nextInt(3)]; final Mirror mirror = Mirror.values()[random.nextInt(2)]; final BlockPos spawnTo = new BlockPos(i + 0, j + 0, k + 0); final int x = spawnTo.func_177958_n(); final int y = spawnTo.func_177956_o(); final int z = spawnTo.func_177952_p(); final Template template = world.func_201672_e().func_184163_y().func_200220_a(new ResourceLocation("mushoku", "firetower")); if (template == null) { return false; } template.func_237144_a_((IServerWorld)world, spawnTo, new PlacementSettings().func_186220_a(rotation).func_189950_a(random).func_186214_a(mirror).func_215222_a((StructureProcessor)BlockIgnoreStructureProcessor.field_215206_c).func_186218_a((ChunkPos)null).func_186222_a(false), random); } } return true; } }; FireTowerStructure.configuredFeature = (ConfiguredFeature<?, ?>)FireTowerStructure.feature.func_225566_b_((IFeatureConfig)IFeatureConfig.field_202429_e).func_227228_a_(Placement.field_215022_h.func_227446_a_((IPlacementConfig)IPlacementConfig.field_202468_e)); event.getRegistry().register(FireTowerStructure.feature.setRegistryName("fire_tower")); Registry.func_218322_a(WorldGenRegistries.field_243653_e, new ResourceLocation("mushoku:fire_tower"), (Object)FireTowerStructure.configuredFeature); } } }

 

"FireTowerStructure$FeatureRegisterHandler.class"

ackage net.mcreator.test.world.structure; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.WorldGenRegistries; import net.minecraft.world.gen.placement.IPlacementConfig; import net.minecraft.world.gen.placement.Placement; import net.minecraft.world.gen.feature.IFeatureConfig; import net.minecraft.world.gen.feature.template.Template; import net.minecraft.util.RegistryKey; import net.minecraft.world.IServerWorld; import net.minecraft.util.math.ChunkPos; import net.minecraft.world.gen.feature.template.StructureProcessor; import net.minecraft.world.gen.feature.template.BlockIgnoreStructureProcessor; import net.minecraft.world.gen.feature.template.PlacementSettings; import net.minecraft.util.ResourceLocation; import net.minecraft.util.Mirror; import net.minecraft.util.Rotation; import net.minecraft.world.gen.Heightmap; import net.minecraft.world.World; import net.minecraft.util.math.BlockPos; import java.util.Random; import net.minecraft.world.gen.ChunkGenerator; import net.minecraft.world.ISeedReader; import com.mojang.serialization.Codec; import net.minecraft.world.gen.feature.NoFeatureConfig; import net.minecraft.world.gen.feature.Feature; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fml.common.Mod; @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) private static class FeatureRegisterHandler { @SubscribeEvent public static void registerFeature(final RegistryEvent.Register<Feature<?>> event) { FireTowerStructure.access$002(new Feature<NoFeatureConfig>(NoFeatureConfig.field_236558_a_) { public boolean generate(final ISeedReader world, final ChunkGenerator generator, final Random random, final BlockPos pos, final NoFeatureConfig config) { final int ci = pos.func_177958_n() >> 4 << 4; final int ck = pos.func_177952_p() >> 4 << 4; final RegistryKey<World> dimensionType = (RegistryKey<World>)world.func_201672_e().func_234923_W_(); boolean dimensionCriteria = false; if (dimensionType == World.field_234919_h_) { dimensionCriteria = true; } if (!dimensionCriteria) { return false; } if (random.nextInt(1000000) + 1 <= 3000) { for (int count = random.nextInt(1) + 1, a = 0; a < count; ++a) { final int i = ci + random.nextInt(16); final int k = ck + random.nextInt(16); int j = world.func_201676_a(Heightmap.Type.OCEAN_FLOOR_WG, i, k); --j; final Rotation rotation = Rotation.values()[random.nextInt(3)]; final Mirror mirror = Mirror.values()[random.nextInt(2)]; final BlockPos spawnTo = new BlockPos(i + 0, j + 0, k + 0); final int x = spawnTo.func_177958_n(); final int y = spawnTo.func_177956_o(); final int z = spawnTo.func_177952_p(); final Template template = world.func_201672_e().func_184163_y().func_200220_a(new ResourceLocation("mushoku", "firetower")); if (template == null) { return false; } template.func_237144_a_((IServerWorld)world, spawnTo, new PlacementSettings().func_186220_a(rotation).func_189950_a(random).func_186214_a(mirror).func_215222_a((StructureProcessor)BlockIgnoreStructureProcessor.field_215206_c).func_186218_a((ChunkPos)null).func_186222_a(false), random); } } return true; } }); FireTowerStructure.access$102(FireTowerStructure.access$000().func_225566_b_((IFeatureConfig)IFeatureConfig.field_202429_e).func_227228_a_(Placement.field_215022_h.func_227446_a_((IPlacementConfig)IPlacementConfig.field_202468_e))); event.getRegistry().register(FireTowerStructure.access$000().setRegistryName("fire_tower")); Registry.func_218322_a(WorldGenRegistries.field_243653_e, new ResourceLocation("mushoku:fire_tower"), (Object)FireTowerStructure.access$100()); } }

 

"FireTowerStructure$FeatureRegisterHandler$1.class"

package net.mcreator.test.world.structure; import net.minecraft.world.gen.feature.IFeatureConfig; import net.minecraft.world.gen.feature.template.Template; import net.minecraft.util.RegistryKey; import net.minecraft.world.IServerWorld; import net.minecraft.util.math.ChunkPos; import net.minecraft.world.gen.feature.template.StructureProcessor; import net.minecraft.world.gen.feature.template.BlockIgnoreStructureProcessor; import net.minecraft.world.gen.feature.template.PlacementSettings; import net.minecraft.util.ResourceLocation; import net.minecraft.util.Mirror; import net.minecraft.util.Rotation; import net.minecraft.world.gen.Heightmap; import net.minecraft.world.World; import net.minecraft.util.math.BlockPos; import java.util.Random; import net.minecraft.world.gen.ChunkGenerator; import net.minecraft.world.ISeedReader; import com.mojang.serialization.Codec; import net.minecraft.world.gen.feature.NoFeatureConfig; import net.minecraft.world.gen.feature.Feature; static final class FireTowerStructure$FeatureRegisterHandler$1 extends Feature<NoFeatureConfig> { public boolean generate(final ISeedReader world, final ChunkGenerator generator, final Random random, final BlockPos pos, final NoFeatureConfig config) { final int ci = pos.func_177958_n() >> 4 << 4; final int ck = pos.func_177952_p() >> 4 << 4; final RegistryKey<World> dimensionType = (RegistryKey<World>)world.func_201672_e().func_234923_W_(); boolean dimensionCriteria = false; if (dimensionType == World.field_234919_h_) { dimensionCriteria = true; } if (!dimensionCriteria) { return false; } if (random.nextInt(1000000) + 1 <= 3000) { for (int count = random.nextInt(1) + 1, a = 0; a < count; ++a) { final int i = ci + random.nextInt(16); final int k = ck + random.nextInt(16); int j = world.func_201676_a(Heightmap.Type.OCEAN_FLOOR_WG, i, k); --j; final Rotation rotation = Rotation.values()[random.nextInt(3)]; final Mirror mirror = Mirror.values()[random.nextInt(2)]; final BlockPos spawnTo = new BlockPos(i + 0, j + 0, k + 0); final int x = spawnTo.func_177958_n(); final int y = spawnTo.func_177956_o(); final int z = spawnTo.func_177952_p(); final Template template = world.func_201672_e().func_184163_y().func_200220_a(new ResourceLocation("mushoku", "firetower")); if (template == null) { return false; } template.func_237144_a_((IServerWorld)world, spawnTo, new PlacementSettings().func_186220_a(rotation).func_189950_a(random).func_186214_a(mirror).func_215222_a((StructureProcessor)BlockIgnoreStructureProcessor.field_215206_c).func_186218_a((ChunkPos)null).func_186222_a(false), random); } } return true; } }





I think this line can maybe help you:

World.field_234919_h_

thanks

Posted

Could you please provide a bit more information, why do you search for the structure, what did you try to achieve?

Also plese post the code in a more readable formate, use the code feature of the forum or use a past side.

Posted

I search were it can spawn (biome/dimension) cause the creator of the mod don't tell where it spawn and "/locate" doesn't work

Code (more readable) :

"FireTowerStructure.class"

 

package net.mcreator.test.world.structure;

import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraft.world.gen.GenerationStage;
import net.minecraftforge.event.world.BiomeLoadingEvent;
import net.minecraft.world.gen.feature.ConfiguredFeature;
import net.minecraft.world.gen.feature.NoFeatureConfig;
import net.minecraft.world.gen.feature.Feature;
import net.minecraftforge.fml.common.Mod;

@Mod.EventBusSubscriber
public class FireTowerStructure
{
    private static Feature<NoFeatureConfig> feature;
    private static ConfiguredFeature<?, ?> configuredFeature;
    
    @SubscribeEvent
    public static void addFeatureToBiomes(final BiomeLoadingEvent event) {
        event.getGeneration().getFeatures(GenerationStage.Decoration.SURFACE_STRUCTURES).add(() -> FireTowerStructure.configuredFeature);
    }
    
    static {
        FireTowerStructure.feature = null;
        FireTowerStructure.configuredFeature = null;
    }
}

"FireTowerStructure$FeatureRegisterHandler.class"

 

package net.mcreator.test.world.structure;

import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraft.util.registry.Registry;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.registry.WorldGenRegistries;
import net.minecraft.world.gen.placement.IPlacementConfig;
import net.minecraft.world.gen.placement.Placement;
import net.minecraft.world.gen.feature.IFeatureConfig;
import net.minecraft.world.gen.feature.NoFeatureConfig;
import net.minecraft.world.gen.feature.Feature;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;

@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
private static class FeatureRegisterHandler
{
    @SubscribeEvent
    public static void registerFeature(final RegistryEvent.Register<Feature<?>> event) {
        FireTowerStructure.access$002((Feature)new FeatureRegisterHandler.FireTowerStructure$FeatureRegisterHandler$1(NoFeatureConfig.field_236558_a_));
        FireTowerStructure.access$102(FireTowerStructure.access$000().func_225566_b_((IFeatureConfig)IFeatureConfig.field_202429_e).func_227228_a_(Placement.field_215022_h.func_227446_a_((IPlacementConfig)IPlacementConfig.field_202468_e)));
        event.getRegistry().register(FireTowerStructure.access$000().setRegistryName("fire_tower"));
        Registry.func_218322_a(WorldGenRegistries.field_243653_e, new ResourceLocation("mushoku:fire_tower"), (Object)FireTowerStructure.access$100());
    }
}

"FireTowerStructure$FeatureRegisterHandler$1.class"

 

package net.mcreator.test.world.structure;

import net.minecraft.world.gen.feature.IFeatureConfig;
import net.minecraft.world.gen.feature.template.Template;
import net.minecraft.util.RegistryKey;
import net.minecraft.world.IServerWorld;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.world.gen.feature.template.StructureProcessor;
import net.minecraft.world.gen.feature.template.BlockIgnoreStructureProcessor;
import net.minecraft.world.gen.feature.template.PlacementSettings;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.world.gen.Heightmap;
import net.minecraft.world.World;
import net.minecraft.util.math.BlockPos;
import java.util.Random;
import net.minecraft.world.gen.ChunkGenerator;
import net.minecraft.world.ISeedReader;
import com.mojang.serialization.Codec;
import net.minecraft.world.gen.feature.NoFeatureConfig;
import net.minecraft.world.gen.feature.Feature;

static final class FireTowerStructure$FeatureRegisterHandler$1 extends Feature<NoFeatureConfig> {
    public boolean generate(final ISeedReader world, final ChunkGenerator generator, final Random random, final BlockPos pos, final NoFeatureConfig config) {
        final int ci = pos.func_177958_n() >> 4 << 4;
        final int ck = pos.func_177952_p() >> 4 << 4;
        final RegistryKey<World> dimensionType = (RegistryKey<World>)world.func_201672_e().func_234923_W_();
        boolean dimensionCriteria = false;
        if (dimensionType == World.field_234919_h_) {
            dimensionCriteria = true;
        }
        if (!dimensionCriteria) {
            return false;
        }
        if (random.nextInt(1000000) + 1 <= 3000) {
            for (int count = random.nextInt(1) + 1, a = 0; a < count; ++a) {
                final int i = ci + random.nextInt(16);
                final int k = ck + random.nextInt(16);
                int j = world.func_201676_a(Heightmap.Type.OCEAN_FLOOR_WG, i, k);
                --j;
                final Rotation rotation = Rotation.values()[random.nextInt(3)];
                final Mirror mirror = Mirror.values()[random.nextInt(2)];
                final BlockPos spawnTo = new BlockPos(i + 0, j + 0, k + 0);
                final int x = spawnTo.func_177958_n();
                final int y = spawnTo.func_177956_o();
                final int z = spawnTo.func_177952_p();
                final Template template = world.func_201672_e().func_184163_y().func_200220_a(new ResourceLocation("mushoku", "firetower"));
                if (template == null) {
                    return false;
                }
                template.func_237144_a_((IServerWorld)world, spawnTo, new PlacementSettings().func_186220_a(rotation).func_189950_a(random).func_186214_a(mirror).func_215222_a((StructureProcessor)BlockIgnoreStructureProcessor.field_215206_c).func_186218_a((ChunkPos)null).func_186222_a(false), random);
            }
        }
        return true;
    }
}

 

Posted
On 11/4/2023 at 11:07 PM, pixelrestrike said:

I'm deconpiling this mod cause I search where spawn the structure and I think it work cause other structure spawn

As Finn already told you the Mod is made by Mcreator its a mode maker for Minecraft (which is not recommend to use).

It looks like there is a 1000/3 chance that the structure is generated in a chunk.

I would recommend removing the mod and replacing it with a similar mod from Curseforge.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.