• Recently Browsing

    No registered users viewing this page.

  • Posts

    • I did what you say, but now i get that exception:   java.lang.IllegalStateException: No renderer registered for enderslime:enderslime     at net.minecraft.client.renderer.entity.EntityRendererManager.<init>(EntityRendererManager.java:189) ~[forge-1.15-29.0.4_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} I got it before sometimes when i registered something before render, but now i have no idea how to fix it. Commit: https://gitlab.com/Emily_Ravenhold/enderSlime/-/commit/73f0efefcddd7f1dd4a8bb7905f3dffce833a1e2 Thanks!
    • Alright, so applying your suggestion to my code did fix the error. However, there's another problem, and I'm not sure exactly what's causing it. It could be an issue with my capability's storage class, it could be that I'm not attaching the capability properly, or something else, but when I went to check my custom sword in-game, instead of printing the amount of "juice" it was supposed to store (juice is just another word for energy; it's just an int value) in the sword's tooltip, it just printed this: https://imgur.com/a/vOUhiDo   Here's my updated Provider class, in case that could have an effect on the above issue: package zorochase.oneirocraft.capability; import net.minecraft.util.Direction; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.CapabilityInject; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.common.util.LazyOptional; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.function.Supplier; public class JuicedItemProvider implements ICapabilityProvider { private Supplier<IJuicedItem> juicedItemSupplier; @CapabilityInject(IJuicedItem.class) public static Capability<IJuicedItem> JUICED_ITEM_CAPABILITY = null; public JuicedItemProvider() { this(() -> JUICED_ITEM_CAPABILITY.getDefaultInstance()); } JuicedItemProvider(Supplier<IJuicedItem> sup) { this.juicedItemSupplier = sup; } private LazyOptional<IJuicedItem> capability = LazyOptional.of(() -> juicedItemSupplier.get()); @Nonnull @Override public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nullable Direction side) { return cap == JUICED_ITEM_CAPABILITY ? capability.cast() : LazyOptional.empty(); } }   Here's the storage class: package zorochase.oneirocraft.capability; import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.INBT; import net.minecraft.util.Direction; import net.minecraftforge.common.capabilities.Capability; import javax.annotation.Nullable; public class JuicedItemStorage implements Capability.IStorage<IJuicedItem> { @Nullable @Override public INBT writeNBT(Capability<IJuicedItem> capability, IJuicedItem instance, Direction side) { CompoundNBT tag = new CompoundNBT(); tag.putInt("juice", instance.getJuice()); tag.putInt("maxJuiceTransferable", instance.getMaxJuiceTransferable()); tag.putBoolean("empowered", instance.getIsEmpowered()); return tag; } @Override public void readNBT(Capability<IJuicedItem> capability, IJuicedItem instance, Direction side, INBT nbt) { CompoundNBT tag = (CompoundNBT) nbt; instance.setJuice(tag.getInt("juice")); instance.setJuiceTransferLimit(tag.getInt("maxJuiceTransferable")); instance.setEmpowered(tag.getBoolean("empowered")); } }   Here's how I'm printing the sword's "juice": @Override public void addInformation(ItemStack stack, @Nullable World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) { tooltip.add( new TranslationTextComponent( String.valueOf( stack.getCapability(JuicedItemProvider.JUICED_ITEM_CAPABILITY).map(IJuicedItem::getJuice) ) ).applyTextStyle(TextFormatting.AQUA) ); }   And here's what I did to attach it in my main class: @SubscribeEvent public static void onAttachCapabilities(AttachCapabilitiesEvent<ItemStack> event) { Item item = event.getObject().getItem(); if (item instanceof DreamsteelSwordItem) { event.addCapability(new ResourceLocation(Oneirocraft.MOD_ID, "juiceditem"), new JuicedItemProvider()); } }   Again, I really do appreciate your help. I apologize for requesting it continually, it's only because I'm having a hard time wrapping my head around this concept.
    • @outflows Just write IngameGui, then press F3 if you are using eclipse. It should be the same for IntelliJ
    • Is there an easy way to search for these classes in the explorer because I've been looking for a while and can't find them. All I was able to find was ForgeGUIFactory.
    • All of the minecraft .png files are in the assets directory of the minecraft jar. just extract that and have a look. this includes all items that would appear in an inventory and also the inventory container gui. It seems like that's what you want. 
  • Topics

  • Who's Online (See full list)