Schematics

Started by saajsterxpro on Sat, 12/19/2015 - 08:28
Last seen on 16:50, 25. Aug 2016
Joined Oct 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Schematics
Sat, 12/19/2015 - 08:28

Does anyone know how to code a generated structure so that the schematic spawns chest contents??

Example:

I make a new generated structure mod

Import my schematics file

(the file has chests with armour in them)

I export the mod

When the structure spawns in, there's no chest contents?!

Can anyone out there fix this??

Last seen on 16:50, 25. Aug 2016
Joined Oct 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
RE:I already write here how to
Sat, 12/19/2015 - 09:51

@#1 thanks! 

 

Last seen on 16:50, 25. Aug 2016
Joined Oct 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
RE:I already write here how to
Sat, 12/19/2015 - 09:55

@#1 but i need the chest to be filled automatically...

because the structures are going to keep spawning around the world, a chest needs to be there everytime

 

Last seen on 12:51, 17. Aug 2018
Joined Aug 2013
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • wiki contributor
  • moderator
RE:RE:I already write here how to
Sat, 12/19/2015 - 10:27

@#1.2 You have to write the loot to the code yourself. The schematics dont convert the inventory to the code automatically. If you want , you can add there some random functions , so there will be random loot.

Last seen on 16:50, 25. Aug 2016
Joined Oct 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
RE:RE:RE:I already write here how to
Sat, 12/19/2015 - 15:37

@#1.2.1 could you help me with this please?

 

Last seen on 12:51, 17. Aug 2018
Joined Aug 2013
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • wiki contributor
  • moderator
This is example of my code:
Sat, 12/19/2015 - 15:57

This is example of my code:

[spoiler]
import net.minecraftforge.fml.client.registry.*;
import net.minecraftforge.fml.common.*;
import net.minecraftforge.fml.common.asm.*;
import net.minecraftforge.fml.common.asm.transformers.*;
import net.minecraftforge.fml.common.discovery.*;
import net.minecraftforge.fml.common.discovery.asm.*;
import net.minecraftforge.fml.common.event.*;
import net.minecraftforge.fml.common.functions.*;
import net.minecraftforge.fml.common.network.*;
import net.minecraftforge.fml.common.registry.*;
import net.minecraftforge.fml.common.toposort.*;
import net.minecraftforge.fml.common.versioning.*;
import net.minecraftforge.fml.relauncher.*;
import net.minecraftforge.fml.server.*;
import net.minecraft.block.*;
import net.minecraft.block.material.*;
import net.minecraft.client.*;
import net.minecraft.client.audio.*;
import net.minecraft.client.entity.*;
import net.minecraft.client.gui.*;
import net.minecraft.client.gui.achievement.*;
import net.minecraft.client.gui.inventory.*;
import net.minecraft.client.model.*;
import net.minecraft.client.multiplayer.*;
import net.minecraft.client.particle.*;
import net.minecraft.client.renderer.*;
import net.minecraft.client.renderer.culling.*;
import net.minecraft.client.renderer.entity.*;
import net.minecraft.client.renderer.tileentity.*;
import net.minecraft.client.settings.*;
import net.minecraft.command.*;
import net.minecraft.crash.*;
import net.minecraft.creativetab.*;
import net.minecraft.dispenser.*;
import net.minecraft.enchantment.*;
import net.minecraft.entity.*;
import net.minecraft.entity.ai.*;
import net.minecraft.entity.boss.*;
import net.minecraft.entity.effect.*;
import net.minecraft.entity.item.*;
import net.minecraft.entity.monster.*;
import net.minecraft.entity.passive.*;
import net.minecraft.entity.player.*;
import net.minecraft.entity.projectile.*;
import net.minecraft.inventory.*;
import net.minecraft.item.*;
import net.minecraft.item.crafting.*;
import net.minecraft.nbt.*;
import net.minecraft.network.*;
import net.minecraft.network.rcon.*;
import net.minecraft.pathfinding.*;
import net.minecraft.potion.*;
import net.minecraft.profiler.*;
import net.minecraft.server.*;
import net.minecraft.server.dedicated.*;
import net.minecraft.server.gui.*;
import net.minecraft.server.integrated.*;
import net.minecraft.server.management.*;

import net.minecraft.stats.*;
import net.minecraft.tileentity.*;
import net.minecraft.util.*;
import net.minecraft.village.*;
import net.minecraft.world.*;
import net.minecraft.world.biome.*;
import net.minecraft.world.chunk.*;
import net.minecraft.world.chunk.storage.*;
import net.minecraft.world.demo.*;
import net.minecraft.world.gen.*;
import net.minecraft.world.gen.feature.*;
import net.minecraft.world.gen.layer.*;
import net.minecraft.world.gen.structure.*;
import net.minecraft.world.storage.*;
import net.minecraftforge.classloading.*;
import net.minecraftforge.client.*;
import net.minecraftforge.client.event.*;
import net.minecraftforge.client.event.sound.*;
import net.minecraftforge.common.*;
import net.minecraftforge.event.*;
import net.minecraftforge.event.entity.*;
import net.minecraftforge.event.entity.item.*;
import net.minecraftforge.event.entity.living.*;
import net.minecraftforge.event.entity.minecart.*;
import net.minecraftforge.event.entity.player.*;
import net.minecraftforge.event.terraingen.*;
import net.minecraftforge.event.world.*;
import net.minecraftforge.oredict.*;
import net.minecraftforge.transformers.*;
import net.minecraft.init.*;
import java.util.Random;

import java.util.Random;

public class mcreator_tree4{

public Object instance;

public mcreator_tree4(){}

public void load(FMLInitializationEvent event){
}


    public void generateSurface(World world, Random random, int i2, int k2){

int i = i2 + random.nextInt(15);
int k = k2 + random.nextInt(15);

int chunkX = i >> 4;
int chunkZ = k >> 4;
int height = world.getChunkFromChunkCoords(chunkX, chunkZ).getHeight(i & 15, k & 15);

int j = height-1;

 

if((random.nextInt(1000000)+1)<=150){
boolean place = true;

if(place){
world.setBlockState(new BlockPos(i+1, j+0, k+1), Block.getBlockById(17).getStateFromMeta(0), 3);
world.setBlockState(new BlockPos(i+1, j+1, k+1), Block.getBlockById(17).getStateFromMeta(0), 3);
world.setBlockState(new BlockPos(i+1, j+2, k+1), Block.getBlockById(17).getStateFromMeta(0), 3);
world.setBlockState(new BlockPos(i+0, j+3, k+1), Block.getBlockById(17).getStateFromMeta(4), 3);
world.setBlockState(new BlockPos(i+1, j+3, k+1), Block.getBlockById(17).getStateFromMeta(0), 3);
world.setBlockState(new BlockPos(i+1, j+4, k+0), Block.getBlockById(17).getStateFromMeta(8), 3);
world.setBlockState(new BlockPos(i+1, j+4, k+1), Block.getBlockById(17).getStateFromMeta(0), 3);
world.setBlockState(new BlockPos(i+3, j+5, k+0), Block.getBlockById(17).getStateFromMeta(8), 3);
world.setBlockState(new BlockPos(i+1, j+5, k+1), Block.getBlockById(17).getStateFromMeta(0), 3);
world.setBlockState(new BlockPos(i+2, j+5, k+1), Block.getBlockById(17).getStateFromMeta(4), 3);
world.setBlockState(new BlockPos(i+3, j+5, k+1), Block.getBlockById(17).getStateFromMeta(4), 3);
world.setBlockState(new BlockPos(i+4, j+5, k+1), Block.getBlockById(17).getStateFromMeta(4), 3);
world.setBlockState(new BlockPos(i+1, j+5, k+2), Block.getBlockById(17).getStateFromMeta(8), 3);
world.setBlockState(new BlockPos(i+1, j+5, k+3), Block.getBlockById(17).getStateFromMeta(8), 3);
world.setBlockState(new BlockPos(i+1, j+6, k+1), Block.getBlockById(17).getStateFromMeta(0), 3);
world.setBlockState(new BlockPos(i, j, k), Blocks.chest.getDefaultState());
TileEntityChest chest = (TileEntityChest) world.getTileEntity(new BlockPos(i, j, k));
chest.setInventorySlotContents(0, new ItemStack(Items.apple, (int)(Math.random()*64)));
chest.setInventorySlotContents(0, new ItemStack(Items.coal, (int)(Math.random()*34)));
chest.setInventorySlotContents(0, new ItemStack(Item.getItemFromBlock(Blocks.tnt), (int)(Math.random()*10)));
chest.setInventorySlotContents(0, new ItemStack(Item.getItemFromBlock(Blocks.bedrock), (int)(Math.random()*1)));
 
}
}


}

public void generateNether(World world, Random random, int chunkX, int chunkZ){}

    public int addFuel(ItemStack fuel){
        return 0;
    }
    public void serverLoad(FMLServerStartingEvent event){}
    public void preInit(FMLPreInitializationEvent event){}
    public void registerRenderers(){}


}
[/spoiler]

Last seen on 12:51, 17. Aug 2018
Joined Aug 2013
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • wiki contributor
  • moderator
RE:RE:This is example of my code:
Sat, 12/19/2015 - 17:23

@#2.1 Can i see your code?

Last seen on 16:50, 25. Aug 2016
Joined Oct 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
RE:RE:RE:This is example of my code:
Sat, 12/19/2015 - 17:33

@#2.1.1 the code was exact same as your one, except i changed mccreator_tree4 to mcreator_test... 

----------------------------------------------------------------------------------------------------------------------------------

My original code where i implemented the chest code was:

http://pastebin.com/9JFyrb53

Even when i add the chest code at the end of code it still comes with error:

http://pastebin.com/c5tu48cf

 

 

Last seen on 12:51, 17. Aug 2018
Joined Aug 2013
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • wiki contributor
  • moderator
RE:RE:RE:RE:This is example of my code:
Sat, 12/19/2015 - 19:35

@#2.1.1.1 What for version you use MCreator?