Make an item go invisible.

Started by Ima-builder on

Topic category: Help with modding (Java Edition)

Last seen on 04:25, 19. Mar 2023
Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Make an item go invisible.

Hi, I am trying to make a super invisibility potion (with a stack size of 16) , where even the potion disappears, I thought about swiping out the potion with a dummy invisible item but I'm not quite Shure how to do that (preferably with block coding).

Last seen on 04:35, 17. Jan 2021
Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
K, now I would use prints.  …
Thu, 06/18/2020 - 20:55

K, now I would use prints. 

System.out.println()

Use that to see what the values are returning and then fix them👍

Last seen on 04:25, 19. Mar 2023
Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Does it matter where I put…
Thu, 06/18/2020 - 20:56

Does it matter where I put that in?

Last seen on 04:35, 17. Jan 2021
Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
In the method
Thu, 06/18/2020 - 21:03

In the method

Last seen on 04:25, 19. Mar 2023
Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
how would i add it to the…
Thu, 06/18/2020 - 21:35

how would i add it to the method?

Last seen on 04:35, 17. Jan 2021
Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Just under the method. Like…
Thu, 06/18/2020 - 23:25

Just under the method.

Like this;

public void myCustomMethod(int coolness) {
System.out.println(coolness)
}

 

Last seen on 04:25, 19. Mar 2023
Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
where is it suppose to…
Fri, 06/19/2020 - 00:34

where is it suppose to output it?

Last seen on 04:35, 17. Jan 2021
Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
The console.
Fri, 06/19/2020 - 00:40

The console.

Last seen on 04:25, 19. Mar 2023
Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
that's what I thought, the…
Fri, 06/19/2020 - 01:12

that's what I thought, the problem is that nothing is showing up, was I suppose to change any of the text in

public void myCustomMethod(int coolness) {
System.out.println(coolness)
}

 

Last seen on 04:35, 17. Jan 2021
Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Did you actually put; public…
Fri, 06/19/2020 - 01:16

Did you actually put;

public void myCustomMethod(int coolness) { System.out.println(coolness) }

Or did you put;

System.out.println(entity.getPersistentData().getBoolean("superinvis"));

In the rendering method?

Last seen on 04:35, 17. Jan 2021
Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Post all of your code.
Fri, 06/19/2020 - 01:32

Post all of your code.

Last seen on 04:25, 19. Mar 2023
Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
package net.mcreator…
Fri, 06/19/2020 - 01:37
package net.mcreator.smokebombs.procedures;

import net.minecraftforge.registries.ForgeRegistries;

import net.minecraft.world.server.ServerWorld;
import net.minecraft.world.World;
import net.minecraft.util.SoundCategory;
import net.minecraft.potion.Effects;
import net.minecraft.potion.EffectInstance;
import net.minecraft.particles.ParticleTypes;
import net.minecraft.item.ItemStack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.Entity;
import net.minecraftforge.client.event.RenderPlayerEvent
;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraft.util.ResourceLocation;

import net.mcreator.smokebombs.SmokeBombsModElements;

@SmokeBombsModElements.ModElement.Tag
public class SplashSmokeBombPotionStartedappliedProcedure extends SmokeBombsModElements.ModElement {
	public SplashSmokeBombPotionStartedappliedProcedure(SmokeBombsModElements instance) {
		super(instance, 2);
MinecraftForge.EVENT_BUS.register(this);
	}

	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 SplashSmokeBombPotionStartedapplied!");
			return;
		}
		if (dependencies.get("x") == null) {
			System.err.println("Failed to load dependency x for procedure SplashSmokeBombPotionStartedapplied!");
			return;
		}
		if (dependencies.get("y") == null) {
			System.err.println("Failed to load dependency y for procedure SplashSmokeBombPotionStartedapplied!");
			return;
		}
		if (dependencies.get("z") == null) {
			System.err.println("Failed to load dependency z for procedure SplashSmokeBombPotionStartedapplied!");
			return;
		}
		if (dependencies.get("itemstack") == null) {
			System.err.println("Failed to load dependency itemstack for procedure SplashSmokeBombPotionStartedapplied!");
			return;
		}
		if (dependencies.get("world") == null) {
			System.err.println("Failed to load dependency world for procedure SplashSmokeBombPotionStartedapplied!");
			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");
		ItemStack itemstack = (ItemStack) dependencies.get("itemstack");
		World world = (World) dependencies.get("world");
		double X = 0;
		double Y = 0;
		double Z = 0;
		double Tic = 0;
		double BombNum = 0;
		((itemstack)).shrink((int) 1);
		if (entity instanceof PlayerEntity)
			((PlayerEntity) entity).getCooldownTracker().setCooldown(((itemstack)).getItem(), (int) 200);
		Tic = (double) 0;
		X = (double) (entity.getPosX());
		Y = (double) (entity.getPosY());
		Z = (double) (entity.getPosZ());
		world.playSound((PlayerEntity) null, x, y, z,
				(net.minecraft.util.SoundEvent) ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("entity.ghast.shoot")),
				SoundCategory.NEUTRAL, (float) 1, (float) 1);
		if (entity instanceof LivingEntity)
			((LivingEntity) entity).addPotionEffect(new EffectInstance(Effects.SPEED, (int) 200, (int) 1, (false), (false)));
		entity.getPersistentData().putBoolean("superinvis", (true));
		while (((Tic) < 200)) {
			if (((Tic) < 80)) {
				if (world instanceof ServerWorld) {
					((ServerWorld) world).spawnParticle(ParticleTypes.CLOUD, (X), (Y), (Z), (int) 500, 1, 1, 1, 0.01);
				}
				if (world instanceof ServerWorld) {
					((ServerWorld) world).spawnParticle(ParticleTypes.CLOUD, (X), ((Y) + 1), (Z), (int) 500, 1, 1, 1, 0.01);
				}
			}
			Tic = (double) ((Tic) + 1);
		}
		entity.getPersistentData().putBoolean("superinvis", (false));
	
	}

public void myCustomMethod(int coolness) {
System.out.printlnSystem.out.println(entity.getPersistentData().getBoolean("superinvis"));
}

@SubscribeEvent
    public void renderPlayerPre(RenderPlayerEvent.Pre event)
    {
        if (event.getPlayer().getPersistentData().getBoolean("superinvis") == true)
        {
            event.setCanceled(true);
        }
    }
}