net.minecraft.entity.EntityPose Java Examples

The following examples show how to use net.minecraft.entity.EntityPose. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MixinOtherClientPlayerEntity.java    From multiconnect with MIT License 6 votes vote down vote up
@Inject(method = "updateSize", at = @At("HEAD"))
private void onUpdateSize(CallbackInfo ci) {
    if (ConnectionInfo.protocolVersion <= Protocols.V1_13_2) {
        EntityPose pose;
        if (isFallFlying()) {
            pose = EntityPose.FALL_FLYING;
        } else if (isSleeping()) {
            pose = EntityPose.SLEEPING;
        } else if (isSwimming()) {
            pose = EntityPose.SWIMMING;
        } else if (isUsingRiptide()) {
            pose = EntityPose.SPIN_ATTACK;
        } else if (isSneaking() && !abilities.flying) {
            pose = EntityPose.CROUCHING;
        } else {
            pose = EntityPose.STANDING;
        }
        setPose(pose);
    }
}
 
Example #2
Source File: EvolvedCreeperEntity.java    From Galacticraft-Rewoven with MIT License 5 votes vote down vote up
@Override
public EntityDimensions getDimensions(EntityPose pose) {
    if (this.isBaby()) {
        return this.getType().getDimensions().scaled(0.75F, 0.5F);
    } else {
        return this.getType().getDimensions();
    }
}
 
Example #3
Source File: MixinPlayerEntity.java    From multiconnect with MIT License 5 votes vote down vote up
@Inject(method = "getDimensions", at = @At("HEAD"), cancellable = true)
private void onGetDimensions(EntityPose pose, CallbackInfoReturnable<EntityDimensions> ci) {
    if (ConnectionInfo.protocolVersion <= Protocols.V1_13_2) {
        if (pose == EntityPose.CROUCHING) {
            ci.setReturnValue(SNEAKING_DIMENSIONS_1_13_2);
        }
    }
}
 
Example #4
Source File: EntityEvent.java    From patchwork-api with GNU Lesser General Public License v2.1 5 votes vote down vote up
public EyeHeight(Entity entity, EntityPose pose, EntityDimensions size, float defaultHeight) {
	super(entity);
	this.pose = pose;
	this.size = size;
	this.oldHeight = defaultHeight;
	this.newHeight = defaultHeight;
}
 
Example #5
Source File: MixinEntity.java    From patchwork-api with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Inject(method = "<init>", at = @At("RETURN"))
public void hookConstructor(EntityType<?> type, World world, CallbackInfo ci) {
	Entity entity = (Entity) (Object) this;

	this.standingEyeHeight = EntityEvents.getEyeHeight(entity, EntityPose.STANDING, dimensions, getEyeHeight(EntityPose.STANDING, dimensions));

	EntityEvents.onEntityConstruct(entity);
}
 
Example #6
Source File: MixinClientPlayerEntity.java    From MineLittlePony with MIT License 5 votes vote down vote up
@Override
public float getActiveEyeHeight(EntityPose pose, EntityDimensions dimensions) {
    float value = super.getActiveEyeHeight(pose, dimensions);

    IPony pony = MineLittlePony.getInstance().getManager().getPony(this);

    if (!pony.getRace(false).isHuman()) {
        value *= pony.getMetadata().getSize().getEyeHeightFactor();
    }

    return value;
}
 
Example #7
Source File: EvolvedCreeperEntity.java    From Galacticraft-Rewoven with MIT License 4 votes vote down vote up
@Override
protected float getActiveEyeHeight(EntityPose pose, EntityDimensions dimensions) {
    return this.isBaby() ? 0.75F : 1.4F;
}
 
Example #8
Source File: RestlessCactusEntity.java    From the-hallow with MIT License 4 votes vote down vote up
@Override
public EntityDimensions getDimensions(EntityPose pose) {
	return EntityDimensions.changing(0.9F, 1.0F * getCactusHeight());
}
 
Example #9
Source File: CrowEntity.java    From the-hallow with MIT License 4 votes vote down vote up
@Override
protected float getActiveEyeHeight(EntityPose pose, EntityDimensions dimensions) {
	return dimensions.height * 0.6F;
}
 
Example #10
Source File: EntityAccessor.java    From multiconnect with MIT License 4 votes vote down vote up
@Accessor("POSE")
static TrackedData<EntityPose> getPose() {
    return MixinHelper.fakeInstance();
}
 
Example #11
Source File: EntityEvent.java    From patchwork-api with GNU Lesser General Public License v2.1 4 votes vote down vote up
public EntityPose getPose() {
	return pose;
}
 
Example #12
Source File: EntityEvents.java    From patchwork-api with GNU Lesser General Public License v2.1 4 votes vote down vote up
public static float getEyeHeight(Entity entity, EntityPose pose, EntityDimensions size, float defaultHeight) {
	EntityEvent.EyeHeight event = new EntityEvent.EyeHeight(entity, pose, size, defaultHeight);
	MinecraftForge.EVENT_BUS.post(event);
	return event.getNewHeight();
}
 
Example #13
Source File: MixinEntity.java    From patchwork-api with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Shadow
protected abstract float getEyeHeight(EntityPose pose, EntityDimensions dimensions);