Jump to content

Worldgeneration with schematic files[1.7.10]


Androm

Recommended Posts

Hello modders,

I need help with my mod. Can you read schematic files and generate them randomly in the world without converting schematic to java code ? Maybe it is good to  read the schematic file into bytes and then set arrays or HashMaps ? Or best with inputStream? And how would you do it ? If you have an idea and a code for the beginning please help me. Thank you.

Link to comment
Share on other sites

public Schematic get(String schemname){
        try {
            InputStream is = this.getClass().getClassLoader().getResourceAsStream("assets/mymod/schem/"+schemname);
            NBTTagCompound nbtdata = CompressedStreamTools.readCompressed(is);
            short width = nbtdata.getShort("Width");
            short height = nbtdata.getShort("Height");
            short length = nbtdata.getShort("Length");

            byte[] blocks = nbtdata.getByteArray("Blocks");
            byte[] data = nbtdata.getByteArray("Data");


            System.out.println("schem size:" + width + " x " + height + " x " + length);
            NBTTagList tileentities = nbtdata.getTagList("TileEntities", 10);
            is.close();

            return new Schematic(tileentities, width, height, length, blocks, data);
        } catch (Exception e) {
            System.out.println("I can't load schematic, because " + e.toString());
            return null;
        }
    }

    public class Schematic{
        public  NBTTagList tileentities;
        public  short width;
        public  short height;
        public short length;
        public byte[] blocks;
        public byte[] data;
        public Schematic(NBTTagList tileentities, short width, short height, short length, byte[] blocks, byte[] data){
            this.tileentities = tileentities;
            this.width = width;
            this.height = height;
            this.length = length;
            this.blocks = blocks;
            this.data = data;
        }

    }

 

And it's from my item code, maybe it can help you:

public boolean onItemUse(ItemStack is, EntityPlayer placer, World world, int x, int y, int z, int side, float px, float py, float pz) {

        if(!world.isRemote && !blocked && delay<=0 && side == 1 && placer.capabilities.isCreativeMode){
        blocked = true;
        delay = 20;
        int rotation = OtherUtils.getPlayerRotationSide(placer);
        SchemUtils.Schematic sh = sut.get(schematic);
        if(sh==null){
            placer.addChatMessage(new ChatComponentText("Schematic is dead!"));
            this.setUnlocalizedName("builder_corrupt");
        return false;}

       if(logBuilding)placer.addChatMessage(new ChatComponentText("Building started."));

        int i = 0;
        for(int sy = 0; sy < sh.height; sy++)
        for(int sz = 0; sz < sh.length; sz++)
        for(int sx = 0; sx < sh.width; sx++){

                Block b = Block.getBlockById(sh.blocks[i]);
                if(b!= Blocks.air)
                {
                    int rx = SchemUtils.blockCoordsRotation(sx - this.getxShift(), sz, rotation)[0];
                    int rz = SchemUtils.blockCoordsRotation(sx - this.getxShift(), sz, rotation)[1];
                    world.setBlockToAir(x + rx, y + ylevel + sy, z + rz);
                    world.setBlock(x+rx, y+ylevel+sy, z+rz, b, SchemUtils.rotateMeta(sh.blocks[i], sh.data[i], rotation ), 2);
                }
                i++;
        }

        if (sh.tileentities != null)
        {
            for (int i1 = 0; i1 < sh.tileentities.tagCount(); ++i1)
            {
                NBTTagCompound nbttagcompound4 = sh.tileentities.getCompoundTagAt(i1);
                TileEntity tileentity = TileEntity.createAndLoadEntity(nbttagcompound4);

                if (tileentity != null)
                {
                    int[] conv2 = SchemUtils.blockCoordsRotation(tileentity.xCoord - this.getxShift(), tileentity.zCoord, rotation);
                    tileentity.xCoord = x + conv2[0];
                    tileentity.yCoord += y+ylevel;
                    tileentity.zCoord = z + conv2[1];
                    world.setTileEntity(tileentity.xCoord, tileentity.yCoord, tileentity.zCoord, tileentity);
                }
            }
        }

       if(logBuilding) placer.addChatMessage(new ChatComponentText("Building finished."));
        blocked = false;
        return true;
        }
        return false;
    }

Link to comment
Share on other sites

So this would be right in the WorldGenerate method:

for(int chanceForChuk = 0; chanceForChuk < 1; chanceForChuk++) {
        	Schematic spring = SchematicLoader.get("spring");
        	 int i = 0;
             for(int cy = 0; cy < spring.height; cy++)
             for(int cz = 0; cz < spring.length; cz++)
             for(int cx = 0; cx < spring.width; cx++){

                     Block b = Block.getBlockById(spring.blocks[i]);
                     if(b!= Blocks.air)
                     {
                         world.setBlockToAir(cx , cy, cz);
                         world.setBlock(cx, cy, cz, b, Integer.parseInt(String.valueOf(spring.data[i])), 2);
                     }
                     i++;
             }
        }

Or would it be other if cx, cy, cz are my coordinates ? I am new with structure spawning in the world... Thanks for your help

Link to comment
Share on other sites

Oh, forget my code, i just write before I test. I read your code carefully but because of your rotationthings i am not sure about it, so how do you can generate a structure with the Schematic and blocks[] and data[] ?

 

I used Integer.parseINt(String.valueOf(spring.data)); because i needed an integer and Integer.something returns an integer, but i didn´t saw a byte - convert, so i tried to make first a string from the data stored in data and then I tried to get the value of this string.. Very complicated..

Link to comment
Share on other sites

Your code is correct. And you can pass meta directly, byte normally casts to int (world.setBlock(cx, cy, cz, b, spring.data[і]), 2); ).

 

And another thing.

Schematic spring = SchematicLoader.get("spring");

Don't forget to add extention to filename if you didnt do it.

Link to comment
Share on other sites

I get an error:

 

my WorldGen code:

package de.MhytRPG.www.worldgen;

import java.util.Random;

import cpw.mods.fml.common.IWorldGenerator;
import de.MhytRPG.www.MhytRPG;
import de.MhytRPG.www.structures.Schematic;
import de.MhytRPG.www.structures.SchematicLoader;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenLiquids;
import net.minecraft.world.gen.feature.WorldGenMinable;
import net.minecraft.world.gen.feature.WorldGenerator;

public class WorldGen implements IWorldGenerator{

@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
        switch(world.provider.dimensionId){
        case -1:
            generateNether(world, random, chunkX * 16, chunkZ * 16);
            break;
        case 0:
            generateSurface(world, random, chunkX * 16, chunkZ * 16);
            break;
        case 1:
            generateEnd(world, random, chunkX * 16, chunkZ * 16);
            break;
        }
}

private void generateEnd(World world, Random rand, int chunkX, int chunkZ) {}

private void generateSurface(World world, Random rand, int chunkX, int chunkZ) {
        for(int k = 0; k < 10; k++){
        	int firstBlockXCoord = chunkX + rand.nextInt(16);
        	int firstBlockYCoord = rand.nextInt(200);
        	int firstBlockZCoord = chunkZ + rand.nextInt(16);
        	
        	(new WorldGenLiquids(MhytRPG.blockgoldenwater)).generate(world, rand, firstBlockXCoord, firstBlockYCoord, firstBlockZCoord);
        }
        for(int chanceForChuk = 0; chanceForChuk < 1; chanceForChuk++) {
        	Schematic spring = SchematicLoader.get("spring.schematic");
        	
        	int firstBlockXCoord = chunkX + rand.nextInt(16);
        	int firstBlockYCoord = rand.nextInt(200);
        	int firstBlockZCoord = chunkZ + rand.nextInt(16);
        	
        	 int i = 0;
             for(int cy = 0; cy < spring.height; cy++)
             for(int cz = 0; cz < spring.length; cz++)
             for(int cx = 0; cx < spring.width; cx++){

                     Block b = Block.getBlockById(spring.blocks[i]);
                     if(b!= Blocks.air)
                     {
                         world.setBlockToAir(cx + firstBlockXCoord , cy + firstBlockYCoord, cz + firstBlockZCoord);
                         world.setBlock(cx + firstBlockXCoord, cy + firstBlockYCoord, cz + firstBlockZCoord, b, spring.data[i] , 2);
                     }
                     i++;
             }
        }
}

private void generateNether(World world, Random rand, int chunkX, int chunkZ) {}
}

 

 

 

 

Description: Exception in server tick loop

 

java.lang.NullPointerException: Exception in server tick loop

at de.MhytRPG.www.worldgen.WorldGen.generateSurface(WorldGen.java:52)

at de.MhytRPG.www.worldgen.WorldGen.generate(WorldGen.java:26)

at cpw.mods.fml.common.registry.GameRegistry.generateWorld(GameRegistry.java:106)

at net.minecraft.world.gen.ChunkProviderServer.populate(ChunkProviderServer.java:316)

at net.minecraft.world.chunk.Chunk.populateChunk(Chunk.java:1163)

at net.minecraft.world.gen.ChunkProviderServer.originalLoadChunk(ChunkProviderServer.java:210)

at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:151)

at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:121)

at net.minecraft.server.MinecraftServer.initialWorldChunkLoad(MinecraftServer.java:315)

at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:79)

at net.minecraft.server.integrated.IntegratedServer.startServer(IntegratedServer.java:96)

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:455)

at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:762)

 

 

 

My Line 52 is:              for(int cy = 0; cy < spring.height; cy++)

 

I don´t really know why, is the spring.height = 0 ?

Link to comment
Share on other sites

I didn´t find it. My log (skip the errors with unable loading pngs, because it is something I forgot to add a texture.):

 

 

 

[14:50:58] [main/INFO]: Setting user: ForgeDevName

[14:50:58] [Client thread/INFO]: LWJGL Version: 2.9.1

[14:51:01] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:MhytRPG

[14:51:02] [sound Library Loader/INFO]: Sound engine started

[14:51:03] [Client thread/INFO]: Created: 512x256 textures/blocks-atlas

[14:51:03] [Client thread/ERROR]: Using missing texture, unable to load mhytrpg:textures/items/boundedChain.png

java.io.FileNotFoundException: mhytrpg:textures/items/boundedChain.png

at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:65) ~[FallbackResourceManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:67) ~[simpleReloadableResourceManager.class:?]

at net.minecraft.client.renderer.texture.TextureMap.loadTextureAtlas(TextureMap.java:126) [TextureMap.class:?]

at net.minecraft.client.renderer.texture.TextureMap.loadTexture(TextureMap.java:91) [TextureMap.class:?]

at net.minecraft.client.renderer.texture.TextureManager.loadTexture(TextureManager.java:89) [TextureManager.class:?]

at net.minecraft.client.renderer.texture.TextureManager.loadTickableTexture(TextureManager.java:71) [TextureManager.class:?]

at net.minecraft.client.renderer.texture.TextureManager.loadTextureMap(TextureManager.java:58) [TextureManager.class:?]

at net.minecraft.client.Minecraft.startGame(Minecraft.java:593) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:941) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_25]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_25]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_25]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_25]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]

[14:51:03] [Client thread/INFO]: Created: 256x256 textures/items-atlas

[14:51:03] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:MhytRPG

[14:51:03] [Client thread/ERROR]: Using missing texture, unable to load mhytrpg:textures/items/boundedChain.png

java.io.FileNotFoundException: mhytrpg:textures/items/boundedChain.png

at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:65) ~[FallbackResourceManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:67) ~[simpleReloadableResourceManager.class:?]

at net.minecraft.client.renderer.texture.TextureMap.loadTextureAtlas(TextureMap.java:126) [TextureMap.class:?]

at net.minecraft.client.renderer.texture.TextureMap.loadTexture(TextureMap.java:91) [TextureMap.class:?]

at net.minecraft.client.renderer.texture.TextureManager.loadTexture(TextureManager.java:89) [TextureManager.class:?]

at net.minecraft.client.renderer.texture.TextureManager.onResourceManagerReload(TextureManager.java:170) [TextureManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SimpleReloadableResourceManager.java:134) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SimpleReloadableResourceManager.java:118) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:653) [Minecraft.class:?]

at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:303) [FMLClientHandler.class:?]

at net.minecraft.client.Minecraft.startGame(Minecraft.java:596) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:941) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_25]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_25]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_25]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_25]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]

[14:51:03] [Client thread/INFO]: Created: 256x256 textures/items-atlas

[14:51:03] [Client thread/INFO]: Created: 512x256 textures/blocks-atlas

[14:51:04] [sound Library Loader/INFO]: Sound engine started

[14:51:05] [Client thread/WARN]: Unable to play unknown soundEvent: minecraft:gui.button.press

[14:51:06] [Client thread/WARN]: Unable to play unknown soundEvent: minecraft:gui.button.press

[14:51:07] [Client thread/WARN]: Unable to play unknown soundEvent: minecraft:gui.button.press

[14:51:07] [Client thread/WARN]: Unable to play unknown soundEvent: minecraft:gui.button.press

[14:51:08] [Client thread/WARN]: Unable to play unknown soundEvent: minecraft:gui.button.press

[14:51:08] [server thread/INFO]: Starting integrated minecraft server version 1.7.10

[14:51:08] [server thread/INFO]: Generating keypair

[14:51:08] [server thread/INFO]: Converting map!

[14:51:08] [server thread/INFO]: Scanning folders...

[14:51:08] [server thread/INFO]: Total conversion count is 0

[14:51:09] [server thread/INFO]: Preparing start region for level 0

[14:51:09] [server thread/ERROR]: Encountered an unexpected exception

java.lang.NullPointerException

at de.MhytRPG.www.worldgen.WorldGen.generateSurface(WorldGen.java:47) ~[WorldGen.class:?]

at de.MhytRPG.www.worldgen.WorldGen.generate(WorldGen.java:26) ~[WorldGen.class:?]

at cpw.mods.fml.common.registry.GameRegistry.generateWorld(GameRegistry.java:106) ~[GameRegistry.class:?]

at net.minecraft.world.gen.ChunkProviderServer.populate(ChunkProviderServer.java:316) ~[ChunkProviderServer.class:?]

at net.minecraft.world.chunk.Chunk.populateChunk(Chunk.java:1163) ~[Chunk.class:?]

at net.minecraft.world.gen.ChunkProviderServer.originalLoadChunk(ChunkProviderServer.java:210) ~[ChunkProviderServer.class:?]

at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:151) ~[ChunkProviderServer.class:?]

at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:121) ~[ChunkProviderServer.class:?]

at net.minecraft.server.MinecraftServer.initialWorldChunkLoad(MinecraftServer.java:315) ~[MinecraftServer.class:?]

at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:79) ~[integratedServer.class:?]

at net.minecraft.server.integrated.IntegratedServer.startServer(IntegratedServer.java:96) ~[integratedServer.class:?]

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:455) [MinecraftServer.class:?]

at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:762) [MinecraftServer$2.class:?]

[14:51:09] [server thread/ERROR]: This crash report has been saved to: C:\Users\Knirps\Desktop\forge 1.7.10\eclipse\.\crash-reports\crash-2014-07-09_14.51.09-server.txt

 

 

Link to comment
Share on other sites

I found a mistake, now there is an error : I can't load schematic because java.lang.NullPointerException

with the same Errorcode..

My Schematic.java:

package de.MhytRPG.www.structures;

import net.minecraft.nbt.NBTTagList;

public class Schematic{
    public  NBTTagList tileentities;
    public  short width;
    public  short height;
    public short length;
    public byte[] blocks;
    public byte[] data;
    public Schematic(NBTTagList tileentities, short width, short height, short length, byte[] blocks, byte[] data){
        this.tileentities = tileentities;
        this.width = width;
        this.height = height;
        this.length = length;
        this.blocks = blocks;
        this.data = data;
    }

}

 

and my SchematicLoader.java :

package de.MhytRPG.www.structures;

import java.io.File;
import java.io.InputStream;

import de.MhytRPG.www.MhytRPG;
import de.MhytRPG.www.structures.Schematic;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;

public class SchematicLoader {

public static Schematic get(String schemname){
        try {
            InputStream is = Schematic.class.getClass().getClassLoader().getResourceAsStream("assets" + File.separator + MhytRPG.MODID + File.separator + "schematics" + File.separator + schemname +".schematic");
            NBTTagCompound nbtdata = CompressedStreamTools.readCompressed(is);
            short width = nbtdata.getShort("Width");
            short height = nbtdata.getShort("Height");
            short length = nbtdata.getShort("Length");

            byte[] blocks = nbtdata.getByteArray("Blocks");
            byte[] data = nbtdata.getByteArray("Data");


            System.out.println("schem size:" + width + " x " + height + " x " + length);
            NBTTagList tileentities = nbtdata.getTagList("TileEntities", 10);
            is.close();

            return new Schematic(tileentities, width, height, length, blocks, data);
        } catch (Exception e) {
            System.out.println("I can't load schematic, because " + e.toString());
            return null;
        }
    }
}

 

I splitted them and write it to public static Schematic...  and changed the this. to Schematic. because the method need to performed with the Schematic.class

 

So what I have done wrong ?

 

EDIT : My location of schematic files: forge 1.7.10\src\main\resources\assets\mhytrpg\schematics

Link to comment
Share on other sites

I tested it, if it throws a FileNotFoundException before I post this. I tried to import this schematic in WorldEdit and there is no error. So something other is going wrong. Do you know other programs with export something in the world to schematic ? Maybe WorldEdit mad something other in schematic so only WorldEdit can place them into the world ?

Link to comment
Share on other sites

Replace

 

InputStream is = Schematic.class.getClass().getClassLoader().getResourceAsStream("assets" + File.separator + MhytRPG.MODID + File.separator + "schematics" + File.separator + schemname +".schematic");

 

With

 

String temp = "assets" + File.separator + MhytRPG.MODID + File.separator + "schematics" + File.separator + schemname +".schematic";
System.out.println("Trying to load " + temp);
InputStream is = Schematic.class.getClass().getClassLoader().getResourceAsStream(temp);

 

And look at log before crash.

Link to comment
Share on other sites

Trying to load assets\mhytrpg\schematics\spring.schematic

and same error

(After first error i changed MODID to MODID.toLowercase() but the error was the same)

I think now he didn´t found the schematic but didn´t throw a FileNotFound exception ( i tested it)

 

EDIT: Here has to be the mistake after i added some more Sytem.Out.Println´s:

 

package de.MhytRPG.www.structures;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.InputStream;

import de.MhytRPG.www.MhytRPG;
import de.MhytRPG.www.structures.Schematic;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;

public class SchematicLoader {

public static Schematic get(String schemname) {
        try {
        	String temp = "assets" + File.separator + MhytRPG.MODID.toLowerCase() + File.separator + "schematics" + File.separator + schemname +".schematic";
        	System.out.println("Trying to load " + temp);                                      
        	InputStream is = Schematic.class.getClass().getClassLoader().getResourceAsStream(temp);      //Is this Wrong ?
            NBTTagCompound nbtdata = CompressedStreamTools.readCompressed(is);                                   //Or this ?
            System.out.println("First successfully"); // This doesn´t happen --- So the mistake is before !
            short width = nbtdata.getShort("Width");
            short height = nbtdata.getShort("Height");
            short length = nbtdata.getShort("Length");
            System.out.println("Second successfully");
            byte[] blocks = nbtdata.getByteArray("Blocks");
            byte[] data = nbtdata.getByteArray("Data");
            System.out.println("Third successfully");

            System.out.println("schem size:" + width + " x " + height + " x " + length);
            NBTTagList tileentities = nbtdata.getTagList("TileEntities", 10);
            is.close();

            return new Schematic(tileentities, width, height, length, blocks, data);
        } catch (Exception e) {
            System.out.println("I can't load schematic, because " + e.toString());
            return null;
        }
    }
}

 

 

 

Link to comment
Share on other sites

I don't know what's wrong  :(

 

In my case it's works.

 

 

 

https://gist.github.com/MultiMote/7242a27197cce7f17a7f

https://gist.github.com/MultiMote/dee9b07369fa4ca40336

public static Item basebuilder2 = new BuilderItem("rotator.schematic", 0, 3, true).setTextureName("microz:builder").setUnlocalizedName("rotator");

 

width=237 height=210http://up42.ru/u/p/_________________2014-07-10_17_02_35.png[/img]

 

width=800 height=449http://up42.ru/u/p/2014-07-10_17.19.11.png[/img]

 

 

 

Link to comment
Share on other sites

I found the error:

  I forgot to declare SchematicLoader:

private Schematicloader sl = new SchematicLoader();

Now I get no error but my world doesn´t load fast (takes more than 1 minutes with only one structure)

 

How can I set my spawnrate lower or make Worldgenerating faster ?

My Class:

 

package de.MhytRPG.www.worldgen;

import java.util.Random;

import cpw.mods.fml.common.IWorldGenerator;
import de.MhytRPG.www.MhytRPG;
import de.MhytRPG.www.structures.SchematicLoader;
import de.MhytRPG.www.structures.SchematicLoader.Schematic;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenLiquids;
import net.minecraft.world.gen.feature.WorldGenMinable;
import net.minecraft.world.gen.feature.WorldGenerator;

public class WorldGen implements IWorldGenerator{

private SchematicLoader sl = new SchematicLoader();

@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
        switch(world.provider.dimensionId){
        case -1:
            generateNether(world, random, chunkX * 16, chunkZ * 16);
            break;
        case 0:
            generateSurface(world, random, chunkX * 16, chunkZ * 16);
            break;
        case 1:
            generateEnd(world, random, chunkX * 16, chunkZ * 16);
            break;
        }
}

private void generateEnd(World world, Random rand, int chunkX, int chunkZ) {}

private void generateSurface(World world, Random rand, int chunkX, int chunkZ) {
        for(int k = 0; k < 10; k++){
        	int firstBlockXCoord = chunkX + rand.nextInt(16);
        	int firstBlockYCoord = rand.nextInt(200);
        	int firstBlockZCoord = chunkZ + rand.nextInt(16);
        	(new WorldGenLiquids(MhytRPG.blockgoldenwater)).generate(world, rand, firstBlockXCoord, firstBlockYCoord, firstBlockZCoord);
        }
        
        for(int k = 0; k < 10; k++) {
        	Schematic spring = sl.get("spring");
        	int firstBlockXCoord = chunkX + rand.nextInt(16);
        	int firstBlockYCoord = rand.nextInt(200);
        	int firstBlockZCoord = chunkZ + rand.nextInt(16);
        	
        	 int i = 0;
             for(int cy = 0; cy < spring.height; cy++) {
            	 for(int cz = 0; cz < spring.length; cz++)
            		 for(int cx = 0; cx < spring.width; cx++){

             	       Block b = Block.getBlockById(spring.blocks[i]);
             	       if(b!= Blocks.air)
             	       {
             	    	   world.setBlockToAir(cx + firstBlockXCoord , cy + firstBlockYCoord, cz + firstBlockZCoord);
             	    	   world.setBlock(cx + firstBlockXCoord, cy + firstBlockYCoord, cz + firstBlockZCoord, b, spring.data[i] , 2);
             	       }
             	       i++;
            		 }
             	}
             }
}

private void generateNether(World world, Random rand, int chunkX, int chunkZ) {}
}

 

 

Link to screenshot from world: http://prntscr.com/419ew9

Link to comment
Share on other sites

I solved this problems. But now I have some questions about my method to create a structure in the worl:

 

My complet WorldGen.class :

 

package de.MhytRPG.www.worldgen;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Random;

import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.tileentity.TileEntityMobSpawner;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenLiquids;
import cpw.mods.fml.common.IWorldGenerator;
import de.MhytRPG.www.MhytRPG;
import de.MhytRPG.www.structures.SchematicLoader;
import de.MhytRPG.www.structures.SchematicLoader.Schematic;

public class WorldGen implements IWorldGenerator{

private static SchematicLoader sl = new SchematicLoader();

@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
        switch(world.provider.dimensionId){
        case -1:
            generateNether(world, random, chunkX * 16, chunkZ * 16);
            break;
        case 0:
            generateSurface(world, random, chunkX * 16, chunkZ * 16);
            break;
        case 1:
            generateEnd(world, random, chunkX * 16, chunkZ * 16);
            break;
        }
}

private void generateEnd(World world, Random rand, int chunkX, int chunkZ) {}

private void generateSurface(World world, Random rand, int chunkX, int chunkZ) {
	ArrayList<Block> normalList = new ArrayList<Block>();
	normalList.add(Blocks.sand);
	normalList.add(Blocks.dirt);
	normalList.add(Blocks.stone);
	normalList.add(Blocks.grass);

	ArrayList<Block> normalListSpawner = new ArrayList<Block>();
	normalListSpawner.add(Blocks.soul_sand);

	ArrayList<Block> normalListChest = new ArrayList<Block>();
	normalListChest.add(Blocks.bedrock);

	ArrayList<Block> normalListSpinnwebs = new ArrayList<Block>();
	normalListSpinnwebs.add(Blocks.end_portal_frame);

	ArrayList<Block> nothingBlocks = new ArrayList<Block>();

	ArrayList<Item> noLoot = new ArrayList<Item>();
	ArrayList<Integer> noStackSize = new ArrayList<Integer>();

	ArrayList<Item> towerLoot = new ArrayList<Item>();
	ArrayList<Integer> towerLootStackSize = new ArrayList<Integer>();
	towerLoot.add(Items.potato);
	towerLootStackSize.add(5);
	towerLoot.add(Items.apple);
	towerLootStackSize.add(7);
	towerLoot.add(Items.arrow);
	towerLootStackSize.add(18);
	towerLoot.add(Items.iron_ingot);
	towerLootStackSize.add(9);
	towerLoot.add(Items.gold_nugget);
	towerLootStackSize.add(10);
	towerLoot.add(Items.ender_pearl);
	towerLootStackSize.add(3);
	towerLoot.add(Items.blaze_powder);
	towerLootStackSize.add(2);
	towerLoot.add(Items.spider_eye);
	towerLootStackSize.add(7);
	towerLoot.add(Items.rotten_flesh);
	towerLootStackSize.add(30);

	GeneralGenerateMethod(10, "spring", 0, 1, 12, true, chunkX, rand, chunkZ, world, normalList, false, nothingBlocks, false, nothingBlocks, false, nothingBlocks, noLoot, noStackSize);
	GeneralGenerateMethod(10, "tower", 0, -1, 50, true, chunkX, rand, chunkZ, world, normalList, true, normalListSpawner, true, normalListChest, true, normalListSpinnwebs, towerLoot, towerLootStackSize);
}

private void generateNether(World world, Random rand, int chunkX, int chunkZ) {}


public static void GeneralGenerateMethod(int chance, String schemname, int where, int blockInUnderGround, int structureHigh, boolean structureWithAir, 
		int chunkX, Random rand, int chunkZ, World world, ArrayList<Block> allowedBlocks, boolean SpawnerAcivate, ArrayList<Block> spawnerBlocks,
		boolean ChestWithRandomLoot, ArrayList<Block> chestBlocks, boolean randomSpinnwebs, ArrayList<Block> spinnwebsBlocks, ArrayList<Item> LootItems, ArrayList<Integer> LootMaxStackSize) {

	 int chanceForSpawn = new Random().nextInt(chance);
     if(chanceForSpawn == 1) {
        int bcy = 0;
        Schematic schem = sl.get(schemname);
        int firstBlockXCoord = chunkX + rand.nextInt(16);
        int firstBlockZCoord = chunkZ + rand.nextInt(16);
        if(where == 0) {
        	//where = 0 : spawn over ground  ; where  = 1 : spawn underground ; where = 2 : spawn only over water ; where = 3 : spawn on sea ground
        	for(bcy = 256; bcy > 0; bcy--) {
	        	if(!world.getBlock(chunkX, bcy, chunkZ).equals(Blocks.air)) {
	        		if(allowedBlocks.contains(world.getBlock(chunkX, bcy, chunkZ))) {
	        			bcy = bcy - (blockInUnderGround + 1);
	        			break;
	        		}
	        		else {
	        			return;
	        		}
	       		}
        	}
        }
       	else if(where == 1) {
       		for(bcy = 0; bcy < 256; bcy++) {
       			if(world.getBlock(chunkX, bcy, chunkZ).equals(Blocks.air)) {
       				bcy = (bcy-2)-structureHigh;
       				break;
       			}
       			if(bcy == 240) {
       				return;
       			}
       		}
       	}
        
       	else if(where == 2) {
       		for(bcy = 256; bcy > 3; bcy--) {
       			if(world.getBlock(chunkX, bcy, chunkZ).equals(Blocks.water)) {
       				bcy = (bcy + 1) - blockInUnderGround;
       				break;
       			}
       			if(bcy == 4) {
       				return;
       			}
       		}
       	}
        
       	else if(where == 3) {
       		for(bcy = 1; bcy < 256; bcy++) {
       			if(world.getBlock(chunkX, bcy, chunkZ).equals(Blocks.water)) {
       				bcy = bcy - blockInUnderGround;
       				break;
       			}
       			if(bcy == 240) {
       				return;
       			}
       		}
       	}
        	
     	int i = 0;
        for(int cy = 0; cy < schem.height; cy++) {
        	for(int cz = 0; cz < schem.length; cz++) {
        		for(int cx = 0; cx < schem.width; cx++){

        			Block b = Block.getBlockById(schem.blocks[i]);
        			
        			if(b == Blocks.air) {
        				if(structureWithAir == true) {
        					world.setBlockToAir(cx + firstBlockXCoord , cy + bcy, cz + firstBlockZCoord);
		             	    world.setBlock(cx + firstBlockXCoord, cy + bcy, cz + firstBlockZCoord, b, schem.data[i] , 2);
		             	    i++;
		             	    continue;
        				}
        				else if(structureWithAir == false) {
        					continue;
        				}
        			}
        			
        			else if(spinnwebsBlocks.contains(b)) {
        				if(randomSpinnwebs == true) {
        					int ran = new Random().nextInt(4);
        					if(ran <= 1) {
        						world.setBlockToAir(cx + firstBlockXCoord , cy + bcy, cz + firstBlockZCoord);
			             	    world.setBlock(cx + firstBlockXCoord, cy + bcy, cz + firstBlockZCoord, Blocks.web);
			             	    i++;
			             	    continue;
        					}
        				}
        				else if(randomSpinnwebs == false) {
        					continue;
        				}
        			}
        			else if(spawnerBlocks.contains(b)) {
        				if(SpawnerAcivate == true) {
        					
        					world.setBlockToAir(cx + firstBlockXCoord , cy + bcy, cz + firstBlockZCoord);
		             	    world.setBlock(cx + firstBlockXCoord, cy + bcy, cz + firstBlockZCoord, Blocks.mob_spawner, schem.data[i] , 2);
		             	    TileEntityMobSpawner spawner = (TileEntityMobSpawner)world.getTileEntity(cx + firstBlockXCoord, cy + bcy, cz + firstBlockZCoord);
		             	    spawner.func_145881_a().setEntityName("Witch");
		             	    i++;
		             	    continue;
        				}
        				else if(SpawnerAcivate == false) {
        					continue;
        				}
        			}
        			else if(chestBlocks.contains(b)) {
        				if(ChestWithRandomLoot == true) {
        					world.setBlockToAir(cx + firstBlockXCoord , cy + bcy, cz + firstBlockZCoord);
		             	    world.setBlock(cx + firstBlockXCoord, cy + bcy, cz + firstBlockZCoord, Blocks.chest, schem.data[i], 2);
		             	    TileEntityChest tec = (TileEntityChest) world.getTileEntity(cx + firstBlockXCoord, cy + bcy, cz + firstBlockZCoord);
		             	    if(!tec.isInvalid()) {
		             	    	
		             	    	Block maybeChest1 = world.getBlock(cx + firstBlockXCoord + 1, cy + bcy, cz + firstBlockZCoord);
		             	    	Block maybeChest2 = world.getBlock(cx + firstBlockXCoord - 1, cy + bcy, cz + firstBlockZCoord);
		             	    	Block maybeChest3 = world.getBlock(cx + firstBlockXCoord, cy + bcy, cz + firstBlockZCoord + 1);
		             	    	Block maybeChest4 = world.getBlock(cx + firstBlockXCoord, cy + bcy, cz + firstBlockZCoord - 1);
		             	    	
		             	    	
		             	    	if(maybeChest1.equals(Blocks.chest) || maybeChest2.equals(Blocks.chest) || maybeChest3.equals(Blocks.chest) || maybeChest4.equals(Blocks.chest)) {
		             	    		int loot = (int) new Random().nextDouble()*10;
		             	    		for(int t = 0; t <= loot; t++) {
		             	    			int place = new Random().nextInt(27 + 27);
		             	    			int whichItem = new Random().nextInt(LootItems.size());
		             	    			Item ranItem = LootItems.get(whichItem);
		             	    			int stackSize = new Random().nextInt(LootMaxStackSize.get(whichItem) + 1);
		             	    			ItemStack stack = new ItemStack(ranItem, stackSize);
		             	    			tec.setInventorySlotContents(place, stack);
		             	    			place = 0;
		             	    			continue;
		             	    		}
		             	    		i++;
		             	    		continue;
		             	    	}
		             	    	else if(!maybeChest1.equals(Blocks.chest) && !maybeChest2.equals(Blocks.chest) && !maybeChest3.equals(Blocks.chest) && !maybeChest4.equals(Blocks.chest)) {
		             	    		int loot = (int) new Random().nextDouble()*10;
		             	    		for(int t = 0; t <= loot; t++) {
		             	    			int place = new Random().nextInt(27);
		             	    			int whichItem = new Random().nextInt(LootItems.size());
		             	    			Item ranItem = LootItems.get(whichItem);
		             	    			int stackSize = new Random().nextInt(LootMaxStackSize.get(whichItem) + 1);
		             	    			ItemStack stack = new ItemStack(ranItem, stackSize);
		             	    			tec.setInventorySlotContents(place, stack);
		             	    			place = 0;
		             	    			continue;
		             	    		}
		             	    		i++;
		             	    		continue;
		             	    	}
		             	    }
		             	    else if(tec.isInvalid()) {
		             	    	i++;
		             	    	continue;
		             	    }
        				}
        				else if(ChestWithRandomLoot == false) {
		             	    continue;
        				}
        			}
        			
        			else if(b != Blocks.air && !chestBlocks.contains(b) && !spawnerBlocks.contains(b) && !spinnwebsBlocks.contains(b)) {
        				world.setBlockToAir(cx + firstBlockXCoord , cy + bcy, cz + firstBlockZCoord);
	             	    world.setBlock(cx + firstBlockXCoord, cy + bcy, cz + firstBlockZCoord, b, schem.data[i] , 2);
	             	    i++;
	             	    continue;
        			}
        		}	
             }
         }
        
        if (schem.tileentities != null)
        {
            for (int i1 = 0; i1 < schem.tileentities.tagCount(); ++i1)
            {
                NBTTagCompound nbttagcompound4 = schem.tileentities.getCompoundTagAt(i1);
                TileEntity tileentity = TileEntity.createAndLoadEntity(nbttagcompound4);

                if (tileentity != null)
                {
                    tileentity.xCoord = tileentity.xCoord + firstBlockXCoord;
                    tileentity.yCoord = tileentity.yCoord + bcy;
                    tileentity.zCoord = tileentity.zCoord + firstBlockZCoord;
                    world.setTileEntity(tileentity.xCoord, tileentity.yCoord, tileentity.zCoord, tileentity);
                }
            }
        }

     }
}
}

 

 

This happens after I made a world :

 

 

[18:03:07] [server thread/ERROR]: Encountered an unexpected exception

java.lang.ArrayIndexOutOfBoundsException: 42

at net.minecraft.tileentity.TileEntityChest.setInventorySlotContents(TileEntityChest.java:129) ~[TileEntityChest.class:?]

at de.MhytRPG.www.worldgen.WorldGen.GeneralGenerateMethod(WorldGen.java:223) ~[WorldGen.class:?]

at de.MhytRPG.www.worldgen.WorldGen.generateSurface(WorldGen.java:89) ~[WorldGen.class:?]

at de.MhytRPG.www.worldgen.WorldGen.generate(WorldGen.java:36) ~[WorldGen.class:?]

at cpw.mods.fml.common.registry.GameRegistry.generateWorld(GameRegistry.java:106) ~[GameRegistry.class:?]

at net.minecraft.world.gen.ChunkProviderServer.populate(ChunkProviderServer.java:316) ~[ChunkProviderServer.class:?]

at net.minecraft.world.chunk.Chunk.populateChunk(Chunk.java:1163) ~[Chunk.class:?]

at net.minecraft.world.gen.ChunkProviderServer.originalLoadChunk(ChunkProviderServer.java:210) ~[ChunkProviderServer.class:?]

at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:151) ~[ChunkProviderServer.class:?]

at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:121) ~[ChunkProviderServer.class:?]

at net.minecraft.server.MinecraftServer.initialWorldChunkLoad(MinecraftServer.java:315) ~[MinecraftServer.class:?]

at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:79) ~[integratedServer.class:?]

at net.minecraft.server.integrated.IntegratedServer.startServer(IntegratedServer.java:96) ~[integratedServer.class:?]

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:455) [MinecraftServer.class:?]

at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:762) [MinecraftServer$2.class:?]

[18:03:07] [server thread/ERROR]: This crash report has been saved to: C:\Users\Knirps\Desktop\forge-1.7.10-10.13.0.1179-src\eclipse\.\crash-reports\crash-2014-07-11_18.03.07-server.txt

[18:03:07] [server thread/INFO] [FML]: Applying holder lookups

[18:03:07] [server thread/INFO] [FML]: Holder lookups applied

[18:03:07] [server thread/INFO] [FML]: The state engine was in incorrect state SERVER_STARTING and forced into state SERVER_STOPPED. Errors may have been discarded.

---- Minecraft Crash Report ----

// Don't do that.

 

Time: 11.07.14 18:03

Description: Exception in server tick loop

 

java.lang.ArrayIndexOutOfBoundsException: 42

at net.minecraft.tileentity.TileEntityChest.setInventorySlotContents(TileEntityChest.java:129)

at de.MhytRPG.www.worldgen.WorldGen.GeneralGenerateMethod(WorldGen.java:223)

at de.MhytRPG.www.worldgen.WorldGen.generateSurface(WorldGen.java:89)

at de.MhytRPG.www.worldgen.WorldGen.generate(WorldGen.java:36)

at cpw.mods.fml.common.registry.GameRegistry.generateWorld(GameRegistry.java:106)

at net.minecraft.world.gen.ChunkProviderServer.populate(ChunkProviderServer.java:316)

at net.minecraft.world.chunk.Chunk.populateChunk(Chunk.java:1163)

at net.minecraft.world.gen.ChunkProviderServer.originalLoadChunk(ChunkProviderServer.java:210)

at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:151)

at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:121)

at net.minecraft.server.MinecraftServer.initialWorldChunkLoad(MinecraftServer.java:315)

at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:79)

at net.minecraft.server.integrated.IntegratedServer.startServer(IntegratedServer.java:96)

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:455)

at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:762)

 

 

A detailed walkthrough of the error, its code path and all known details is as follows:

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

 

-- System Details --

Details:

Minecraft Version: 1.7.10

Operating System: Windows 7 (amd64) version 6.1

Java Version: 1.7.0_25, Oracle Corporation

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

Memory: 4092538560 bytes (3902 MB) / 4260102144 bytes (4062 MB) up to 4260102144 bytes (4062 MB)

JVM Flags: 3 total; -Xincgc -Xmx4G -Xms4G

AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0

FML: MCP v9.05 FML v7.10.11.1179 Minecraft Forge 10.13.0.1179 4 mods loaded, 4 mods active

mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available

FML{7.10.11.1179} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.0.1179.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available

Forge{10.13.0.1179} [Minecraft Forge] (forgeSrc-1.7.10-10.13.0.1179.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available

MhytRPG{1.0} [MhytRPG] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available

Profiler Position: N/A (disabled)

Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

Player Count: 0 / 8; []

Type: Integrated Server (map_client.txt)

Is Modded: Definitely; Client brand changed to 'fml,forge'

#@!@# Game crashed! Crash report saved to: #@!@# .\crash-reports\crash-2014-07-11_18.03.07-server.txt

AL lib: (EE) alc_cleanup: 1 device not closed

 

 

 

1. What is the problem with my chest system ? Also I want to know how I can add more loot items in a chest, because there is only one item in each chest. And there have to be more different items! But I don´t know what I had done wrong..

 

2. And if a tower generate, the top is complet randomlly set ! But I want that only spinnwebs are generated randomly..

 

Thanks for your help!

Link to comment
Share on other sites

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hey today I was trying to play in 1.21 modpack that I made on fabric (my version of fabric is in 0.16.0) with this list of mods : - Entity Model Features (by traben_0) - Entity Texture Features (by traben_0) - Advanced Chat (by Wesley8081) - Ambient Environment (by Jaredlll08) - Ambient Souds 6 (by CreativeMD) - Animatica (by FoundationGames) - Armor Statues (by Fuzs) - Auto HUD (by Crendgrim) - Bad Packets (by badasintended) - Balm (by BlayTheNinth) - Better Beds (by Motschen) - Better Chunk Loading (by someaddon) - Better Compatibility Checker (by Gaz-) - Better FPS [Render Distance] (by someaddon) - Better Ping Display (by Quintinity) - Better Statistics Screen (by TheCSDev) - Better Armor HUD (by efekos) - Better F3 ( by cominixo) - Blur + (by Motschen) - Bobby (by Johni0702) - Cat Jam (by shmove) - Catalogue (by MrCrayfish) - Chat Heads (by dzwdz) - Cherished Worlds (by TheIllusiveC4) - Chunk Sending (by someaddon) - Chunks Fade In (by kerudion) - Chunky (by pop4959) - Cloth Config (by shedaniel) - Clumps (by Jaredlll08) - Cobweb (CrystalSpider) - Collective (by Serilum) - Configured (by MrCrayfish) - Connectivity (by someaddon) - Continuity (by Pepper_Bell) - Creative Core (by CreativeMD) - Cupboard (by someaddon) - Cut Through (by Fuzs) - Dark Loading Screen (by Neecko5b84) - Debugify (by XanderIsDev) - Double Doors (by Serilum) - Dynamic FPS (by juliand665) - Dynamic Lights (by Tschipcraft) - Easy Anvils (by Fuzs) - Easy Magic (by Fuzs) - Easy Shulker Boxes (by Fuzs) - Eating Animation (by theone-ss) - Enhanced Attack Indicator (by Mineash) - Enhanced Block Entities (by FoundationGames) - Enhanced Visuals (by CreativeMD) - Entity Culling (by tr7zw) - Environmental Water (by AgentMindStorm) - Essential (by SparkUniverse_) - Extra Thicc Packets (by JaselUmena) - Fabric (by modmuss50) - Fabric Language Kotlin (by modmuss50) - Falling Leaves (by RandomMcSomethin) - Fancy Block Particles (by Hantonik) - Fancy Health Bar (by efekos) - Farsight (by someaddon) - Fast IP Ping (by Fallen_Breath) - Ferrite Core (by  malte0811) - Fish On The Line (by Serilum) - Fix GPU Memory Leak  (by someaddon) - Forge Config API Port (by Fuzs) - FPS Reducer (by bre2el) - Freecam (by hashalite) - Fzzy Config (by fzzyhmstrs) - Get It Together (by bl4ckscor3) - Global Packs (by JTK222) - Harvest With Ease (by CrystalSpider) - Ichuntil Util (by iChun) - Immediately Fast (by RaphilMC) - Immersive UI (by SSKirillSS) - Indium (by comp500) - Inventory HUD+ (by dmitrylovin) - Iris Shaders (by coderbot) - Item Physic Full (by CreativeMD) - Jade (by Snownee) - Journey Map (by techbrew) - Just Enough Breeding (by Christofmeg) - Just Enough Items (by mezz) - Just Enough Professions (by Mrbysco) - Language Reload (by Jerozgen) - Leaves Be Gone (by Fuzs) - Let Me Despawn (by frikinjay) - Let Sleeping Dogs Lie (by iChun) - Lithium (by JellySquid) - Loading Backgrounds (by Lupin) - Mineblock's Repeated Utilities (by itsmineblock11) - Menulogue (by MrCrayfish) - Mob Plaques (by Fuzs) - Mod Menu (by Prospector) - Model Gap Fix (by MehVahdJukaar) - Mouse Tweaks (by YaLTeR) - Nether Portal Fix (by BlayTheNinth) - Nicer Skies (by ztereohype) - Noisium (by Steveplays28) - Not Enough Animations (by tr7zw) - Opti GUI (by opekope2) - Packet Fixer (by TonimatasDEV) - Particle Core (by fzzyhmstrs) - Passive Shields (by Serilum) - Pick Up Notifier (by Fuzs) - Ping Wheel (by LukenSkyne) - Puzzle (by Motschen) - Puzzles LIB (by Fuzs) - Reese's Sodium Options (by FlashyReese) - Resource Pack Overrides (by Fuzs) - Server Country Flags (by khajiitos) - Server Performance (by someaddon) - Skin Layer 3D (by tr7zw) - Sodium (by JellySquid) - Sodium Extra (by FlashyReese) - Sodium Shadowy Path Blocks (by Rynnavinx) - Sound Physics Remastered (by henkelmax) - Sounds (by itsmineblock11) - Spark (by lucko) - Stack Refill (by Serilum) - Structure Essentials (by someaddon) - TCD Commons API (by TheCSDev) - Text Placeholder API (by Patbox) - Villager Names (by Serilum) - Visual Overhaul (by Motschen) - Visual Workbench (by Fuzs) - Visuality (by PinkGoosik) - Wakes (by Goby56) - Wavey Capes (by tr7zw) - YDM'S Weapon Master  (by YourDailyModderx) - Yet Another Config LIB (by XanderIsDev) - Zoomify (by XanderIsDev) And When I load it it work, I can create a world and even let him open forever at least I didn't move cause if so the game just crash and tell me this message :   Encountered an unexpected exception net.minecraft.class_148: Ticking entity at net.minecraft.server.MinecraftServer.method_3813(MinecraftServer.java:1025) at net.minecraft.server.MinecraftServer.method_3748(MinecraftServer.java:912) at net.minecraft.class_1132.method_3748(class_1132.java:114) at net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:697) at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:281) at java.base/java.lang.Thread.run(Thread.java:1583) Caused by: java.lang.NullPointerException: Cannot invoke "net.minecraft.class_4706.isEmpty()" because "tickets" is null at net.minecraft.class_3204.canNoneExpire(class_3204.java:1034) at net.minecraft.class_3204.handler$dln000$lithium$unregisterExpiringTicket(class_3204.java:1075) at net.minecraft.class_3204.method_17645(class_3204.java:172) at net.minecraft.class_3204.method_17292(class_3204.java:194) at net.minecraft.class_3215.method_17300(class_3215.java:443) at com.betterchunkloading.chunk.PlayerChunkData.checkPrediction(PlayerChunkData.java:406) at com.betterchunkloading.chunk.PlayerChunkData.checkDirection(PlayerChunkData.java:353) at com.betterchunkloading.chunk.PlayerChunkData.trackPlayerMovement(PlayerChunkData.java:177) at com.betterchunkloading.chunk.PlayerChunkData.onChunkChanged(PlayerChunkData.java:130) at com.betterchunkloading.event.EventHandler.onPlayerTick(EventHandler.java:200) at net.minecraft.class_3222.handler$zed000$betterchunkloading$onPlayerTick(class_3222.java:2618) at net.minecraft.class_3222.method_5773(class_3222.java:564) at net.minecraft.class_3218.mixinextras$bridge$method_5773$202(class_3218.java) at net.minecraft.class_3218.wrapOperation$eei000$puzzleslib$tickNonPassenger(class_3218.java:7797) at net.minecraft.class_3218.method_18762(class_3218.java:770) at net.minecraft.class_1937.method_18472(class_1937.java:498) at net.minecraft.class_3218.method_31420(class_3218.java:408) at net.minecraft.class_5574.method_31791(class_5574.java:54) at net.minecraft.class_3218.method_18765(class_3218.java:372) at net.minecraft.server.MinecraftServer.method_3813(MinecraftServer.java:1021) ... 5 more Sorry guys if it obvious but actually I'm an old player of Minecraft but I'm new in modding so yup. But Thanks everyone by advance to help me with this.
    • These forums are for Minecraft Forge, not Fabric. You would probably be better served posting this question wherever fabric support is given, most likely their discord server.
    • Add the new latest.log (logs-folder) with sites like https://mclo.gs/ and paste the link to it here
    • Update: I tried to reproduce the bug and found out that if I place a flare on a block and then dismantle it with the pickarang (Quark), the flare gets no NBT Tag after getting assigned an empty one through the offhand.
  • Topics

×
×
  • Create New...

Important Information

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