Jump to content

Recommended Posts

Posted
11 minutes ago, eggpasta said:

Every tick for 5 minutes

So every tick while (the potion effect) condition is active.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
11 minutes ago, diesieben07 said:

Override isDurationEffectTick in your Effect class and return true if you want the effect to be active that tick (so just return true always).

Then override applyEffectTick in your Effect class and do whatever effect you want.

How do i choose the effect name?

Posted
2 minutes ago, diesieben07 said:

Put the texture in assets/your_mod_id/textures/mob_effect/your_effect_id.png. Should be 18x18.

How do i know the effect id?

Posted
55 minutes ago, diesieben07 said:

The registry name.

I added this code to register it 

private static Effect register(int p_220308_0_, String p_220308_1_, Effect p_220308_2_) {
	      return Registry.registerMapping(Registry.MOB_EFFECT, p_220308_0_, p_220308_1_, p_220308_2_);
	  };

	public final Effect FREEZE = register(6000,"freeze_effect",new FreezeEffect(EffectType.BENEFICIAL,6000));

but now i am getting this error 

encountered an error during the load_registries event phase
        java.lang.IllegalStateException: Can not register to a locked registry. Modder should use Forge Register methods.

Posted
8 minutes ago, diesieben07 said:

Are you unable to use Ctrl-F and type "Effect"?!

	  private static final DeferredRegister<Effect> EFFECTS = DeferredRegister.create(ForgeRegistries.POTIONS, Main.MODID);

	  public RegistryObject<Effect> FREEZE = EFFECTS.register("freeze",FreezeEffect::new);

Gives me : The type FreezeEffect does not define FreezeEffect() that is applicable here

Posted
19 minutes ago, eggpasta said:

Gives me : The type FreezeEffect does not define FreezeEffect() that is applicable here

Your FreezeEffect class does not have a zero-parameter constructor implied by FreezeEffect::new.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
3 minutes ago, Draco18s said:

Your FreezeEffect class does not have a zero-parameter constructor implied by FreezeEffect::new.

Now it's The method register(String, Supplier<? extends I>) in the type DeferredRegister<Effect> is not applicable for the arguments (String, FreezeEffect)

Posted
1 minute ago, diesieben07 said:

Show updated code.

  private static final DeferredRegister<Effect> EFFECTS = DeferredRegister.create(ForgeRegistries.POTIONS, Main.MODID);

      public RegistryObject<Effect> FREEZE = EFFECTS.register("freeze",new FreezeEffect(EffectType.BENEFICIAL,6000));
    

 

Posted
14 minutes ago, diesieben07 said:

Learn basic Java if you do not know how to implement an interface.

Now i get 
 

[16:35:48] [Server thread/ERROR] [minecraft/MinecraftServer]: Encountered an unexpected exception
net.minecraft.crash.ReportedException: Ticking player
	at net.minecraft.network.NetworkSystem.tick(NetworkSystem.java:137) ~[forge:?] {re:classloading}
	at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:865) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:787) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.integrated.IntegratedServer.tickServer(IntegratedServer.java:78) ~[forge:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:642) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:232) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at java.lang.Thread.run(Thread.java:832) [?:?] {}
Caused by: java.lang.NullPointerException: Registry Object not present: mcore:freeze
	at java.util.Objects.requireNonNull(Objects.java:348) ~[?:?] {}
	at net.minecraftforge.fml.RegistryObject.get(RegistryObject.java:120) ~[forge:?] {re:classloading}
	at mod.trianglesinpoo.mcores.CRYOCOCKTAIL.finishUsingItem(CRYOCOCKTAIL.java:33) ~[?:?] {re:classloading}
	at net.minecraft.item.ItemStack.finishUsingItem(ItemStack.java:221) ~[forge:?] {re:classloading,xf:fml:forge:filled_map.4,xf:fml:forge:itemstack}
	at net.minecraft.entity.LivingEntity.completeUsingItem(LivingEntity.java:2843) ~[forge:?] {re:classloading}
	at net.minecraft.entity.player.ServerPlayerEntity.completeUsingItem(ServerPlayerEntity.java:1057) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.entity.LivingEntity.updatingUsingItem(LivingEntity.java:2723) ~[forge:?] {re:classloading}
	at net.minecraft.entity.LivingEntity.tick(LivingEntity.java:2114) ~[forge:?] {re:classloading}
	at net.minecraft.entity.player.PlayerEntity.tick(PlayerEntity.java:223) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.entity.player.ServerPlayerEntity.doTick(ServerPlayerEntity.java:404) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.network.play.ServerPlayNetHandler.tick(ServerPlayNetHandler.java:207) ~[forge:?] {re:classloading}
	at net.minecraft.network.NetworkManager.tick(NetworkManager.java:226) ~[forge:?] {re:classloading}
	at net.minecraft.network.NetworkSystem.tick(NetworkSystem.java:134) ~[forge:?] {re:classloading}
	... 6 more
[16:35:48] [Render thread/FATAL] [minecraft/ThreadTaskExecutor]: Error executing task on Client
java.lang.NullPointerException: Registry Object not present: mcore:freeze
	at java.util.Objects.requireNonNull(Objects.java:348) ~[?:?] {}
	at net.minecraftforge.fml.RegistryObject.get(RegistryObject.java:120) ~[forge-1.16.5-36.1.4_mapped_official_1.16.5-recomp.jar:?] {re:classloading}
	at mod.trianglesinpoo.mcores.CRYOCOCKTAIL.finishUsingItem(CRYOCOCKTAIL.java:33) ~[main/:?] {re:classloading}
	at net.minecraft.item.ItemStack.finishUsingItem(ItemStack.java:221) ~[forge-1.16.5-36.1.4_mapped_official_1.16.5-recomp.jar:?] {re:classloading,xf:fml:forge:filled_map.4,xf:fml:forge:itemstack}
	at net.minecraft.entity.LivingEntity.completeUsingItem(LivingEntity.java:2843) ~[forge-1.16.5-36.1.4_mapped_official_1.16.5-recomp.jar:?] {re:classloading}
	at net.minecraft.entity.player.PlayerEntity.handleEntityEvent(PlayerEntity.java:415) ~[forge-1.16.5-36.1.4_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.client.entity.player.ClientPlayerEntity.handleEntityEvent(ClientPlayerEntity.java:447) ~[forge-1.16.5-36.1.4_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.network.play.ClientPlayNetHandler.handleEntityEvent(ClientPlayNetHandler.java:958) ~[forge-1.16.5-36.1.4_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.network.play.server.SEntityStatusPacket.handle(SEntityStatusPacket.java:35) ~[forge-1.16.5-36.1.4_mapped_official_1.16.5-recomp.jar:?] {re:classloading}
	at net.minecraft.network.play.server.SEntityStatusPacket.handle(SEntityStatusPacket.java:12) ~[forge-1.16.5-36.1.4_mapped_official_1.16.5-recomp.jar:?] {re:classloading}
	at net.minecraft.network.PacketThreadUtil.lambda$ensureRunningOnSameThread$0(PacketThreadUtil.java:19) ~[forge-1.16.5-36.1.4_mapped_official_1.16.5-recomp.jar:?] {re:classloading}
	at net.minecraft.util.concurrent.ThreadTaskExecutor.doRunTask(ThreadTaskExecutor.java:136) ~[forge-1.16.5-36.1.4_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.util.concurrent.RecursiveEventLoop.doRunTask(RecursiveEventLoop.java:22) ~[forge-1.16.5-36.1.4_mapped_official_1.16.5-recomp.jar:?] {re:classloading}
	at net.minecraft.util.concurrent.ThreadTaskExecutor.pollTask(ThreadTaskExecutor.java:109) ~[forge-1.16.5-36.1.4_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.util.concurrent.ThreadTaskExecutor.runAllTasks(ThreadTaskExecutor.java:97) ~[forge-1.16.5-36.1.4_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.client.Minecraft.runTick(Minecraft.java:947) ~[forge-1.16.5-36.1.4_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.run(Minecraft.java:607) ~[forge-1.16.5-36.1.4_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.main(Main.java:184) ~[forge-1.16.5-36.1.4_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?] {}
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}
	at java.lang.reflect.Method.invoke(Method.java:564) ~[?:?] {}
	at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:52) ~[forge-1.16.5-36.1.4_mapped_official_1.16.5-recomp.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.0.9.jar:?] {}
	at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:105) [forge-1.16.5-36.1.4_mapped_official_1.16.5-recomp.jar:?] {}
AL lib: (EE) alc_cleanup: 1 device not closed

What did i do wrong?

Posted
2 minutes ago, diesieben07 said:

CRYOCOCKTAIL - show this class.

import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Food;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.item.MilkBucketItem;
import net.minecraft.item.UseAction;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.Effects;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.World;

public class CRYOCOCKTAIL extends Item{

	public CRYOCOCKTAIL() {
		
			super(new Item.Properties().stacksTo(1).tab(ItemGroup.TAB_MISC).food(new Food.Builder().nutrition(8).effect(new EffectInstance(Effects.SLOW_FALLING,1000,2),1).saturationMod(1.2f).alwaysEat().build()));
		
		
	}
	@Override
	public UseAction getUseAnimation(ItemStack stack) {
		return UseAction.DRINK;
		
	}
	ModEffects e = new ModEffects();
	@Override
	public ItemStack finishUsingItem(ItemStack stack, World worldIn, LivingEntity entityLiving) {
		entityLiving.addEffect(new EffectInstance(e.FREEZE.get()));
		ItemStack itemstack = super.finishUsingItem(stack, worldIn, entityLiving);
		return entityLiving instanceof PlayerEntity && ((PlayerEntity)entityLiving).abilities.mayfly ? itemstack : new ItemStack(Items.GLASS_BOTTLE);

	}
	public void doSlideEffect(LivingEntity entityLiving) {
		
	}


}

 

Posted
2 minutes ago, diesieben07 said:

Why?

 

Why is ModEffects.FREEZE not a static field? Please follow the instructions in the linked documentation.

Ok i changed that but the same error occurs

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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