-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c9c6b66
commit 0786402
Showing
10 changed files
with
115 additions
and
22 deletions.
There are no files selected for viewing
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
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
67 changes: 67 additions & 0 deletions
67
...main/java/github/commandblock2/coffee_mod/mixins/minecraft/server/MixinPlayerManager.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,67 @@ | ||
/* | ||
* This file is part of CoffeeMod (https://github.com/commandblock2/coffee-mod-hsds) | ||
* | ||
* Copyright (c) 2023 commandblock2 | ||
* | ||
* CoffeeMod is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* CoffeeMod 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 General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with CoffeeMod. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package github.commandblock2.coffee_mod.mixins.minecraft.server; | ||
|
||
import net.minecraft.network.ClientConnection; | ||
import net.minecraft.network.packet.s2c.play.EntityStatusEffectS2CPacket; | ||
import net.minecraft.server.PlayerManager; | ||
import net.minecraft.server.network.ServerPlayerEntity; | ||
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.CallbackInfo; | ||
|
||
@Mixin(PlayerManager.class) | ||
public class MixinPlayerManager { | ||
@Inject(method = "onPlayerConnect", at = @At("TAIL")) | ||
private void sendAllPlayerEffect(ClientConnection connection, ServerPlayerEntity player, CallbackInfo ci){ | ||
player | ||
.getServerWorld() | ||
.getPlayers() | ||
.forEach(p -> | ||
p.getStatusEffects().forEach( | ||
effect -> | ||
player | ||
.networkHandler | ||
.sendPacket( | ||
new EntityStatusEffectS2CPacket( | ||
p.getId(), effect | ||
) | ||
) | ||
) | ||
); | ||
|
||
player | ||
.getServerWorld() | ||
.getPlayers() | ||
.forEach(p -> | ||
player.getStatusEffects().forEach( | ||
effect -> | ||
p | ||
.networkHandler | ||
.sendPacket( | ||
new EntityStatusEffectS2CPacket( | ||
player.getId(), effect | ||
) | ||
) | ||
) | ||
); | ||
} | ||
} |
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
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