Code Monkey home page Code Monkey logo

refinedstorage's Introduction

uwx/refinedstorage

This is a fork of Refined Storage a Minecraft Forge mod for mass storing items. This version has separate insert/extract priority settings for storage items, designed so that you can still store items normally while using a ProjectE Transmutation Table to learn new items as they come in, making it usable for keeping backup copies of all your items.

For more information, see the original project's README.

More in-depth explanation

Sequence for inserting an item into the network:

  1. If item is in transmutation table's external storage filter list, item is burned into EMC
  2. Item is learned if it's not already (this does not cost any items, unlike the real Transmutation Table)
  3. Storage is updated to reflect the amount of obtainable items based on the stored EMC amount; if the existing item hasn't been burned into EMC yet, it's placed into the network's storage.

Sequence for removing an item from the network:

  1. If item is present in storage, item is taken from storage;
  2. Otherwise, item is created from the tablet
  • You can test this by adding and removing an item, and looking in the disk drives - depending on the item, as long as it was imported early enough and is then stored in a full drive, the color in the drive bay should change.
  • You can also test this by creating a stack of very high EMC items and putting them back in, you can see that the count of other available EMC-able items changes when you first pull it out, but not again since the item gets stored properly.

Using the priority settings

Rather than the priority field being an integer, it's now two integers delimited by a comma (,). The increment and decrement buttons will likely not do what you intend; instead, you should type the values manually into the field.

Future ideas

Maybe instead of reporting the total amount of creatable items in the Grid (StorageItemTransmutationTable.getStacks), cap it to only show up to the max stack of that item or if the number doesn't matter for the amount being pulled out, report only 1 item, that way everything is sorted nicely!

To delete 1 item from the stack when researching it through the tablet (to work similarly to the real Transmutation Table), we need to modify StorageItemTransmutationTable.insert. We need to make handleKnowledge return a bool when provider.hasKnowledge() is false, and then we do this:

//ItemStack retval = actualStack;
if (!simulate) {
    if (IFilterable.canTake(externalStorage.getItemFilters(), externalStorage.getMode(), externalStorage.getCompare(), stack)) { // shouldn't need to copy for the `stack` bit here
        provider.setEmc(provider.getEmc() + emc);
        actualStack = null; // we deleted the item
        
        handleKnowledge(provider, stack.copy());
    } else if (handleKnowledge(provider, stack.copy())) {
        provider.setEmc(provider.getEmc() + (emc / size)); // TODO get the emc value of only 1 item properly, though this works fine
        
        if (size == 1) actualStack = null; // took the last item from the stack

        // take 1 item from the stack
        actualStack.setCount(size-1);
    }

    EntityPlayer player = externalStorage.getWorld().getPlayerEntityByUUID(externalStorage.getOwner());

    if (player != null) {
        provider.sync((EntityPlayerMP) player);
    }
}

return retval;

Idea to reduce Refined Storage lag:

  • Keep a local EMC cache (preferably use an ObjectIntMap of some sort)
  • Use some sort of ServerChatEvent (whatever the equivalent is in 1.12) to clear the cache when /projecte setEMC is ran (or perhaps just add a custom command that does it?)

refinedstorage's People

Contributors

0blu avatar blaytheninth avatar chaotictabris avatar cooliojazz avatar cylek56 avatar davenonymous avatar davidog23 avatar geldorn avatar ghjsh avatar ineternet avatar inusualz avatar jaquadro avatar jazzpi avatar jhjaggars avatar lordmau5 avatar modmuss50 avatar msreagle avatar pauljoda avatar raoulvdberge avatar speiger avatar tartaricacid avatar teamspen210 avatar thexxturboxx avatar tomevoll avatar tomkpz avatar uwx avatar volune avatar vt-14 avatar way2muchnoise avatar xinyuan-liu avatar

Watchers

 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.