Jump to content

Recommended Posts

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

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I am trying to install forge 1.20.1 but after installing java 8 144, it only quickly opens a cmd prompt then recloses it without anything else happening. Any help?
    • This is a hopefully quick question, but I'm tryin to slow down the player and have reduced the movement speed attribute, which works as long as the player is on the ground, however when the player is sprint jumping their speed is only slightly slower than a actual player(For reference there movement speed is 0.5 of it's original value)
    • Hello there! I developing a mod, that will be allow to spawn a hologram of the player. So i need, that a hologram has a skin of owner. I don't sure how to do that, 'cause if i just place a path to standart steve skin, that will lead for same skin on all holograms. Btw, is it posible to dynamicly add an another layer to player's skin? For creating a small diffusing. Can anyone share some ideas? (will be perfect if i don't must be use an openGL API and something)
    • I've been running a very old instance of Forge on my 1.18.2 server (40.2.5) and would like to upgrade it, but if I install any version past that, Minecraft won't load.  It doesn't crash, it just brings up the command prompt and hangs until I close it.  I'm guessing it's some sort of mod incompatibility, but I have no idea how to tell.  Here's my debug log: https://mclo.gs/7Chnf4a
    • Update your AMD/ATI drivers - get the drivers from their website - do not update via system  
×
×
  • Create New...

Important Information

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