generated from Fallen-Breath/fabric-mod-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master'
- Loading branch information
Showing
8 changed files
with
114 additions
and
2 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/main/java/com/vulpeus/vulpeus_carpet/mixins/logEntityCount/MixinServerWorld.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
...ain/java/com/vulpeus/vulpeus_carpet/mixins/visibleSpectators/MixinServerPlayerEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* This file is part of the VulpeusCarpet project, licensed under the | ||
* GNU Lesser General Public License v3.0 | ||
* | ||
* Copyright (C) 2024 VulpeusServer and contributors | ||
* | ||
* VulpeusCarpet is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* VulpeusCarpet is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with VulpeusCarpet. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.vulpeus.vulpeus_carpet.mixins.visibleSpectators; | ||
|
||
import com.mojang.authlib.GameProfile; | ||
import com.vulpeus.vulpeus_carpet.VulpeusCarpetSettings; | ||
import net.minecraft.entity.Entity; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.server.network.ServerPlayerEntity; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.World; | ||
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.callback.CallbackInfo; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
@Mixin(ServerPlayerEntity.class) | ||
public abstract class MixinServerPlayerEntity extends PlayerEntity { | ||
|
||
public MixinServerPlayerEntity(World world, BlockPos pos, float yaw, GameProfile gameProfile) { | ||
super(world, pos, yaw, gameProfile); | ||
} | ||
|
||
@Shadow | ||
public abstract Entity getCameraEntity(); | ||
@Shadow | ||
public abstract boolean isSpectator(); | ||
|
||
@Inject(method = "updatePotionVisibility", at = @At("HEAD"), cancellable = true) | ||
private void noInvisibleSpectators(CallbackInfo ci) { | ||
if (VulpeusCarpetSettings.visibleSpectators) { | ||
if (isSpectator()) clearPotionSwirls(); | ||
else super.updatePotionVisibility(); | ||
ci.cancel(); | ||
} | ||
} | ||
|
||
@Inject(method = "canBeSpectated", at = @At("HEAD"), cancellable = true) | ||
private void allowSpectatorsToBeSpectated(ServerPlayerEntity spectator, CallbackInfoReturnable<Boolean> cir) { | ||
if (VulpeusCarpetSettings.visibleSpectators) { | ||
if (spectator.isSpectator()) cir.setReturnValue(getCameraEntity() == this); | ||
else cir.setReturnValue(super.canBeSpectated(spectator)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters