Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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);

world.spawnEntityInWorld(efb);

 

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) {

super(world);

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() {

super.onUpdate();

 

int onIdle = 0;

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

force = velocity * density1;

 

if(velocity == 0) {

onIdle++;

}

if(onIdle > 40) {

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

setDead();

}

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) {

super.onUpdate();

this.collidingBondingBloxes.clear();

// 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)){

           

                this.collidingBondingBloxes.add(block);

              }

              } else {

                block =  null;

              }

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

            }

          }

      }

   

      return this.collidingBondingBloxes;

}

 

public boolean canBeCollidedWith() {

return true;

 

}

 

 

@Override

protected void readEntityFromNBT(NBTTagCompound arg0) {

super.readFromNBT(arg0);

 

}

 

@Override

protected void writeEntityToNBT(NBTTagCompound arg0) {

 

 

}

 

@Override

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

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.