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

hello

i found out why my blocks not will get in game but i don't now how to fix it

the problem is in my tickhandler i don't now why but it is

here's how i start my tickhandler

TickRegistry.registerTickHandler(new ServerTickHandler(), Side.SERVER);

 

and here is my tickhandler

package com.dark2222.core.handlers;

import java.util.EnumSet;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;

import com.dark2222.itempack.armor.ModArmor;
import com.dark2222.itempack.config.ModConfigCore;
import com.dark2222.itempack.lib.Reference;
import com.dark2222.itempack.lib.Strings;

import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.ITickHandler;
import cpw.mods.fml.common.TickType;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.server.FMLServerHandler;

public class ServerTickHandler implements ITickHandler{
    private static boolean initializedserver = false;
    private static boolean initialized = false;
    
    private void onPlayerTick(EntityPlayer player){
        if (player.getCurrentItemOrArmor(3) != null && player.getCurrentItemOrArmor(1) != null){
          ItemStack Ochestplate = player.getCurrentItemOrArmor(3);
          ItemStack OBoots = player.getCurrentItemOrArmor(1);
          
          if (Ochestplate.getItem() == ModArmor.ObsidianChestPalte && OBoots.getItem() == ModArmor.ObsidianBoots ){
              player.addPotionEffect(new PotionEffect(Potion.resistance.getId(), 19, 2));
          }
        }
    }

    @Override
    public void tickStart(EnumSet<TickType> type, Object... tickData) {
        if(type.equals(EnumSet.of(TickType.PLAYER, TickType.SERVER)))
        {
                onPlayerTick((EntityPlayer) tickData[0]);
        }
    }

    @Override
    public void tickEnd(EnumSet<TickType> type, Object... tickData) {
        if(!initializedserver) {
            for (TickType ticktype : type) {
                if (ticktype == TickType.SERVER){
                    if (FMLServerHandler.instance().getServer() != null) {
                        if(ModConfigCore.ConfigLoadFail != false || ModConfigCore.ConfigLoadFailArmor != false){
                            initializedserver = true;
                            
                            if(ModConfigCore.ConfigLoadFail == true || ModConfigCore.ConfigLoadFailArmor == true){
                                FMLServerHandler.instance().getServer().logWarning(Strings.CONFIG_DIFFICULTY_INGAME_CHAT);
                            }
                        }
                    }
                }
            }
        }
        
        if(!initialized) {
            for (TickType ticktype : type) {
                if (ticktype == TickType.CLIENT){
                    if (FMLClientHandler.instance().getClient().currentScreen == null) {
                        if(ModConfigCore.ConfigLoadFail != false || ModConfigCore.ConfigLoadFailArmor != false){
                            initialized = true;
                            
                            if(ModConfigCore.ConfigLoadFail == true || ModConfigCore.ConfigLoadFailArmor == true){
                                FMLClientHandler.instance().getClient().ingameGUI.getChatGUI().printChatMessage(Strings.CONFIG_DIFFICULTY_INGAME_CHAT);
                                System.out.println("Something is wrong!");
                            }
                        }
                    }
                }
            }
        }
    }

    @Override
    public EnumSet<TickType> ticks() {
        return EnumSet.of(TickType.PLAYER, TickType.SERVER, TickType.WORLD);
    }

    @Override
    public String getLabel() {
        return Reference.MOD_NAME + ": " + this.getClass().getSimpleName();
    }

}

fell free too look in my github too see other stuff but it is not 100% up-to-date (maby 5 days old)

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.