Jump to content

Block overflows AxisAlignedBB pool


planetguy

Recommended Posts

I have isolated the error to this block because with the line that loads it commented out, it works fine. With the block loaded, it gives me this stack trace:


java.lang.OutOfMemoryError: Java heap space

    at java.util.Arrays.copyOf(Arrays.java:2245)

    at java.util.Arrays.copyOf(Arrays.java:2219)

    at java.util.ArrayList.grow(ArrayList.java:213)

    at java.util.ArrayList.ensureCapacityInternal(ArrayList.java:187)

    at java.util.ArrayList.add(ArrayList.java:411)

    at net.minecraft.util.AABBPool.getAABB(AABBPool.java:51)

    at net.minecraft.block.Block.getCollisionBoundingBoxFromPool(Block.java:593)

    at net.minecraft.block.Block.addCollisionBoxesToList(Block.java:559)

    at net.minecraft.world.World.getCollidingBoundingBoxes(World.java:1681)

    at net.minecraft.entity.player.EntityPlayerMP.<init>(EntityPlayerMP.java:178)

    at net.minecraft.server.management.ServerConfigurationManager.createPlayerForUser(ServerConfigurationManager.java:383)

    at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:91)

    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:674)

    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:570)

    at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:127)

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

    at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)



 

The block itself:

 


package planetguy.Gizmos.timebomb;

 

import java.util.Random;

 

import planetguy.Gizmos.ConfigHolder;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

 

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

import net.minecraft.client.renderer.texture.IconRegister;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.entity.EntityLiving;

import net.minecraft.entity.item.EntityTNTPrimed;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.util.Icon;

import net.minecraft.world.World;

 

public class BlockTimeBomb extends Block{

 

    private Icon topTex;

    private Icon bottomTex;

 

    public BlockTimeBomb(int id) {

        super(id, Material.tnt);

        this.setTickRandomly(true);

        this.setCreativeTab(CreativeTabs.tabRedstone);

        // TODO Auto-generated constructor stub

    }

   

    public void registerIcons(IconRegister ir){

        System.out.println("GraviBomb textures loading");

        topTex=ir.registerIcon(ConfigHolder.modName+":"+"bombTop");

        bottomTex=ir.registerIcon(ConfigHolder.modName+":"+"bombBottom");

    }

 

    @SideOnly(Side.CLIENT)

    public Icon getBlockTextureFromSideAndMetadata(int side, int meta){

        if(side==0||side==1){

            return topTex;

        }

        if(meta%2==0){//We're a plain time bomb

           

        }else{//Fork bomb >

           

        }

        return topTex;

    }

 

    public void updateTick(World w, int x, int y, int z, Random r){

        int curMeta=w.getBlockMetadata(x,y,z);

        int a=r.nextInt(5);

        if(a==0){

            curMeta+=2;

        }

        if(curMeta>15){

            w.spawnEntityInWorld(new EntityTNTPrimed(w, (double)((float)x + 0.5F), (double)((float)y + 0.5F), (double)((float)z + 0.5F), (EntityLiving) null));

        }

        w.setBlockMetadataWithNotify(x, y, z, curMeta, 0x02);

       

    }     

   

    public boolean onBlockActivated(World w, int x, int y, int z, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9){

        fork(w,x,y,z);

        return true;

    }

 

    /** The fork method for the fork bomb variant of the time bomb. Moves the bomb to all available spaces

    * around it, or if there isn't space leaves it where it is.

    *

    */

    private void fork(World w, int x, int y, int z){

 

        if(w.getBlockMetadata(x, y, z)%2!=1||!ConfigHolder.allowFB){

            return;

        }

        boolean hasReplaced=false;

        int meta=w.getBlockMetadata(x, y, z);

        if(w.getBlockMaterial(x+1, y, z)==Material.air){

            w.setBlock(x+1, y, z, ConfigHolder.timeExplosivesID, meta, 0x02);

            hasReplaced=true;

        }

        if(w.getBlockMaterial(x-1, y, z)==Material.air){

            w.setBlock(x-1, y, z, ConfigHolder.timeExplosivesID, meta, 0x02);

            hasReplaced=true;

        }

        if(w.getBlockMaterial(x, y+1, z)==Material.air){

            w.setBlock(x, y+1, z, ConfigHolder.timeExplosivesID, meta, 0x02);

            hasReplaced=true;

        }

        if(w.getBlockMaterial(x, y-1, z)==Material.air){

            w.setBlock(x, y-1, z, ConfigHolder.timeExplosivesID, meta, 0x02);

            hasReplaced=true;

        }

        if(w.getBlockMaterial(x, y, z+1)==Material.air){

            w.setBlock(x, y, z+1, ConfigHolder.timeExplosivesID, meta, 0x02);

            hasReplaced=true;

        }

        if(w.getBlockMaterial(x, y, z-1)==Material.air){

            w.setBlock(x, y, z-1, ConfigHolder.timeExplosivesID, meta, 0x02);

            hasReplaced=true;

        }

        if(hasReplaced){

            w.setBlockToAir(x, y, z);

        }

    }

}

Can anyone help me with this one?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...