Jump to content

lamp3345

Members
  • Posts

    14
  • Joined

  • Last visited

Posts posted by lamp3345

  1. I've been searching for related issue in the Google and still can't find an answer to solve this. And I don't know what's going on with my build.gradle.

     

    My Current Gradle (working properly) :

    buildscript {
        repositories {
            jcenter()
            maven { url = "http://files.minecraftforge.net/maven" }
        }
        dependencies {
            classpath "net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT"
            classpath "gradle.plugin.com.matthewprenger:CurseGradle:1.0.11"
        }
    }
    
    plugins {
        id "com.matthewprenger.cursegradle" version "1.0.11"
    }
    
    def api = new groovy.json.JsonSlurper().parseText(file("${api_token_path}").text)
    def keystore = new groovy.json.JsonSlurper().parseText(file("${keystore_path}").text)
    def mcVersion = project.mc_version
    
    apply plugin: "net.minecraftforge.gradle.forge"
    
    sourceSets.main {
        java {
            srcDirs = ["src/main/java", "dependencies/main/java", "src/api/java"]
        }
        resources {
            srcDirs = ["src/main/resources", "dependencies/main/resources", "src/api/resources"]
        }
    }
    
    version = project.version
    group = "stevekung.mods.moreplanets"
    archivesBaseName = "More-Planets-All"
    sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
    
    minecraft {
        version = "1.12.2-14.23.4.2725"
        runDir = "run"
        mappings = "snapshot_20171003"
        makeObfSourceJar = false
    
        replace "@FINGERPRINT@", keystore.sha1
        replace "4.0.1.-1", project.gc_require_version
        replaceIn "MorePlanetsMod.java"
    }
    
    repositories {
        // Hwyla : https://tehnut.info/maven/mcp/mobius/waila/Hwyla/
        maven {
            url "http://tehnut.info/maven/"
        }
        // JEI
        maven {
            url "http://dvs1.progwml6.com/files/maven"
        }
        // Code Chicken Lib : http://chickenbones.net/maven/codechicken/CodeChickenLib/
        maven {
            url "http://chickenbones.net/maven/"
        }
        // Curse Gradle
        maven {
            url "https://plugins.gradle.org/m2/"
        }
        // CTM : https://maven.tterrag.com/index.php?dir=team%2Fchisel%2Fctm%2FCTM
        maven {
            url "http://maven.tterrag.com/"
        }
    }
    
    dependencies {
        compile "mezz.jei:jei_${mc_version}:${jei_version}:api"
        compile "codechicken:CodeChickenLib:${mc_version}-${ccl_version}:deobf"
        deobfCompile "team.chisel.ctm:CTM:MC${ctm_version}"
        deobfCompile "mcp.mobius.waila:Hwyla:${hwyla_version}"
        runtime "mezz.jei:jei_${mc_version}:${jei_version}"
        runtime "codechicken:CodeChickenLib:${mc_version}-${ccl_version}:deobf"
    }
    
    curseforge {
        apiKey = api.more_planets
        project {
            id = "261990"
            changelog = ""
            changelogType = "markdown"
            releaseType = "beta"
            addGameVersion mcVersion
    
            mainArtifact(file("build/libs/More-Planets-" + mcVersion + "-" + version + ".jar")) {
                displayName = "More-Planets-" + mcVersion + "-" + version
                relations {
                    requiredLibrary "stevekungs-lib"
                    optionalLibrary "jei"
                    optionalLibrary "ctm"
                    optionalLibrary "hwyla"
                }
            }
        }
    }
    
    ext.finalJar = "build/libs/" + "More-Planets-" + mcVersion + "-" + version + ".jar"
    ext.coreJar = "build/libs/" + archivesBaseName + "-" + version + ".jar"
    ext.coreFiles = ["stevekung/mods/moreplanets/**", "assets/moreplanets/**", "license.txt", "pack.mcmeta", "META-INF/moreplanets_at.cfg"]
    
    // signing jar first
    task buildJar(type: SignJar, dependsOn: "processJar") {
        keyStore = keystore.keystore_path
        alias = keystore.alias
        storePass = keystore.keystore_pass
        keyPass = keystore.keystore_pass
        inputFile = project.ext.finalJar
        outputFile = project.ext.finalJar
    }
    
    // processing jar
    task processJar(type: Jar, dependsOn: "rePackAllJar") {
        outputs.upToDateWhen { false }
        baseName = "More-Planets-" + mcVersion
    
        from(zipTree(project.ext.coreJar)) {
            includes.addAll(project.ext.coreFiles)
        }
        manifest {
            attributes.put("FMLAT", "moreplanets_at.cfg")
            attributes.put("FMLCorePluginContainsFMLMod", "true")
        }
    }
    
    task rePackAllJar(type: Jar, dependsOn: "copyModFiles") {
        from "temporary"
    }
    
    task copyModFiles(type: Copy, dependsOn: "reobfJar") {
        from(zipTree(project.ext.coreJar))
        into "temporary"
    }
    
    task deleteTemporary(type: Delete) {
        delete "temporary"
    }
    
    task buildDeobfJar(type: Jar) {
        from sourceSets.main.output
        classifier = "deobf"
        manifest {
            attributes.put("FMLAT", "moreplanets_at.cfg")
            attributes.put("FMLCorePluginContainsFMLMod", "true")
        }
    }
    
    buildJar.finalizedBy(deleteTemporary)

     

    My Current Gradle (cleanup, doesn't work in end user environment) :

    buildscript {
        repositories {
            jcenter()
            maven { url = "http://files.minecraftforge.net/maven" }
        }
        dependencies {
            classpath "net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT"
            classpath "gradle.plugin.com.matthewprenger:CurseGradle:1.0.11"
        }
    }
    
    plugins {
        id "com.matthewprenger.cursegradle" version "1.0.11"
    }
    
    repositories {
        // Hwyla : https://tehnut.info/maven/mcp/mobius/waila/Hwyla/
        maven {
            url "http://tehnut.info/maven/"
        }
        // JEI
        maven {
            url "http://dvs1.progwml6.com/files/maven"
        }
        // Code Chicken Lib : http://chickenbones.net/maven/codechicken/CodeChickenLib/
        maven {
            url "http://chickenbones.net/maven/"
        }
        // Curse Gradle
        maven {
            url "https://plugins.gradle.org/m2/"
        }
        // CTM : https://maven.tterrag.com/index.php?dir=team%2Fchisel%2Fctm%2FCTM
        maven {
            url "http://maven.tterrag.com/"
        }
    }
    
    def api = new groovy.json.JsonSlurper().parseText(file("${api_token_path}").text)
    def keystore = new groovy.json.JsonSlurper().parseText(file("${keystore_path}").text)
    def mcVersion = project.mc_version
    
    apply plugin: "net.minecraftforge.gradle.forge"
    
    sourceSets.main {
        java {
            srcDirs = ["src/main/java", "dependencies/main/java", "src/api/java"]
        }
        resources {
            srcDirs = ["src/main/resources", "dependencies/main/resources", "src/api/resources"]
        }
    }
    
    version = project.version
    group = "stevekung.mods.moreplanets"
    archivesBaseName = "More-Planets"
    sourceCompatibility = targetCompatibility = 1.8
    
    minecraft {
        version = "1.12.2-14.23.4.2725"
        runDir = "run"
        mappings = "snapshot_20171003"
        makeObfSourceJar = false
    
        replace "@FINGERPRINT@", keystore.sha1
        replace "4.0.1.-1", project.gc_require_version
        replaceIn "MorePlanetsMod.java"
    }
    
    dependencies {
        compile "mezz.jei:jei_${mc_version}:${jei_version}:api"
        compile "codechicken:CodeChickenLib:${mc_version}-${ccl_version}:deobf"
        deobfCompile "team.chisel.ctm:CTM:MC${ctm_version}"
        deobfCompile "mcp.mobius.waila:Hwyla:${hwyla_version}"
        runtime "mezz.jei:jei_${mc_version}:${jei_version}"
        runtime "codechicken:CodeChickenLib:${mc_version}-${ccl_version}:deobf"
    }
    
    jar {
        include "stevekung/mods/moreplanets/**"
        include "assets/moreplanets/**"
        include "META-INF/moreplanets_at.cfg"
        include "license.txt"
        include "pack.mcmeta"
    
        manifest {
            attributes("FMLAT": "moreplanets_at.cfg", "FMLCorePluginContainsFMLMod": "true")
        }
        baseName = "More-Planets-" + mcVersion
    }
    
    curseforge {
        apiKey = api.more_planets
        project {
            id = "261990"
            changelog = ""
            changelogType = "markdown"
            releaseType = "beta"
            addGameVersion mcVersion
    
            mainArtifact(file("build/libs/More-Planets-" + mcVersion + "-" + version + ".jar")) {
                displayName = "More-Planets-" + mcVersion + "-" + version
                relations {
                    requiredLibrary "stevekungs-lib"
                    optionalLibrary "jei"
                    optionalLibrary "ctm"
                    optionalLibrary "hwyla"
                }
            }
        }
    }
    
    task signJar(type: SignJar, dependsOn: reobfJar) {
        keyStore = keystore.keystore_path
        alias = keystore.alias
        storePass = keystore.keystore_pass
        keyPass = keystore.keystore_pass
        inputFile = jar.archivePath
        outputFile = jar.archivePath
    }
    
    task deobfJar(type: Jar) {
        from sourceSets.main.output
        classifier = "deobf"
        manifest {
            attributes("FMLAT": "moreplanets_at.cfg", "FMLCorePluginContainsFMLMod": "true")
        }
    }
    
    build.dependsOn signJar

     

    Crash Log :

    https://pastebin.com/KDRq0FY2

  2. When break the block, EntityJuicer will ride to the nearby player. This work perfectly in 1.8.9 but its broken in 1.10.2.

     

    Current method that I used.

        @Override
        public void onBlockDestroyedByPlayer(World world, BlockPos pos, IBlockState state)
        {
            EntityPlayer player = world.getClosestPlayer(pos.getX(), pos.getY(), pos.getZ(), 5, false);
            
            if (!world.isRemote)
            {
    //            if (world.rand.nextInt(5) == 0)
    //            {
    //                EntityJuicer juicer = new EntityJuicer(world);
    //                juicer.setLocationAndAngles(pos.getX() + 0.5D, pos.getY() + 1.0D, pos.getZ() + 0.5D, 0.0F, 0.0F);
    //                world.spawnEntityInWorld(juicer);
    //            }
                //if (world.rand.nextInt(10) == 0)
                {
    //                double radiusPlayer = 5.0D;
    //                List<EntityPlayer> playerList = world.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(pos.getX() - radiusPlayer, pos.getY() - radiusPlayer, pos.getZ() - radiusPlayer, pos.getX() + radiusPlayer, pos.getY() + radiusPlayer, pos.getZ() + radiusPlayer));
    //
    //                if (!playerList.isEmpty())
    //                {
    //                    for (EntityPlayer player : playerList)
    //                    {
    //                        EntityJuicer juicer = new EntityJuicer(world);
    //                        juicer.setLocationAndAngles(pos.getX() + 0.5D, pos.getY() + 1.0D, pos.getZ() + 0.5D, 0.0F, 0.0F);
    //                        world.spawnEntityInWorld(juicer);
    //                        juicer.startRiding(player, true);
    //                    }
    //                }
                  EntityJuicer juicer = new EntityJuicer(world);
                  juicer.setLocationAndAngles(pos.getX() + 0.5D, pos.getY() + 1.0D, pos.getZ() + 0.5D, 0.0F, 0.0F);
                  juicer.startRiding(player, true);
                  world.spawnEntityInWorld(juicer);
    
                  //juicer.startRiding(player, true);
                }
            }
        }

     

  3. I make the Custom Cape rendering with PNG image from URL. Current method seems bad performance (And its make game lag 2~ second after finished download texture).

     

    Current Code :

     

        public static void setCapeURL(String url, boolean startup)
        {
            URL jurl = null;
            boolean noConnection = false;
            JsonUtil json = new JsonUtil();
    
            try
            {
                jurl = new URL(url);
            }
            catch (MalformedURLException e)
            {
                noConnection = true;
                e.printStackTrace();
                return;
            }
    
            if (CapeUtils.textureUploaded && !noConnection)
            {
                try
                {
                    CapeUtils.CAPE_TEXTURE.put(GameProfileUtil.getUsername(), new DynamicTexture(ImageIO.read(jurl)));
                    ExtendedConfig.CAPE_URL = Base64Utils.encode(url);
                    ExtendedConfig.save();
                    CapeUtils.textureUploaded = false;
                }
                catch (MalformedURLException e)
                {
                    if (IndicatiaMod.MC.player != null)
                    {
                        IndicatiaMod.MC.player.sendMessage(json.text("Missing protocol or wrong URL format").setStyle(json.red()));
                    }
                    e.printStackTrace();
                    return;
                }

     

    I've changed to use Thread, but I don't know whats wrong with it.

    It throw message "No OpenGL context found in the current thread."

     

    public class ThreadDownloadedCustomCape extends Thread
    {
        @Override
        public void run()
        {
            URL capeUrl = null;
    
            try
            {
                capeUrl = new URL("http://i.imgur.com/vXgIBgM.png");
                BufferedImage image = ImageIO.read(capeUrl);
                File pngFile = new File(IndicatiaMod.CONFIG, "custom_cape.png");
                ImageIO.write(image, "png", pngFile);
                Thread.sleep(5000);
                new ThreadReadCustomCape().start();
            }
            catch (MalformedURLException e)
            {
                e.printStackTrace();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            catch (InterruptedException e)
            {
                e.printStackTrace();
            }
        }
    }

     

    public class ThreadReadCustomCape extends Thread
    {
        @Override
        public void run()
        {
            try
            {
                File pngFile = new File(IndicatiaMod.CONFIG, "custom_cape.png");
    
                if (pngFile.exists())
                {
                    BufferedImage image = ImageIO.read(pngFile);
                    CapeUtils.CAPE_TEXTURE.put(GameProfileUtil.getUsername(), new DynamicTexture(image));
                }
            }
            catch (MalformedURLException e)
            {
                e.printStackTrace();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
        }
    }

     

  4. I've tried to setting up modding workspace with 1.9.4/1.8.9/1.7.10/1.7.2 (I know Forge 1.7.10/1.7.2 isn't support on this forum). I got this error log while setup, not sure it is an issue on ForgeGradle host or my internet.

     

    1.10.2+ work fine.

     

    Tmkfqb2.png

  5. I've make a block that will spawn entity and ride to the player when destroy it, but this seem to not work anymore.

     

    Code :

        @Override
        public void onBlockDestroyedByPlayer(World world, BlockPos pos, IBlockState state)
        {
            if (!world.isRemote)
            {
                if (world.rand.nextInt(5) == 0)
                {
                    EntityJuicer juicer = new EntityJuicer(world);
                    juicer.setLocationAndAngles(pos.getX() + 0.5D, pos.getY() + 1.0D, pos.getZ() + 0.5D, 0.0F, 0.0F);
                    world.spawnEntityInWorld(juicer);
                }
                if (world.rand.nextInt(10) == 0)
                {
                    double radiusPlayer = 5.0D;
                    List<EntityPlayer> playerList = world.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(pos.getX() - radiusPlayer, pos.getY() - radiusPlayer, pos.getZ() - radiusPlayer, pos.getX() + radiusPlayer, pos.getY() + radiusPlayer, pos.getZ() + radiusPlayer));
    
                    if (!playerList.isEmpty())
                    {
                        for (EntityPlayer player : playerList)
                        {
                            EntityJuicer juicer = new EntityJuicer(world);
                            juicer.setLocationAndAngles(pos.getX() + 0.5D, pos.getY() + 1.0D, pos.getZ() + 0.5D, 0.0F, 0.0F);
                            world.spawnEntityInWorld(juicer);
                            juicer.startRiding(player);
                        }
                    }
                }
            }
        }

     

  6. I've looking at Twilight Forest render event, Ice Cubed will rendered if entity has slowness attribute.

    https://github.com/TeamTwilight/twilightforest/blob/1.11.2/src/main/java/twilightforest/client/TFClientEvents.java#L53-L61

     

    So I've try the same way as TW does. (Sorry I'm not expert at custom packet and I really don't understand how to do step by step as you said) But this working correctly.

        private static final AttributeModifier CRYSTALLIZE_POTION_MODIFIER = new AttributeModifier(UUID.fromString("0B0BC323-E263-4EF8-9108-4B6503129B16"), "generic.crystallize_effect", 0, 0);
    
        @SubscribeEvent
        public void onRenderLiving(RenderLivingEvent.Post event)
        {
            EntityLivingBase living = event.getEntity();
            // check if entity has crystallize potion modifier
            boolean hasPotion = living.getEntityAttribute(InfectedCrystallizeEffect.CRYSTALLIZE_EFFECT) != null ? living.getEntityAttribute(InfectedCrystallizeEffect.CRYSTALLIZE_EFFECT).hasModifier(CRYSTALLIZE_POTION_MODIFIER) : false;
    
            if (hasPotion)
            {
                GlStateManager.disableLighting();
                TextureMap texturemap = this.mc.getTextureMapBlocks();
                TextureAtlasSprite textureatlassprite = texturemap.getAtlasSprite("moreplanets:blocks/infected_crystallize");
                GlStateManager.pushMatrix();
                GlStateManager.translate((float)event.getX(), (float)event.getY(), (float)event.getZ());
                float f = living.width * 1.4F;
                GlStateManager.scale(f, f, f);
                Tessellator tessellator = Tessellator.getInstance();
                VertexBuffer worldrenderer = tessellator.getBuffer();
                float f1 = 0.5F;
                float f2 = 0.0F;
                float f3 = living.height / f;
                float f4 = (float)(living.posY - living.getEntityBoundingBox().minY);
                GlStateManager.rotate(-event.getRenderer().getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F);
                GlStateManager.translate(0.0F, 0.0F, -0.3F + (int)f3 * 0.02F);
                GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
                float f5 = 0.0F;
                int i = 0;
                worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
    
                while (f3 > 0.0F)
                {
                    event.getRenderer().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
                    float f6 = textureatlassprite.getMinU();
                    float f7 = textureatlassprite.getMinV();
                    float f8 = textureatlassprite.getMaxU();
                    float f9 = textureatlassprite.getMaxV();
    
                    if (i / 2 % 2 == 0)
                    {
                        float f10 = f8;
                        f8 = f6;
                        f6 = f10;
                    }
                    worldrenderer.pos(f1 - f2, 0.0F - f4, f5).tex(f8, f9).endVertex();
                    worldrenderer.pos(-f1 - f2, 0.0F - f4, f5).tex(f6, f9).endVertex();
                    worldrenderer.pos(-f1 - f2, 1.4F - f4, f5).tex(f6, f7).endVertex();
                    worldrenderer.pos(f1 - f2, 1.4F - f4, f5).tex(f8, f7).endVertex();
                    f3 -= 0.45F;
                    f4 -= 0.45F;
                    f1 *= 0.9F;
                    f5 += 0.03F;
                    ++i;
                }
                tessellator.draw();
                GlStateManager.popMatrix();
                GlStateManager.enableLighting();
            }
        }
    
        @SubscribeEvent
        public void onEntityJoinWorld(EntityJoinWorldEvent event)
        {
            if (event.getEntity() instanceof EntityLivingBase)
            {
                EntityLivingBase living = (EntityLivingBase) event.getEntity();
    
                // check if generic.crystallize_effect is not registed to AttributeMap
                // also prevent exception on server side
                if (living.getAttributeMap().getAttributeInstanceByName("generic.crystallize_effect") == null)
                {
                    living.getAttributeMap().registerAttribute(InfectedCrystallizeEffect.CRYSTALLIZE_EFFECT);
                }
            }
        }
    
    // Potion class
          public static final IAttribute CRYSTALLIZE_EFFECT = new RangedAttribute((IAttribute)null, "generic.crystallize_effect", 0.0D, 0.0D, 0.0D).setShouldWatch(true);
    
        public InfectedCrystallizeEffect()
        {
            super("infected_crystallize", true, ColorHelper.rgbToDecimal(136, 97, 209), 0);
            this.registerPotionAttributeModifier(InfectedCrystallizeEffect.CRYSTALLIZE_EFFECT, "0B0BC323-E263-4EF8-9108-4B6503129B16", 0.0D, 0);
        }

     

  7. I've created custom overlay rendering on entity (just like fire overlay) when entity has potion effect.

    My problem is my custom overlay not rendered on other entities but only work with player.

    Not sure why it doesn't work :( Please let me know if I doing something wrong, Thanks.

     

    Picture

    MCEWDDp.png

     

    Code

        @SubscribeEvent
        public void onRenderLiving(RenderLivingEvent.Post event)
        {
            EntityLivingBase living = event.getEntity();
    
            System.out.println(living.getActivePotionEffects().contains(MPPotions.INFECTED_CRYSTALLIZE)); // debug test - always return false
    
            if (living.isPotionActive(MPPotions.INFECTED_CRYSTALLIZE))
            {
                GlStateManager.disableLighting();
                TextureMap texturemap = this.mc.getTextureMapBlocks();
                TextureAtlasSprite textureatlassprite = texturemap.getAtlasSprite("moreplanets:blocks/infected_crystallize");
                GlStateManager.pushMatrix();
                GlStateManager.translate((float)event.getX(), (float)event.getY(), (float)event.getZ());
                float f = living.width * 1.4F;
                GlStateManager.scale(f, f, f);
                Tessellator tessellator = Tessellator.getInstance();
                VertexBuffer worldrenderer = tessellator.getBuffer();
                float f1 = 0.5F;
                float f2 = 0.0F;
                float f3 = living.height / f;
                float f4 = (float)(living.posY - living.getEntityBoundingBox().minY);
                GlStateManager.rotate(-event.getRenderer().getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F);
                GlStateManager.translate(0.0F, 0.0F, -0.3F + (int)f3 * 0.02F);
                GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
                float f5 = 0.0F;
                int i = 0;
                worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
    
                while (f3 > 0.0F)
                {
                    event.getRenderer().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
                    float f6 = textureatlassprite.getMinU();
                    float f7 = textureatlassprite.getMinV();
                    float f8 = textureatlassprite.getMaxU();
                    float f9 = textureatlassprite.getMaxV();
    
                    if (i / 2 % 2 == 0)
                    {
                        float f10 = f8;
                        f8 = f6;
                        f6 = f10;
                    }
                    worldrenderer.pos(f1 - f2, 0.0F - f4, f5).tex(f8, f9).endVertex();
                    worldrenderer.pos(-f1 - f2, 0.0F - f4, f5).tex(f6, f9).endVertex();
                    worldrenderer.pos(-f1 - f2, 1.4F - f4, f5).tex(f6, f7).endVertex();
                    worldrenderer.pos(f1 - f2, 1.4F - f4, f5).tex(f8, f7).endVertex();
                    f3 -= 0.45F;
                    f4 -= 0.45F;
                    f1 *= 0.9F;
                    f5 += 0.03F;
                    ++i;
                }
                tessellator.draw();
                GlStateManager.popMatrix();
                GlStateManager.enableLighting();
            }

     

  8. Hi, I try to do some testing in my server with RenderOverlayEvent.

    Its doesn't work in multiplayer. I don't know how to get it worked.

     

     

                MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();

     

                if (server != null)

                {

                    mc.fontRendererObj.drawStringWithShadow(String.valueOf(server.getMaxPlayerIdleMinutes()), 4, 44, 16777215);

     

                    if (server.getMaxPlayerIdleMinutes() >= 5)

                    {

                        if (player.ticksExisted % 500 == 0)

                        {

                            player.playSound(SoundEvents.AMBIENT_CAVE, 1.0F, 1.0F);

                            player.addChatMessage(Serializer.jsonToComponent("[{\"text\":\"You are AFK too long\"}]"));

                        }

                    }

                }

     

     

    Sorry for english. I'm bad.

  9. Hi, I try to do some testing in my server with RenderOverlayEvent.

    Its doesn't work in multiplayer. I don't know how to get it worked.

     

     

                MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();

     

                if (server != null)

                {

                    mc.fontRendererObj.drawStringWithShadow(String.valueOf(server.getMaxPlayerIdleMinutes()), 4, 44, 16777215);

     

                    if (server.getMaxPlayerIdleMinutes() >= 5)

                    {

                        if (player.ticksExisted % 500 == 0)

                        {

                            player.playSound(SoundEvents.AMBIENT_CAVE, 1.0F, 1.0F);

                            player.addChatMessage(Serializer.jsonToComponent("[{\"text\":\"You are AFK too long\"}]"));

                        }

                    }

                }

     

     

    Sorry for english. I'm bad.

×
×
  • Create New...

Important Information

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