Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/08/19 in all areas

  1. You're registering your block as "block_sapphire_ore" but are using "sapphire_ore" for the resources.
    1 point
  2. The registry name is a resource location. You probably have it in String form in which case just pass it into the ResourceLocation constructor.
    1 point
  3. I would rather start with FE and not use RF, because the FE API is build into Forge itself and thus it is always available. You would also not run into problems when the RF API doesn't update anymore. Like I remember a time where the mods by TeamCOFH got the 1.7.10 version 2014 and three years later followed 1.10.2 skipping 1.8.9 etc. Also most mods which support RF also support FE. More explanation on wether to use FE or RF or both might be found here: https://minecraft.curseforge.com/projects/redstone-flux Most mods have this complex implementations because they are supporting multiply energy APIs while converting the energy internally to the one which is requested as an output or they got their own energy API for internal uses and convert to RF or FE or whatever is required by the connected machines. When searching for mods which support energy and don't have complex systems I would start searching for mods which just support FE or maybe even support FE and Tesla, but I would also suggest looking into mods which got a fresh rewrite as otherwhise it might be that at one point they added support for FE into their existing systems and later on removed all the other APIs which aren't needed and such code is harder to read when you've got no idea how it works. WARNING: I might have missed some things in the following description as my own energy system also supports Tesla and thus is a bit more complicated. As a starting point for FE, I would highly suggest to learn about the Capability System by Forge, if you haven't already done this. https://mcforge.readthedocs.io/en/latest/datastorage/capabilities/ This is required as the Forge Energy system is based around capabilities. The next point would be create a new class extended from EnergyStorage or just implement all the code yourself using the IEnergyStorage interface which I would suggest if you plan on overwritting all methods provided in EnergyStorage anyway. This class should also implement the interface INBTSerializable<NBTTagCompound> if you want to store your energy data (I assume here that you are already familiar with Java Generics). In this class, save your data and read it in using normal NBT read and write methods (serializeNBT and deserializeNBT). This methods will later be called in for example our TileEntity's NBT read and write methods. In a more advanced system you might also use the capability methods to call wrapper classes around FE and Tesla and other capability based energy systems in this class, but this is out of scope of this basic overview. At next, you should create a TileEntity. This TileEntity needs your EnergyManager class you created before (the class which extends EnergyStorage or implements IEnergyStorage ). In here you add the read and write methods for NBT data and call the serializeNBT and deserializeNBT methods of your EnergyManager. For example: this.container.deserializeNBT(compound.getCompoundTag("Energy")); (container is here the instance of EnergyManager.) Then you also need the hasCapability and getCapability methods. I think you figure yourself out what to put in there. In the update method of your TileEntity you might want to put your logic about energy production or extraction in. this.container.receiveEnergy(int maxReceive, boolean simulate); this.container.extractEnergy(int maxExtract, boolean simulate); If you want to extract or receive energy from another TileEntity, you first need to get it at the specific location and than get the capability at the specific side. (Note: If a machine only sends energy in other machines underneath, then it might only return a capability for EnumFacing.DOWN.) An EnumFacing with null is also possible and might be used for internal purposes if I recall correctly. Do note that it is recommended for the most compatibility between mods to let your machines send the energy into the cables instead of letting the cables extract the energy out of your machines. https://github.com/SleepyTrousers/EnderIO/issues/4081#issuecomment-284911416 I hope this gives you a basic overview of how energy systems actually work. For items, I currently having figured it out myself as I've not worked with items and capabilities so far and transmitting energy wirelessly shouldn't be a challange after reading this. The basics are always the same, just how much more you put around those basic is different.
    1 point
×
×
  • Create New...

Important Information

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