cactus and block rotator

This commit is contained in:
gnembon committed 2019-06-08 01:11:34 -03:00
1 parent fa2ff94258
commit e9d2be34c0
9 files changed
+209 -30

No files matched your search

@@ -2,6 +2,7 @@ package carpet.mixins;
import carpet.CarpetSettings;
import carpet.fakes.EntityInterface;
import carpet.helpers.BlockRotator;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.Direction;
import org.spongepowered.asm.mixin.Mixin;
@@ -12,15 +13,31 @@ import org.spongepowered.asm.mixin.injection.Redirect;
public abstract class DirectionMixin
{
@Redirect(method = "getEntityFacingOrder", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;getYaw(F)F"))
private static float ifGetYaw(Entity entity, float float_1)
private static float getYaw(Entity entity, float float_1)
{
float yaw;
if (!CarpetSettings.getBool("placementRotationFix"))
{
return entity.getYaw(1.0F);
yaw = entity.getYaw(float_1);
}
else
{
return ((EntityInterface) entity).getMainYaw(1.0F);
yaw = ((EntityInterface) entity).getMainYaw(float_1);
}
if (BlockRotator.flippinEligibility(entity))
{
yaw += 180f;
}
return yaw;
}
@Redirect(method = "getEntityFacingOrder", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;getPitch(F)F"))
private static float getPitch(Entity entity, float float_1)
{
float pitch = entity.getPitch(float_1);
if (BlockRotator.flippinEligibility(entity))
{
pitch = -pitch;
}
return pitch;
}
}