Sync Waila mode to client when connecting to server
No more sneaky bypassing
This commit is contained in:
parent
fd8e81cbdc
commit
c9c03a3971
3 changed files with 39 additions and 0 deletions
|
@ -17,6 +17,7 @@ public class BloodMagicPacketHandler
|
||||||
{
|
{
|
||||||
INSTANCE.registerMessage(ChatUtil.PacketNoSpamChat.Handler.class, ChatUtil.PacketNoSpamChat.class, 0, Side.CLIENT);
|
INSTANCE.registerMessage(ChatUtil.PacketNoSpamChat.Handler.class, ChatUtil.PacketNoSpamChat.class, 0, Side.CLIENT);
|
||||||
INSTANCE.registerMessage(ItemRouterButtonPacketProcessor.class, ItemRouterButtonPacketProcessor.class, 1, Side.SERVER);
|
INSTANCE.registerMessage(ItemRouterButtonPacketProcessor.class, ItemRouterButtonPacketProcessor.class, 1, Side.SERVER);
|
||||||
|
INSTANCE.registerMessage(PacketSyncConfig.class, PacketSyncConfig.class, 2, Side.CLIENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendToAllAround(IMessage message, TileEntity te, int range)
|
public static void sendToAllAround(IMessage message, TileEntity te, int range)
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
package WayofTime.bloodmagic.network;
|
||||||
|
|
||||||
|
import WayofTime.bloodmagic.ConfigHandler;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||||
|
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
|
||||||
|
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
|
||||||
|
|
||||||
|
public class PacketSyncConfig implements IMessage, IMessageHandler<PacketSyncConfig, IMessage>
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fromBytes(ByteBuf buf)
|
||||||
|
{
|
||||||
|
ConfigHandler.wailaAltarDisplayMode = buf.readInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void toBytes(ByteBuf buf)
|
||||||
|
{
|
||||||
|
buf.writeInt(ConfigHandler.wailaAltarDisplayMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IMessage onMessage(PacketSyncConfig message, MessageContext ctx)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -9,6 +9,8 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
import WayofTime.bloodmagic.api.network.SoulNetwork;
|
import WayofTime.bloodmagic.api.network.SoulNetwork;
|
||||||
import WayofTime.bloodmagic.api.orb.IBloodOrb;
|
import WayofTime.bloodmagic.api.orb.IBloodOrb;
|
||||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||||
|
import WayofTime.bloodmagic.network.BloodMagicPacketHandler;
|
||||||
|
import WayofTime.bloodmagic.network.PacketSyncConfig;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.enchantment.Enchantment;
|
import net.minecraft.enchantment.Enchantment;
|
||||||
import net.minecraft.enchantment.EnchantmentHelper;
|
import net.minecraft.enchantment.EnchantmentHelper;
|
||||||
|
@ -48,6 +50,7 @@ import net.minecraftforge.fml.common.eventhandler.Event.Result;
|
||||||
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||||
|
import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import WayofTime.bloodmagic.ConfigHandler;
|
import WayofTime.bloodmagic.ConfigHandler;
|
||||||
import WayofTime.bloodmagic.api.BloodMagicAPI;
|
import WayofTime.bloodmagic.api.BloodMagicAPI;
|
||||||
|
@ -210,6 +213,12 @@ public class EventHandler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onLoggedIn(PlayerLoggedInEvent event)
|
||||||
|
{
|
||||||
|
BloodMagicPacketHandler.sendTo(new PacketSyncConfig(), (EntityPlayerMP) event.player);
|
||||||
|
}
|
||||||
|
|
||||||
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||||
public void onEntityUpdate(LivingEvent.LivingUpdateEvent event)
|
public void onEntityUpdate(LivingEvent.LivingUpdateEvent event)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue