• Recently Browsing

    No registered users viewing this page.

  • Posts

    • How do you add a description or lore to an item?
    • ---- Minecraft Crash Report ---- // I let you down. Sorry :( Time: 15/08/20 10:32 Description: Initializing game java.lang.RuntimeException: Something crashed the event bus earlier in the loading stage. This is NOT a Cooking for Blockheads issue! Scroll up in your latest.log to find the real crash log.     at net.blay09.mods.cookingforblockheads.client.TileEntityRenderers.initBlockColors(TileEntityRenderers.java:39) ~[?:8.0.3] {re:classloading}     at net.minecraftforge.eventbus.ASMEventHandler_153_TileEntityRenderers_initBlockColors_Block.invoke(.dynamic) ~[?:?] {}     at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:80) ~[eventbus-2.2.0-service.jar:?] {}     at net.minecraftforge.eventbus.EventBus.post(EventBus.java:258) ~[eventbus-2.2.0-service.jar:?] {}     at net.minecraftforge.fml.javafmlmod.FMLModContainer.acceptEvent(FMLModContainer.java:168) ~[?:31.2] {re:classloading}     at net.minecraftforge.fml.ModLoader.lambda$postEvent$31(ModLoader.java:260) ~[?:?] {re:classloading}     at net.minecraftforge.fml.ModLoader$$Lambda$4408/1158870513.accept(Unknown Source) ~[?:?] {}     at java.util.HashMap.forEach(HashMap.java:1280) ~[?:1.8.0_51] {}     at net.minecraftforge.fml.ModList.forEachModContainer(ModList.java:218) ~[?:?] {re:classloading}     at net.minecraftforge.fml.ModLoader.postEvent(ModLoader.java:260) ~[?:?] {re:classloading}     at net.minecraftforge.client.ForgeHooksClient.onBlockColorsInit(ForgeHooksClient.java:207) ~[?:?] {re:classloading}     at net.minecraft.client.renderer.color.BlockColors.func_186723_a(BlockColors.java:76) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}     at net.minecraft.client.Minecraft.<init>(Minecraft.java:419) [?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}     at net.minecraft.client.main.Main.main(SourceFile:166) [?:?] {re:classloading}     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_51] {}     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_51] {}     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_51] {}     at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_51] {}     at net.minecraftforge.fml.loading.FMLClientLaunchProvider.lambda$launchService$0(FMLClientLaunchProvider.java:51) [forge-1.15.2-31.2.13.jar:31.2] {}     at net.minecraftforge.fml.loading.FMLClientLaunchProvider$$Lambda$422/936931778.call(Unknown Source) [forge-1.15.2-31.2.13.jar:31.2] {}     at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-5.1.0.jar:?] {}     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-5.1.0.jar:?] {}     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-5.1.0.jar:?] {}     at cpw.mods.modlauncher.Launcher.run(Launcher.java:81) [modlauncher-5.1.0.jar:?] {}     at cpw.mods.modlauncher.Launcher.main(Launcher.java:65) [modlauncher-5.1.0.jar:?] {} A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Render thread Stacktrace:     at net.blay09.mods.cookingforblockheads.client.TileEntityRenderers.initBlockColors(TileEntityRenderers.java:39)     at net.minecraftforge.eventbus.ASMEventHandler_153_TileEntityRenderers_initBlockColors_Block.invoke(.dynamic)     at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:80)     at net.minecraftforge.eventbus.EventBus.post(EventBus.java:258)     at net.minecraftforge.fml.javafmlmod.FMLModContainer.acceptEvent(FMLModContainer.java:168)     at net.minecraftforge.fml.ModLoader.lambda$postEvent$31(ModLoader.java:260)     at net.minecraftforge.fml.ModLoader$$Lambda$4408/1158870513.accept(Unknown Source)     at java.util.HashMap.forEach(HashMap.java:1280)     at net.minecraftforge.fml.ModList.forEachModContainer(ModList.java:218)     at net.minecraftforge.fml.ModLoader.postEvent(ModLoader.java:260)     at net.minecraftforge.client.ForgeHooksClient.onBlockColorsInit(ForgeHooksClient.java:207)     at net.minecraft.client.renderer.color.BlockColors.func_186723_a(BlockColors.java:76)     at net.minecraft.client.Minecraft.<init>(Minecraft.java:419) -- Initialization -- Details: Stacktrace:     at net.minecraft.client.main.Main.main(SourceFile:166)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:497)     at net.minecraftforge.fml.loading.FMLClientLaunchProvider.lambda$launchService$0(FMLClientLaunchProvider.java:51)     at net.minecraftforge.fml.loading.FMLClientLaunchProvider$$Lambda$422/936931778.call(Unknown Source)     at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37)     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54)     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72)     at cpw.mods.modlauncher.Launcher.run(Launcher.java:81)     at cpw.mods.modlauncher.Launcher.main(Launcher.java:65) -- System Details -- Details:     Minecraft Version: 1.15.2     Minecraft Version ID: 1.15.2     Operating System: Windows 10 (amd64) version 10.0     Java Version: 1.8.0_51, Oracle Corporation     Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation     Memory: 2547424880 bytes (2429 MB) / 3221225472 bytes (3072 MB) up to 3221225472 bytes (3072 MB)     CPUs: 4     JVM Flags: 9 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xss1M -Xmx3G -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M     ModLauncher: 5.1.0+69+master.79f13f7     ModLauncher launch target: fmlclient     ModLauncher naming: srg     ModLauncher services:          /eventbus-2.2.0-service.jar eventbus PLUGINSERVICE          /forge-1.15.2-31.2.13.jar object_holder_definalize PLUGINSERVICE          /forge-1.15.2-31.2.13.jar runtime_enum_extender PLUGINSERVICE          /accesstransformers-2.1.1-shadowed.jar accesstransformer PLUGINSERVICE          /forge-1.15.2-31.2.13.jar capability_inject_definalize PLUGINSERVICE          /forge-1.15.2-31.2.13.jar runtimedistcleaner PLUGINSERVICE          /OptiFine-1.15.2_HD_U_G1_pre16.jar OptiFine TRANSFORMATIONSERVICE          /forge-1.15.2-31.2.13.jar fml TRANSFORMATIONSERVICE      FML: 31.2     Forge: net.minecraftforge:31.2.13     FML Language Providers:          javafml@31.2         minecraft@1     Mod List:          glasscutter-1.0.1-mc1.15.2.jar Glasscutter {glasscutter@1.0.1 CREATE_REGISTRIES}         Cucumber-1.15.2-3.0.9.jar Cucumber Library {cucumber@3.0.9 CREATE_REGISTRIES}         torchslabmod (colocar tochas em slabs)-1.15.2_v1.6.15.jar Torch Slab Mod {torchslabmod@1.6.15 CREATE_REGISTRIES}         xray-1.15.2-2.2.0.jar Advanced XRay {xray@2.2.0 CREATE_REGISTRIES}         vanillaexcavators (ferramentas de escavação)-1.15.2-2.1.jar Vanilla Excavators {vanillaexcavators@2.1 CREATE_REGISTRIES}         jei-1.15.2-6.0.0.4 (ajuda nos craftings).jar Just Enough Items {jei@6.0.0.4 CREATE_REGISTRIES}         enchantable-1.3.0-mc1.15.2.jar Enchantable {enchantable@1.3.0 CREATE_REGISTRIES}         metalbarrels-2.1.jar Metal Barrels {metalbarrels@2.1 CREATE_REGISTRIES}         WoolyTrees (árvores de lã)-1.15.2-1.0.1.jar Wooly Trees {woolytrees@1.0.1 CREATE_REGISTRIES}         Uppers-0.2.12.jar Uppers {uppers@0.2.12 CREATE_REGISTRIES}         goblintraders (troca com globins)-1.2.0-1.15.2.jar Goblin Traders {goblintraders@1.2.0 CREATE_REGISTRIES}         Glacia (dimensão)-15.2.2.jar §9§lGlacia§r {greenapple_glacia@§915.2.2§r CREATE_REGISTRIES}         caelus-FORGE-1.15.2-2.0-beta3.jar Caelus API {caelus@FORGE-1.15.2-2.0-beta3 CREATE_REGISTRIES}         DurabilityNotifier (avisa a duração da ferramenta)-1.15-1.0.0.jar Durability Notifier {durabilitynotifier@1.0.0 CREATE_REGISTRIES}         reap-1.12.4.jar Reap Mod {reap@1.12.4 CREATE_REGISTRIES}         colytra-FORGE-1.15.2-3.0.jar Colytra {colytra@FORGE-1.15.2-3.0 CREATE_REGISTRIES}         invtweaks (organiza o inventário)-1.15.2-1.0.1.jar Inventory Tweaks Reborn {invtweaks@1.15.2-1.0.1 CREATE_REGISTRIES}         Rotten+Flesh+to+Leather+1.15.2.jar Rotten Flesh to Leather {rftl@1.15.2 - 1.0.0 CREATE_REGISTRIES}         Neat+1.6-22 (mostra a vida dos mobs).jar Neat {neat@1.6-22 CREATE_REGISTRIES}         essentials (tec)-1.15.2-2.7.2.jar Essentials {essentials@1.15.2-2.7.2 CREATE_REGISTRIES}         goldenhopper-1.1.1-mc1.15.2.jar Golden Hopper {goldenhopper@1.1.1 CREATE_REGISTRIES}         Clumps (XP junto)-5.0.2.jar Clumps {clumps@5.0.2 CREATE_REGISTRIES}         OresAboveDiamonds+1.15.2+v4.1 (minérios melhores q diamante).jar Ores Above Diamonds {oresabovediamonds@4.0 CREATE_REGISTRIES}         journeymap-1.15.2-5.7.0b2 (minimapa).jar Journeymap {journeymap@5.7.0b2 CREATE_REGISTRIES}         ElementsOfPower (magia)-1.15.2-0.9.2-alpha.jar Elements of Power {elementsofpower@0.9.2-alpha CREATE_REGISTRIES}         CookingForBlockheads_1.15.2-8.0.3.jar Cooking for Blockheads {cookingforblockheads@8.0.3 CREATE_REGISTRIES}         Placebo-1.15.2-3.1.0.jar Placebo {placebo@3.1.0 CREATE_REGISTRIES}         citadel-1.1.11.jar Citadel {citadel@1.1.11 CREATE_REGISTRIES}         NaturesCompass-1.15.2-1.8.5.jar Nature's Compass {naturescompass@1.15.2-1.8.5 CREATE_REGISTRIES}         good-nights-sleep (+dimensões)-1.15.2-1.0.1.jar Good Night's Sleep {goodnightsleep@1.0.1 CREATE_REGISTRIES}         BasicNetherOres-1.15.2-4.0.3.jar Basic Nether Ores {bno@4.0.3 CREATE_REGISTRIES}         DungeonCrawl (cria dungeons)-1.15.2-1.6.3.jar Dungeon Crawl {dungeoncrawl@1.6.3 CREATE_REGISTRIES}         MagicDoorknob (porta mágica q abre caminho)-1.15.2-0.0.3.185.jar Magic Doorknob {magic_doorknob@1.15.2-0.0.3.185 CREATE_REGISTRIES}         improvedwolves-1.1.1-mc1.15.2.jar Improved Wolves {improvedwolves@1.1.1 CREATE_REGISTRIES}         oceangems (minérios do oceano)-1.0.0_1.15.2.jar Ocean Gems {ocean_gems@1.0.0 CREATE_REGISTRIES}         guardvillagers (villagers guardas)-1.15.2-1.0.6.jar Guard Villagers {guardvillagers@1.0.6 CREATE_REGISTRIES}         bottleyourxp (coloca XP na garrafa)_1.15-1.2.jar Bottle Your Xp {bottleyourxp@1.2 CREATE_REGISTRIES}         notenoughdirt (dimensão de terra)-1.0.1-universal.jar Not Enough Dirt {dirt@1.0.1 CREATE_REGISTRIES}         Morpheus-1.15.2-4.2.50.jar Morpheus {morpheus@version CREATE_REGISTRIES}         travellersboots (+botas)-1.15.2-1.3.2.jar Traveller's Boots {travellersboots@1.3.1 CREATE_REGISTRIES}         venture-1.0.0-mc1.15.2.jar Venture {venture@1.0.0 CREATE_REGISTRIES}         StoneChest-1.15.2-1.0.0.jar Stone Chest {stonechest@1.0.0 CREATE_REGISTRIES}         JustEnoughResources-1.15.2-0.10.1.77.jar Just Enough Resources {jeresources@0.10.1.77 CREATE_REGISTRIES}         gemsplusplus (+ minérios)-1.6.1.jar GemsPlusPlus {gemsplusplus@V1.4.1 CREATE_REGISTRIES}         forge-1.15.2-31.2.13-universal.jar Forge {forge@31.2.13 CREATE_REGISTRIES}         JustNeeded-1.15.2-1.0 (+craftings inexistentes).jar Just Needed {justneeded@1.0 CREATE_REGISTRIES}         MysticalAgriculture-1.15.2-3.0.9.jar Mystical Agriculture {mysticalagriculture@3.0.9 CREATE_REGISTRIES}         ironchest (baús melhores)-1.15.2-10.0.3.jar Iron Chests {ironchest@1.15.2-10.0.1 CREATE_REGISTRIES}         forge-1.15.2-31.2.13-client.jar Minecraft {minecraft@1.15.2 CREATE_REGISTRIES}         crocmod (crocodilo)-1.15.2-31.1.631.5.1-11.jar Crocodile Mod {crocmod@1.15.2-31.1.631.5.1-11 CREATE_REGISTRIES}         theoneprobe (mostra itens do baú)-1.15-2.0.3.jar The One Probe {theoneprobe@1.15-2.0.3 CREATE_REGISTRIES}         Netherrocks (ferramentas e minérios adicionais do Nether)-1.15.2-2.1.3.4.jar SimpleOres:Netherrocks {netherrocks@1.15.2-2.1.3.4 CREATE_REGISTRIES}         MouseTweaks (organização pra pegar itens)-2.13-mc1.15.1.jar Mouse Tweaks {mousetweaks@2.13 CREATE_REGISTRIES}         compactores (+ minérios em 1 bloco)-1.15.2-2.1.2.jar Compact Ores {compactores@2.1.2 CREATE_REGISTRIES}         morevanillalib (mod q adiciona crafting de obsidian, papelada e end stone lisa)-1.15.2-1.2.2.jar MoreVanillaLib {morevanillalib@1.2.2 CREATE_REGISTRIES}         morevanillatools (+ferramentas)-1.15.2-2.1.jar MoreVanillaTools {morevanillatools@2.1 CREATE_REGISTRIES}         BiomesOPlenty (+ biomas)-1.15.2-10.0.0.363-universal.jar Biomes O' Plenty {biomesoplenty@1.15.2-10.0.0.363 CREATE_REGISTRIES}         ironfurnaces-1.15.2-2.0.4.jar Iron Furnaces {ironfurnaces@2.0.4 CREATE_REGISTRIES}         xercamod (vários itens adicionais)-1.15.2-2.5.jar Xerca Mod {xercamod@1.15.2-2.5 CREATE_REGISTRIES}         simplybackpacks (mochilas)-1.15.2-1.3.0.jar Simply Backpacks {simplybackpacks@1.15.2-1.3.0 CREATE_REGISTRIES}         JAHM+v1.2.3+[1.15.2] (+cabeças de mobs).jar Just Another Head Mod {justanotherheadmod@1.2.1 CREATE_REGISTRIES}         curios-FORGE-1.15.2-2.0.2.6.jar Curios API {curios@FORGE-1.15.2-2.0.2.6 CREATE_REGISTRIES}         Botania-r1.15-388.jar Botania {botania@r1.15-388 CREATE_REGISTRIES}         Patchouli-1.15.2-1.2-35.jar Patchouli {patchouli@1.15.2-1.2-35 CREATE_REGISTRIES}         The-End-Update-1.2.0.jar Minecraft End Update {minecraftendupdate@1.0.0 CREATE_REGISTRIES}         rats-5.3.2-1.15.2.jar Rats {rats@5.3.2 CREATE_REGISTRIES}         DoubleSlabs (slabs duplos diferentes)-1.15-2.4.5.jar Double Slabs {doubleslabs@2.4.5 CREATE_REGISTRIES}         backpacked-1.4.1-mc1.15.2.jar Backpacked {backpacked@1.4.1 CREATE_REGISTRIES}         libnonymous-1.15.2-1.1.1.5.jar Libnonymous {libnonymous@1.1.1.5 CREATE_REGISTRIES}         BonsaiTrees-2.1.2.6.jar Bonsai Trees 2 {bonsaitrees2@2.1.2.6 CREATE_REGISTRIES}         elevatorid-1.15.2-1.7.1.jar Elevator Mod {elevatorid@1.15.2-1.7.1 CREATE_REGISTRIES}         InventoryHud_1.15.1 (ver o inventário)-1.15.2.forge.2.5.jar Inventory HUD+(Forge edition) {inventoryhud@2.5 CREATE_REGISTRIES}         Gobber2 (ferramentas)-1.15.2-2.2.99.jar Gobber 2 {gobber2@2.2.99 CREATE_REGISTRIES}         tombstone (cria uma lápide ao morrer)-4.4.0-1.15.2.jar Corail Tombstone {tombstone@4.4.0 CREATE_REGISTRIES}         spidermod (mini aranhazinhas)-1.15.2-1.0.0-10.jar Spider Mod {spidermod@1.15.2-1.0.0-10 CREATE_REGISTRIES}         FastFurnace-1.15.1-3.0.0.jar FastFurnace {fastfurnace@3.0.0 CREATE_REGISTRIES}         furniture (decoração)-7.0.0-pre16-1.15.1.jar MrCrayfish's Furniture Mod {cfm@7.0.0-pre16 CREATE_REGISTRIES}         engineersdecor (decoração)-1.15.2-1.1.0-b1.jar Engineer's Decor {engineersdecor@1.1.0-b1 CREATE_REGISTRIES}         Aquaculture-1.15.2-2.0.16.jar Aquaculture 2 {aquaculture@1.15.2-2.0.16 CREATE_REGISTRIES}         betterbedrockgenerator-1.15.2-0.1.0.jar Better Bedrock Generator {betterbedrockgenerator@0.1.0 ERROR}         RingOfReturn (teletransporte pra cama)-1.15.2-1.0.13.jar Ring of Return {ring_of_return@1.0.12 CREATE_REGISTRIES}         MelonMod (guarda melancia tipo de snow)-1.15-1.5.1.jar Melon Golem {melongolem@1.14-1.5.0 CREATE_REGISTRIES}         Get-In-The-Bucket-Mod-1.15.2.jar Get In The Bucket Mod {getinthebucketmod@2.2.1 CREATE_REGISTRIES}         FastLeafDecay-v22.jar FastLeafDecay {fastleafdecay@v22 CREATE_REGISTRIES}         Disenchanting (desencantar)-forge_1.15.2-1.5.0.jar Disenchanting {disenchanting@1.5.0 CREATE_REGISTRIES}         NetherEx-1.15.2-4.0.0.jar NetherEx {netherex@4.0.0 CREATE_REGISTRIES}         LibraryEx-1.15.2-3.0.0.jar LibraryEx {libraryex@3.0.0 CREATE_REGISTRIES}     Launched Version: 1.15.2-forge-31.2.13     Backend library: LWJGL version 3.2.2 build 10     Backend API: Intel(R) HD Graphics 620 GL version 4.5.0 - Build 25.20.100.6373, Intel     GL Caps: Using framebuffer using OpenGL 3.0     Using VBOs: Yes     Is Modded: Definitely; Client brand changed to 'forge'     Type: Client (map_client.txt)     CPU: 4x Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz     OptiFine Version: OptiFine_1.15.2_HD_U_G1_pre16     OptiFine Build: 20200506-004910     Render Distance Chunks: 12     Mipmaps: 4     Anisotropic Filtering: 1     Antialiasing: 0     Multitexture: false     Shaders: null     OpenGlVersion: 4.5.0 - Build 25.20.100.6373     OpenGlRenderer: Intel(R) HD Graphics 620     OpenGlVendor: Intel     CpuCount: 4
    • Oh ok, you are overriding the vanilla block with your custom one in the registry, i missed that, my bad! What Draco18 suggested you should be fine
    • Hi, I'm currently trying to learn how to use capabilities. My requirement is as follows: I have a "relic" item (max stack size 1) in my player's inventory. Whenever a certain event happens (for now I'm using breaking a stone block as prototype), the "experience" of the item is increased. The experience must only be increased if the item is actually in the player's inventory, not just when it exists somewhere in the world e.g. a chest or on the ground.   My problem is that if I drop the item, it continues to gain experience when I break more blocks. When I try to debug and look at the player's inventory, I can see that after dropping the item the ItemStack in that slot is an Air item - but its delegate is my "relic" item, and it also apparently has inherited my "experience" capability from the dropped item??   Could anybody please help me to understand: what this delegate property is, how it is used and/or how it is affecting this situation why the Air itemstack has also been given my item's capabilities? (shouldn't my instanceof check stop that?)   I'm going to go ahead and assume I've set up the boilerplate capability bits&bobs wrong in some way, too (all the tutorials I could find were either out of date, or only dealt with simple cases for blocks/entities/tileentities and not items) - so if anybody could point out where that'd be great too   Thanks in advance!   (Note that because I have the following, this issue only occurs if I've got more than one of the item in the inventory and then dropped one of them before breaking the stone block; both the dropped and still-held relics continue to gain experience) if (player.inventory.hasAny(Set.of(MyMod.MINING_RELIC_ITEM.get())))   Relevant classes are as follows:   public class MiningRelicItem extends Item { ... @Override public ICapabilityProvider initCapabilities(ItemStack itemStack, @Nullable CompoundNBT nbt) { // To try to stop passing the capability to an Air item if our item is no longer in the inventory? Bah, didn't seem to help if (!itemStack.isEmpty()) { MyMod.LOGGER.info("MagicRelicItem just provided some kind of capability"); return new RelicExperienceCapabilityProvider(); } return null; } } public class CapabilityHandler { public static final ResourceLocation RELIC_EXP_CAP = new ResourceLocation(MyMod.MODID, "relic_exp"); @SubscribeEvent public void attachCapability(AttachCapabilitiesEvent<Item> event) { Item item = event.getObject().asItem(); if (item instanceof MiningRelicItem) { event.addCapability(RELIC_EXP_CAP, new RelicExperienceCapabilityProvider()); } } } public class RelicExperienceCapabilityProvider implements ICapabilitySerializable<INBT> { @CapabilityInject(IRelicExperienceCapability.class) public static Capability<IRelicExperienceCapability> RELIC_EXP_CAPABILITY = null; private final RelicExperienceCapability relicExperienceCapability = new RelicExperienceCapability(); private final RelicExperienceStorage relicExperienceStorage = new RelicExperienceStorage(); @Nonnull @Override public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nullable Direction side) { if (cap == RELIC_EXP_CAPABILITY) { return (LazyOptional<T>) LazyOptional.of(() -> relicExperienceCapability); } return LazyOptional.empty(); } @Override public INBT serializeNBT() { return relicExperienceStorage.writeNBT(RELIC_EXP_CAPABILITY, relicExperienceCapability, null); } @Override public void deserializeNBT(INBT nbt) { relicExperienceStorage.readNBT(RELIC_EXP_CAPABILITY, relicExperienceCapability, null, nbt); } } @Mod.EventBusSubscriber(modid = MyMod.MODID, bus = Mod.EventBusSubscriber.Bus.FORGE, value = Dist.CLIENT) public class ClientEvents { @SubscribeEvent public static void onBlockDestroyed(BlockEvent.BreakEvent breakEvent) { if (!breakEvent.isCanceled()) { if (breakEvent.getState().getBlock() == Blocks.STONE) { MyMod.LOGGER.info("Stone block broken."); PlayerEntity player = breakEvent.getPlayer(); if (player.inventory.hasAny(Set.of(MyMod.MINING_RELIC_ITEM.get()))) { MyMod.LOGGER.info("The dude is holding a relic"); final List<ItemStack> playerItems = Stream .concat(player.inventory.mainInventory.stream(), player.inventory.offHandInventory.stream()) .collect(Collectors.toList()); for (ItemStack i : playerItems) { IRelicExperienceCapability relicExperienceCapability = i.getCapability(RelicExperienceCapabilityProvider.RELIC_EXP_CAPABILITY).orElse(null); if (relicExperienceCapability != null) { relicExperienceCapability.addExp(5); MyMod.LOGGER.info("I just added 5 exp to a relic..."); MyMod.LOGGER.info(String.format("Current exp for this relic is: %d", relicExperienceCapability.getExp())); } } } } } } }  
  • Topics

  • Who's Online (See full list)