Jump to content

A simple SED script to replace getOrCreate... deprecated functions


Recommended Posts

Posted

Hello,

 

Maybe someone could use this oneliner shell script for porting from forge 4.x -> 5.0 which replaces the deprecated getOrCreate... functions.

 

 

find . -iname '*.java' -type f | xargs sed -i.bak -e 's/getOrCreateIntProperty(\(.*\),\s*\(.*\),\s*\(.*\))/get(\2, \1, \3)/g' -e 's/getOrCreateProperty(\(.*\),\s*\(.*\),\s*\(.*\))/get(\2, \1, \3)/g' -e 's/getOrCreateBooleanProperty(\(.*\),\s*\(.*\),\s*\(.*\))/get(\2, \1, \3)/g' -e 's/getOrCreateBlockIdProperty(\(.*\),\s*\(.*\))/getBlock(Configuration.CATEGORY_BLOCK, \1, \2)/g'

 

 

It solved 56 of 60 buildcraft build errors.

 

[bF]

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.