Jump to content

Recommended Posts

Posted

Add this to sword class:

@Override

public void onUpdate(ItemStack stack, World worldIn, Entity entityIn,

int itemSlot, boolean isSelected) {

// TODO Auto-generated method stub

stack.addEnchantment(ench, level);

super.onUpdate(stack, worldIn, entityIn, itemSlot, isSelected);

}

Sorry for my English

Posted

I did this and when ever I have the sword the game crashes(I did have some of the code from potion effect but I got rid of the potion effect while doing this)

 

Code for my sword:

package wearethewarriorsmod.item;

 

import net.minecraft.enchantment.Enchantment;

import net.minecraft.entity.Entity;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.item.ItemSword;

import net.minecraft.potion.Potion;

import net.minecraft.potion.PotionEffect;

import net.minecraft.world.World;

 

public class ItemDragonsword extends ItemSword {

 

public ItemDragonsword(ToolMaterial material) {

super(material);

}

public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5){

super.onUpdate(stack, world, entity, par4, par5);

{

int itemSlot, boolean isSelected) {

          stack.addEnchantment(Enchantment.fireAspect, 2);

          super.onUpdate(stack, world, entity, itemSlot, isSelected);

}

}

 

}

}

 

Posted

---- Minecraft Crash Report ----

// This doesn't make any sense!

 

Time: 2/04/15 11:22 PM

Description: Ticking entity

 

java.lang.Error: Unresolved compilation problems:

Syntax error on token ",", ; expected

Syntax error on token ")", ; expected

 

at wearethewarriorsmod.item.ItemDragonsword.onUpdate(ItemDragonsword.java:21)

at net.minecraft.item.ItemStack.updateAnimation(ItemStack.java:476)

at net.minecraft.entity.player.InventoryPlayer.decrementAnimations(InventoryPlayer.java:347)

at net.minecraft.entity.player.EntityPlayer.onLivingUpdate(EntityPlayer.java:610)

at net.minecraft.client.entity.EntityPlayerSP.onLivingUpdate(EntityPlayerSP.java:299)

at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:1816)

at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:327)

at net.minecraft.client.entity.EntityClientPlayerMP.onUpdate(EntityClientPlayerMP.java:96)

at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2298)

at net.minecraft.world.World.updateEntity(World.java:2258)

at net.minecraft.world.World.updateEntities(World.java:2108)

at net.minecraft.client.Minecraft.runTick(Minecraft.java:2086)

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1028)

at net.minecraft.client.Minecraft.run(Minecraft.java:951)

at net.minecraft.client.main.Main.main(Main.java:164)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:483)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)

at GradleStart.main(Unknown Source)

 

 

A detailed walkthrough of the error, its code path and all known details is as follows:

---------------------------------------------------------------------------------------

 

-- Head --

Stacktrace:

at wearethewarriorsmod.item.ItemDragonsword.onUpdate(ItemDragonsword.java:21)

at net.minecraft.item.ItemStack.updateAnimation(ItemStack.java:476)

at net.minecraft.entity.player.InventoryPlayer.decrementAnimations(InventoryPlayer.java:347)

at net.minecraft.entity.player.EntityPlayer.onLivingUpdate(EntityPlayer.java:610)

at net.minecraft.client.entity.EntityPlayerSP.onLivingUpdate(EntityPlayerSP.java:299)

at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:1816)

at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:327)

at net.minecraft.client.entity.EntityClientPlayerMP.onUpdate(EntityClientPlayerMP.java:96)

at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2298)

at net.minecraft.world.World.updateEntity(World.java:2258)

 

-- Entity being ticked --

Details:

Entity Type: null (net.minecraft.client.entity.EntityClientPlayerMP)

Entity ID: 240

Entity Name: Player941

Entity's Exact location: -381.73, 97.86, 323.81

Entity's Block location: World: (-382,97,323), Chunk: (at 2,6,3 in -24,20; contains blocks -384,0,320 to -369,255,335), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)

Entity's Momentum: 0.00, 0.00, 0.00

Stacktrace:

at net.minecraft.world.World.updateEntities(World.java:2108)

 

-- Affected level --

Details:

Level name: MpServer

All players: 1 total; [EntityClientPlayerMP['Player941'/240, l='MpServer', x=-381.73, y=97.86, z=323.81]]

Chunk stats: MultiplayerChunkCache: 0, 0

Level seed: 0

Level generator: ID 00 - default, ver 1. Features enabled: false

Level generator options:

Level spawn location: World: (-124,64,240), Chunk: (at 4,4,0 in -8,15; contains blocks -128,0,240 to -113,255,255), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)

Level time: 25018 game time, 25018 day time

Level dimension: 0

Level storage version: 0x00000 - Unknown?

Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)

Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false

Forced entities: 20 total; [EntityXPOrb['Experience Orb'/256, l='MpServer', x=-377.25, y=88.13, z=308.25], EntityXPOrb['Experience Orb'/257, l='MpServer', x=-376.13, y=83.13, z=310.88], EntityZombie['Zombie'/258, l='MpServer', x=-359.56, y=25.00, z=324.53], EntityCreeper['Creeper'/259, l='MpServer', x=-354.50, y=24.00, z=328.66], EntityCreeper['Creeper'/260, l='MpServer', x=-358.72, y=25.00, z=325.66], EntitySkeleton['Skeleton'/261, l='MpServer', x=-361.44, y=24.00, z=324.72], EntityZombie['Zombie'/263, l='MpServer', x=-356.47, y=24.00, z=335.66], EntityItem['item.item.rottenFlesh'/264, l='MpServer', x=-360.41, y=56.13, z=325.28], EntityClientPlayerMP['Player941'/240, l='MpServer', x=-381.73, y=97.86, z=323.81], EntityZombie['Zombie'/245, l='MpServer', x=-392.41, y=34.00, z=326.94], EntityZombie['Zombie'/246, l='MpServer', x=-393.31, y=34.00, z=324.50], EntityZombie['Zombie'/247, l='MpServer', x=-395.53, y=34.00, z=324.00], EntitySkeleton['Skeleton'/248, l='MpServer', x=-393.88, y=34.00, z=323.47], EntitySkeleton['Skeleton'/249, l='MpServer', x=-393.50, y=34.22, z=329.50], EntityItem['item.tile.stonebrick'/250, l='MpServer', x=-396.38, y=78.13, z=323.41], EntityItem['item.tile.stonebrick'/251, l='MpServer', x=-391.34, y=93.13, z=322.88], EntityItem['item.tile.dirt.default'/252, l='MpServer', x=-394.88, y=95.13, z=326.88], EntityItem['item.tile.dirt.default'/253, l='MpServer', x=-393.13, y=96.13, z=327.88], EntityXPOrb['Experience Orb'/254, l='MpServer', x=-374.50, y=67.13, z=313.94], EntityItem['item.item.rottenFlesh'/255, l='MpServer', x=-377.13, y=88.13, z=309.00]]

Retry entities: 0 total; []

Server brand: fml,forge

Server type: Integrated singleplayer server

Stacktrace:

at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:415)

at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2555)

at net.minecraft.client.Minecraft.run(Minecraft.java:973)

at net.minecraft.client.main.Main.main(Main.java:164)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:483)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)

at GradleStart.main(Unknown Source)

 

-- System Details --

Details:

Minecraft Version: 1.7.10

Operating System: Windows 7 (x86) version 6.1

Java Version: 1.8.0_25, Oracle Corporation

Java VM Version: Java HotSpot Client VM (mixed mode), Oracle Corporation

Memory: 819846952 bytes (781 MB) / 1046937600 bytes (998 MB) up to 1046937600 bytes (998 MB)

JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95

FML: MCP v9.05 FML v7.10.85.1291 Minecraft Forge 10.13.2.1291 4 mods loaded, 4 mods active

mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

FML{7.10.85.1291} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.2.1291.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

Forge{10.13.2.1291} [Minecraft Forge] (forgeSrc-1.7.10-10.13.2.1291.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

watwm{1.0} [We Are The Warriors Mod] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

Launched Version: 1.7.10

LWJGL: 2.9.1

OpenGL: ATI Radeon 3000 Graphics GL version 3.3.10750 Compatibility Profile Context, ATI Technologies Inc.

GL Caps: Using GL 1.3 multitexturing.

Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.

Anisotropic filtering is supported and maximum anisotropy is 16.

Shaders are available because OpenGL 2.1 is supported.

 

Is Modded: Definitely; Client brand changed to 'fml,forge'

Type: Client (map_client.txt)

Resource Packs: []

Current Language: English (US)

Profiler Position: N/A (disabled)

Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

Anisotropic Filtering: Off (1)

Posted

Try this:

package wearethewarriorsmod.item;

import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;

public class ItemDragonsword extends ItemSword {

   public ItemDragonsword(ToolMaterial material) {
      super(material);
   }
   public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5){
      super.onUpdate(stack, world, entity, par4, par5);
      
            if(itemstack.isItemEnchanted() == false) {
                 stack.addEnchantment(Enchantment.fireAspect, 2);
                 super.onUpdate(stack, world, entity, itemSlot, isSelected);
         }
      

   }
}

Sorry for my English

Posted

Well, you should understand basic java to do this. The code is totally wrong.

Learn basic java, please.

To laci200270: Do not just provide copy-paste code.. It is far from how learning works.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted

Well, you should understand basic java to do this. The code is totally wrong.

Learn basic java, please.

To laci200270: Do not just provide copy-paste code.. It is far from how learning works.

OK I just reworked the code because totally  wrong.

Next time I only say what is the error?(I just only want to help)

Sorry for my English

Posted

Oh, I'm not saying to you when 'The code is totally wrong'.  :/

It seems that OP doesn't know basic java. So it would be more helpful to tell him/her 'Learn Basic Java', I think.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

  • 1 year later...
Posted

Although this thread is suuuper dead, in case anyone needs the working code, here it is:

 

public void onUpdate(ItemStack stack, World world, Entity entity, int i, boolean bool) {
	super.onUpdate(stack, world, entity, i, bool);

	if(stack.isItemEnchanted() == false) {
		stack.addEnchantment(MainRegistry.customEnchantment, 2);
                                                        // Or, Enchantments.whateverEnchantmentYouWant
		super.onUpdate(stack, world, entity, i, bool);
	}
}

 

Basically, the variables on the second super.onUpdate method were incorrect. Just match the variables of the super with the onUpdate method and everything should work.

 

Also, take a look at where my code says:

    (MainRegistry.customEnchantment, 2);

 

This line is swappable and will change. If you're doing in game enchantments, then do:

     (Enchantments.nameOfEnchantment, idOfTheEnchantment);

 

The code I have is for custom enchantments, for which you call your main modding class.

Creator and Developer of the SkyrimCraft mod!

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • When I first heard about Bitcoin back in 2018, I was skeptical. The idea of a decentralized, digital currency seemed too good to be true. But I was intrigued as I learned more about the technology behind it and its potential. I started small, investing just a few hundred dollars, dipping my toes into the cryptocurrency waters. At first, it was exhilarating to watch the value of my investment grow exponentially. I felt like I was part of the future, an early adopter of this revolutionary new asset. But that euphoria was short-lived. One day, I logged into my digital wallet only to find it empty - my Bitcoin had vanished without a trace. It turned out that the online exchange I had trusted had been hacked, and my funds were stolen. I was devastated, both financially and emotionally. All the potential I had seen in Bitcoin was tainted by the harsh reality that with decentralization came a lack of regulation and oversight. My hard-earned money was gone, lost to the ether of the digital world. This experience taught me a painful lesson about the price of trust in the uncharted territory of cryptocurrency. While the technology holds incredible promise, the risks can be catastrophic if you don't approach it with extreme caution. My Bitcoin investment gamble had failed, and I was left to pick up the pieces, wiser but poorer for having placed my faith in the wrong hands. My sincere appreciation goes to MUYERN TRUST HACKER. You are my hero in recovering my lost funds. Send a direct m a i l ( muyerntrusted ( @ ) mail-me ( . )c o m ) or message on whats app : + 1 ( 4-4-0 ) ( 3 -3 -5 ) ( 0-2-0-5 )
    • You could try posting a log (if there is no log at all, it may be the launcher you are using, the FAQ may have info on how to enable the log) as described in the FAQ, however this will probably need to be reported to/remedied by the mod author.
    • So me and a couple of friends are playing with a shitpost mod pack and one of the mods in the pack is corail tombstone and for some reason there is a problem with it, where on death to fire the player will get kicked out of the server and the tombstone will not spawn basically deleting an entire inventory, it doesn't matter what type of fire it is, whether it's from vanilla fire/lava, or from modded fire like ice&fire/lycanites and it's common enough to where everyone on the server has experienced at least once or twice and it doesn't give any crash log. a solution to this would be much appreciated thank you!
    • It is 1.12.2 - I have no idea if there is a 1.12 pack
  • Topics

×
×
  • Create New...

Important Information

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