added placementRotationFix mixins

This commit is contained in:
DeadlyMC committed 2019-06-01 21:07:58 +05:30
1 parent 4ec6e0e03e
commit db091d68d7
5 files changed
+57 -1

No files matched your search

+1 -1
View File
@@ -197,7 +197,7 @@ public class CarpetSettings
rule("kelpGenerationGrowLimit", "feature", "limits growth limit of newly naturally generated kelp to this amount of blocks")
.choices("25", "0 2 25").setNotStrict(),
rule("renewableCoral", "feature", "Coral structures will grow with bonemeal from coral plants"),
rule("placementRotationFix", "fix", "fixes block placement rotation issue when player rotates quickly while placing blocks").wip(),
rule("placementRotationFix", "fix", "fixes block placement rotation issue when player rotates quickly while placing blocks"),
rule("leadFix", "fix", "Fixes leads breaking/becoming invisible in unloaded chunks")
.extraInfo("You may still get visibly broken leash links on the client side, but server side the link is still there.").wip(),
rule("lagFreeSpawning", "optimizations", "Spawning requires much less CPU and Memory").boolAccelerate()
@@ -0,0 +1,26 @@
package carpet.mixins;
import carpet.CarpetSettings;
import carpet.utils.IEntity;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.Direction;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(Direction.class)
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)
{
if (!CarpetSettings.getBool("placementRotationFix"))
{
return -entity.getYaw(1.0F) * 0.017453292F;
}
else
{
return -((IEntity) entity).getMainYaw(1.0F) * 0.017453292F;
}
}
}
@@ -0,0 +1,22 @@
package carpet.mixins;
import carpet.utils.IEntity;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.MathHelper;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@Mixin(Entity.class)
public abstract class EntityMixin implements IEntity
{
@Shadow
public float yaw;
@Shadow
public float prevYaw;
public float getMainYaw(float partialTicks)
{
return partialTicks == 1.0F ? this.yaw : MathHelper.lerp(partialTicks, this.prevYaw, this.yaw);
}
}
+6
View File
@@ -0,0 +1,6 @@
package carpet.utils;
public interface IEntity
{
float getMainYaw(float partialTicks);
}
+2
View File
@@ -48,6 +48,8 @@
"FossilFeatureMixin",
"BuriedTreasureGeneratorPieceMixin",
"GravityStructureProcessorMixin",
"EntityMixin",
"DirectionMixin",
"ServerChunkManagerMixin",