Crash mod client mais pas sur eclipse



  • bonjour, mon mod fonctionne sur eclipse mais pas sur le launcher minecraft 😕 voici le crash

    https://hastebin.com/ufitajihec.sql

    Mais la class existe bien en une fois compiler

    https://image.noelshack.com/fichiers/2017/22/1496260433-images.jpg


  • Rédacteurs

    Surement annotée d'un @SideOnly, faudra apprendre à vous en servir un jour



  • 
        @EventHandler
        public void preInitOverlay(FMLPreInitializationEvent event)
        {
        log = event.getModLog();
        network = NetworkRegistry.INSTANCE.newSimpleChannel("OverlayMod.channel.1");
        network.registerMessage(OC01PacketData.Handler.class, OC01PacketData.class, 1, Side.CLIENT);
    
        if(event.getSide().isClient())
        {
        MinecraftForge.EVENT_BUS.register(new ClientEventHandler());
        }
        else
        {
        MinecraftForge.EVENT_BUS.register(new ServerEventHandler());
        FMLCommonHandler.instance().bus().register(new ServerEventHandler());
        }
    GameRegistry.registerWorldGenerator(worldgene, 0);
        }
    

    non …


  • Rédacteurs

    Je parle de la classe, dans la classe OC01PacketData il y a sûrement un SideOnly qui ne va pas



  • package aymanejojo95.platinium.overlay;
    
    import aymanejojo95.platinium.common.Sceptremod;
    import cpw.mods.fml.common.network.ByteBufUtils;
    import cpw.mods.fml.common.network.simpleimpl.IMessage;
    import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
    import cpw.mods.fml.common.network.simpleimpl.MessageContext;
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    
    import io.netty.buffer.ByteBuf;
    import io.netty.buffer.ByteBufUtil;
    
    public class OC01PacketData implements IMessage 
    {
    private DataType type;
    private Object data;
    
    public static enum DataType
    {
    ERROR(0, null),
    BC(1, String.class),
    NEW_PLAYER(2, String.class),
    NEW_VOTER(3, String.class),
    ALL(4, String[].class);
    private int id;
    private Class pattern;
    private DataType(int id, Class pattern)
    {
    this.id = id; this.pattern = pattern;
    }
    public static DataType fromId(int id)
    {
    if(id > 0 && id < values().length)
    return values()[id];
    return ERROR;
    }
    }
    public static class Handler implements IMessageHandler <oc01packetdata, imessage="">{
    @SideOnly(Side.CLIENT)
    @Override
    public IMessage onMessage(OC01PacketData message, MessageContext ctx) 
    {
    switch (message.type) {
    case BC:
    ClientEventHandler.currentBroadcast = (String) message.data;
    ClientEventHandler.endBcTime = System.currentTimeMillis() + 10000; //10 seconds
    break;
    case NEW_PLAYER:
    ClientEventHandler.lastPlayer = (String) message.data;
    ClientEventHandler.endNwPlayerTime = System.currentTimeMillis() + 7500; //7.5 seconds
    break;
    case NEW_VOTER:
    ClientEventHandler.lastVoter = (String) message.data;
    ClientEventHandler.endVoteTime = System.currentTimeMillis() + 7500; //7.5 seconds
    break;
    case ALL:
    ClientEventHandler.lastPlayer = ((String[])message.data)[0];
    ClientEventHandler.endNwPlayerTime = System.currentTimeMillis() + 7500; //7.5 seconds
    ClientEventHandler.lastVoter = ((String[])message.data)[1];
    ClientEventHandler.endVoteTime = System.currentTimeMillis() + 7500; //7.5 seconds
    break;
    default:
    Sceptremod.log.warn("Cannot handle OC01 packet : unknow type ! (data: " + message.data + ").");
    break;
    }
    return null;
    }
    }
    public OC01PacketData() {}
    public OC01PacketData(DataType dataType, Object data)
    {
    this.type = dataType;
    this.data = data;
    }
    @Override
    public void fromBytes(ByteBuf buf)
    {
    type = DataType.fromId(buf.readInt());
    if(type.pattern==String.class)
    {
    data = ByteBufUtils.readUTF8String(buf);
    }
    else if(type.pattern==String[].class)
    {
    int s = buf.readInt();
    data = new String~~;
    for(int i=0;i<s;i++)<br>{
    ((String[])data)*=ByteBufUtils.readUTF8String(buf);
    }
    }
    }
    @Override
    public void toBytes(ByteBuf buf)
    {
    buf.writeInt(type.id);
    if(type.pattern==String.class)
    {
    ByteBufUtils.writeUTF8String(buf, (String) data);
    }
    else if(type.pattern==String[].class)
    {
    buf.writeInt(((String[])data).length);
    for(int i=0;i<((String[])data).length;i++)
    {
    ByteBufUtils.writeUTF8String(buf, ((String[]) data)*);
    }
    }
    }
    }
    
    ```</s;i++)<br>~~</oc01packetdata,>


  • @'Riizn':

    package aymanejojo95.platinium.overlay;
    
    import aymanejojo95.platinium.common.Sceptremod;
    import cpw.mods.fml.common.network.ByteBufUtils;
    import cpw.mods.fml.common.network.simpleimpl.IMessage;
    import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
    import cpw.mods.fml.common.network.simpleimpl.MessageContext;
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    
    import io.netty.buffer.ByteBuf;
    import io.netty.buffer.ByteBufUtil;
    
    public class OC01PacketData implements IMessage 
    {
    private DataType type;
    private Object data;
    
    public static enum DataType
    {
    ERROR(0, null),
    BC(1, String.class),
    NEW_PLAYER(2, String.class),
    NEW_VOTER(3, String.class),
    ALL(4, String[].class);
    private int id;
    private Class pattern;
    private DataType(int id, Class pattern)
    {
    this.id = id; this.pattern = pattern;
    }
    public static DataType fromId(int id)
    {
    if(id > 0 && id < values().length)
    return values()[id];
    return ERROR;
    }
    }
    public static class Handler implements IMessageHandler <oc01packetdata, imessage="">{
    @SideOnly(Side.CLIENT)
    @Override
    public IMessage onMessage(OC01PacketData message, MessageContext ctx) 
    {
    switch (message.type) {
    case BC:
    ClientEventHandler.currentBroadcast = (String) message.data;
    ClientEventHandler.endBcTime = System.currentTimeMillis() + 10000; //10 seconds
    break;
    case NEW_PLAYER:
    ClientEventHandler.lastPlayer = (String) message.data;
    ClientEventHandler.endNwPlayerTime = System.currentTimeMillis() + 7500; //7.5 seconds
    break;
    case NEW_VOTER:
    ClientEventHandler.lastVoter = (String) message.data;
    ClientEventHandler.endVoteTime = System.currentTimeMillis() + 7500; //7.5 seconds
    break;
    case ALL:
    ClientEventHandler.lastPlayer = ((String[])message.data)[0];
    ClientEventHandler.endNwPlayerTime = System.currentTimeMillis() + 7500; //7.5 seconds
    ClientEventHandler.lastVoter = ((String[])message.data)[1];
    ClientEventHandler.endVoteTime = System.currentTimeMillis() + 7500; //7.5 seconds
    break;
    default:
    Sceptremod.log.warn("Cannot handle OC01 packet : unknow type ! (data: " + message.data + ").");
    break;
    }
    return null;
    }
    }
    public OC01PacketData() {}
    public OC01PacketData(DataType dataType, Object data)
    {
    this.type = dataType;
    this.data = data;
    }
    @Override
    public void fromBytes(ByteBuf buf)
    {
    type = DataType.fromId(buf.readInt());
    if(type.pattern==String.class)
    {
    data = ByteBufUtils.readUTF8String(buf);
    }
    else if(type.pattern==String[].class)
    {
    int s = buf.readInt();
    data = new String~~;
    for(int i=0;i<s;i++)<br>{
    ((String[])data)*=ByteBufUtils.readUTF8String(buf);
    }
    }
    }
    @Override
    public void toBytes(ByteBuf buf)
    {
    buf.writeInt(type.id);
    if(type.pattern==String.class)
    {
    ByteBufUtils.writeUTF8String(buf, (String) data);
    }
    else if(type.pattern==String[].class)
    {
    buf.writeInt(((String[])data).length);
    for(int i=0;i<((String[])data).length;i++)
    {
    ByteBufUtils.writeUTF8String(buf, ((String[]) data)*);
    }
    }
    }
    }
    
    
    
    public static class Handler implements IMessageHandler <oc01packetdata, imessage="">{
    @SideOnly(Side.CLIENT)
    
    

    Essaie d'enlever le ''@SideOnly(Side.CLIENT)"</oc01packetdata,></s;i++)<br>~~</oc01packetdata,>



  • déjà essayer


  • Rédacteurs

    • vérifie que ton code est build (project -> build All ou build automatically)
    • tente de resetup ton environnement de dev (setupDecompWorspace eclipse)