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

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

 

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

 

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

    • Well, when I log in to the server, sometimes within an hour, sometimes within a minute, the server closes and informs me that there was a Ticking entity error. Below is the crash report
    • Try switching to Windowed or Borderless Window mode in Minecraft. These modes make it easier for the recorder to capture gameplay, as it still has access to the display without the game taking up all of the graphics resources.
    • This forum is for Forge, not NeoForge. Please go to them for support.
    • Forge version: 55.0.0 Minecraft version: 1.21.5 Downloads: As this is the start of a new version, it is recommended that you check the downloads page and use the latest version to receive any bug fixes. Downloads page Intro: Good evening! Today, we have released our initial build of Forge 55.0 for Minecraft 1.21.5. 1.21.5 is the newest member of the 1.21 family of versions, which was released yesterday on March 25, 2025. As a reminder, the first minor (X.0) of a Forge version is a beta. Forge betas are marked as such on the bottom left of the title screen and are candidates for any breaking changes. Additionally, there are a couple of important things to note about this update, which I've made sure to mention in this post as well. Feel free to chat with us about bugs or these implementation changes on GitHub and in our Discord server. As always, we will continue to keep all versions of 1.21 and 1.20 in active support as covered by our tiered support policy. Cheers, happy modding, and good luck porting! Rendering Refactor For those who tuned in to Minecraft Live on March 22, 2025, you may already know that Mojang have announced their intention to bring their new Vibrant Visuals overhaul to Java in the future. They've taken the first steps toward this by refactoring how rendering pipelines and render types are handled internally. This has, in turn, made many of Forge's rendering APIs that have existed for years obsolete, as they (for the most part) can be done directly in vanilla. If there was a rendering API that was provided by Forge which you believe should be re-implemented, we're happy to discuss on GitHub through an issue or a pull request. Deprecation of weapon-like ToolActions In 1.21.5, Minecraft added new data components for defining the characteristics of weapons in data. This includes attack speed, block tags which define efficient blocks, and more. As such, we will begin marking our ToolActions solution for this as deprecated. ToolActions were originally added to address the problem of creating modded tools that needed to perform the same actions as vanilla tools. There are still a few tool actions that will continue to be used, such as the shears tool action for example. There are some existing Forge tool actions that are currently obsolete and have no effect given the way the new data components are implemented. We will continue to work on these deprecations and invite you to chat with us on GitHub or Discord if you have any questions.
    • In summary, a full mod to adjust mining progress in such a specific way does not yet exist in its exact form, but it is possible to find mods that change certain aspects of progression (e.g. "Harder Ores").
  • Topics

  • Who's Online (See full list)

    • There are no registered users currently online
×
×
  • Create New...

Important Information

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