Giter VIP home page Giter VIP logo

rcpatch's Introduction

rcpatch

Small coremod to patch a method in Railcraft that causes a server crash with Futurepack.

What this mod is for

Railcraft and Futurepack have an interaction at the moment where if you have a a Thruster in your inventory with metadata greater than 11, the server will crash as Railcraft assumes that metadata can be mapped directly to a blockstate. What this mod does is make Railcraft treat any item that would otherwise cause a crash as if it is an air block.

What this mod does

Patches Railcraft 12.0.0 at runtime to add a try-catch around a statement that crashes with Futurepack

Original code:

return block == null ? Blocks.AIR.getDefaultState() : block.getStateFromMeta(stack.getItemDamage());

Patched code:

try {
  return block == null ? Blocks.AIR.getDefaultState() : block.getStateFromMeta(stack.getItemDamage());
}
catch (IllegalArgumentException e) {
  return Blocks.AIR.getDefaultState();
}

Why not just patch Railcraft directly?

Railcraft's license forbids distributing compiled binaries from modified source code. This means that even though I had already produced a patched jar which applied this fix to the source code, I could not use it on a private community server. Therefore I had to learn ASM to apply this change at runtime, which took twice as long as finding and patching the problem originally did.

You probably should not use this mod

This is a coremod written in 2 days, with no prior knowledge of coremodding nor any experience with ASM. This mod is just a hack to prevent the game from crashing. The underlying cause of the crash is not addressed by this mod. I will not be providing support for this mod. Feel free to leave issue reports, but I make no guarantees that they will be addressed.

However, if by chance you are playing a pack with Railcraft 12.0.0 and Futurepack, this will probably prevent crashes that force a player data reset, and will allow you to login again after even after causing such a crash.

Or you could just stick to the first 12 colors of thrusters.

rcpatch's People

Contributors

maxwell-lt avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.