use of simplepets.brainsynder.pet.types.ShulkerDefault in project SimplePets by brainsynder-Dev.
the class EntityControllerPet method repeatTask.
@Override
public void repeatTask() {
super.repeatTask();
if (!this.isInvisible())
this.setInvisible(true);
if (getPet() != null)
if (isBaby())
setBaby((getPet().getPetType() instanceof ShulkerDefault));
Player p = getPet().getOwner();
if (hasCustomName()) {
setCustomNameVisible(false);
if (displayEntity.getPassenger() != null) {
this.displayEntity.getPassenger().setCustomName(getCustomName());
this.displayEntity.getPassenger().setCustomNameVisible(true);
} else {
this.displayEntity.setCustomName(getCustomName());
this.displayEntity.setCustomNameVisible(true);
}
}
if (this.displayEntity != null) {
if (this.displayEntity.isValid()) {
if (displayEntity.getPassenger() == null) {
reloadLocation();
net.minecraft.server.v1_11_R1.Entity displayEntity = ((CraftEntity) this.displayEntity).getHandle();
if (((CraftPlayer) getOwner()).getHandle().isInvisible() != displayEntity.isInvisible()) {
displayEntity.setInvisible(!displayEntity.isInvisible());
}
return;
}
if (this.displayEntity.getPassenger() != null) {
net.minecraft.server.v1_11_R1.Entity displayEntity = ((CraftEntity) this.displayEntity.getPassenger()).getHandle();
if (((CraftPlayer) p).getHandle().isInvisible() != displayEntity.isInvisible()) {
displayEntity.setInvisible(!displayEntity.isInvisible());
}
}
}
}
}
use of simplepets.brainsynder.pet.types.ShulkerDefault in project SimplePets by brainsynder-Dev.
the class SpawnUtil method spawn.
public IEntityPet spawn(Location l, IPet pet, String className) {
try {
World mcWorld = ((CraftWorld) l.getWorld()).getHandle();
EntityTypes<?> types = EntityUtils.getType((className.equals("EntityControllerPet")) ? EntityWrapper.ZOMBIE : pet.getEntityType());
EntityPet customEntity = (EntityPet) petMap.get(className).getDeclaredConstructor(EntityTypes.class, World.class, IPet.class).newInstance(types, mcWorld, pet);
customEntity.setInvisible(false);
customEntity.setLocation(l.getX(), l.getY(), l.getZ(), l.getYaw(), l.getPitch());
mcWorld.addEntity(customEntity, CreatureSpawnEvent.SpawnReason.CUSTOM);
if (customEntity instanceof IEntityControllerPet) {
if (pet.getPetType() instanceof ArmorStandDefault) {
ArmorStand stand = EntityArmorStandPet.spawn(l, ((EntityControllerPet) customEntity));
stand.setGravity(false);
stand.setArms(true);
stand.setCollidable(false);
stand.setLeftLegPose(new EulerAngle(0.0D, 0.0D, 0.0D));
stand.setRightLegPose(new EulerAngle(0.0D, 0.0D, 0.0D));
stand.setLeftArmPose(new EulerAngle(0.0D, 0.0D, 0.0D));
stand.setRightArmPose(new EulerAngle(0.0D, 0.0D, 0.0D));
((IEntityControllerPet) customEntity).setDisplayEntity(stand);
} else if (pet.getPetType() instanceof ShulkerDefault) {
ArmorStand stand = EntityGhostStandPet.spawn(l, pet);
stand.setGravity(false);
stand.setCollidable(false);
stand.setSmall(true);
Shulker shulker = EntityShulkerPet.spawn(l, (EntityControllerPet) customEntity);
shulker.setAI(false);
shulker.setCollidable(false);
((CraftEntity) stand).getHandle().passengers.add(0, ((CraftEntity) shulker).getHandle());
((IEntityControllerPet) customEntity).setDisplayEntity(stand);
}
}
return customEntity;
} catch (Exception e) {
e.printStackTrace();
throw new SimplePetsException("Could not summon the " + pet.getPetType().getConfigName() + " Pet", e);
}
}
use of simplepets.brainsynder.pet.types.ShulkerDefault in project SimplePets by brainsynder-Dev.
the class EntityControllerPet method repeatTask.
@Override
public void repeatTask() {
super.repeatTask();
if (!this.isInvisible())
this.setInvisible(true);
if (getPet() != null)
if (isBaby())
setBaby((getPet().getPetType() instanceof ShulkerDefault));
Player p = getPet().getOwner();
if (this.displayEntity != null) {
if (this.displayEntity.isValid()) {
if (displayEntity.getPassenger() != null) {
this.displayEntity.getPassenger().setCustomName(getCustomName().getText());
} else {
this.displayEntity.setCustomName(getCustomName().getText());
}
if (displayEntity.getPassenger() == null) {
reloadLocation();
net.minecraft.server.v1_13_R2.Entity displayEntity = ((CraftEntity) this.displayEntity).getHandle();
if (((CraftPlayer) getOwner()).getHandle().isInvisible() != displayEntity.isInvisible()) {
displayEntity.setInvisible(!displayEntity.isInvisible());
}
return;
}
if (this.displayEntity.getPassenger() != null) {
net.minecraft.server.v1_13_R2.Entity displayEntity = ((CraftEntity) this.displayEntity.getPassenger()).getHandle();
if (((CraftPlayer) p).getHandle().isInvisible() != displayEntity.isInvisible()) {
displayEntity.setInvisible(!displayEntity.isInvisible());
}
}
}
}
}
use of simplepets.brainsynder.pet.types.ShulkerDefault in project SimplePets by brainsynder-Dev.
the class SpawnUtil method spawn.
public IEntityPet spawn(Location l, IPet pet, String className) {
try {
World mcWorld = ((CraftWorld) l.getWorld()).getHandle();
EntityPet customEntity = (EntityPet) petMap.get(className).getDeclaredConstructor(World.class, IPet.class).newInstance(mcWorld, pet);
customEntity.setInvisible(false);
customEntity.setLocation(l.getX(), l.getY(), l.getZ(), l.getYaw(), l.getPitch());
mcWorld.addEntity(customEntity, CreatureSpawnEvent.SpawnReason.CUSTOM);
if (customEntity instanceof IEntityControllerPet) {
if (pet.getPetType() instanceof ArmorStandDefault) {
ArmorStand stand = EntityArmorStandPet.spawn(l, ((EntityControllerPet) customEntity));
stand.setGravity(false);
stand.setArms(true);
stand.setCollidable(false);
stand.setLeftLegPose(new EulerAngle(0.0D, 0.0D, 0.0D));
stand.setRightLegPose(new EulerAngle(0.0D, 0.0D, 0.0D));
stand.setLeftArmPose(new EulerAngle(0.0D, 0.0D, 0.0D));
stand.setRightArmPose(new EulerAngle(0.0D, 0.0D, 0.0D));
((IEntityControllerPet) customEntity).setDisplayEntity(stand);
} else if (pet.getPetType() instanceof ShulkerDefault) {
ArmorStand stand = EntityGhostStandPet.spawn(l, pet);
stand.setGravity(false);
stand.setCollidable(false);
stand.setSmall(true);
Shulker shulker = EntityShulkerPet.spawn(l, (EntityControllerPet) customEntity);
shulker.setAI(false);
shulker.setCollidable(false);
((CraftEntity) stand).getHandle().passengers.add(0, ((CraftEntity) shulker).getHandle());
((IEntityControllerPet) customEntity).setDisplayEntity(stand);
}
}
return customEntity;
} catch (Exception e) {
e.printStackTrace();
throw new SimplePetsException("Could not summon the " + pet.getPetType().getConfigName() + " Pet", e);
}
}
use of simplepets.brainsynder.pet.types.ShulkerDefault in project SimplePets by brainsynder-Dev.
the class EntityControllerPet method repeatTask.
@Override
public void repeatTask() {
super.repeatTask();
if (!this.isInvisible())
this.setInvisible(true);
if (getPet() != null)
if (isBaby())
setBaby((getPet().getPetType() instanceof ShulkerDefault));
Player p = getPet().getOwner();
if (this.displayEntity != null) {
if (this.displayEntity.isValid()) {
if (displayEntity.getPassenger() != null) {
this.displayEntity.getPassenger().setCustomName(getCustomName().getText());
} else {
this.displayEntity.setCustomName(getCustomName().getText());
}
if (displayEntity.getPassenger() == null) {
reloadLocation();
net.minecraft.server.v1_13_R1.Entity displayEntity = ((CraftEntity) this.displayEntity).getHandle();
if (((CraftPlayer) getOwner()).getHandle().isInvisible() != displayEntity.isInvisible()) {
displayEntity.setInvisible(!displayEntity.isInvisible());
}
return;
}
if (this.displayEntity.getPassenger() != null) {
net.minecraft.server.v1_13_R1.Entity displayEntity = ((CraftEntity) this.displayEntity.getPassenger()).getHandle();
if (((CraftPlayer) p).getHandle().isInvisible() != displayEntity.isInvisible()) {
displayEntity.setInvisible(!displayEntity.isInvisible());
}
}
}
}
}
Aggregations