Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

  • Author
10 minutes ago, diesieben07 said:

All those fields have been replaced with getters.

How about fontRenderer?

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.