-
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
Showing
11 changed files
with
74 additions
and
22 deletions.
There are no files selected for viewing
17 changes: 0 additions & 17 deletions
17
src/client/java/com/megadoxs/megalib/registry/factory/MegalibClientPowers.java
This file was deleted.
Oops, something went wrong.
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
2 changes: 0 additions & 2 deletions
2
...a/com/megadoxs/megalib/MegalibClient.java → ...a/com/megadoxs/megalib/MegalibClient.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 |
---|---|---|
@@ -1,11 +1,9 @@ | ||
package com.megadoxs.megalib; | ||
|
||
import com.megadoxs.megalib.registry.factory.MegalibClientPowers; | ||
import net.fabricmc.api.ClientModInitializer; | ||
|
||
public class MegalibClient implements ClientModInitializer { | ||
@Override | ||
public void onInitializeClient() { | ||
MegalibClientPowers.register(); | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
35 changes: 35 additions & 0 deletions
35
src/main/java/com/megadoxs/megalib/data/UserInterfaceData.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,35 @@ | ||
package com.megadoxs.megalib.data; | ||
|
||
import io.github.apace100.calio.data.SerializableData; | ||
import io.github.apace100.calio.data.SerializableDataType; | ||
import io.github.apace100.calio.data.SerializableDataTypes; | ||
|
||
public record UserInterfaceData(String title) { | ||
|
||
public static final SerializableData DATA = new SerializableData() | ||
.add("title", SerializableDataTypes.STRING); | ||
|
||
public static final SerializableDataType<UserInterfaceData> DATA_TYPE = SerializableDataType.compound( | ||
UserInterfaceData.class, | ||
DATA, | ||
UserInterfaceData::fromData, | ||
(serializableData, interfaceData) -> interfaceData.toData() | ||
); | ||
|
||
public static UserInterfaceData fromData(SerializableData.Instance data) { | ||
return new UserInterfaceData( | ||
data.get("title") | ||
); | ||
} | ||
|
||
public SerializableData.Instance toData() { | ||
|
||
SerializableData.Instance data = DATA.new Instance(); | ||
|
||
data.set("title", this.title()); | ||
|
||
return data; | ||
|
||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
src/main/java/com/megadoxs/megalib/networking/packet/s2c/UserInterfaceS2CPacket.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,29 @@ | ||
package com.megadoxs.megalib.networking.packet.s2c; | ||
|
||
import com.megadoxs.megalib.Megalib; | ||
import com.megadoxs.megalib.data.UserInterfaceData; | ||
import net.fabricmc.fabric.api.networking.v1.FabricPacket; | ||
import net.fabricmc.fabric.api.networking.v1.PacketType; | ||
import net.minecraft.network.PacketByteBuf; | ||
|
||
public record UserInterfaceS2CPacket(UserInterfaceData InterfaceData) implements FabricPacket { | ||
|
||
public static final PacketType<UserInterfaceS2CPacket> TYPE = PacketType.create( | ||
Megalib.identifier("s2c/user_interface"), UserInterfaceS2CPacket::read | ||
); | ||
|
||
public static UserInterfaceS2CPacket read(PacketByteBuf buf) { | ||
return new UserInterfaceS2CPacket(UserInterfaceData.DATA_TYPE.receive(buf)); | ||
} | ||
|
||
@Override | ||
public void write(PacketByteBuf buf) { | ||
UserInterfaceData.DATA_TYPE.send(buf, InterfaceData); | ||
} | ||
|
||
@Override | ||
public PacketType<?> getType() { | ||
return TYPE; | ||
} | ||
|
||
} |
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
3 changes: 2 additions & 1 deletion
3
src/main/java/com/megadoxs/megalib/registry/factory/MegalibPowers.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