Jump to content

Recommended Posts

Posted

Hello @ all ,

 

after using my skill for example:

 

public class IceBall extends EntityThrowable
{
  public IceBall(World par1World)
  {
    super(par1World);
  }
  
  public IceBall(World par1World, EntityPlayer par3EntityPlayer)
  {
    super(par1World, par3EntityPlayer);
  }
  
  public IceBall(World par1World, double par2, double par4, double par6)
  {
    super(par1World, par2, par4, par6);
  }
  
  public int ticks = 20;
  
  public void onEntityUpdate()
  {
    if (this.ticks <= 0)
    {
      this.ticks = 20;
      setDead();
    }
    else
    {
      this.ticks -= 1;
    }
  }
  
  protected void onImpact(MovingObjectPosition par1MovingObjectPosition)
  {
    if (par1MovingObjectPosition.entityHit != null)
    {
      double x = 0.0D;
      double y = 0.0D;
      double z = 0.0D;
      
      EntityLivingBase living = (EntityLivingBase)par1MovingObjectPosition.entityHit;
      
      living.addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), 300, 3000));
      
      x = par1MovingObjectPosition.entityHit.posX;
      y = par1MovingObjectPosition.entityHit.posY;
      z = par1MovingObjectPosition.entityHit.posZ;
      
      worldObj.setBlockState(new BlockPos(x , y + 2, z), Blocks.packed_ice.getDefaultState());
      
      worldObj.setBlockState(new BlockPos(x + 1, y + 2, z), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x - 1, y + 2, z), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x , y + 2, z + 1), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x , y + 2, z - 1), Blocks.packed_ice.getDefaultState());
      
      worldObj.setBlockState(new BlockPos(x + 1, y + 2, z + 1), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x + 1, y + 2, z - 1), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x - 1, y + 2, z + 1), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x - 1, y + 2, z - 1), Blocks.packed_ice.getDefaultState());
      
      worldObj.setBlockState(new BlockPos(x + 2, y + 1, z), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x + 2, y , z), Blocks.packed_ice.getDefaultState());
      
      worldObj.setBlockState(new BlockPos(x - 2, y + 1, z), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x - 2, y , z), Blocks.packed_ice.getDefaultState());
      
      worldObj.setBlockState(new BlockPos(x , y + 1, z + 2), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x , y , z + 2), Blocks.packed_ice.getDefaultState());
      
      worldObj.setBlockState(new BlockPos(x , y + 1, z - 2), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x , y , z - 2), Blocks.packed_ice.getDefaultState());
      
      worldObj.setBlockState(new BlockPos(x + 2, y + 1, z + 1), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x + 2, y , z + 1), Blocks.packed_ice.getDefaultState());
      
      worldObj.setBlockState(new BlockPos(x + 2, y + 1, z - 1), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x + 2, y , z - 1), Blocks.packed_ice.getDefaultState());
      
      worldObj.setBlockState(new BlockPos(x - 1, y + 1, z + 2), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x - 1, y , z + 2), Blocks.packed_ice.getDefaultState());
      
      worldObj.setBlockState(new BlockPos(x + 1, y + 1, z + 2), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x + 1, y , z + 2), Blocks.packed_ice.getDefaultState());
      
      worldObj.setBlockState(new BlockPos(x - 2, y + 1, z + 1), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x - 2, y , z + 1), Blocks.packed_ice.getDefaultState());
      
      worldObj.setBlockState(new BlockPos(x - 2, y + 1, z - 1), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x - 2, y , z - 1), Blocks.packed_ice.getDefaultState());
      
      worldObj.setBlockState(new BlockPos(x - 1, y + 1, z - 2), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x - 1, y , z - 2), Blocks.packed_ice.getDefaultState());
   
      worldObj.setBlockState(new BlockPos(x + 1, y + 1, z - 2), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x + 1, y , z - 2), Blocks.packed_ice.getDefaultState());
      
      worldObj.setBlockState(new BlockPos(x + 2, y + 1, z + 2), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x + 2, y , z + 2), Blocks.packed_ice.getDefaultState());
      
      worldObj.setBlockState(new BlockPos(x - 2, y + 1, z + 2), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x - 2, y , z + 2), Blocks.packed_ice.getDefaultState());
      
      worldObj.setBlockState(new BlockPos(x + 2, y + 1, z- 2), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x + 2, y , z - 2), Blocks.packed_ice.getDefaultState());

      worldObj.setBlockState(new BlockPos(x - 2, y + 1, z -2), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x - 2, y , z - 2), Blocks.packed_ice.getDefaultState());

      par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, getThrower()), 5.0F);
    }
    if (!this.worldObj.isRemote)
    {
      int x = par1MovingObjectPosition.getBlockPos().getX();
      int y = par1MovingObjectPosition.getBlockPos().getY();
      int z = par1MovingObjectPosition.getBlockPos().getZ();
      
      worldObj.setBlockState(new BlockPos(x , y + 2, z), Blocks.packed_ice.getDefaultState());
      
      worldObj.setBlockState(new BlockPos(x + 1, y + 2, z), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x - 1, y + 2, z), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x , y + 2, z + 1), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x , y + 2, z - 1), Blocks.packed_ice.getDefaultState());
      
      worldObj.setBlockState(new BlockPos(x + 1, y + 2, z + 1), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x + 1, y + 2, z - 1), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x - 1, y + 2, z + 1), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x - 1, y + 2, z - 1), Blocks.packed_ice.getDefaultState());
      
      worldObj.setBlockState(new BlockPos(x + 2, y + 1, z), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x + 2, y, z), Blocks.packed_ice.getDefaultState());
      
      worldObj.setBlockState(new BlockPos(x - 2, y + 1, z), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x - 2, y, z), Blocks.packed_ice.getDefaultState());
      
      worldObj.setBlockState(new BlockPos(x , y + 1, z + 2), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x , y, z + 2), Blocks.packed_ice.getDefaultState());
      
      worldObj.setBlockState(new BlockPos(x , y + 1, z - 2), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x , y, z - 2), Blocks.packed_ice.getDefaultState());
      
      worldObj.setBlockState(new BlockPos(x + 2, y + 1, z + 1), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x + 2, y, z + 1), Blocks.packed_ice.getDefaultState());
      
      worldObj.setBlockState(new BlockPos(x + 2, y + 1, z - 1), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x + 2, y, z - 1), Blocks.packed_ice.getDefaultState());
      
      worldObj.setBlockState(new BlockPos(x - 1, y + 1, z + 2), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x - 1, y, z + 2), Blocks.packed_ice.getDefaultState());
      
      worldObj.setBlockState(new BlockPos(x + 1, y + 1, z + 2), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x + 1, y, z + 2), Blocks.packed_ice.getDefaultState());
      
      worldObj.setBlockState(new BlockPos(x - 2, y + 1, z + 1), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x - 2, y, z + 1), Blocks.packed_ice.getDefaultState());

      worldObj.setBlockState(new BlockPos(x - 2, y + 1, z - 1), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x - 2, y, z - 1), Blocks.packed_ice.getDefaultState());
      
      worldObj.setBlockState(new BlockPos(x - 1, y + 1, z - 2), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x - 1, y, z - 2), Blocks.packed_ice.getDefaultState());    
      
      worldObj.setBlockState(new BlockPos(x + 1, y + 1, z - 2), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x + 1, y, z - 2), Blocks.packed_ice.getDefaultState());
      
      worldObj.setBlockState(new BlockPos(x + 2, y + 1, z + 2), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x + 2, y, z + 2), Blocks.packed_ice.getDefaultState());
      
      worldObj.setBlockState(new BlockPos(x - 2, y + 1, z + 2), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x - 2, y, z + 2), Blocks.packed_ice.getDefaultState());
    
      worldObj.setBlockState(new BlockPos(x + 2, y + 1, z - 2), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x + 2, y, z - 2), Blocks.packed_ice.getDefaultState());
      
      worldObj.setBlockState(new BlockPos(x - 2, y + 1, z - 2), Blocks.packed_ice.getDefaultState());
      worldObj.setBlockState(new BlockPos(x - 2, y, z - 2), Blocks.packed_ice.getDefaultState());
      
      setDead();
    }
  }
}

 

when an "Entity" gets into the blocks ... the game crashes and the error log says "Entity Ticking" ... any idea?

Posted

On which line does the error occur? Please paste the content of that line of code.

Providing a detailed error log would be nice too.

I still haven't published a mod because I can never get that in-dev version just right to warrant a public release. And yes, after two years of mod development I am still learning to speak Java.

 

Follow me on GitHub: https://github.com/yooksi

Contact me on Twitter: https://twitter.com/yooksi

Read my Minecraft blog: https://yooksidoesminecraft.blogspot.de/

Posted

--- ERROR LOG ---

---- Minecraft Crash Report ----
// Don't be sad, have a hug! <3

Time: 16.10.16 23:29
Description: Ticking entity

java.lang.NullPointerException: Ticking entity
at DevilFruitSkills.IceArrow.changeToIce(IceArrow.java:39)
at DevilFruitSkills.IceArrow.onImpact(IceArrow.java:65)
at net.minecraft.entity.projectile.EntityThrowable.onUpdate(EntityThrowable.java:239)
at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2011)
at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:725)
at net.minecraft.world.World.updateEntity(World.java:1976)
at net.minecraft.world.World.updateEntities(World.java:1805)
at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:560)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:777)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:681)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:159)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:548)
at java.lang.Thread.run(Unknown Source)

 

 

 

--- CODE ---

 

public class IceArrow extends EntityThrowable {
public IceArrow(World par1World) {
	super(par1World);
}

public IceArrow(World par1World, EntityPlayer par3EntityPlayer) {
	super(par1World, par3EntityPlayer);
}

public IceArrow(World par1World, double par2, double par4, double par6) {
	super(par1World, par2, par4, par6);
}

public int ticks = 200;

public void onEntityUpdate() {
	if (this.ticks <= 0) {
		this.ticks = 200;
		setDead();
	} else {
		this.ticks -= 1;
	}
}

public void changeToIce(BlockPos location, int radius) {
	for (int x = location.getX() - radius; x <= location.getX() + radius; x++) {
		for (int y = location.getY() - radius; y <= location.getY() + radius; y++) {
			for (int z = location.getZ() - radius; z <= location.getZ() + radius; z++) {
				BlockPos pos = new BlockPos(x, y, z);
				if (pos.distanceSq(location) <= radius) {
					IBlockState blockState = worldObj.getBlockState(pos);
					if (blockState != Blocks.air
							.getDefaultState() /* TODO und kein gras */) {
						worldObj.setBlockState(pos, BlocksUpdate.IceBlock1.getDefaultState());
					}
				}
			}
		}
	}
}

protected void onImpact(MovingObjectPosition par1MovingObjectPosition) {
	if (par1MovingObjectPosition.entityHit != null) {
		par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, getThrower()),10.0F);

	}
	if ( !this.worldObj.isRemote ) {

		changeToIce(par1MovingObjectPosition.getBlockPos(), 5);

		setDead();
	}
}

protected float getGravityVelocity() {
	return 0.001F;
}
}

Posted

Without knowing the content of the code on line 39, my best bet would be that one of these elements you are accessing are null: location or IceBlock1.

I still haven't published a mod because I can never get that in-dev version just right to warrant a public release. And yes, after two years of mod development I am still learning to speak Java.

 

Follow me on GitHub: https://github.com/yooksi

Contact me on Twitter: https://twitter.com/yooksi

Read my Minecraft blog: https://yooksidoesminecraft.blogspot.de/

Posted

imports are

 

import java.util.ArrayList;
import java.util.List;

import ArturFarid.BlockUpdate.init.BlocksUpdate;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.init.Blocks;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.BlockPos;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;

 

line 39 is:

 

		for (int x = location.getX() - radius; x <= location.getX() + radius; x++) {

Posted

location is null.

 

This is passing null:

 

changeToIce(par1MovingObjectPosition.getBlockPos(), 5);

 

par1MovingObjectPosition.getBlockPos()

is not guaranteed to not be null.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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



×
×
  • Create New...

Important Information

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