Jump to content

[1.7.2] Entity wont initiate [SOLVED]


Recommended Posts

i have created an entity similar to the fallingblock entity though when i spawn it in with an Item (

package src.IVWeather.item;


import src.IVWeather.block.BlockRushingWater;

import src.IVWeather.entity.EntityFlyingBlock;

import net.minecraft.block.material.Material;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.init.Blocks;

import net.minecraft.init.Items;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.world.World;


public class ItemDEV extends Item {


public ItemDEV(){



public ItemStack onItemRightClick(ItemStack it, World world, EntityPlayer epl){


EntityFlyingBlock efb = new EntityFlyingBlock(world, Blocks.stone, 3, Material.rock, (int) epl.posX, (int) epl.posY, (int) epl.posZ);



return it;








i get this error message


[09:04:55] [server thread/WARN]: Skipping Entity with id flying!

java.lang.NoSuchMethodException: src.IVWeather.entity.EntityFlyingBlock.<init>(net.minecraft.world.World)

at java.lang.Class.getConstructor0(Unknown Source)

at java.lang.Class.getConstructor(Unknown Source)

at net.minecraft.entity.EntityList.createEntityFromNBT(EntityList.java:160)




entity class

package src.IVWeather.entity;


import java.util.List;


import net.minecraft.entity.Entity;

import net.minecraft.entity.item.EntityFallingBlock;

import net.minecraft.init.Blocks;

import net.minecraft.block.*;

import net.minecraft.block.material.Material;

import net.minecraft.nbt.NBTTagCompound;

import net.minecraft.util.AxisAlignedBB;

import net.minecraft.util.MathHelper;

import net.minecraft.world.World;


public class EntityFlyingBlock extends Entity {


List collidingBondingBloxes;

Material mate;

float density1;


public EntityFlyingBlock(World world, Block inheritblock, float density, Material mat, int x, int y, int z) {


float velocity = (float) (this.motionX + this.motionY + this.motionZ) / 3;

float force = velocity * density;

mate = mat;

this.posX = x;

this.posY = y;

this.posZ = z;

density1 = density;

setSize(1, 1);

this.iblock = inheritblock;



float force;

Block iblock;


public void onUpdate() {



int onIdle = 0;

float velocity = (float) (this.motionX + this.motionY + this.motionZ) / 3;

force = velocity * density1;


if(velocity == 0) {



if(onIdle > 40) {

worldObj.setBlock((int) this.posX, (int) this.posY, (int) this.posZ, this.iblock);



for(int k = 0; k < this.collidingBondingBloxes.size(); k++) {

Block block = this.collidingBondingBloxes.get(k);

if(this.velocity > worldObj.getFBlockHardness(block)) {

block = new BlockFlyingBlock(block.getMaterial(), block);





public float getForce() {

return force;




public List getCollidingBlocksWithMoveBlock(Entity entity, AxisAlignedBB par2AxisAlignedBB) {



// declaring bounding box as int to be used in 'for' statement

int i = MathHelper.floor_double(entity.boundingBox.minX);

    int j = MathHelper.floor_double(entity.boundingBox.maxX + 1.0D);

    int k = MathHelper.floor_double(entity.boundingBox.minY);

    int l = MathHelper.floor_double(entity.boundingBox.maxY + 1.0D);

    int i1 = MathHelper.floor_double(entity.boundingBox.minZ);

    int j1 = MathHelper.floor_double(entity.boundingBox.maxZ + 1.0D);

    // 'for' statement of minX to MaxX

    for (int k1 = i; k1 < j; k1++) {

    //'for' statement of minZ to MaxZ

        for (int l1 = i1; l1 < j1; l1++) {

        // 'for' statement of minY to MaxY

            for (int i2 = k - 1; i2 < l; i2++)


            //declaring block

            Block block;

              if ((k1 >= -30000000) && (k1 < 30000000) && (l1 >= -30000000) && (l1 < 30000000)) {

                // getting all blocks inside bounding Box

              block = worldObj.getBlock(k1, i2, l1);

            // i dont want air blocks included so they will not be added

              if(!worldObj.isAirBlock(k1, i2, l1)){




              } else {

                block =  null;


              block.addCollisionBoxesToList(worldObj, k1, i2, l1, par2AxisAlignedBB, this.collidingBondingBloxes, (Entity) entity);





      return this.collidingBondingBloxes;



public boolean canBeCollidedWith() {

return true;






protected void readEntityFromNBT(NBTTagCompound arg0) {






protected void writeEntityToNBT(NBTTagCompound arg0) {






protected void entityInit() {

// TODO Auto-generated method stub







as delcared in mod class





//render registry for entity

RenderingRegistry.registerEntityRenderingHandler(EntityFlyingBlock.class, new RenderFlyin(new ModelBlock(), Blocks.planks));



    EntityRegistry.registerGlobalEntityID(EntityFlyingBlock.class, "flying!", EntityRegistry.findGlobalUniqueEntityId());





please help, Thank you

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.

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.

  • Create New...

Important Information

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