mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
Use that weird new runnable thing now.
Thanks to Blay09 for noticing that for me :v
This commit is contained in:
parent
cba12aabe0
commit
81f743f03d
2 changed files with 22 additions and 8 deletions
|
@ -14,6 +14,7 @@ import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
|||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
|
||||
|
@ -59,10 +60,16 @@ public class PacketClientToServer implements IMessage{
|
|||
public static class Handler implements IMessageHandler<PacketClientToServer, IMessage>{
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketClientToServer message, MessageContext ctx){
|
||||
if(message.data != null && message.handler != null){
|
||||
message.handler.handleData(message.data);
|
||||
}
|
||||
public IMessage onMessage(PacketClientToServer aMessage, MessageContext ctx){
|
||||
final PacketClientToServer message = aMessage;
|
||||
FMLCommonHandler.instance().getMinecraftServerInstance().addScheduledTask(new Runnable(){
|
||||
@Override
|
||||
public void run(){
|
||||
if(message.data != null && message.handler != null){
|
||||
message.handler.handleData(message.data);
|
||||
}
|
||||
}
|
||||
});
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.mod.network;
|
|||
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||
|
@ -62,10 +63,16 @@ public class PacketServerToClient implements IMessage{
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IMessage onMessage(PacketServerToClient message, MessageContext ctx){
|
||||
if(message.data != null && message.handler != null){
|
||||
message.handler.handleData(message.data);
|
||||
}
|
||||
public IMessage onMessage(PacketServerToClient aMessage, MessageContext ctx){
|
||||
final PacketServerToClient message = aMessage;
|
||||
Minecraft.getMinecraft().addScheduledTask(new Runnable(){
|
||||
@Override
|
||||
public void run(){
|
||||
if(message.data != null && message.handler != null){
|
||||
message.handler.handleData(message.data);
|
||||
}
|
||||
}
|
||||
});
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue