* Add javadocs to many methods * Added built-in ways to generate BundledModules and documented them * Add Eclipse launch files to .gitignore and fix 11 warnings * Remove many unused imports * Remove some dead and unused code around app loading * Allow extensions to have client-side rules in their SettingsManager Also change tabs to spaces when those changed * Remove unnecessary classloader param in BundledModule * Change max tickwarp duration to Integer.MAX_VALUE * Move RulePrinter into the source so it can be managed by the IDE * Properly reset hopperCounters when changing worlds Also change tabs to spaces again and minor tweaks to javadocs * Run mergedocs even if Full.md was modified * Update src/main/java/carpet/commands/TickCommand.java Co-authored-by: gnembon <41132274+gnembon@users.noreply.github.com>
51 lines
1.8 KiB
Java
51 lines
1.8 KiB
Java
package carpet.mixins;
|
|
|
|
import carpet.CarpetSettings;
|
|
import net.minecraft.server.network.ServerPlayNetworkHandler;
|
|
import net.minecraft.server.network.ServerPlayerEntity;
|
|
import org.spongepowered.asm.mixin.Mixin;
|
|
import org.spongepowered.asm.mixin.Shadow;
|
|
import org.spongepowered.asm.mixin.injection.At;
|
|
import org.spongepowered.asm.mixin.injection.Inject;
|
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|
|
|
@Mixin(ServerPlayNetworkHandler.class)
|
|
public abstract class ServerPlayNetworkHandler_antiCheatDisabledMixin
|
|
{
|
|
@Shadow private int floatingTicks;
|
|
|
|
@Shadow private int vehicleFloatingTicks;
|
|
|
|
@Shadow protected abstract boolean isHost();
|
|
|
|
@Inject(method = "tick", at = @At("HEAD"))
|
|
private void restrictFloatingBits(CallbackInfo ci)
|
|
{
|
|
if (CarpetSettings.antiCheatDisabled)
|
|
{
|
|
if (floatingTicks > 70) floatingTicks--;
|
|
if (vehicleFloatingTicks > 70) vehicleFloatingTicks--;
|
|
}
|
|
|
|
}
|
|
|
|
@Redirect(method = "onVehicleMove", at = @At(
|
|
value = "INVOKE",
|
|
target = "Lnet/minecraft/server/network/ServerPlayNetworkHandler;isHost()Z"
|
|
))
|
|
private boolean isServerTrusting(ServerPlayNetworkHandler serverPlayNetworkHandler)
|
|
{
|
|
return isHost() || CarpetSettings.antiCheatDisabled;
|
|
}
|
|
|
|
@Redirect(method = "onPlayerMove", require = 0, // don't crash with immersive portals,
|
|
at = @At(
|
|
value = "INVOKE",
|
|
target = "Lnet/minecraft/server/network/ServerPlayerEntity;isInTeleportationState()Z"))
|
|
private boolean relaxMoveRestrictions(ServerPlayerEntity serverPlayerEntity)
|
|
{
|
|
return CarpetSettings.antiCheatDisabled || serverPlayerEntity.isInTeleportationState();
|
|
}
|
|
}
|