How do I add an effect then full armor set is on player (minecraft 1.7.10)

Started by Mineralka on Fri, 03/09/2018 - 18:39
Last seen on 14:42, 26. Mar 2018
Joined Mar 2018
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
How do I add an effect then full armor set is on player (minecraft 1.7.10)
Fri, 03/09/2018 - 18:42 (edited)

Hello, I want to make custom armor set with special effect. For example, then full set is on player, the one gets speed boost. But the main thing is, there should be no way a player gets effect, if at least one part of the set will be missing. This is how I tried to make this, but, unfortunately, this never works. So, there am I wrong? Is there any smart solution of the problem? I will be glad to get any help.

 

package mod.mcreator;

import net.minecraftforge.common.util.EnumHelper;

import net.minecraft.world.World;
import net.minecraft.potion.PotionEffect;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.Item;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.creativetab.CreativeTabs;

import java.util.Random;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;

public class mcreator_yellow {

	public mcreator_yellow() {
	}

	public static Item helmet;
	public static Item body;
	public static Item legs;
	public static Item boots;
	public Object instance;

	public void load() {
		helmet.setCreativeTab(CreativeTabs.tabCombat);
		body.setCreativeTab(CreativeTabs.tabCombat);
		legs.setCreativeTab(CreativeTabs.tabCombat);
		boots.setCreativeTab(CreativeTabs.tabCombat);
	}

	public void generateNether(World world, Random random, int chunkX, int chunkZ) {
	}

	public void generateSurface(World world, Random random, int chunkX, int chunkZ) {
	}

	public int addFuel(ItemStack fuel) {
		return 0;
	}

	public void serverLoad(FMLServerStartingEvent event) {
	}

	public void preInit(FMLPreInitializationEvent event) {
	}

	public void registerRenderers() {
	}

	static {
		ItemArmor.ArmorMaterial enuma = EnumHelper.addArmorMaterial("YELLOW", 250, new int[]{2, 7, 5, 3}, 9);
          boolean Helmet = false;
          boolean Body = false;
          boolean Legs = false;
		int armorPreffix = 0;
		if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
			armorPreffix = RenderingRegistry.addNewArmourRendererPrefix("yellow");
		helmet = (new ItemArmor(enuma, armorPreffix, 0) {
			public void onArmorTick(World world, EntityPlayer entity, ItemStack itemStack) {
				int i = (int) entity.posX;
				int j = (int) entity.posY;
				int k = (int) entity.posZ;
                   if (true){
                    Helmet = true;
                   }
			}
		}).setUnlocalizedName("yellow_head").setTextureName("yellow_head");
		helmet.setMaxStackSize(1);
		body = (new ItemArmor(enuma, armorPreffix, 1) {
			public void onArmorTick(World world, EntityPlayer entity, ItemStack itemStack) {
				int i = (int) entity.posX;
				int j = (int) entity.posY;
				int k = (int) entity.posZ;

                   if (true){
                    Body = true;
                   }
			}
		}).setUnlocalizedName("yellow_body").setTextureName("yellow_body");
		body.setMaxStackSize(1);
		legs = (new ItemArmor(enuma, armorPreffix, 2) {
			public void onArmorTick(World world, EntityPlayer entity, ItemStack itemStack) {
				int i = (int) entity.posX;
				int j = (int) entity.posY;
				int k = (int) entity.posZ;
                   if (true){
                    Legs = true;
                   }
			}
		}).setUnlocalizedName("yellow_leggins").setTextureName("yellow_leggins");
		legs.setMaxStackSize(1);
		boots = (new ItemArmor(enuma, armorPreffix, 3) {
			public void onArmorTick(World world, EntityPlayer entity, ItemStack itemStack) {
				int i = (int) entity.posX;
				int j = (int) entity.posY;
				int k = (int) entity.posZ;

				if (true) {
                    if (Helmet and Body and Legs){
                         if (entity instanceof EntityLivingBase)
                              ((EntityLivingBase) entity).addPotionEffect(new PotionEffect(1, 4, 3));
                    }
					
				}
			}
		}).setUnlocalizedName("yellow_boots").setTextureName("yellow_boots");
		boots.setMaxStackSize(1);

		Item.itemRegistry.addObject(545, "yellow_head", helmet);
		Item.itemRegistry.addObject(546, "yellow_body", body);
		Item.itemRegistry.addObject(547, "yellow_leggins", legs);
		Item.itemRegistry.addObject(548, "yellow_boots", boots);

	}

}

this is that console returns

C:\Pylo\MCreator173\forge\build\sources\java\mod\mcreator\mcreator_yellow.java:108: error: ')' expected
:compileJava FAILED
                    if (Helmet                     BUILD FAILED
          ^
and Body and Legs){
Total time: 16.239 secs
C:\Pylo\MCreator173\forge\build\sources\java\mod\mcreator\: error: ';' expected
mcreator_yellow.java:108                    if (Helmet and Body and Legs){
                                       ^
C:\Pylo\MCreator173\forge\build\sources\java\mod\mcreator\mcreator_yellow.java:108: error: variable declaration not allowed here
                    if (Helmet and Body and Legs){
                                   ^
C:\Pylo\MCreator173\forge\build\sources\java\mod\mcreator\mcreator_yellow.java:108: error: ';' expected
                    if (Helmet and Body and Legs){
                                                ^
4 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

Edited by Mineralka on Fri, 03/09/2018 - 18:42
Last seen on 13:18, 7. May 2018
Joined Dec 2014
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Whatever version of MCreator…
Sun, 03/18/2018 - 20:48

Whatever version of MCreator you're using, it's really old, so some of us might not now.

Last seen on 13:18, 7. May 2018
Joined Dec 2014
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
As I always say, I  d o n '…
Sun, 03/18/2018 - 21:10

As I always say, I  d o n ' t  t h i n k  y o u  c a n .