use of com.lying.variousoddities.entity.AbstractGoblinWolf in project VariousOddities by Lyinginbedmon.
the class VOBusServer method onDeathNearGoblinEvent.
@SubscribeEvent
public static void onDeathNearGoblinEvent(LivingDeathEvent event) {
LivingEntity victim = event.getEntityLiving();
DamageSource cause = event.getSource();
World world = victim.getEntityWorld();
// Reduce refractory period of nearby goblins when a. goblin is slain or b. goblin slays any mob (esp. players)
if (victim instanceof EntityGoblin)
reduceRefractory(victim, 1000);
else if (cause instanceof EntityDamageSource && ((EntityDamageSource) cause).getTrueSource() instanceof EntityGoblin)
reduceRefractory(victim, victim instanceof PlayerEntity ? 4000 : 500);
// Occasionally spawn ghastlings when a ghast dies to a reflected fireball
if (victim.getType() == EntityType.GHAST)
if (cause.getImmediateSource() instanceof FireballEntity && cause.getTrueSource() instanceof PlayerEntity) {
Random rand = victim.getRNG();
if (rand.nextInt(15) == 0)
for (int i = 0; i < rand.nextInt(3); i++) {
EntityGhastling ghastling = VOEntities.GHASTLING.create(world);
ghastling.setLocationAndAngles(victim.getPosX(), victim.getPosY(), victim.getPosZ(), rand.nextFloat() * 360F, 0F);
world.addEntity(ghastling);
}
}
// Heal worgs and wargs when they kill something
if (cause instanceof EntityDamageSource && ((EntityDamageSource) cause).getTrueSource() instanceof AbstractGoblinWolf)
((AbstractGoblinWolf) cause.getTrueSource()).heal(2F + victim.getRNG().nextFloat() * 3F);
}
use of com.lying.variousoddities.entity.AbstractGoblinWolf in project VariousOddities by Lyinginbedmon.
the class EntityWorg method func_241840_a.
public AgeableEntity func_241840_a(ServerWorld arg0, AgeableEntity arg1) {
if (arg1.getType() == VOEntities.WORG) {
EntityWorg worg2 = (EntityWorg) arg1;
Genetics genesA = getGenetics();
Genetics genesB = worg2.getGenetics();
Genetics genesC = Genetics.cross(genesA, genesB, getRNG());
AbstractGoblinWolf offspring;
if (genesC.gene(6) == false && genesC.gene(7) == false) {
EntityWarg warg = VOEntities.WARG.create(arg0);
warg.setGenetics(genesC);
offspring = warg;
} else {
EntityWorg worg = VOEntities.WORG.create(arg0);
worg.setGenetics(genesC);
offspring = worg;
}
offspring.setColor(getRNG().nextBoolean() ? getColor() : worg2.getColor());
return offspring;
}
return null;
}
Aggregations