Collision Spike

- Reduced false positives for train/player collisions during lag spikes
This commit is contained in:
simibubi 2022-09-25 20:41:12 +02:00
parent 1f06034b47
commit 95a23f7433
2 changed files with 11 additions and 1 deletions

View File

@ -32,6 +32,7 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.Direction.Axis;
import net.minecraft.core.Direction.AxisDirection;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
@ -373,6 +374,13 @@ public class ContraptionCollider {
return entityMotion;
if (!entity.isOnGround())
return entityMotion;
CompoundTag persistentData = entity.getPersistentData();
if (persistentData.contains("ContraptionGrounded")) {
persistentData.remove("ContraptionGrounded");
return entityMotion;
}
if (cce.collidingEntities.containsKey(entity))
return entityMotion;
if (entity instanceof ItemEntity)
@ -413,7 +421,7 @@ public class ContraptionCollider {
.add(0, .25, 0)
.scale(damage * 4))
.add(diffMotion);
return VecHelper.clamp(added, 3);
}

View File

@ -141,6 +141,8 @@ public abstract class EntityContraptionInteractionMixin extends CapabilityProvid
return;
self.setOnGround(true);
self.getPersistentData()
.putBoolean("ContraptionGrounded", true);
}
@Inject(method = { "spawnSprintParticle" }, at = @At(value = "TAIL"))