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.

Brokenglass32

Members
  • Joined

  • Last visited

Everything posted by Brokenglass32

  1. This is how my structure is generated. the structure comes with a chest, and i want to find out how to generate items in that chest. package com.BrokenGlass32.ImprovedMinecraft.gen; import java.util.ArrayList; import java.util.Random; import com.BrokenGlass32.ImprovedMinecraft.init.ModBlocks; import net.minecraft.block.Block; import net.minecraft.init.Biomes; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntityChest; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.WorldType; import net.minecraft.world.biome.BiomeDesert; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.IChunkGenerator; import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraftforge.fml.common.IWorldGenerator; import scala.actors.threadpool.Arrays; public class WorldGenCustomStructures implements IWorldGenerator { @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) { switch(world.provider.getDimension()) { case 2: break; case 1: break; case 0: this.generateStructureSandStoneHouseOne(new WorldGenStructure("sandstonehouse_structure_1"), world, random, chunkX, chunkZ, 75, Blocks.SAND, BiomeDesert.class); break; case -1: } } private void generateStructureSandStoneHouseOne(WorldGenerator generator, World world, Random random, int chunkX, int chunkZ, int chance, Block topBlock, Class<?>... classes) { ArrayList<Class<?>> classesList = new ArrayList<Class<?>>(Arrays.asList(classes)); int x = (chunkX * 16) + random.nextInt(15) + 8; int z = (chunkZ * 16) + random.nextInt(15) + 8; int y = calculateGenerationHeight(world, x, z, topBlock); BlockPos pos = new BlockPos(x,y,z); Class<?> biome = world.provider.getBiomeForCoords(pos).getClass(); if(world.getWorldType() != WorldType.FLAT) { if(classesList.contains(biome)) { if(random.nextInt(chance) == 0) { generator.generate(world, random, pos); } } } } private static int calculateGenerationHeight(World world, int x, int z, Block topBlock) { int y = world.getHeight(); boolean foundGround = false; while(!foundGround && y-- >= 0) { Block block = world.getBlockState(new BlockPos(x,y,z)).getBlock(); foundGround = block == topBlock; } return y; } } Sorry for the very late response, and thank you for the reply.
  2. I've been searching for a while and I wanted to know how to create custom loot tables for the chests in my structure and add custom items to the chests in my structure. thank you.

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.