flying in end gateways in cretiveNoClip won't teleport. fixes #943
This commit is contained in:
1 parent
28374b977b
commit
00ab7c1601
3 files changed
+27
No files matched your search
@@ -10,6 +10,8 @@ import carpet.utils.Messenger;
|
||||
import carpet.utils.SpawnChunks;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.command.ServerCommandSource;
|
||||
import net.minecraft.server.dedicated.DedicatedServer;
|
||||
@@ -803,6 +805,11 @@ public class CarpetSettings
|
||||
category = {CREATIVE, CLIENT}
|
||||
)
|
||||
public static boolean creativeNoClip = false;
|
||||
public static boolean isCreativeFlying(Entity entity)
|
||||
{
|
||||
// #todo replace after merger to 1.17
|
||||
return CarpetSettings.creativeNoClip && entity instanceof PlayerEntity && (((PlayerEntity) entity).isCreative()) && ((PlayerEntity) entity).abilities.flying;
|
||||
}
|
||||
|
||||
|
||||
@Rule(
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.CarpetSettings;
|
||||
import net.minecraft.block.entity.EndGatewayBlockEntity;
|
||||
import net.minecraft.entity.Entity;
|
||||
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.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(EndGatewayBlockEntity.class)
|
||||
public class EndGatewayBlockEntity_creativeNoClipMixin
|
||||
{
|
||||
@Inject(method = "method_30276", cancellable = true, at = @At("HEAD"))
|
||||
private static void checkFlyingCreative(Entity entity, CallbackInfoReturnable<Boolean> cir)
|
||||
{
|
||||
if (CarpetSettings.isCreativeFlying(entity)) cir.setReturnValue(false);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user