Begin adding DynamicChest UI, and finish adding the HeadUtilities
This commit is contained in:
parent
5c70fb1291
commit
8fde794b65
23 changed files with 662 additions and 7 deletions
|
@ -0,0 +1,43 @@
|
|||
package dev.zontreck.libzontreck.networking.packets;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import dev.zontreck.libzontreck.networking.structures.OpenGUIRequest;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraftforge.network.NetworkEvent;
|
||||
|
||||
/**
|
||||
* To be used by first-party and third-party mods to assemble a menu
|
||||
* NOTE: Without the server, only the credits menu will be able to be opened, which is the only built-in menu utilizing this system.
|
||||
*/
|
||||
public class ChestGUIOpenC2S {
|
||||
private CompoundTag data;
|
||||
|
||||
public ChestGUIOpenC2S(OpenGUIRequest request)
|
||||
{
|
||||
data = request.serialize();
|
||||
}
|
||||
|
||||
public ChestGUIOpenC2S(FriendlyByteBuf buf)
|
||||
{
|
||||
data = buf.readAnySizeNbt();
|
||||
}
|
||||
|
||||
public void toBytes(FriendlyByteBuf buf)
|
||||
{
|
||||
buf.writeNbt(data);
|
||||
}
|
||||
|
||||
public boolean handle(Supplier<NetworkEvent.Context> supplier)
|
||||
{
|
||||
NetworkEvent.Context ctx = supplier.get();
|
||||
|
||||
ctx.enqueueWork(()->{
|
||||
// We are on the server!
|
||||
OpenGUIRequest req = new OpenGUIRequest(data);
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
Reference in a new issue