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.
|
||||
mod_license=GPLv3
|
||||
# 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.
|
||||
# This should match the base package used for the mod sources.
|
||||
# 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.currency.Bank;
|
||||
import dev.zontreck.libzontreck.currency.CurrencyHelper;
|
||||
import dev.zontreck.libzontreck.events.BlockRestoreQueueRegistrationEvent;
|
||||
import dev.zontreck.libzontreck.items.ModItems;
|
||||
import dev.zontreck.libzontreck.menus.ChestGUIScreen;
|
||||
import dev.zontreck.libzontreck.types.ModMenuTypes;
|
||||
|
@ -106,6 +107,8 @@ public class LibZontreck {
|
|||
{
|
||||
ALIVE=true;
|
||||
CURRENT_SIDE = LogicalSide.SERVER;
|
||||
|
||||
MinecraftForge.EVENT_BUS.post(new BlockRestoreQueueRegistrationEvent());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
|
|
@ -6,11 +6,7 @@ import java.util.List;
|
|||
import dev.zontreck.libzontreck.networking.packets.IPacket;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
@Deprecated
|
||||
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.world.level.block.Block;
|
||||
import net.minecraftforge.event.TickEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -112,4 +114,13 @@ public abstract class BlockRestoreQueue
|
|||
Thread tx = new Thread(RUNNER);
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,15 +37,6 @@ public class ModMessages {
|
|||
.serverAcceptedVersions(s->true)
|
||||
.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)
|
||||
.decoder(S2CPlaySoundPacket::new)
|
||||
|
|
Reference in a new issue