Schematics

38 posts / 0 new
Last post
Offline
Last seen: 9 months 6 days ago
Joined: 10/11/2015 - 23:58
Gems: 0
Schematics

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



Offline
Last seen: 13 hours 2 min ago
Joined: 08/27/2013 - 18:03
Gems: 314
I already write here how to
Offline
Last seen: 9 months 6 days ago
Joined: 10/11/2015 - 23:58
Gems: 0
RE:I already write here how to

@Nuparu00 thanks! 

 

Offline
Last seen: 9 months 6 days ago
Joined: 10/11/2015 - 23:58
Gems: 0
RE:I already write here how to

@Nuparu00 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

 

Offline
Last seen: 13 hours 2 min ago
Joined: 08/27/2013 - 18:03
Gems: 314
RE:RE:I already write here how to

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

Offline
Last seen: 9 months 6 days ago
Joined: 10/11/2015 - 23:58
Gems: 0
RE:RE:RE:I already write here how to

@Nuparu00 could you help me with this please?

 

Offline
Last seen: 13 hours 2 min ago
Joined: 08/27/2013 - 18:03
Gems: 314
This is example of my code:

This is example of my code:

Spoiler: Highlight to view

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(){}


}

Offline
Last seen: 9 months 6 days ago
Joined: 10/11/2015 - 23:58
Gems: 0
RE:This is example of my code:

@Nuparu00 I get many errors when i try this... http://pastebin.com/njPapegW

Offline
Last seen: 13 hours 2 min ago
Joined: 08/27/2013 - 18:03
Gems: 314
RE:RE:This is example of my code:

@saajsterxpro  Can i see your code?

Offline
Last seen: 9 months 6 days ago
Joined: 10/11/2015 - 23:58
Gems: 0
RE:RE:RE:This is example of my code:

@Nuparu00 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

 

 

Offline
Last seen: 13 hours 2 min ago
Joined: 08/27/2013 - 18:03
Gems: 314
RE:RE:RE:RE:This is example of my code:

@saajsterxpro What for version you use MCreator?

Pages