Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.12.2] On item right click damage entity.
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 0
Merthew

[1.12.2] On item right click damage entity.

By Merthew, February 27, 2019 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

Merthew    2

Merthew

Merthew    2

  • Creeper Killer
  • Merthew
  • Members
  • 2
  • 128 posts
Posted February 27, 2019

Currently I have an item, the phantom sword that gets an entity that the player is looking at. However, it should cause the entity to be damaged by an amount dependent on the sword type. This does not happen. There is no indication that the entity has been damaged and it will not kill any entity. Any help would be appreciated.

Relevant file: https://github.com/Merthew/Merthew-Mod/blob/master/src/main/java/merthew/mod/object/item/weapons/PhantomBlade.java

  • Quote

The seven became one and the one became two.

Share this post


Link to post
Share on other sites

DavidM    179

DavidM

DavidM    179

  • World Shaper
  • DavidM
  • Members
  • 179
  • 1821 posts
Posted February 27, 2019 (edited)

1. Your switch statement for sword tier is messy. Utilize string concatenation.

2. Stop using BlockBase and ItemBase (or in your case, BlockBasic and MItem).

3. You are trying to get the player's view from the server side, which will immediately cause a crash due to the usage of Minecraft#getMinecraft. Use packets. 

Edited February 27, 2019 by DavidM
  • Quote

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

    • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 0
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Mark74
      I don't know how forge works

      By Mark74 · Posted 2 minutes ago

      I dont have that folder, should i create it?
    • poopoodice
      [1.16.4] How i can open a container by clicking on my mob

      By poopoodice · Posted 11 minutes ago

      Well, since  public Container createMenu(int id, PlayerInventory playerInventory, PlayerEntity playerEntity <--------) { return new MyModContainer(id,playerInventory, world,extraDataWriter); } you already have the player, why don't you just pass the player in? Also getEntityByID is using entityID not UUID, use ServerWorld#getEntityByUuid/getPlayerByUuid although it is not necessary because you've got the player already.  
    • MKR0902
      1.12.2 Forge Server Not starting with command arguements

      By MKR0902 · Posted 21 minutes ago

      trying to start the forge server with more memory using the command  java -Xmx1G -Xms1G -jar minecraftforge-universal-1.6.2-9.10.0.804.jar nogui but keep getting the error: launcher.lang.reflect.InvocationTargetException also happens if I use the megabyte version, so like 1024M.
    • Thorius
      I don't know how forge works

      By Thorius · Posted 21 minutes ago

      For the client you have to select the location of your minecraft installation, .minecraft
    • Thorius
      I don't know how forge works

      By Thorius · Posted 26 minutes ago

      The place where you installed the server with forge should have a folder named mods propably. Put your mods in there.
  • Topics

    • Mark74
      3
      I don't know how forge works

      By Mark74
      Started 48 minutes ago

    • Klarks
      39
      [1.16.4] How i can open a container by clicking on my mob

      By Klarks
      Started Saturday at 09:56 PM

    • MKR0902
      0
      1.12.2 Forge Server Not starting with command arguements

      By MKR0902
      Started 21 minutes ago

    • Amazinwave
      0
      Amazinwave

      By Amazinwave
      Started 48 minutes ago

    • EthanDev
      2
      Why does Forge installer 1.8.9 have Vape as an execution parent?

      By EthanDev
      Started 2 hours ago

  • Who's Online (See full list)

    • Wintersky20
    • st4s1k
    • MKR0902
    • Mark74
    • CookieLukas
    • Joshthehoneskid
    • Thorius
    • Microcellule
    • vemerion
    • Amazinwave
    • adem
    • Nuparu00
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.12.2] On item right click damage entity.
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community