Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/21/20 in all areas

  1. Editing* Edition means something else entirely. No I do not think so. At least, not easily. There might be a way if you intercepted the rendering, but having not tried to do this, I am not sure.
    1 point
  2. Howdy You need to store the information inside an ItemStack. A unique ItemStack is created every time your Item is spawned: ItemStack is the class used when an Item is actually "created" - in addition to the Item type, it also stores the item count (eg a stack of 46 planks), "damage" (eg pickaxe "wear-and-tear" indicator), and several other pieces of information The easiest way to do that is NBT, for a working example see here https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe11_item_variants or here https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe12_item_nbt_animate Like the other folks said, you can use a Capability but that is considerably more complicated / difficult to understand and isn't necessary unless you want other mods to be able to read/control the power of your item without knowing what kind of item it is. -TGG
    1 point
  3. Override Item#initCapabilities. In there, return a new ICapabilityProvider, essentially a wrapper for the getCapability method. Then, perform ItemStack#getCapability to query the ICapabilityProvider from the Item class. Here's an example from my code. @Override public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) { return new ICapabilityProvider() { protected IEnergyStorage energy = new IEnergyStorage() { @Override public int receiveEnergy(int maxReceive, boolean simulate) { if (getMaxPower() < maxReceive + getCurrentPower(stack)) { maxReceive = getMaxPower() - getCurrentPower(stack); } if (simulate == false) { setCurrentPower(stack, getCurrentPower(stack) + maxReceive); } return maxReceive; } @Override public int getMaxEnergyStored() { return getMaxPower(); } @Override public int getEnergyStored() { return getCurrentPower(stack); } @Override public int extractEnergy(int maxExtract, boolean simulate) { return 0; } @Override public boolean canReceive() { return true; } @Override public boolean canExtract() { return false; } }; protected LazyOptional<IEnergyStorage> energyHandler = LazyOptional.of(() -> energy); @Override public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) { return this.getCapability(cap); } @Override public <T> LazyOptional<T> getCapability(Capability<T> cap) { if (cap == CapabilityEnergy.ENERGY) { return energyHandler.cast(); } return LazyOptional.empty(); } }; }
    1 point
  4. AttachCapabilitiesEvent to attach the capability to the itemstacks
    1 point
  5. Update Regarding LTS System: Please read The Big Forge Update Earlier this year, 1.13 was announced and the snapshots started coming out, the update was relatively small, but enough to be a hurdle for mod developers. This combined with 1.12 stabilizing, and a few fundamental Java changes that broke modding in general, made the Forge team decide to use this opportunity and work on cleaning the years of technical debt that Forge had accrued. During this time, it was discovered that a lot of things needed updating. In fact, well, everything did. And so, it was done, a full rewrite of practically everything Forge related. This took a long time, longer than originally anticipated. But what’s the outcome of this you might ask? A lot. cpw’s mod launching system (ModLauncher) allows for parallel mod loading and support for more modern Java versions. (Considering the original was written to target Java 6). The Forge installer now runs tasks at install time once, rather than doing it every time you run the game. These alone provide dramatic reduction in launch times. ForgeGradle, the “devkit” for creating mods, has been rewritten and is faster at, well, everything. It also integrates much better with IDEs. What does that mean, you ask? Simple. Mods are nicer to make. (Also 100% less setupDecompWorkspace.) MCPConfig allows for much easier MCP updates, and is public source too, so people can see exactly what's going on between updates. In short: There was a lot of work to do. And now that it's done, future updates will be much, much smoother. 1.14 and 1.15 The 1.14 release came around, just in time for the rewrite to be finished, so it was time to get the ball rolling again. The bulk of the restructure work was done through 1.13's life, so all that remained was actually seeing how it was to update all of it, and it went pretty well. A lot of improved systems exist now that make developing for these modern versions far easier and just better in general. The 1.15 release was relatively simple, even if Mojang decided to restructure everything and make changes to how the rendering works. (Taking some of our systems in the process, don't worry, this is a good thing.) 1.15's rendering changes were mostly a refactor, and we expect 1.16 to be a large update to rendering. This plus 1.14 seeing growth is why we chose 1.14 to be a candidate for LTS. (More on that further down.) Hopefully this kind of restructure from them is a rare thing in the future, but we welcome the change, since it often brings improvement. Although the rendering changes may pose a tough hurdle for some, the update for most should be relatively straight-forward. Forge support and LTS Forge's support for Minecraft versions will try to follow a predictable cycle, assuming Mojang also follows a predictable cycle. We will always actively target the latest Minecraft version, as ever. We will now also deem a previous major Minecraft version as "LTS" (Long Term Support). The LTS version will receive support for modders and players alike, however all new features must target the latest version first, and then may be backported. An LTS version differs slightly from the latest version, in that any new features you may want to add to it, must target the latest version, only once it has been merged in, can it be backported. (The exception to this is if the feature is non-applicable to the latest version.) The Forge Team will also mostly be focusing on the latest. This is so the community has time to stabilize a bit and gives modpack developers some time to create something special. But still have Forge running full steam ahead. Late last year (Happy 2020!) a vote was held privately with many developers of various Minecraft projects to determine which version will be LTS: Should 1.12 remain LTS or should 1.14? A vast majority chose 1.14, and so, from now on we are dropping 1.12 from support, and 1.14 is now LTS. What does this mean? 1.15 is latest. It will get full support. 1.14 is LTS. It will also get support, and new features, but new features must be made for 1.15 first. 1.12 is no longer supported on this forum, no new features, and no more bugfixes. All other versions are not supported. This means if you come to us for help with those, we will ask you to update. This includes crashes/bugs. To keep with Mojang's history of releases, we expect 1.14 to stay LTS for 12-18 months, giving plenty of time for modders and pack developers alike. However, this may change depending on what surprises Mojang has in store for us. Finally… Thank you. Thank you to all the modders/developers, all the players, and especially to all the contributors. The Minecraft modding community would not be what it is without you. You are responsible for the striving ecosystem we have today. We hope this new year brings you all you desire, and we look forward to seeing what you create. And now time for some shameless plugging, if you like Forge, please consider supporting us. http://www.patreon.com/lexmanos - The Forge Team.
    1 point
  6. You don't need to explicitly specify the value property of an annotation, just pass the values directly to the annotation. e.g. @Mod.EventBusSubscriber(Side.CLIENT) .
    1 point
  7. Hello, I've been wondering how to call the LivingDeathEvent. @ForgeSubscribe public void LivingDeathEvent(EntityLivingBase entity){ if(entity instanceof EntityPlayer){ System.out.println("test"); } } i tried doing this but entitylivingbase isn't a event class with what should i replace this ? I'm trying to call a line of code on player death Thanks for any help and have a great 2014
    1 point
×
×
  • Create New...

Important Information

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