-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add /back compat for vanilla tp (#126)
Co-authored-by: Martin Robertz <[email protected]>
- Loading branch information
1 parent
56a89e3
commit 748275c
Showing
6 changed files
with
58 additions
and
16 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
33 changes: 33 additions & 0 deletions
33
src/mixins/java/serverutils/mixins/early/minecraft/MixinCommandTeleport.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,33 @@ | ||
package serverutils.mixins.early.minecraft; | ||
|
||
import net.minecraft.command.server.CommandTeleport; | ||
import net.minecraft.entity.player.EntityPlayerMP; | ||
|
||
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; | ||
|
||
import com.llamalad7.mixinextras.sugar.Local; | ||
|
||
import serverutils.data.ServerUtilitiesPlayerData; | ||
import serverutils.data.TeleportType; | ||
import serverutils.lib.data.Universe; | ||
import serverutils.lib.math.BlockDimPos; | ||
|
||
@Mixin(CommandTeleport.class) | ||
public abstract class MixinCommandTeleport { | ||
|
||
@Inject( | ||
method = "processCommand", | ||
at = { @At( | ||
value = "INVOKE", | ||
target = "Lnet/minecraft/network/NetHandlerPlayServer;setPlayerLocation(DDDFF)V"), | ||
@At( | ||
value = "INVOKE", | ||
target = "Lnet/minecraft/entity/player/EntityPlayerMP;setPositionAndUpdate(DDD)V") }) | ||
private void serverutilities$backCompat(CallbackInfo ci, @Local(ordinal = 0) EntityPlayerMP player) { | ||
ServerUtilitiesPlayerData data = ServerUtilitiesPlayerData.get(Universe.get().getPlayer(player)); | ||
data.setLastTeleport(TeleportType.VANILLA_TP, new BlockDimPos(player)); | ||
} | ||
} |