Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Just now, jeffryfisher said:

 

Explore this call in Witch's code:

 

you mean the witch hut, (Sorry I thought you meant the witch hut structure but it was in fact @myWitch)

Edited by TheRPGAdventurer
S

On 6/9/2017 at 8:34 PM, myWitch said:

 Here I'll show the final code that definitly works for me:


 //spawn structure  
				if (!worldIn.isRemote) {
					WorldServer worldserver = (WorldServer) worldIn;
					MinecraftServer minecraftserver = worldIn.getMinecraftServer();
					TemplateManager templatemanager = worldserver.getStructureTemplateManager();
					ResourceLocation loc = new ResourceLocation(Reference.MOD_ID,"t1");
					Template template = templatemanager.getTemplate(minecraftserver, loc); 
					Utils.getLogger().info("=======0======="+template);
					if (template != null) {   
						worldIn.notifyBlockUpdate(pos, iblockstate, iblockstate, 3);
						PlacementSettings placementsettings = (new PlacementSettings()).setMirror(Mirror.NONE)
								.setRotation(Rotation.NONE).setIgnoreEntities(false).setChunk((ChunkPos) null)
								.setReplacedBlock((Block) null).setIgnoreStructureBlock(false);
						
						Utils.getLogger().info("=======1======="+loc);
						
						 
						template.addBlocksToWorld(worldIn, pos, placementsettings);
						 
						Utils.getLogger().info("========2======="+pos);
					}
				}

 

Thank you (and to everyone else who helped) when I get back around to modding Ill implement it!

 

edit: It worked first time, excelent.

Edited by Acrogenous
it worked

On 6/7/2017 at 0:08 PM, JimiIT92 said:

This class is called from the WorldGenMinable class, in the generateOverworld method (so where you put the code to spawn ores) by doing this


if (world.getBiomeGenForCoords(new BlockPos(x, 60, z)).equals(Biomes.DESERT) && random.nextInt(70) == 1) {
            int randPosX = x + random.nextInt(35);
            int randPosZ = z + random.nextInt(35);
            int randPosY = 60 + random.nextInt(255 - 64);
            BlockPos position = new BlockPos(randPosX, randPosY, randPosZ);
            if (!(world.getBlockState(world.getTopSolidOrLiquidBlock(position)).getBlock().equals(Blocks.WATER)))
                new WorldGenObelisk(world.getTopSolidOrLiquidBlock(position), world);
        }

 

I have tried implementing this into a world generator class (changing all necessary things) I do not think I am doing it right however, what is your full implementation of the working class?

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.