1 parent
b1455b8c41
commit
dbda1d4482
4 files changed
+43
No files matched your search
@@ -1,6 +1,9 @@
|
|||||||
package carpet.fakes;
|
package carpet.fakes;
|
||||||
|
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import carpet.script.EntityEventsGroup;
|
import carpet.script.EntityEventsGroup;
|
||||||
|
import net.minecraft.world.entity.Entity;
|
||||||
|
|
||||||
public interface EntityInterface
|
public interface EntityInterface
|
||||||
{
|
{
|
||||||
@@ -19,4 +22,5 @@ public interface EntityInterface
|
|||||||
int getPublicNetherPortalCooldown();
|
int getPublicNetherPortalCooldown();
|
||||||
void setPublicNetherPortalCooldown(int what);
|
void setPublicNetherPortalCooldown(int what);
|
||||||
|
|
||||||
|
Stream<Entity> cm$getIndirectPassengersStream();
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,9 @@ import net.minecraft.util.Mth;
|
|||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
|
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
@@ -37,4 +40,13 @@ public abstract class EntityMixin implements EntityInterface
|
|||||||
{
|
{
|
||||||
if (getControllingPassenger() instanceof EntityPlayerMPFake) cir.setReturnValue(!level.isClientSide());
|
if (getControllingPassenger() instanceof EntityPlayerMPFake) cir.setReturnValue(!level.isClientSide());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Shadow
|
||||||
|
protected abstract Stream<Entity> getIndirectPassengersStream();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Stream<Entity> cm$getIndirectPassengersStream()
|
||||||
|
{
|
||||||
|
return this.getIndirectPassengersStream();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
|
||||||
|
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
||||||
|
|
||||||
|
import carpet.fakes.EntityInterface;
|
||||||
|
import carpet.patches.EntityPlayerMPFake;
|
||||||
|
import net.minecraft.world.TickRateManager;
|
||||||
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
|
||||||
|
@Mixin(TickRateManager.class)
|
||||||
|
abstract class TickRateManager_fakePlayersMixin {
|
||||||
|
@Shadow
|
||||||
|
abstract boolean runsNormally();
|
||||||
|
|
||||||
|
@ModifyReturnValue(method = "isEntityFrozen", at = @At("TAIL"))
|
||||||
|
private boolean handler(boolean alreadyFrozen, Entity entity) {
|
||||||
|
if (alreadyFrozen) return true;
|
||||||
|
return !runsNormally() && (entity instanceof EntityPlayerMPFake)
|
||||||
|
&& !((EntityInterface) entity).cm$getIndirectPassengersStream().anyMatch(e -> e instanceof Player && !(e instanceof EntityPlayerMPFake));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -49,6 +49,7 @@
|
|||||||
"MobMixin",
|
"MobMixin",
|
||||||
"Villager_aiMixin",
|
"Villager_aiMixin",
|
||||||
"Player_fakePlayersMixin",
|
"Player_fakePlayersMixin",
|
||||||
|
"TickRateManager_fakePlayersMixin",
|
||||||
"ServerGamePacketListenerImpl_coreMixin",
|
"ServerGamePacketListenerImpl_coreMixin",
|
||||||
"MinecraftServer_scarpetMixin",
|
"MinecraftServer_scarpetMixin",
|
||||||
"ExperienceOrb_xpNoCooldownMixin",
|
"ExperienceOrb_xpNoCooldownMixin",
|
||||||
|
|||||||
Reference in new issue
Block a user