There is a method in net.minecraft.item.Item, that you can override. It's something like shouldRedraw or shouldUpdate (not sure how it's called exactly. Try looking for othetr things, that don't do the update animation, when changed (I think bows and tools do that)
IC² API and IC² Addon Creation. (The Code Part)
-
-
Yeah! I do a simple test that looks OK!
Java
Display More@Override public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) { if (oldStack.hasTagCompound() && newStack.hasTagCompound()) { NBTTagCompound nbtO = oldStack.getTagCompound(),nbtN = newStack.getTagCompound(); if (nbtO.hasKey("charge") && nbtN.hasKey("charge")) { if(!slotChanged && nbtO.getDouble("charge") != nbtN.getDouble("charge")) return false; } } return !oldStack.equals(newStack); //!ItemStack.areItemStacksEqual(oldStack, newStack); }
-
I guess that is a 1.10.2 thing, because I cant find it in 1.7.10... damnit...
-
Is there a good way to place IC2 blocks/machines from code?
I'm working on an Immersive Engineering multiblock (for Industrial Wires) that has a kinetic generator as one of the parts. I currently use the TE registry name to check whether a block is a kinetic generator (which isn't ideal but works), but I can't think of a reasonably non-hacky way to place them when the multiblock is broken. I could just drop the item, but I ideally want the multiblock to be re-formable easily after breaking.
-
I can't think of any other way right now to detect it.
To place the block again, you just need to pla ce the correct block ic2:te and the tileentity. (The other properties of the BlockState are overridden by getActualState when the te is present) Ideally, you'd serialize writeToNBT and store it before removing the block and create a new te when breaking the multiblock.
If you need anything else, or you want me to add a hook, please let me know.
-
Ideally blocks are placed through the associated item's use action against a solid surface as if a regular player was placing it. AFAIK there's no proper API for automated placement.
-
Hi guys, I already know how to setup the workspace to start a fresh new mod, but I'm stuck at importing the api to the project. I already read the steps, but I dont really understand this part:
"Add the IC2 dev jar as a library to the build path. You can get it from http://jenkins.ic2.player.to/job/IC2_experimental/, the file name is "industrialcraft-x-x.x.xxx-experimental-dev.jar" (should be the second one). It also needs to be copied to your eclipse working (run) directory's mods-Folder."
And searching for the dev build, it looks that the last one looks a bit outdated. I hope you can help me out with this step to start an updated ic2 addon, thanks in advance!
-
Nowerdays, you just add it to your build script (as shown in the original post) and reimport the build script in your ide.
-
If you're doing it old school though, the jar you need depends on how much of IC2 you're going to use. For a start the 1.12 ones are here, the old link goes to the 1.6.4 and 1.7 builds.
If you're just depending on the IC2 API and have no need for any of the internal classes within IC2 (ie any that start with ic2.core) then you will want the -api jar. You download that and link it to your buildpath. To actually run the game from Eclipse when you're testing, you will need the -dev jar to be in the mods folder of where you run the game from (this is the run directory mentioned above).
If you're depending on all of IC2 (or lazy and only want to download one jar), you want just the -dev jar. You link that one to your buildpath, and it will automatically be loaded as the game is tested without having to put it in the mods folder too.
Doing it from the build script is less work than doing all this of course, but that's the process in case you need it.
-
Link in the first post doesn't work (404)
http://ic2api.player.to/ic2api/html/annotated.html
Also some spam up here.
-
Hi. Is player.to domain working nowadays?
I can't access API or IC2 builds..
Server shut down for maintenance or forever?
-
It's maintenance most likely, it was working two days ago and Player has had no public plans to stop it any time soon. No doubt it will be restored as soon as he's around again to do it. In the meantime you can get the normal builds as well as the API and dev versions from Curse.
-
The provided link to the documentation website is not working anymore. Is there any new documentation page?
-
The documentation itself is generated from the API source, so you could always download the API jar from Jenkins and read the .java files directly.
-
How can I make a machine recipe output an universal item cell with a specified fluid?
-
I assume you output a fluid cell with an NBTTagCompound "fluid" with the type and amount of fluid, although I have never done that, so I may be wrong. Best way to test is to look at the syntax, test and repeat
-
Yes they are NBT based. For the IC2 recipe configs the special format ic2:fluid_cell#ic2air (fluid name is ic2air) would work as well.
-
Is there a way to emit redstone only on a specific side? RedstoneEmitter emits on all sides, and this seems to be hardcoded in BlockTileEntity#getWeakPower
-
Might not be the smartest question here, but how do I actually add a machine, that produces EU energy and consumes something or consumes energy and does something? I guess the easy answer is to read the documentation, but the link is not working
-
Question solved, just had to look at some source code