Follow along with the video below to see how to install our site as a web app on your home screen.
Примечание: This feature may not be available in some browsers.
talosdx написал(а):Если бы всё так было бы просто я бы не создал темы. Проблема в том, что entity это не entityplayer
public void onEntityWalking(World par1World, int par2, int par3, int par4, Entity par5Entity)
{
//EntityPlayer player = (EntityPlayer)par5Entity.get
//par5Entity.addPotionEffect((new PotionEffect(20, 100, 1000)));
par5Entity.attackEntityFrom(DamageSource.wither, 1.0F);
}
Вот как-то использовать зелье на игрока не получается, хотел попробовать определить entity именно как EntityPlayer, первая закомментированная недописанная строка, но нифига не понял как.
EntityPlayer player = (EntityPlayer) par5Entity;
public void onEntityCollidedWithBlock(World p_149670_1_, int p_149670_2_, int p_149670_3_, int p_149670_4_, Entity entity)
{
if(entity instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer)entity;
player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 80, 0));
player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 80, 0));
}
}