- 29
- 1
Ребят,есть код на рандомное получение зелья отравления.
Но происходит зацикливание.
Как подправить код?
Но происходит зацикливание.
Как подправить код?
- Краш-лог
-
@SubscribeEvent
public void damege(LivingHurtEvent event) {
if(event.entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer)event.entity;
if(!player.capabilities.isCreativeMode) {
if(event.entity.worldObj.rand.nextFloat() <= 0.3F) {
player.addPotionEffect(new PotionEffect(Potion.poison.id, 600, 1, true));
}
}
}
}
Краш-лог:
@SubscribeEvent
public void damege(LivingHurtEvent event) {
if(event.entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer)event.entity;
if(!player.capabilities.isCreativeMode) {
if(event.entity.worldObj.rand.nextFloat() <= 0.3F) {
player.addPotionEffect(new PotionEffect(Potion.poison.id, 600, 1, true));
}
}
}
}