Jump to content

boyx

Members
  • Posts

    20
  • Joined

  • Last visited

boyx's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I no longer need to. I found a fix for that problem but it still crashes because of the Capability. I dont know what i did wrong. I made a class where i used @CapabilityInject in and i put that in my preInit. The game only crashes when i get the Item in my inventory.
  2. What should i update? The forge version or the mapping or what?
  3. I am exactly in the same class and dont find this
  4. package boyx.arandomstuff.handlers; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.CapabilityInject; import net.minecraftforge.common.capabilities.ICapabilityProvider; import javax.annotation.Nonnull; import javax.annotation.Nullable; import boyx.arandomstuff.Reference; public class InternalTimers { @CapabilityInject(InternalTimers.class) public static final Capability<InternalTimers> CAPABILITY = null; public static final ResourceLocation NAME = new ResourceLocation(Reference.MODID, "internal_timers"); private final Timer repair = new Timer(); private final Timer heal = new Timer(); private final Timer feed = new Timer(); public void tick() { if (repair.shouldUpdate) { repair.tickCount++; repair.shouldUpdate = false; } if (heal.shouldUpdate) { heal.tickCount++; heal.shouldUpdate = false; } if (feed.shouldUpdate) { feed.tickCount++; feed.shouldUpdate = false; } } public void activateRepair() { repair.shouldUpdate = true; } public void activateHeal() { heal.shouldUpdate = true; } public void activateFeed() { feed.shouldUpdate = true; } public boolean canRepair() { if (repair.tickCount >= 19) { repair.tickCount = 0; repair.shouldUpdate = false; return true; } return false; } public boolean canHeal() { if (heal.tickCount >= 19) { heal.tickCount = 0; heal.shouldUpdate = false; return true; } return false; } public boolean canFeed() { if (feed.tickCount >= 19) { feed.tickCount = 0; feed.shouldUpdate = false; return true; } return false; } public static class Provider implements ICapabilityProvider { private final InternalTimers capInstance = new InternalTimers(); @Override public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing) { return capability == CAPABILITY; } @Override public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) { if (capability == CAPABILITY) return CAPABILITY.cast(capInstance); else return null; } } private static class Timer { public int tickCount = 0; public boolean shouldUpdate = false; } } Thats the class i did the Capabilitys in. I dont know much and i didnt understand the documentation well.
  5. In Minecraft the class ItemStack doesnt own a Method called isEmpty() somehow... I dont even know if this is the error. How i said some post above the crashlog says there too many ticks and something with the Capability doesnt work. [Edit] Btw the game crashes whenever i get the Repairer Item in my inventory.
  6. It is undefined and not working in ItemStack...
  7. Yes i tried that but it also doesnt work. I know many basic things in java. I also programmed some programs but not too complicated. I never did something like this advanced modding.
  8. After i deleted the stack.isEmpty then yes it does
  9. @CapabilityInject(InternalTimers.class) public static final Capability<InternalTimers> CAPABILITY = null; public static final ResourceLocation NAME = new ResourceLocation(Reference.MODID, "internal_timers"); I did this with the capability.
  10. Minecraft Crash Report says this line is the error?
  11. This is the crash report. Maybe it has nothing to do with the isEmpty error...
  12. Do you know something i could use instead of this?
  13. There are many things that can return a boolean but nothing i need i think. What i need is that it returns true if the ItemStack is empty for that i always used ItemStack.Empy or ItemStack.isEmpty and both dont work.
  14. When i hover over it it says : isEmpty cannot be resolved or is not a field In the other mods ive just did the same thing. I created a new ItemStack stack = inv.getStackInSlot(i); and then just did invStack.isEmpty; to get a boolean.
  15. Ok i expressed myself wrong. I know Java and i also know why its marked red but i dont understand why because i used this alot in some mods from me but only here it doesnt work. Thats what i ment by this
×
×
  • Create New...

Important Information

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