use of com.lying.variousoddities.species.abilities.AbilitySize in project VariousOddities by Lyinginbedmon.
the class EntityMixin method getSize.
@Inject(method = "getBoundingBox(Lnet/minecraft/entity/Pose;)Lnet/minecraft/util/math/AxisAlignedBB;", at = @At("TAIL"), cancellable = true)
public void getSize(Pose poseIn, final CallbackInfoReturnable<AxisAlignedBB> ci) {
Entity ent = (Entity) (Object) this;
if (ent.getType() == EntityType.PLAYER && AbilityRegistry.hasAbility((PlayerEntity) ent, AbilitySize.REGISTRY_NAME)) {
AbilitySize size = (AbilitySize) AbilityRegistry.getAbilityByName((PlayerEntity) ent, AbilitySize.REGISTRY_NAME);
if (size == null)
return;
AxisAlignedBB baseSize = ci.getReturnValue();
float scale = size.getScale();
double posX = ent.getPosX();
double posY = ent.getPosY();
double posZ = ent.getPosZ();
double lenX = baseSize.getXSize() * scale * 0.5D;
double lenY = baseSize.getYSize() * scale;
double lenZ = baseSize.getZSize() * scale * 0.5D;
AxisAlignedBB trueSize = new AxisAlignedBB(posX - lenX, posY, posZ - lenZ, posX + lenX, posY + lenY, posZ + lenZ);
ci.setReturnValue(trueSize);
}
}
use of com.lying.variousoddities.species.abilities.AbilitySize in project VariousOddities by Lyinginbedmon.
the class VOBusClient method resizeEntity.
@SuppressWarnings("rawtypes")
@SubscribeEvent(priority = EventPriority.HIGHEST)
public static <T extends LivingEntity, M extends EntityModel<T>> void resizeEntity(RenderLivingEvent.Pre event) {
LivingEntity renderTarget = event.getEntity();
AbilitySize size = (AbilitySize) AbilityRegistry.getAbilityByName(renderTarget, AbilitySize.REGISTRY_NAME);
if (size == null)
return;
float scale = size.getScale();
event.getMatrixStack().scale(scale, scale, scale);
}
Aggregations