June 12, 20178 yr 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 June 12, 20178 yr by TheRPGAdventurer S
June 15, 20178 yr 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 June 20, 20178 yr by Acrogenous it worked
June 21, 20178 yr 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.