I have a grenade in my mod which is thrown and on contact with an object or entity explodes. the explosion does not hurt entities and appears to break blocks but the blocks are only invisible. When you leave the world and get back on it the blocks revert to being visible again. If anyone could tell me how to fix this that would be great! Code for the grenade entity below.
package com.krazykid1117.entity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
public class EntityGrenade extends EntityThrowable{
public EntityGrenade(World p_i1776_1_) {
super(p_i1776_1_);
}
public EntityGrenade(World world, EntityLivingBase entity){
super(world, entity);
}
@Override
protected void onImpact(MovingObjectPosition p_70184_1_) {
for(int i = 0; i < 10; i ++){
this.worldObj.spawnParticle("largesmoke", this.posX, this.posY, this.posZ, 0f, 0f, 0f);
}
if(!this.worldObj.isRemote);
this.setDead();
if(this.worldObj.isRemote){
this.worldObj.createExplosion((Entity) null, this.posX, this.posY, this.posZ, 5.0f, true);
}
}
}