-
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
6d1cf61
commit 0f49aed
Showing
15 changed files
with
156 additions
and
14 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
src/main/generated/.cache/89b86ab0e66f527166d98df92ddbcf5416ed58f6
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
// 1.19.2 2024-04-19T10:01:41.7140308 Language | ||
// 1.19.2 2024-04-19T19:43:43.0995063 Language | ||
84f246a88b9c3dc4c5d0c98a56c4de5529eabe74 assets\the_origin_of_magic\lang\en_us.json |
2 changes: 1 addition & 1 deletion
2
src/main/generated/.cache/dc1d6e7286e7569a79007c10f809d49635ea1c49
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
// 1.19.2 2024-04-19T10:01:41.7110246 Block Loot Tables | ||
// 1.19.2 2024-04-19T19:43:43.0964229 Block Loot Tables | ||
fe57f13449a11436bbede8c37e01bd0d1cd87191 data\the_origin_of_magic\loot_tables\blocks\magic_workbench.json |
23 changes: 23 additions & 0 deletions
23
src/main/java/com/ictye/the_origin_of_magic/foundation/mixin/ClientPlayerMixin.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,23 @@ | ||
package com.ictye.the_origin_of_magic.foundation.mixin; | ||
|
||
import com.ictye.the_origin_of_magic.foundation.player.MagicAbilitiesManager; | ||
import com.ictye.the_origin_of_magic.utils.PlayerEntityMixinInterfaces; | ||
import com.mojang.authlib.GameProfile; | ||
import net.minecraft.client.network.ClientPlayerEntity; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.network.encryption.PlayerPublicKey; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.World; | ||
import org.jetbrains.annotations.Nullable; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
|
||
@Mixin(ClientPlayerEntity.class) | ||
public abstract class ClientPlayerMixin extends PlayerEntity { | ||
public ClientPlayerMixin(World world, BlockPos pos, float yaw, GameProfile gameProfile, @Nullable PlayerPublicKey publicKey) { | ||
super(world, pos, yaw, gameProfile, publicKey); | ||
} | ||
|
||
private final MagicAbilitiesManager magicAbilitiesManager = ((PlayerEntityMixinInterfaces)this).the_origin_of_magic$getMagicAbilitiesManager(); | ||
|
||
|
||
} |
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
39 changes: 39 additions & 0 deletions
39
src/main/java/com/ictye/the_origin_of_magic/foundation/mixin/SeriverEntityMixin.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,39 @@ | ||
package com.ictye.the_origin_of_magic.foundation.mixin; | ||
|
||
import com.ictye.the_origin_of_magic.foundation.player.MagicAbilitiesManager; | ||
import com.ictye.the_origin_of_magic.infrastructure.netWork.NetworkIDFinder; | ||
import com.ictye.the_origin_of_magic.utils.PlayerEntityMixinInterfaces; | ||
import com.mojang.authlib.GameProfile; | ||
import net.fabricmc.fabric.api.networking.v1.PacketByteBufs; | ||
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.network.PacketByteBuf; | ||
import net.minecraft.network.encryption.PlayerPublicKey; | ||
import net.minecraft.server.network.ServerPlayerEntity; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.World; | ||
import org.jetbrains.annotations.Nullable; | ||
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(ServerPlayerEntity.class) | ||
public abstract class SeriverEntityMixin extends PlayerEntity { | ||
public SeriverEntityMixin(World world, BlockPos pos, float yaw, GameProfile gameProfile, @Nullable PlayerPublicKey publicKey) { | ||
super(world, pos, yaw, gameProfile, publicKey); | ||
} | ||
|
||
private final MagicAbilitiesManager magicAbilitiesManager = ((PlayerEntityMixinInterfaces)this).the_origin_of_magic$getMagicAbilitiesManager(); | ||
|
||
@Inject(method = "playerTick", at = @At(value = "HEAD")) | ||
public void playerTick(CallbackInfo ci) { | ||
// ServerPlayerEntity | ||
ServerPlayerEntity serverPlayerEntity = (ServerPlayerEntity) (Object) this; | ||
|
||
PacketByteBuf buffer = PacketByteBufs.create(); | ||
buffer.writeFloat(this.magicAbilitiesManager.getMagicLevel()); | ||
ServerPlayNetworking.send(serverPlayerEntity, NetworkIDFinder.SYNC_HUD_ID, buffer); | ||
} | ||
|
||
} |
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
12 changes: 12 additions & 0 deletions
12
src/main/java/com/ictye/the_origin_of_magic/infrastructure/netWork/NetWorkReg.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,12 @@ | ||
package com.ictye.the_origin_of_magic.infrastructure.netWork; | ||
|
||
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; | ||
|
||
public class NetWorkReg { | ||
public static void registerC2SPackets() { | ||
} | ||
|
||
public static void registerS2CPackets() { | ||
ClientPlayNetworking.registerGlobalReceiver(NetworkIDFinder.SYNC_HUD_ID, SyncHUDS2CPacket::receive); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/com/ictye/the_origin_of_magic/infrastructure/netWork/NetworkIDFinder.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,11 @@ | ||
package com.ictye.the_origin_of_magic.infrastructure.netWork; | ||
|
||
import com.ictye.the_origin_of_magic.the_origin_of_magic; | ||
import net.minecraft.util.Identifier; | ||
|
||
public class NetworkIDFinder { | ||
public static final Identifier DRINK_WATER_ID = new Identifier(the_origin_of_magic.Mod_Id, "drink_water"); | ||
public static final Identifier SWING_HAND_ID = new Identifier(the_origin_of_magic.Mod_Id, "swing_hand"); | ||
public static final Identifier SYNC_THIRST_ID = new Identifier(the_origin_of_magic.Mod_Id, "sync_thirst"); | ||
public static final Identifier SYNC_HUD_ID = new Identifier(the_origin_of_magic.Mod_Id, "sync_hud"); | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/com/ictye/the_origin_of_magic/infrastructure/netWork/SyncHUDS2CPacket.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,20 @@ | ||
package com.ictye.the_origin_of_magic.infrastructure.netWork; | ||
|
||
import com.ictye.the_origin_of_magic.foundation.player.MagicAbilitiesManager; | ||
import com.ictye.the_origin_of_magic.utils.PlayerEntityMixinInterfaces; | ||
import net.fabricmc.fabric.api.networking.v1.PacketSender; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.client.network.ClientPlayNetworkHandler; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.network.PacketByteBuf; | ||
|
||
public class SyncHUDS2CPacket { | ||
public static void receive(MinecraftClient client, ClientPlayNetworkHandler handler, PacketByteBuf buffer, PacketSender responseSender) { | ||
PlayerEntity playerEntity = client.player; | ||
MagicAbilitiesManager magicAbilitiesManager = null; | ||
if (playerEntity != null) { | ||
magicAbilitiesManager = ((PlayerEntityMixinInterfaces) playerEntity).the_origin_of_magic$getMagicAbilitiesManager(); | ||
magicAbilitiesManager.setMagicLevel(buffer.readFloat()); | ||
} | ||
} | ||
} |
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
Binary file modified
BIN
-85 Bytes
(78%)
src/main/resources/assets/the_origin_of_magic/textures/gui/magic_power_image.png
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
"PlayerEntityMixin" | ||
], | ||
"client": [ | ||
"ClientPlayerMixin", | ||
"PlayerHudMixin" | ||
], | ||
"injectors": { | ||
|