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.