-
Notifications
You must be signed in to change notification settings - Fork 35
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
8be3635
commit e18549c
Showing
10 changed files
with
158 additions
and
14 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
36 changes: 36 additions & 0 deletions
36
...rpettisaddition/mixins/command/lifetime/spawning/playerlogin/ServerPlayerEntityMixin.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,36 @@ | ||
/* | ||
* This file is part of the Carpet TIS Addition project, licensed under the | ||
* GNU Lesser General Public License v3.0 | ||
* | ||
* Copyright (C) 2024 Fallen_Breath and contributors | ||
* | ||
* Carpet TIS Addition 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. | ||
* | ||
* Carpet TIS Addition 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 Carpet TIS Addition. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package carpettisaddition.mixins.command.lifetime.spawning.playerlogin; | ||
|
||
import carpettisaddition.utils.ModIds; | ||
import carpettisaddition.utils.compat.DummyClass; | ||
import me.fallenbreath.conditionalmixin.api.annotation.Condition; | ||
import me.fallenbreath.conditionalmixin.api.annotation.Restriction; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
|
||
/** | ||
* See {@link PlayerManagerMixin} for impl for this mc version | ||
*/ | ||
@Restriction(require = @Condition(value = ModIds.minecraft, versionPredicates = ">1.21.1")) | ||
@Mixin(DummyClass.class) | ||
public abstract class ServerPlayerEntityMixin | ||
{ | ||
} |
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
36 changes: 36 additions & 0 deletions
36
...va/carpettisaddition/mixins/command/lifetime/spawning/playerlogin/PlayerManagerMixin.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,36 @@ | ||
/* | ||
* This file is part of the Carpet TIS Addition project, licensed under the | ||
* GNU Lesser General Public License v3.0 | ||
* | ||
* Copyright (C) 2024 Fallen_Breath and contributors | ||
* | ||
* Carpet TIS Addition 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. | ||
* | ||
* Carpet TIS Addition 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 Carpet TIS Addition. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package carpettisaddition.mixins.command.lifetime.spawning.playerlogin; | ||
|
||
import carpettisaddition.utils.ModIds; | ||
import carpettisaddition.utils.compat.DummyClass; | ||
import me.fallenbreath.conditionalmixin.api.annotation.Condition; | ||
import me.fallenbreath.conditionalmixin.api.annotation.Restriction; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
|
||
/** | ||
* See {@link ServerPlayerEntityMixin} for impl for this mc version | ||
*/ | ||
@Restriction(require = @Condition(value = ModIds.minecraft, versionPredicates = "<=1.21.1")) | ||
@Mixin(DummyClass.class) | ||
public abstract class PlayerManagerMixin | ||
{ | ||
} |
55 changes: 55 additions & 0 deletions
55
...rpettisaddition/mixins/command/lifetime/spawning/playerlogin/ServerPlayerEntityMixin.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,55 @@ | ||
/* | ||
* This file is part of the Carpet TIS Addition project, licensed under the | ||
* GNU Lesser General Public License v3.0 | ||
* | ||
* Copyright (C) 2024 Fallen_Breath and contributors | ||
* | ||
* Carpet TIS Addition 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. | ||
* | ||
* Carpet TIS Addition 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 Carpet TIS Addition. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package carpettisaddition.mixins.command.lifetime.spawning.playerlogin; | ||
|
||
import carpettisaddition.commands.lifetime.interfaces.LifetimeTrackerTarget; | ||
import carpettisaddition.commands.lifetime.spawning.LiteralSpawningReason; | ||
import carpettisaddition.utils.ModIds; | ||
import com.llamalad7.mixinextras.injector.ModifyReturnValue; | ||
import me.fallenbreath.conditionalmixin.api.annotation.Condition; | ||
import me.fallenbreath.conditionalmixin.api.annotation.Restriction; | ||
import net.minecraft.entity.Entity; | ||
import net.minecraft.server.PlayerManager; | ||
import net.minecraft.server.network.ServerPlayerEntity; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
@Restriction(require = @Condition(value = ModIds.minecraft, versionPredicates = ">1.21.1")) | ||
@Mixin(ServerPlayerEntity.class) | ||
public abstract class ServerPlayerEntityMixin | ||
{ | ||
@ModifyReturnValue( | ||
// The lambda function argument for EntityType.loadEntityWithPassengers | ||
method = { | ||
"method_64132", // in method readRootVehicle | ||
"method_64129" // in method readEnderPearls | ||
}, | ||
at = @At("TAIL") | ||
) | ||
private static Entity lifetimeTracker_recordSpawning_playerLogin(Entity entity) | ||
{ | ||
if (entity != null) | ||
{ | ||
((LifetimeTrackerTarget)entity).recordSpawning(LiteralSpawningReason.PLAYER_LOGIN); | ||
} | ||
return entity; | ||
} | ||
} |