Merge branch 'master' into 1.16
This commit is contained in:
commit
74c5116ec3
5 files changed
+117
-2
No files matched your search
@@ -583,4 +583,10 @@ public class CarpetSettings
|
|||||||
category = CLIENT
|
category = CLIENT
|
||||||
)
|
)
|
||||||
public static boolean fogOff = false;
|
public static boolean fogOff = false;
|
||||||
|
|
||||||
|
@Rule(
|
||||||
|
desc = "Creative No Clip",
|
||||||
|
category = {CREATIVE, CLIENT}
|
||||||
|
)
|
||||||
|
public static boolean creativeNoClip = false;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.CarpetSettings;
|
||||||
|
import net.minecraft.block.entity.PistonBlockEntity;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
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.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
@Mixin(PistonBlockEntity.class)
|
||||||
|
public class PistonBlockEntity_creativeNoClipMixin
|
||||||
|
{
|
||||||
|
@Inject(method = "method_23672", at = @At("HEAD"), cancellable = true)
|
||||||
|
private static void dontPushSpectators(Direction direction, Entity entity, double d, Direction direction2, CallbackInfo ci)
|
||||||
|
{
|
||||||
|
if (CarpetSettings.creativeNoClip && entity instanceof PlayerEntity && (((PlayerEntity) entity).isCreative()) && ((PlayerEntity) entity).abilities.flying) ci.cancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Redirect(method = "pushEntities", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;setVelocity(DDD)V"))
|
||||||
|
private void ignoreAccel(Entity entity, double x, double y, double z)
|
||||||
|
{
|
||||||
|
if (CarpetSettings.creativeNoClip && entity instanceof PlayerEntity && (((PlayerEntity) entity).isCreative()) && ((PlayerEntity) entity).abilities.flying) return;
|
||||||
|
entity.setVelocity(x,y,z);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.CarpetSettings;
|
||||||
|
import net.minecraft.entity.EntityType;
|
||||||
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
import net.minecraft.entity.MovementType;
|
||||||
|
import net.minecraft.entity.player.PlayerAbilities;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import org.spongepowered.asm.mixin.Final;
|
||||||
|
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.Redirect;
|
||||||
|
|
||||||
|
@Mixin(PlayerEntity.class)
|
||||||
|
public abstract class PlayerEntity_creativeNoClipMixin extends LivingEntity
|
||||||
|
{
|
||||||
|
@Shadow public abstract boolean isCreative();
|
||||||
|
|
||||||
|
@Shadow @Final public PlayerAbilities abilities;
|
||||||
|
|
||||||
|
protected PlayerEntity_creativeNoClipMixin(EntityType<? extends LivingEntity> type, World world)
|
||||||
|
{
|
||||||
|
super(type, world);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Redirect(method = "tick", at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/entity/player/PlayerEntity;isSpectator()Z")
|
||||||
|
)
|
||||||
|
private boolean canClipTroughWorld(PlayerEntity playerEntity)
|
||||||
|
{
|
||||||
|
return playerEntity.isSpectator() || (CarpetSettings.creativeNoClip && playerEntity.isCreative() && playerEntity.abilities.flying);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Redirect(method = "tickMovement", at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/entity/player/PlayerEntity;isSpectator()Z")
|
||||||
|
)
|
||||||
|
private boolean collidesWithEntities(PlayerEntity playerEntity)
|
||||||
|
{
|
||||||
|
return playerEntity.isSpectator() || (CarpetSettings.creativeNoClip && playerEntity.isCreative() && playerEntity.abilities.flying);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Redirect(method = "updateSize", at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/entity/player/PlayerEntity;isSpectator()Z")
|
||||||
|
)
|
||||||
|
private boolean spectatorsDontPose(PlayerEntity playerEntity)
|
||||||
|
{
|
||||||
|
return playerEntity.isSpectator() || (CarpetSettings.creativeNoClip && playerEntity.isCreative() && playerEntity.abilities.flying);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.CarpetSettings;
|
||||||
|
import net.minecraft.client.network.ClientPlayerEntity;
|
||||||
|
import net.minecraft.client.render.WorldRenderer;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
@Mixin(WorldRenderer.class)
|
||||||
|
public class WorldRenderer_creativeNoClipMixin
|
||||||
|
{
|
||||||
|
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isSpectator()Z"))
|
||||||
|
private boolean canSeeWorld(ClientPlayerEntity clientPlayerEntity)
|
||||||
|
{
|
||||||
|
return clientPlayerEntity.isSpectator() || (CarpetSettings.creativeNoClip && clientPlayerEntity.isCreative());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -157,7 +157,10 @@
|
|||||||
"PistonBlockEntity_movableTEMixin",
|
"PistonBlockEntity_movableTEMixin",
|
||||||
"World_movableTEMixin",
|
"World_movableTEMixin",
|
||||||
"WorldChunk_movableTEMixin",
|
"WorldChunk_movableTEMixin",
|
||||||
"PistonHandler_movableTEMixin"
|
"PistonHandler_movableTEMixin",
|
||||||
|
"PlayerEntity_creativeNoClipMixin",
|
||||||
|
"PistonBlockEntity_creativeNoClipMixin"
|
||||||
|
|
||||||
],
|
],
|
||||||
"client": [
|
"client": [
|
||||||
"RenderTickCounter_tickSpeedMixin",
|
"RenderTickCounter_tickSpeedMixin",
|
||||||
@@ -170,7 +173,9 @@
|
|||||||
"PistonBlockEntityRenderer_movableTEMixin",
|
"PistonBlockEntityRenderer_movableTEMixin",
|
||||||
"ClientPlayNetworkHandler_smoothClientAnimationsMixin",
|
"ClientPlayNetworkHandler_smoothClientAnimationsMixin",
|
||||||
"ClientPlayerEntity_clientCommandMixin",
|
"ClientPlayerEntity_clientCommandMixin",
|
||||||
"WorldRenderer_fogOffMixin"
|
"WorldRenderer_fogOffMixin",
|
||||||
|
"WorldRenderer_creativeNoClipMixin"
|
||||||
|
|
||||||
],
|
],
|
||||||
"server": [
|
"server": [
|
||||||
"MinecraftDedicatedServerMixin"
|
"MinecraftDedicatedServerMixin"
|
||||||
|
|||||||
Reference in new issue
Block a user