
onVoid
-
Posts
48 -
Joined
-
Last visited
Posts posted by onVoid
-
-
All 3.
TileEntity: http://pastebin.com/p4Bi42qg
Gui: http://pastebin.com/aCGSPub9
Container: http://pastebin.com/ErQ8i332
-
-
-
There's always a log, regardless of whether you're in the development or release environment. It's written to logs/fml-client-latest.log in the game directory.
Mods will work in the development environment if you're using development/deobfuscated versions.
Checked logs, no errors.
-
Presumably the method returns a value, that value being the amount inserted.
The method is an int, but I can't see a correlation. This is the code:
int x = 0; x = ((IEnergyContainerItem)slots[10].getItem()).receiveEnergy(slots[10], 7000, false); extractEnergy(x, false);
When finishing the charging an item with max 250,000 RF (and my storage has 600,000 RF in it), the storage is left with 95,000 RF (it's using 505,000).
-
-
So, I have a basic charger TileEntity and I am looking for a way to remove the exact amount of energy from my EnergyStorage as the amount of energy that goes into the item (like ThermalExpansion's energetic infusor). How can I do this? Note: I am using the RF Api.
-
Are there any errors in the log? Have you registered your
TileEntity
class?
I can't see the log since I am testing the mod outside of the modding environment (if anyone wants to help me get mods working in the environment that would be great), and my TileEntity is registered in initialization
GameRegistry.registerTileEntity(ChargerTileEntity.class, "Charger");
. It also has working features.
-
Assuming you have an
EnergyStorage
field in your
TileEntity
, call its
readFromNBT
and
writeToNBT
methods in your overrides of the corresponding
TileEntity
methods. You can also extend
[url=https://github.com/CoFH/RedstoneFlux-API/blob/10e10af21489e351624813120ed6474c44b09ff6/src/main/java/cofh/api/energy/TileEnergyHandler.java]TileEnergyHandler[/url]
and let it handle the NBT reading/writing for you.
I have this
@Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); storage.readFromNBT(nbt); } @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); storage.writeToNBT(nbt); }
and it isn't saving. I also attempted making it a TileEnergyHandler, also nothing. What am I missing?
-
I would assume this would be done with NBT in my tile entity, and I know there are readFromNBT() and writeToNBT() methods in my tile entity, but I am unsure how to go about using them to store my RF values. Can anyone help me please?
-
-
With EnderIO items when I take it out of my custom charger, fully charged, it removes the charge and reverts to its uncharged state. But, if press a number key on the item to make it go to my hotbar, it keeps the charge. Anyone know why this is happening?
-
How would I change the charge of an IC2 item? I have my charger done I just need some insight on how to set the charge.
-
I got the charging working (using IEnergyContainerItem and ItemEnergyContainer) but I am having another problem. With EnderIO items when I take it out of the machine, fully charged, it removes the charge and reverts to its uncharged state. But, if press a number key on the item to make it go to my hotbar, it keeps the charge. Anyone know why this is happening?
-
If you're trying to charge another mod's items, there is no need to mess with the durability bar. That should happen on the other mod item's end. YOU just need to use the existent API to call ISomeInterface#someAddPowerMethod on the item (you will need to explicitly cast the Item)
Alright. I will begin searching for that method in CoFHLib. In the meantime, if anyone knows it, please inform me. Thanks!
-
Specifically, <Class>#<method> refers to a method that requires an object instance, rather then a static method.
You will see a lot of <Class>#<method> references on this board and that's exactly what that format is. So in those references, "Item" is a reference to your presumed item's super class (net.minecraft.item.Item) and "showDurabilityBar" is a method within that class.
Either way, as I said, the items I am trying to charge aren't my items, so I can't do anything to the item class.
-
In my previous post I posted the methods necessary to get your display bar working. Apparently you didn't feel like doing your own research into them, so I will spell it out for you.
Item#showDurabilityBar
In your item class override this method and return true when you want the durability bar to display. You can use conditionals to not display the bar when your item has max energy.
@Override public boolean showDurabilityBar(ItemStack is) { if (getEnergyStored(is) >= getMaxEnergyStored(is)) { return false; } return true; }
Item#getDurabilityForDisplay
In your item class override this method and return a double value in a percentage value of 1 for the current stored energy. So if you're using purely RF (no conversions) it would look something like this:
@Override public double getDurabilityForDisplay(ItemStack is) { return (double) (1 - getEnergyStored(is) / getMaxEnergyStored(is)); }
Item#isDamageable
This isn't required as it is true by default. What this does is set whether or not your item has durability. My item, the AE2 Wireless Crafting Terminal, has this set to false simply so "Durability 32/32" isn't displayed in the tooltip.
Thank you, kind sir. I was just a bit unsure about the things you were saying. I will test this out in a bit.
EDIT: The items I am charging aren't my items, they are items from EnderIO and Thermal Expansion. So I don't really have an item class...
-
Why are you storing the energy as a string in NBT then calling parseInt instead of just storing it as an int (using setInteger & getInteger)?
Thank you so much for pointing out my mistake! I got it working.
EDIT: The item charges and the charges displays in the item lore, but when taking it out of the machine it resets. Also, the durability bar still doesn't work.
-
New to NBT tags, my bad.
-
I have this custom Redstone Flux charger (with usage of the CoFHLib) and it gets powered and such perfectly. I am unsure how to go about getting it to charge items, though.
I have attempted to edit the NBT tag of the item (all of the items have a "Energy" NBT tag), and editing it works, but it doesn't change the charge bar of item lore. Any help? Thanks!
Current code:
if (slots[10].hasTagCompound()){ NBTTagCompound = slots[10].getTagCompound(); if (.hasKey("Energy")){ .setString("Energy", Integer.parseInt(.getString("Energy"))+20 + ""); slots[10].setTagCompound(); } }
[1.7.10] EnderIO items losing charge when taken out, except when using # keys
in Modder Support
Posted
I guess from me being oblivious. chargingDC and chargingDC2 are from a complicated method of keeping track of energy being used that I attempted. I removed static tags, running a test now.