Jump to content

Recommended Posts

Posted

Hey Fellow Modders,

 

I am making a terraria mod, and to do this, I have to add in custom ore generation.  The ore gen that I am using seems to be causing this error: "Memory connection overburdened; after processing 2500 packets, we still have 325 to go!"

 

It did not do this until I added in ore generation into the game.  Is there a way to fix this?  I used this tutorial for my ore generation:

http://www.minecraftforum.net/topic/1485580-tutorialforge132forge-ore-generation-tutorial/

 

This is my first experience with Forge, and I am relatively new to Java, but I do understand a lot about programming (C# and web developer).  If anyone could give me a hint about where to look in my code, that would be greatly appreciated.

Posted

seeing someone else's code isn't helpful in diagnosing a problem with your code

 

for all we know you misspelled your ore name or you are generating a null block or you are....9000000 different possible errors later.

 

we cant help unless you show us what your code is even if its exactly the same as the tutorial it could still have a slight error in it such as a typo

Posted

Okay, here are all my classes that I am using for generation:

 

WorldGenJava

  Quote

package terraria.generic;

 

import java.util.Random;

 

import net.minecraft.world.World;

import net.minecraft.world.chunk.IChunkProvider;

import net.minecraft.world.gen.feature.WorldGenGlowStone1;

import net.minecraft.world.gen.feature.WorldGenMinable;

import cpw.mods.fml.common.IWorldGenerator;

 

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 generateSurface(World world, Random random, int chunkX, int chunkZ) {

for(int i=0; i<15; i++){

//i = size of vein

int xCoord = chunkX + random.nextInt(16);

int yCoord = random.nextInt(60); //Max Height

int zCoord = chunkZ + random.nextInt(16);

(new WorldGenMinable(terraria.generic.Generic.CopperOre.blockID, 12)).generate(world, random, xCoord, yCoord, zCoord);

}

for(int i=0; i<6; i++)

{

int xCoord = chunkX + random.nextInt(16);

int yCoord = random.nextInt(8 + 12); //Max Height

int zCoord = chunkZ + random.nextInt(16);

(new WorldGenMinable(terraria.generic.Generic.SilverOre.blockID, 8 )).generate(world, random, xCoord, yCoord, zCoord);

}

for(int i=0; i<3; i++)

{

int xCoord = chunkX + random.nextInt(16);

int yCoord = random.nextInt(8 + 12); //Max Height

int zCoord = chunkZ + random.nextInt(16);

(new WorldGenMinable(terraria.generic.Generic.Demonite.blockID, 8 )).generate(world, random, xCoord, yCoord, zCoord);

}

}

 

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

 

for(int i=0; i<15; i++)

{

//i = number of veins per chunk

int xCoord = chunkX + random.nextInt(16);

int yCoord = random.nextInt(30); //Max Height

int zCoord = chunkZ + random.nextInt(16);

(new WorldGenNether(terraria.generic.Generic.Hellstone.blockID, 8 )).generate(world, random, xCoord, yCoord, zCoord);

}

 

}

 

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

 

}

 

 

}

 

 

WorldGenNether

  Quote

 

package terraria.generic;

 

import java.util.Random;

 

import net.minecraft.block.Block;

import net.minecraft.util.MathHelper;

import net.minecraft.world.World;

 

public class WorldGenNether {

    /** The block ID of the ore to be placed using this generator. */

    private int minableBlockId;

    private int minableBlockMeta = 0;

 

    /** The number of blocks to generate. */

    private int numberOfBlocks;

 

    public WorldGenNether(int par1, int par2)

    {

        this.minableBlockId = par1;

        this.numberOfBlocks = par2;

    }

 

    public WorldGenNether(int id, int meta, int number)

    {

        this(id, number);

        minableBlockMeta = meta;

    }

 

    public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5)

    {

        float var6 = par2Random.nextFloat() * (float)Math.PI;

        double var7 = (double)((float)(par3 + 8) + MathHelper.sin(var6) * (float)this.numberOfBlocks / 8.0F);

        double var9 = (double)((float)(par3 + 8) - MathHelper.sin(var6) * (float)this.numberOfBlocks / 8.0F);

        double var11 = (double)((float)(par5 + 8) + MathHelper.cos(var6) * (float)this.numberOfBlocks / 8.0F);

        double var13 = (double)((float)(par5 + 8) - MathHelper.cos(var6) * (float)this.numberOfBlocks / 8.0F);

        double var15 = (double)(par4 + par2Random.nextInt(3) - 2);

        double var17 = (double)(par4 + par2Random.nextInt(3) - 2);

 

        for (int var19 = 0; var19 <= this.numberOfBlocks; ++var19)

        {

            double var20 = var7 + (var9 - var7) * (double)var19 / (double)this.numberOfBlocks;

            double var22 = var15 + (var17 - var15) * (double)var19 / (double)this.numberOfBlocks;

            double var24 = var11 + (var13 - var11) * (double)var19 / (double)this.numberOfBlocks;

            double var26 = par2Random.nextDouble() * (double)this.numberOfBlocks / 16.0D;

            double var28 = (double)(MathHelper.sin((float)var19 * (float)Math.PI / (float)this.numberOfBlocks) + 1.0F) * var26 + 1.0D;

            double var30 = (double)(MathHelper.sin((float)var19 * (float)Math.PI / (float)this.numberOfBlocks) + 1.0F) * var26 + 1.0D;

            int var32 = MathHelper.floor_double(var20 - var28 / 2.0D);

            int var33 = MathHelper.floor_double(var22 - var30 / 2.0D);

            int var34 = MathHelper.floor_double(var24 - var28 / 2.0D);

            int var35 = MathHelper.floor_double(var20 + var28 / 2.0D);

            int var36 = MathHelper.floor_double(var22 + var30 / 2.0D);

            int var37 = MathHelper.floor_double(var24 + var28 / 2.0D);

 

            for (int var38 = var32; var38 <= var35; ++var38)

            {

                double var39 = ((double)var38 + 0.5D - var20) / (var28 / 2.0D);

 

                if (var39 * var39 < 1.0D)

                {

                    for (int var41 = var33; var41 <= var36; ++var41)

                    {

                        double var42 = ((double)var41 + 0.5D - var22) / (var30 / 2.0D);

 

                        if (var39 * var39 + var42 * var42 < 1.0D)

                        {

                            for (int var44 = var34; var44 <= var37; ++var44)

                            {

                                double var45 = ((double)var44 + 0.5D - var24) / (var28 / 2.0D);

 

                                Block block = Block.blocksList[par1World.getBlockId(var38, var41, var44)];

                                if (var39 * var39 + var42 * var42 + var45 * var45 < 1.0D && (block != null && par1World.getBlockId(var38, var41, var44) == Block.netherrack.blockID))

                                {

                                    par1World.setBlockAndMetadata(var38, var41, var44, this.minableBlockId, minableBlockMeta);

                                }

                            }

                        }

                    }

                }

            }

        }

 

        return true;

    }

}

 

 

Generic

  Quote

 

package terraria.generic;

 

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

import net.minecraft.creativetab.CreativeTabs;

import cpw.mods.fml.common.Mod;

import cpw.mods.fml.common.Mod.Init;

import cpw.mods.fml.common.Mod.Instance;

import cpw.mods.fml.common.Mod.PostInit;

import cpw.mods.fml.common.Mod.PreInit;

import cpw.mods.fml.common.SidedProxy;

import cpw.mods.fml.common.event.FMLInitializationEvent;

import cpw.mods.fml.common.event.FMLPostInitializationEvent;

import cpw.mods.fml.common.event.FMLPreInitializationEvent;

import cpw.mods.fml.common.network.NetworkMod;

import cpw.mods.fml.common.registry.GameRegistry;

import cpw.mods.fml.common.registry.LanguageRegistry;

 

@Mod(modid = "TerrariaMod", name = "TerrariaMod", version = "0.0.1")

@NetworkMod(clientSideRequired = true, serverSideRequired = false)

public class Generic {

 

public final static Block CopperOre = new CopperOreBlock(500,0,Material.rock)

.setBlockName("Copper Ore").setCreativeTab(CreativeTabs.tabBlock);

public final static Block SilverOre =  new SilverOreBlock(501,1,Material.rock)

.setBlockName("Silver Ore").setCreativeTab(CreativeTabs.tabBlock);

public final static Block Demonite = new DemoniteBlock(502,2,Material.rock)

.setBlockName("Demonite").setCreativeTab(CreativeTabs.tabBlock).setLightValue(15.0f);

public final static Block Meteorite = new MeteoriteBlock(503,3,Material.rock)

.setBlockName("Meteorite").setCreativeTab(CreativeTabs.tabBlock).setLightValue(12.0f);

public final static Block Hellstone = new HellStoneBlock(504,4,Material.rock)

.setBlockName("Hell Stone").setCreativeTab(CreativeTabs.tabBlock).setLightValue(10.0f);

 

@Instance("Generic")

public static Generic instance;

 

@SidedProxy(clientSide = "terraria.generic.client.ClientProxy", serverSide = "terraria.generic.CommonProxy")

public static CommonProxy proxy;

 

@PreInit

public void preInit(FMLPreInitializationEvent event)

{

 

 

 

}

 

@Init

public void load(FMLInitializationEvent event)

{

GameRegistry.registerWorldGenerator(new WorldGen());

 

GameRegistry.registerBlock(CopperOre, "Copper Ore");

LanguageRegistry.addName(CopperOre, "Copper Ore");

 

GameRegistry.registerBlock(SilverOre, "Silver Ore");

LanguageRegistry.addName(SilverOre, "Silver Ore");

 

GameRegistry.registerBlock(Demonite, "Demonite");

LanguageRegistry.addName(Demonite, "Demonite");

 

GameRegistry.registerBlock(Meteorite, "Meteorite");

LanguageRegistry.addName(Meteorite, "Meteorite");

 

GameRegistry.registerBlock(Hellstone, "Hell Stone");

LanguageRegistry.addName(Hellstone, "Hell Stone");

 

proxy.registerRenders();

}

 

@PostInit

public void postInit(FMLPostInitializationEvent event)

{

 

 

 

}

 

}

 

 

That is my code.  If you guys could look at it and give me a clue as to where to look, that would be great.

Posted

It seems like there is a lot of render lag.  For example, lava will start flowing, then it will stop moving and fast forward 4 blocks after a little bit of lag.  Then I got memory errors and ############GL Error#############

Posted

I have also noticed that there is a little bit of lag in the overworld as well.  There are several generating chunks, and this is in the console:

 

2013-03-11 13:58:23 [iNFO] [sTDOUT] Fetching addPacket for removed entity

2013-03-11 13:58:31 [iNFO] [sTDOUT] Memory connection overburdened; after processing 2500 packets, we still have 359 to go!

 

I did some testing and took I my generation code, and it helped lag a little bit, but there was still a lot of render lag.

 

It seems like if I just refresh the graphics settings, it fixes the chunk glitches.

 

Any clue what would cause this?

 

 

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

    • Hello , when I try to launch the forge installer it just crash with a message for 0,5 secondes. I'm using java 17 to launch it. Here's the link of the error :https://cdn.corenexis.com/view/?img=d/ma24/qs7u4U.jpg  
    • You will find the crash-report or log in your minecraft directory (crash-report or logs folder)
    • Use a modpack which is using these 2 mods as working base:   https://www.curseforge.com/minecraft/modpacks/life-in-the-village-3
    • inicie un mundo donde instale Croptopia y Farmer's Delight, entonces instale el addon Croptopia Delight pero no funciona. es la version 1.18.2
    • Hello all. I'm currently grappling with the updateShape method in a custom class extending Block.  My code currently looks like this: The conditionals in CheckState are there to switch blockstate properties, which is working fine, as it functions correctly every time in getStateForPlacement.  The problem I'm running into is that when I update a state, the blocks seem to call CheckState with the position of the block which was changed updated last.  If I build a wall I can see the same change propagate across. My question thus is this: is updateShape sending its return to the neighbouring block?  Is each block not independently executing the updateShape method, thus inserting its own current position?  The first statement appears to be true, and the second false (each block is not independently executing the method). I have tried to fix this by saving the block's own position to a variable myPos at inception, and then feeding this in as CheckState(myPos) but this causes a worse outcome, where all blocks take the update of the first modified block, rather than just their neighbour.  This raises more questions than it answers, obviously: how is a different instance's variable propagating here?  I also tried changing it so that CheckState did not take a BlockPos, but had myPos built into the body - same problem. I have previously looked at neighbourUpdate and onNeighbourUpdate, but could not find a way to get this to work at all.  One post on here about updatePostPlacement and other methods has proven itself long superceded.  All other sources on the net seem to be out of date. Many thanks in advance for any help you might offer me, it's been several days now of trying to get this work and several weeks of generally trying to get round this roadblock.  - Sandermall
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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