1.8.0 triigers

Started by BadKaiPanda on Tue, 09/11/2018 - 12:51

Topic category: Help with MCreator's application

Last seen on 00:30, 8. Dec 2018
Joined Oct 2017
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
1.8.0 triigers
Tue, 09/11/2018 - 12:51

I create my triggers or what ever you weant to call them these days but for some reason the send to chat command is been fired twice so it's showing in the chat twice 

As you can see below the code is only added once, I also need to make sure a item is in someones had so could someone help with that also.

But back to the problem at hand it's doing the message twice to the chat window.

 

[13:47:55] [Server thread/INFO]: [Player25: Changing to rainy weather] [13:47:56] [main/INFO]: [CHAT] The Nether Gods have been angered [13:47:56] [main/INFO]: [CHAT] The Nether Gods have been angered [13:47:56] [main/INFO]: [CHAT] Changing to rainy weather [13:48:31] [Server thread/INFO]: Saving and pausing game... [13:48:31] [Server thread/INFO]: Saving chunks for level 'New World'/overworld [13:48:39] [Server thread/INFO]: [Player25: Given [Red Nether Brick] * 64 to Player25] [13:48:39] [main/INFO]: [CHAT] Given [Red Nether Brick] * 64 to Player25 [13:48:40] [Server thread/INFO]: [Player25: Given [NetherCrafter] * 64 to Player25] [13:48:40] [main/INFO]: [CHAT] Given [NetherCrafter] * 64 to Player25 [13:48:44] [Server thread/INFO]: Saving and pausing game... [13:48:44] [Server thread/INFO]: Saving chunks for level 'New World'/overworld [13:48:46] [main/INFO]: Using default channel type [13:48:46] [main/INFO]: Started on 51113 [13:48:46] [main/INFO]: [CHAT] Local game hosted on port 51113 [13:48:55] [main/INFO]: The Nether Gods have been angered [13:48:55] [main/INFO]: [CHAT] The Nether Gods have been angered [13:48:55] [Server thread/INFO]: The Nether Gods have been angered [13:48:55] [Server thread/INFO]: [Player25: Changing to rainy weather] [13:48:55] [main/INFO]: [CHAT] The Nether Gods have been angered [13:48:55] [main/INFO]: [CHAT] Changing to rainy weather

 I had cheats on when I first started the level but as you can see enabled lan to test it without chests and it's still doing it twice.

Reason I change to lan with no cheats was to test the command option to run weather as there is no set weather option on the triggers.

package mod.mcreator;

import java.util.Random;
import java.util.HashMap;

import net.minecraft.entity.passive.*;
import net.minecraft.client.model.*;
import net.minecraft.entity.boss.*;
import net.minecraft.creativetab.*;
import net.minecraft.world.chunk.storage.*;

import net.minecraftforge.fml.common.network.*;

import net.minecraft.server.management.*;
import net.minecraft.client.particle.*;

import net.minecraftforge.client.model.obj.*;
import net.minecraftforge.oredict.*;

import net.minecraft.client.settings.*;

import net.minecraftforge.fml.common.eventhandler.*;

import net.minecraft.client.entity.*;

import net.minecraftforge.fml.relauncher.*;
import net.minecraftforge.fml.server.*;

import net.minecraft.block.state.pattern.*;
import net.minecraft.network.*;
import net.minecraft.client.renderer.tileentity.*;
import net.minecraft.crash.*;
import net.minecraft.stats.*;
import net.minecraft.world.gen.structure.template.*;
import net.minecraft.tileentity.*;

import net.minecraftforge.fml.client.registry.*;

import net.minecraft.world.gen.*;

import net.minecraftforge.fml.common.asm.transformers.*;

import net.minecraft.enchantment.*;

import net.minecraftforge.event.entity.*;
import net.minecraftforge.fml.common.discovery.*;

import net.minecraft.command.*;
import net.minecraft.dispenser.*;

import net.minecraftforge.event.entity.item.*;

import net.minecraft.client.gui.*;
import net.minecraft.server.*;
import net.minecraft.advancements.critereon.*;
import net.minecraft.block.*;
import net.minecraft.entity.*;
import net.minecraft.client.renderer.entity.*;
import net.minecraft.entity.ai.*;
import net.minecraft.inventory.*;
import net.minecraft.world.gen.layer.*;

import net.minecraftforge.event.terraingen.*;
import net.minecraftforge.event.entity.living.*;
import net.minecraftforge.fml.common.*;

import net.minecraft.pathfinding.*;

import net.minecraftforge.event.entity.player.*;
import net.minecraftforge.fml.common.toposort.*;

import net.minecraft.client.util.*;

import net.minecraftforge.client.event.sound.*;
import net.minecraftforge.client.model.*;

import net.minecraft.server.gui.*;

import net.minecraftforge.client.event.*;

import net.minecraft.util.*;

import net.minecraftforge.fml.common.event.*;
import net.minecraftforge.event.world.*;

import net.minecraft.client.renderer.block.statemap.*;

import net.minecraftforge.fml.common.discovery.asm.*;

import net.minecraft.item.crafting.*;
import net.minecraft.entity.effect.*;
import net.minecraft.client.gui.achievement.*;

import net.minecraftforge.event.entity.minecart.*;

import net.minecraft.client.renderer.culling.*;

import net.minecraftforge.fml.common.versioning.*;

import net.minecraft.entity.projectile.*;

import net.minecraftforge.common.*;

import net.minecraft.util.math.*;
import net.minecraft.entity.item.*;
import net.minecraft.item.*;

import net.minecraftforge.fml.client.*;
import net.minecraftforge.fluids.*;

import net.minecraft.init.*;
import net.minecraft.advancements.*;
import net.minecraft.client.audio.*;
import net.minecraft.world.gen.feature.*;

import net.minecraftforge.fml.common.asm.*;

import net.minecraft.block.state.*;
import net.minecraft.client.renderer.*;
import net.minecraft.util.text.*;
import net.minecraft.entity.player.*;

import net.minecraftforge.fml.common.gameevent.*;

import net.minecraft.world.storage.*;
import net.minecraft.world.biome.*;
import net.minecraft.client.*;

import net.minecraftforge.common.util.*;

import net.minecraft.network.rcon.*;
import net.minecraft.profiler.*;

import net.minecraftforge.classloading.*;

import net.minecraft.village.*;
import net.minecraft.potion.*;
import net.minecraft.block.material.*;
import net.minecraft.world.*;
import net.minecraft.nbt.*;
import net.minecraft.world.gen.structure.*;
import net.minecraft.client.gui.inventory.*;
import net.minecraft.server.integrated.*;
import net.minecraft.client.renderer.block.model.*;
import net.minecraft.entity.ai.attributes.*;

import net.minecraftforge.client.*;
import net.minecraftforge.fml.common.registry.*;

import net.minecraft.world.chunk.*;
import net.minecraft.client.multiplayer.*;
import net.minecraft.entity.monster.*;

import net.minecraftforge.event.*;

import net.minecraft.server.dedicated.*;

public class mcreator_copyMeCode {

	public static void executeProcedure(java.util.HashMap<String, Object> dependencies) {
		if (dependencies.get("entity") == null) {
			System.err.println("Failed to load dependency entity for procedure copyMeCode!");
			return;
		}
		if (dependencies.get("x") == null) {
			System.err.println("Failed to load dependency x for procedure copyMeCode!");
			return;
		}
		if (dependencies.get("y") == null) {
			System.err.println("Failed to load dependency y for procedure copyMeCode!");
			return;
		}
		if (dependencies.get("z") == null) {
			System.err.println("Failed to load dependency z for procedure copyMeCode!");
			return;
		}
		if (dependencies.get("world") == null) {
			System.err.println("Failed to load dependency world for procedure copyMeCode!");
			return;
		}
		Entity entity = (Entity) dependencies.get("entity");
		int x = (int) dependencies.get("x");
		int y = (int) dependencies.get("y");
		int z = (int) dependencies.get("z");
		World world = (World) dependencies.get("world");
		if (((entity instanceof EntityLivingBase)
				? ((EntityPlayer) entity).inventory.hasItemStack(new ItemStack(Items.NETHER_STAR, (int) (1)))
				: false)) {
			if ((new ItemStack(((entity instanceof EntityLivingBase) ? ((EntityLivingBase) entity).getHeldItemMainhand().getItem() : null), (int) (1))
					.getItem() == new ItemStack(Items.NETHER_STAR, (int) (1)).getItem() && new ItemStack(((entity instanceof EntityLivingBase)
					? ((EntityLivingBase) entity).getHeldItemMainhand().getItem()
					: null), (int) (1)).getMetadata() == new ItemStack(Items.NETHER_STAR, (int) (1)).getMetadata())) {
				if (entity instanceof EntityPlayer)
					((EntityPlayer) entity).inventory.clearMatchingItems(new ItemStack(Items.NETHER_STAR, (int) (1)).getItem(), -1, (int) 1, null);
				if (entity instanceof EntityPlayer && !world.isRemote) {
					((EntityPlayer) entity).sendStatusMessage(new TextComponentString("Nether Gods: Thank you for the free gift."), (true));
				}
				if (entity instanceof EntityLivingBase)
					((EntityLivingBase) entity).setHealth((float) 1.5);
			} else {
				if (entity instanceof EntityPlayer)
					((EntityPlayer) entity).inventory.clearMatchingItems(new ItemStack(Items.NETHER_STAR, (int) (1)).getItem(), -1, (int) 1, null);
				if ((new ItemStack(((entity instanceof EntityLivingBase) ? ((EntityLivingBase) entity).getHeldItemMainhand().getItem() : null),
						(int) (1)).getItem() == new ItemStack(mcreator_copyMe.block, (int) (1)).getItem() && new ItemStack(
						((entity instanceof EntityLivingBase) ? ((EntityLivingBase) entity).getHeldItemMainhand().getItem() : null), (int) (1))
						.getMetadata() == new ItemStack(mcreator_copyMe.block, (int) (1)).getMetadata())) {
					if (entity instanceof EntityLivingBase)
						((EntityLivingBase) entity).addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, (int) 60, (int) 2));
					if (entity instanceof EntityLivingBase)
						((EntityLivingBase) entity).addPotionEffect(new PotionEffect(MobEffects.NAUSEA, (int) 60, (int) 2));
					if (entity instanceof EntityPlayer && !world.isRemote) {
						((EntityPlayer) entity).sendStatusMessage(new TextComponentString("Nether Gods: You anger us with your disrespect"), (true));
					}
					{
						MinecraftServer mcserv = FMLCommonHandler.instance().getMinecraftServerInstance();
						if (mcserv != null)
							mcserv.getPlayerList().sendMessage(new TextComponentString("The Nether Gods have been angered"));
					}
					if (entity instanceof EntityPlayerMP) {
						MinecraftServer mcserv = FMLCommonHandler.instance().getMinecraftServerInstance();
						if (mcserv != null)
							mcserv.getCommandManager().executeCommand((EntityPlayerMP) entity, "weather rain");
					}
					world.createExplosion(null, (int) x, (int) y, (int) z, (float) 5, true);
				} else {
					if (entity instanceof EntityPlayer)
						((EntityPlayer) entity).inventory.addItemStackToInventory(new ItemStack(((entity instanceof EntityLivingBase)
								? ((EntityLivingBase) entity).getHeldItemMainhand().getItem()
								: null), (int) (1)));
				}
			}
		} else {
			if (entity instanceof EntityPlayer && !world.isRemote) {
				((EntityPlayer) entity).sendStatusMessage(new TextComponentString("Nether Gods: Rejected!!"), (true));
			}
			if (entity instanceof EntityLivingBase)
				((EntityLivingBase) entity).addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, (int) 60, (int) 2));
			entity.attackEntityFrom(DamageSource.GENERIC, (float) 1.5);
		}
	}

	public static Object instance;

	public void load(FMLInitializationEvent event) {
	}

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

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

	public void serverLoad(FMLServerStartingEvent event) {
	}

	public void preInit(FMLPreInitializationEvent event) {
	}

	public void registerRenderers() {
	}

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

 

Last seen on 18:44, 9. Dec 2018
Joined Apr 2010
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • wiki contributor
  • moderator
  • developer
This is because the code is…
Wed, 09/12/2018 - 09:53

This is because the code is called on both client and server side. Use isRemote block from the world tab in procedures to validate if the request is from the server.

Last seen on 00:30, 8. Dec 2018
Joined Oct 2017
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
I will give that a look at,…
Wed, 09/12/2018 - 15:25

I will give that a look at, is there any examples anywhere for these things it's kind of hard to use that section at times as there is no documentation.

Last seen on 18:44, 9. Dec 2018
Joined Apr 2010
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • wiki contributor
  • moderator
  • developer
Unfortunately not many yet,…
Thu, 09/13/2018 - 08:59

Unfortunately not many yet, but do exactly as I said and it should work. Or do some experimenting, you might find out something new this way :)

Last seen on 00:30, 8. Dec 2018
Joined Oct 2017
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Where should I add it just…
Thu, 09/13/2018 - 09:15

Where should I add it just before the text call or before the full call ? 

Last seen on 18:44, 9. Dec 2018
Joined Apr 2010
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • wiki contributor
  • moderator
  • developer
Wrap the print block with if…
Thu, 09/13/2018 - 11:17

Wrap the print block with if statement containing isRemote.

Last seen on 00:30, 8. Dec 2018
Joined Oct 2017
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Will do thanks for the tip…
Thu, 09/13/2018 - 15:08

Will do thanks for the tip but I seen today it's not aways triggered in single player so we see what happens when I add that I have to remakle this section to fix the bug we have been talking about in the issue section I think if I use a UI even tho I don't want to I should be able to fix this unless it bugs out there, we will see worth the test I guess lol