Jump to content

[1.10] Some Errors


DeividasX

Recommended Posts

So, I decided to port some mod from 1.7.10 to 1.10.2 for my private server. The mod is unofficial, and author gave me the source. It shows which region is claimed, which is not with association of bukkit plugin that hooks WorldGuard and this mod. Okay. So on this mod, when I changed 1.7.10 code to 1.10.2, it still marks some code as red error. Can someone there help me?

package com.deividasx;

import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.network.ByteBufUtils;
import net.minecraftforge.fml.common.network.FMLNetworkEvent.ClientCustomPacketEvent;
import io.netty.buffer.ByteBuf;
import net.minecraft.client.Minecraft;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;

public class PacketHandler
{
    private static String currentRegion;
    private static boolean canBuild;
    
    @SubscribeEvent
    public void onClientPacket(ClientCustomPacketEvent event)
    {
        ByteBuf buf = event.packet.payload();
        
        ByteBufUtils.readUTF8String(buf);
        currentRegion = ByteBufUtils.readUTF8String(buf);
        canBuild = buf.readBoolean();
    }
    
    @SubscribeEvent
    public void onRenderOverlay(RenderGameOverlayEvent event)
    {
        if(event.type == ElementType.TEXT)
        {
            if(PacketHandler.currentRegion != null && !PacketHandler.currentRegion.equals("GLOBAL"))
            {
                TextFormatting color = canBuild ? TextFormatting.GREEN : TextFormatting.RED;
                
                Minecraft.getMinecraft().fontRenderer.drawString(color + "[" + TextFormatting.WHITE + currentRegion + color + "]", 10, 10, 0xFFFFFF);
            }
        }
    }
}

Image with errors is attached.

Screenshot_6.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.