use of net.minecraft.entity.EntitySize in project upgrade-aquatic by team-abnormals.
the class FlareEntity method getSize.
public EntitySize getSize(Pose poseIn) {
int i = this.getPhantomSize();
EntitySize entitysize = super.getSize(poseIn);
float f = (entitysize.width + 0.2F * (float) i) / entitysize.width;
return entitysize.scale(f);
}
use of net.minecraft.entity.EntitySize in project VariousOddities by Lyinginbedmon.
the class AbilitySize method handleSize.
public void handleSize(EntityEvent.Size event) {
if (event.getEntity() instanceof LivingEntity && event.getEntity().getType() == EntityType.PLAYER) {
LivingEntity living = (LivingEntity) event.getEntity();
LivingData data = LivingData.forEntity(living);
if (data == null || !AbilityRegistry.hasAbility(living, REGISTRY_NAME))
return;
AbilitySize size = (AbilitySize) AbilityRegistry.getAbilityByName(living, REGISTRY_NAME);
if (size == null)
return;
if (!event.getEntity().isAddedToWorld())
return;
float scale = size.getScale();
EntitySize baseSize = event.getNewSize();
event.setNewSize(EntitySize.fixed(baseSize.width * scale, baseSize.height * scale));
event.setNewEyeHeight(event.getNewEyeHeight() * scale);
}
}
use of net.minecraft.entity.EntitySize in project BudschieMorphMod by Budschie.
the class Events method onCalculatingAABB.
@SubscribeEvent(priority = EventPriority.LOW)
public static void onCalculatingAABB(EntityEvent.Size event) {
if (event.getEntity() instanceof PlayerEntity) {
PlayerEntity player = (PlayerEntity) event.getEntity();
LazyOptional<IMorphCapability> cap = player.getCapability(MorphCapabilityAttacher.MORPH_CAP);
if (cap.isPresent()) {
float divisor = ShrinkAPIInteractor.getInteractor().getShrinkingValue(player);
IMorphCapability resolved = cap.resolve().get();
resolved.getCurrentMorph().ifPresent(item -> {
try {
Entity createdEntity = item.createEntity(event.getEntity().world);
createdEntity.setPose(event.getPose());
// We do this as we apply our own sneaking logic as I couldn't figure out how to get the multiplier for the eye height... F in the chat plz
EntitySize newSize = createdEntity.getSize(Pose.STANDING);
if (ShrinkAPIInteractor.getInteractor().isShrunk(player)) {
newSize = newSize.scale(1.6f / divisor, 1 / divisor);
}
if (event.getPose() == Pose.CROUCHING)
newSize = newSize.scale(1, .85f);
event.setNewSize(newSize, false);
// event.setNewEyeHeight(createdEntity.getEyeHeightAccess(event.getPose(), newSize));
event.setNewEyeHeight(newSize.height * 0.85f);
// event.setNewEyeHeight(player.getEyeHeightAccess(event.getPose(), createdEntity.getSize(event.getPose())));
} catch (NullPointerException ex) {
LOGGER.catching(ex);
if (!player.world.isRemote)
MorphUtil.morphToServer(Optional.empty(), Optional.empty(), player);
else {
resolved.demorph();
player.sendMessage(new StringTextComponent(TextFormatting.RED + "Couldn't morph to " + item.getEntityType().getRegistryName().toString() + ". This is a compatability issue. If possible, report this to the mod author on GitHub."), new UUID(0, 0));
}
}
});
}
}
}
use of net.minecraft.entity.EntitySize in project AstralSorcery by HellFirePvP.
the class TimeStopEffectHelper method playEntityParticles.
@OnlyIn(Dist.CLIENT)
static void playEntityParticles(LivingEntity e) {
EntitySize size = e.getSize(e.getPose());
double x = e.getPosX() - size.width / 2F + rand.nextFloat() * size.width;
double y = e.getPosY() + rand.nextFloat() * size.height;
double z = e.getPosZ() - size.width / 2F + rand.nextFloat() * size.width;
playParticles(x, y, z);
}
use of net.minecraft.entity.EntitySize in project ChocolateQuestRepoured by TeamChocoQuest.
the class AbstractEntityCQR method getDimensionsCloneFromEntity.
@Nullable
private EntitySize getDimensionsCloneFromEntity(Pose poseIn) {
if (poseIn != null) {
EntitySize result = poseIn == Pose.SLEEPING ? SLEEPING_DIMENSIONS : this.getSize();
if (result == null) {
return null;
}
float scale = this.getSizeVariation();
result = result.scale(scale);
if (poseIn != Pose.SLEEPING) {
if (this.isSitting()) {
result.scale(1.0F, 0.75F);
}
}
return result;
}
return this.getSize();
}
Aggregations