Bump version. Add event for restore queue registration
This commit is contained in:
parent
25aa4b2f9d
commit
20a756277d
6 changed files with 25 additions and 15 deletions
|
@ -53,7 +53,7 @@ mod_name=Zontreck's Library Mod
|
||||||
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||||
mod_license=GPLv3
|
mod_license=GPLv3
|
||||||
# The mod version. See https://semver.org/
|
# The mod version. See https://semver.org/
|
||||||
mod_version=1201.13.041224.0752
|
mod_version=1201.13.041224.0827
|
||||||
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
||||||
# This should match the base package used for the mod sources.
|
# This should match the base package used for the mod sources.
|
||||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||||
|
|
|
@ -11,6 +11,7 @@ import java.util.UUID;
|
||||||
import dev.zontreck.libzontreck.chestgui.ChestGUIRegistry;
|
import dev.zontreck.libzontreck.chestgui.ChestGUIRegistry;
|
||||||
import dev.zontreck.libzontreck.currency.Bank;
|
import dev.zontreck.libzontreck.currency.Bank;
|
||||||
import dev.zontreck.libzontreck.currency.CurrencyHelper;
|
import dev.zontreck.libzontreck.currency.CurrencyHelper;
|
||||||
|
import dev.zontreck.libzontreck.events.BlockRestoreQueueRegistrationEvent;
|
||||||
import dev.zontreck.libzontreck.items.ModItems;
|
import dev.zontreck.libzontreck.items.ModItems;
|
||||||
import dev.zontreck.libzontreck.menus.ChestGUIScreen;
|
import dev.zontreck.libzontreck.menus.ChestGUIScreen;
|
||||||
import dev.zontreck.libzontreck.types.ModMenuTypes;
|
import dev.zontreck.libzontreck.types.ModMenuTypes;
|
||||||
|
@ -106,6 +107,8 @@ public class LibZontreck {
|
||||||
{
|
{
|
||||||
ALIVE=true;
|
ALIVE=true;
|
||||||
CURRENT_SIDE = LogicalSide.SERVER;
|
CURRENT_SIDE = LogicalSide.SERVER;
|
||||||
|
|
||||||
|
MinecraftForge.EVENT_BUS.post(new BlockRestoreQueueRegistrationEvent());
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
|
|
@ -6,11 +6,7 @@ import java.util.List;
|
||||||
import dev.zontreck.libzontreck.networking.packets.IPacket;
|
import dev.zontreck.libzontreck.networking.packets.IPacket;
|
||||||
import net.minecraftforge.eventbus.api.Event;
|
import net.minecraftforge.eventbus.api.Event;
|
||||||
|
|
||||||
/**
|
@Deprecated
|
||||||
* Used to register your packets with LibZontreck. Packets must extend IPacket and implement PacketSerializable. This is dispatched on both logical sides, and is considered a final event. It is not cancelable
|
|
||||||
* @see IPacket
|
|
||||||
*/
|
|
||||||
public class RegisterPacketsEvent extends Event
|
public class RegisterPacketsEvent extends Event
|
||||||
{
|
{
|
||||||
public final List<IPacket> packets = new ArrayList<>();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,8 @@ package dev.zontreck.libzontreck.memory.world;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
|
import net.minecraftforge.event.TickEvent;
|
||||||
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -112,4 +114,13 @@ public abstract class BlockRestoreQueue
|
||||||
Thread tx = new Thread(RUNNER);
|
Thread tx = new Thread(RUNNER);
|
||||||
tx.start();
|
tx.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onTick(TickEvent.LevelTickEvent event)
|
||||||
|
{
|
||||||
|
if(event.phase == TickEvent.Phase.END)
|
||||||
|
{
|
||||||
|
tick();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,4 +18,13 @@ public class BlockRestoreQueueRegistry
|
||||||
public static void addQueue(BlockRestoreQueue queue) {
|
public static void addQueue(BlockRestoreQueue queue) {
|
||||||
QUEUES.put(queue.getRestoreQueueName(), queue);
|
QUEUES.put(queue.getRestoreQueueName(), queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves a registered restore queue by its name
|
||||||
|
* @param restoreQueueName Queue Name
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static BlockRestoreQueue getQueue(String restoreQueueName) {
|
||||||
|
return QUEUES.get(restoreQueueName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,16 +36,7 @@ public class ModMessages {
|
||||||
.clientAcceptedVersions(s->true)
|
.clientAcceptedVersions(s->true)
|
||||||
.serverAcceptedVersions(s->true)
|
.serverAcceptedVersions(s->true)
|
||||||
.simpleChannel();
|
.simpleChannel();
|
||||||
|
|
||||||
RegisterPacketsEvent event = new RegisterPacketsEvent();
|
|
||||||
MinecraftForge.EVENT_BUS.post(event);
|
|
||||||
|
|
||||||
INSTANCE=net;
|
|
||||||
|
|
||||||
for(IPacket packet : event.packets)
|
|
||||||
{
|
|
||||||
packet.register(net);
|
|
||||||
}
|
|
||||||
|
|
||||||
net.messageBuilder(S2CPlaySoundPacket.class, PACKET_ID.getAndIncrement(), NetworkDirection.PLAY_TO_CLIENT)
|
net.messageBuilder(S2CPlaySoundPacket.class, PACKET_ID.getAndIncrement(), NetworkDirection.PLAY_TO_CLIENT)
|
||||||
.decoder(S2CPlaySoundPacket::new)
|
.decoder(S2CPlaySoundPacket::new)
|
||||||
|
|
Reference in a new issue