Merge pull request #23 from DeadlyMC/placement_rotation
Added placementRotationFix mixins
This commit is contained in:
5 files changed
+57
-2
No files matched your search
@@ -197,7 +197,7 @@ public class CarpetSettings
|
|||||||
rule("kelpGenerationGrowLimit", "feature", "limits growth limit of newly naturally generated kelp to this amount of blocks")
|
rule("kelpGenerationGrowLimit", "feature", "limits growth limit of newly naturally generated kelp to this amount of blocks")
|
||||||
.choices("25", "0 2 25").setNotStrict(),
|
.choices("25", "0 2 25").setNotStrict(),
|
||||||
rule("renewableCoral", "feature", "Coral structures will grow with bonemeal from coral plants"),
|
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")
|
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(),
|
.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()
|
rule("lagFreeSpawning", "optimizations", "Spawning requires much less CPU and Memory").boolAccelerate()
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package carpet.fakes;
|
||||||
|
|
||||||
|
public interface EntityInterface
|
||||||
|
{
|
||||||
|
float getMainYaw(float partialTicks);
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.CarpetSettings;
|
||||||
|
import carpet.fakes.EntityInterface;
|
||||||
|
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 -((EntityInterface) entity).getMainYaw(1.0F) * 0.017453292F;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.fakes.EntityInterface;
|
||||||
|
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 EntityInterface
|
||||||
|
{
|
||||||
|
@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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -50,7 +50,8 @@
|
|||||||
"GravityStructureProcessorMixin",
|
"GravityStructureProcessorMixin",
|
||||||
"ServerPlayNetworkHandler_scarpetEventsMixin",
|
"ServerPlayNetworkHandler_scarpetEventsMixin",
|
||||||
"ServerPlayerInteractionManager_scarpetEventsMixin",
|
"ServerPlayerInteractionManager_scarpetEventsMixin",
|
||||||
|
"EntityMixin",
|
||||||
|
"DirectionMixin",
|
||||||
|
|
||||||
"ServerChunkManagerMixin",
|
"ServerChunkManagerMixin",
|
||||||
"SpawnHelperMixin",
|
"SpawnHelperMixin",
|
||||||
|
|||||||
Reference in new issue
Block a user