• Recently Browsing

    No registered users viewing this page.

  • Posts

    • Now i have this: @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD) public static class RegistryEvents { @SubscribeEvent public static void registerBlockColors(final ColorHandlerEvent.Block event) { BlockColors blockcolors = event.getBlockColors(); blockcolors.register((p_228059_0_, p_228059_1_, p_228059_2_, p_228059_3_) -> { return colorMultiplier(p_228059_0_.get(RedstoneWireBlock.POWER)); } , Blocks.REDSTONE_WIRE); } @OnlyIn(Dist.CLIENT) public static int colorMultiplier(int power) { float f = (float)power / 15.0F; float f1 = f * 0.6F + 0.4F; if (power == 0) { f1 = 0.3F; } float f2 = f * f * 0.7F - 0.5F; float f3 = f * f * 0.6F - 0.7F; if (f2 < 0.0F) { f2 = 0.0F; } if (f3 < 0.0F) { f3 = 0.0F; } int i = MathHelper.clamp((int)(f1 * 255.0F), (int)(f1 * 223.0F), 255); int j = MathHelper.clamp((int)(f2 * 255.0F), (int)(f2 * 223.0F), 255); int k = MathHelper.clamp((int)(f3 * 255.0F), (int)(f3 * 223.0F), 255); return -16777216 | i << 16 | j << 8 | k; } }   How do i now apply this instance of blockcolors to the redstone?
    • [01Apr2020 16:31:08.458] [Server thread/DEBUG] [net.minecraftforge.registries.ForgeRegistry/REGISTRYDUMP]: Registry Name: forge:moddimensions [01Apr2020 16:31:08.458] [Server thread/DEBUG] [net.minecraftforge.registries.ForgeRegistry/REGISTRYDUMP]: Registry Name: minecraft:dataserializers [01Apr2020 16:31:08.466] [Server thread/DEBUG] [net.minecraftforge.registries.ObjectHolderRegistry/REGISTRIES]: Applying holder lookups [01Apr2020 16:31:08.473] [Server thread/DEBUG] [net.minecraftforge.registries.ObjectHolderRegistry/REGISTRIES]: Holder lookups applied [01Apr2020 16:31:08.480] [Server thread/DEBUG] [net.minecraftforge.fml.server.ServerLifecycleHooks/CORE]: Generating PackInfo named mod:forge for mod file C:\Users\Mike\.gradle\caches\forge_gradle\minecraft_user_repo\net\minecraftforge\forge\1.14.4-28.2.0_mapped_snapshot_20190719-1.14.3\forge-1.14.4-28.2.0_mapped_snapshot_20190719-1.14.3.jar [01Apr2020 16:31:08.481] [Server thread/DEBUG] [net.minecraftforge.fml.server.ServerLifecycleHooks/CORE]: Generating PackInfo named mod:examplemod for mod file C:\Users\Mike\Documents\All My Mods\Test Mod\forge-1.14.4-28.2.0-mdk\build\resources\main [01Apr2020 16:31:08.483] [Server thread/INFO] [net.minecraft.resources.SimpleReloadableResourceManager/]: Reloading ResourceManager: Default, main, forge-1.14.4-28.2.0_mapped_snapshot_20190719-1.14.3.jar [01Apr2020 16:31:13.798] [Server thread/INFO] [net.minecraft.item.crafting.RecipeManager/]: Loaded 6 recipes [01Apr2020 16:31:17.587] [Server thread/INFO] [net.minecraft.advancements.AdvancementList/]: Loaded 811 advancements [01Apr2020 16:31:18.612] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: Preparing start region for dimension minecraft:overworld [01Apr2020 16:31:21.347] [Client thread/INFO] [net.minecraft.world.chunk.listener.LoggingChunkStatusListener/]: Preparing spawn area: 0% [01Apr2020 16:31:21.348] [Client thread/INFO] [net.minecraft.world.chunk.listener.LoggingChunkStatusListener/]: Preparing spawn area: 0% [01Apr2020 16:31:21.348] [Client thread/INFO] [net.minecraft.world.chunk.listener.LoggingChunkStatusListener/]: Preparing spawn area: 0% [01Apr2020 16:31:21.348] [Client thread/INFO] [net.minecraft.world.chunk.listener.LoggingChunkStatusListener/]: Preparing spawn area: 0% [01Apr2020 16:31:21.348] [Client thread/INFO] [net.minecraft.world.chunk.listener.LoggingChunkStatusListener/]: Preparing spawn area: 0% [01Apr2020 16:31:21.349] [Client thread/INFO] [net.minecraft.world.chunk.listener.LoggingChunkStatusListener/]: Preparing spawn area: 0% [01Apr2020 16:31:21.678] [Client thread/INFO] [net.minecraft.world.chunk.listener.LoggingChunkStatusListener/]: Preparing spawn area: 0% [01Apr2020 16:31:22.213] [Client thread/INFO] [net.minecraft.world.chunk.listener.LoggingChunkStatusListener/]: Preparing spawn area: 0% [01Apr2020 16:31:26.552] [Client thread/INFO] [net.minecraft.world.chunk.listener.LoggingChunkStatusListener/]: Preparing spawn area: 83% [01Apr2020 16:31:26.553] [Client thread/INFO] [net.minecraft.world.chunk.listener.LoggingChunkStatusListener/]: Preparing spawn area: 83% [01Apr2020 16:31:26.553] [Client thread/INFO] [net.minecraft.world.chunk.listener.LoggingChunkStatusListener/]: Preparing spawn area: 83% [01Apr2020 16:31:26.553] [Client thread/INFO] [net.minecraft.world.chunk.listener.LoggingChunkStatusListener/]: Preparing spawn area: 83% [01Apr2020 16:31:26.553] [Client thread/INFO] [net.minecraft.world.chunk.listener.LoggingChunkStatusListener/]: Preparing spawn area: 83% [01Apr2020 16:31:26.553] [Client thread/INFO] [net.minecraft.world.chunk.listener.LoggingChunkStatusListener/]: Preparing spawn area: 83% [01Apr2020 16:31:26.553] [Client thread/INFO] [net.minecraft.world.chunk.listener.LoggingChunkStatusListener/]: Preparing spawn area: 83% [01Apr2020 16:31:26.553] [Client thread/INFO] [net.minecraft.world.chunk.listener.LoggingChunkStatusListener/]: Preparing spawn area: 83% [01Apr2020 16:31:26.749] [Client thread/INFO] [net.minecraft.world.chunk.listener.LoggingChunkStatusListener/]: Preparing spawn area: 83% [01Apr2020 16:31:27.189] [Client thread/INFO] [net.minecraft.world.chunk.listener.LoggingChunkStatusListener/]: Preparing spawn area: 95% [01Apr2020 16:31:28.135] [Client thread/INFO] [net.minecraft.world.chunk.listener.LoggingChunkStatusListener/]: Preparing spawn area: 95% [01Apr2020 16:31:28.135] [Client thread/INFO] [net.minecraft.world.chunk.listener.LoggingChunkStatusListener/]: Preparing spawn area: 95% [01Apr2020 16:31:28.722] [Client thread/INFO] [net.minecraft.world.chunk.listener.LoggingChunkStatusListener/]: Preparing spawn area: 95% [01Apr2020 16:31:29.160] [Client thread/INFO] [net.minecraft.world.chunk.listener.LoggingChunkStatusListener/]: Preparing spawn area: 95% [01Apr2020 16:31:29.935] [Client thread/INFO] [net.minecraft.world.chunk.listener.LoggingChunkStatusListener/]: Preparing spawn area: 95% [01Apr2020 16:31:30.307] [Client thread/INFO] [net.minecraft.world.chunk.listener.LoggingChunkStatusListener/]: Preparing spawn area: 95% [01Apr2020 16:31:30.662] [Client thread/INFO] [net.minecraft.world.chunk.listener.LoggingChunkStatusListener/]: Preparing spawn area: 97% [01Apr2020 16:31:31.046] [Client thread/INFO] [net.minecraft.world.chunk.listener.LoggingChunkStatusListener/]: Time elapsed: 12431 ms [01Apr2020 16:31:32.014] [Server thread/DEBUG] [net.minecraftforge.common.DimensionManager/DIMS]: Queueing dimension -1 to unload [01Apr2020 16:31:32.014] [Server thread/DEBUG] [net.minecraftforge.common.DimensionManager/DIMS]: Queueing dimension 1 to unload [01Apr2020 16:31:32.029] [Server thread/DEBUG] [net.minecraftforge.common.DimensionManager/DIMS]: Unloading dimension -1 [01Apr2020 16:31:32.036] [Server thread/INFO] [net.minecraft.world.server.ChunkManager/]: ThreadedAnvilChunkStorage (DIM-1): All chunks are saved [01Apr2020 16:31:32.037] [Server thread/DEBUG] [net.minecraftforge.common.DimensionManager/DIMS]: Unloading dimension 1 [01Apr2020 16:31:32.038] [Server thread/INFO] [net.minecraft.world.server.ChunkManager/]: ThreadedAnvilChunkStorage (DIM1): All chunks are saved [01Apr2020 16:31:38.184] [Server thread/WARN] [net.minecraft.server.MinecraftServer/]: Can't keep up! Is the server overloaded? Running 2135ms or 42 ticks behind [01Apr2020 16:31:40.679] [Netty Local Client IO #0/DEBUG] [net.minecraftforge.fml.network.FMLHandshakeHandler/FMLHANDSHAKE]: Starting local connection. [01Apr2020 16:31:42.038] [Netty Server IO #1/DEBUG] [net.minecraftforge.fml.network.FMLHandshakeHandler/FMLHANDSHAKE]: Starting local connection. [01Apr2020 16:31:42.387] [Server thread/DEBUG] [net.minecraftforge.fml.network.FMLHandshakeHandler/FMLHANDSHAKE]: Sending ticking packet info 'net.minecraftforge.fml.network.FMLHandshakeMessages$S2CModList' to 'fml:handshake' sequence 0 [01Apr2020 16:31:42.425] [Server thread/DEBUG] [net.minecraftforge.fml.network.FMLHandshakeHandler/FMLHANDSHAKE]: Sending ticking packet info 'Config forge-server.toml' to 'fml:handshake' sequence 1 [01Apr2020 16:31:42.607] [Netty Local Client IO #0/DEBUG] [net.minecraftforge.fml.network.FMLLoginWrapper/FMLHANDSHAKE]: Recieved login wrapper packet event for channel fml:handshake with index 0 [01Apr2020 16:31:42.625] [Netty Local Client IO #0/DEBUG] [net.minecraftforge.fml.network.FMLHandshakeHandler/FMLHANDSHAKE]: Logging into server with mod list [minecraft, forge, examplemod] [01Apr2020 16:31:42.627] [Netty Local Client IO #0/DEBUG] [net.minecraftforge.fml.network.NetworkRegistry/NETREGISTRY]: Channel 'fml:loginwrapper' : Version test of 'FML2' from server : ACCEPTED [01Apr2020 16:31:42.627] [Netty Local Client IO #0/DEBUG] [net.minecraftforge.fml.network.NetworkRegistry/NETREGISTRY]: Channel 'fml:handshake' : Version test of 'FML2' from server : ACCEPTED [01Apr2020 16:31:42.627] [Netty Local Client IO #0/DEBUG] [net.minecraftforge.fml.network.NetworkRegistry/NETREGISTRY]: Channel 'minecraft:unregister' : Version test of 'FML2' from server : ACCEPTED [01Apr2020 16:31:42.627] [Netty Local Client IO #0/DEBUG] [net.minecraftforge.fml.network.NetworkRegistry/NETREGISTRY]: Channel 'fml:play' : Version test of 'FML2' from server : ACCEPTED [01Apr2020 16:31:42.628] [Netty Local Client IO #0/DEBUG] [net.minecraftforge.fml.network.NetworkRegistry/NETREGISTRY]: Channel 'minecraft:register' : Version test of 'FML2' from server : ACCEPTED [01Apr2020 16:31:42.628] [Netty Local Client IO #0/DEBUG] [net.minecraftforge.fml.network.NetworkRegistry/NETREGISTRY]: Accepting channel list from server [01Apr2020 16:31:42.631] [Netty Local Client IO #0/DEBUG] [net.minecraftforge.fml.network.FMLLoginWrapper/FMLHANDSHAKE]: Dispatching wrapped packet reply for channel fml:handshake with index 0 [01Apr2020 16:31:42.633] [Netty Server IO #1/DEBUG] [net.minecraftforge.fml.network.FMLLoginWrapper/FMLHANDSHAKE]: Recieved login wrapper packet event for channel fml:handshake with index 0 [01Apr2020 16:31:42.634] [Netty Server IO #1/DEBUG] [net.minecraftforge.fml.network.FMLHandshakeHandler/FMLHANDSHAKE]: Received client indexed reply 0 of type net.minecraftforge.fml.network.FMLHandshakeMessages$C2SModListReply [01Apr2020 16:31:42.635] [Netty Server IO #1/DEBUG] [net.minecraftforge.fml.network.FMLHandshakeHandler/FMLHANDSHAKE]: Received client connection with modlist [minecraft, forge, examplemod] [01Apr2020 16:31:42.635] [Netty Server IO #1/DEBUG] [net.minecraftforge.fml.network.NetworkRegistry/NETREGISTRY]: Channel 'fml:loginwrapper' : Version test of 'FML2' from client : ACCEPTED [01Apr2020 16:31:42.636] [Netty Server IO #1/DEBUG] [net.minecraftforge.fml.network.NetworkRegistry/NETREGISTRY]: Channel 'fml:handshake' : Version test of 'FML2' from client : ACCEPTED [01Apr2020 16:31:42.636] [Netty Server IO #1/DEBUG] [net.minecraftforge.fml.network.NetworkRegistry/NETREGISTRY]: Channel 'minecraft:unregister' : Version test of 'FML2' from client : ACCEPTED [01Apr2020 16:31:42.636] [Netty Server IO #1/DEBUG] [net.minecraftforge.fml.network.NetworkRegistry/NETREGISTRY]: Channel 'fml:play' : Version test of 'FML2' from client : ACCEPTED [01Apr2020 16:31:42.636] [Netty Local Client IO #0/DEBUG] [net.minecraftforge.fml.network.FMLHandshakeHandler/FMLHANDSHAKE]: Accepted server connection [01Apr2020 16:31:42.636] [Netty Server IO #1/DEBUG] [net.minecraftforge.fml.network.NetworkRegistry/NETREGISTRY]: Channel 'minecraft:register' : Version test of 'FML2' from client : ACCEPTED [01Apr2020 16:31:42.636] [Netty Server IO #1/DEBUG] [net.minecraftforge.fml.network.NetworkRegistry/NETREGISTRY]: Accepting channel list from client [01Apr2020 16:31:42.636] [Netty Server IO #1/DEBUG] [net.minecraftforge.fml.network.FMLHandshakeHandler/FMLHANDSHAKE]: Accepted client connection mod list [01Apr2020 16:31:42.637] [Netty Local Client IO #0/DEBUG] [net.minecraftforge.fml.network.FMLHandshakeHandler/REGISTRIES]: Expecting 19 registries: [minecraft:recipe_serializer, minecraft:sound_event, minecraft:particle_type, minecraft:villager_profession, minecraft:item, minecraft:potion, minecraft:block_entity_type, minecraft:block, minecraft:mob_effect, minecraft:stat_type, forge:moddimensions, minecraft:biome, minecraft:menu, minecraft:enchantment, minecraft:motive, minecraft:feature, minecraft:dataserializers, minecraft:fluid, minecraft:entity_type] [01Apr2020 16:31:42.639] [Netty Local Client IO #0/DEBUG] [net.minecraftforge.fml.network.FMLLoginWrapper/FMLHANDSHAKE]: Recieved login wrapper packet event for channel fml:handshake with index 1 [01Apr2020 16:31:42.976] [Netty Local Client IO #0/DEBUG] [net.minecraftforge.fml.network.FMLHandshakeHandler/FMLHANDSHAKE]: Received config sync from server [01Apr2020 16:31:42.976] [Netty Local Client IO #0/DEBUG] [net.minecraftforge.fml.network.FMLLoginWrapper/FMLHANDSHAKE]: Dispatching wrapped packet reply for channel fml:handshake with index 1 [01Apr2020 16:31:42.990] [Netty Server IO #1/DEBUG] [net.minecraftforge.fml.network.FMLLoginWrapper/FMLHANDSHAKE]: Recieved login wrapper packet event for channel fml:handshake with index 1 [01Apr2020 16:31:42.990] [Netty Server IO #1/DEBUG] [net.minecraftforge.fml.network.FMLHandshakeHandler/FMLHANDSHAKE]: Received client indexed reply 1 of type net.minecraftforge.fml.network.FMLHandshakeMessages$C2SAcknowledge [01Apr2020 16:31:42.990] [Netty Server IO #1/DEBUG] [net.minecraftforge.fml.network.FMLHandshakeHandler/FMLHANDSHAKE]: Received acknowledgement from client [01Apr2020 16:31:42.998] [Server thread/DEBUG] [net.minecraftforge.fml.network.FMLHandshakeHandler/FMLHANDSHAKE]: Handshake complete! [01Apr2020 16:31:43.033] [Netty Local Client IO #0/INFO] [net.minecraftforge.fml.network.NetworkHooks/]: Connected to a modded server. [01Apr2020 16:31:43.659] [Server thread/INFO] [net.minecraft.server.management.PlayerList/]: Dev[local:E:0109784b] logged in with entity id 267 at (170.30000001192093, 37.0, 15.801513730088436) [01Apr2020 16:31:43.878] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: Dev joined the game [01Apr2020 16:31:45.423] [Client thread/DEBUG] [net.minecraftforge.fml.network.FMLLoginWrapper/FMLHANDSHAKE]: Recieved login wrapper packet event for channel fml:handshake with index -1 [01Apr2020 16:31:45.424] [Client thread/ERROR] [net.minecraftforge.fml.network.simple.IndexedMessageCodec/SIMPLENET]: Received empty payload on channel fml:handshake [01Apr2020 16:31:46.645] [Server thread/INFO] [net.minecraft.server.integrated.IntegratedServer/]: Saving and pausing game... [01Apr2020 16:31:47.044] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: Saving chunks for level 'New World'/minecraft:overworld [01Apr2020 16:31:47.260] [Client thread/INFO] [net.minecraft.advancements.AdvancementList/]: Loaded 0 advancements [01Apr2020 16:31:49.117] [pool-3-thread-1/WARN] [com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService/]: Couldn't look up profile properties for com.mojang.authlib.GameProfile@49b65e8b[id=380df991-f603-344c-a090-369bad2a924a,name=Dev,properties={},legacy=false] com.mojang.authlib.exceptions.AuthenticationException: The client has sent too many requests within a certain amount of time at com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService.makeRequest(YggdrasilAuthenticationService.java:79) ~[authlib-1.5.25.jar:?] at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService.fillGameProfile(YggdrasilMinecraftSessionService.java:180) ~[authlib-1.5.25.jar:?] at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService$1.load(YggdrasilMinecraftSessionService.java:60) ~[authlib-1.5.25.jar:?] at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService$1.load(YggdrasilMinecraftSessionService.java:57) ~[authlib-1.5.25.jar:?] at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3716) ~[guava-21.0.jar:?] at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2424) ~[guava-21.0.jar:?] at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2298) ~[guava-21.0.jar:?] at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2211) ~[guava-21.0.jar:?] at com.google.common.cache.LocalCache.get(LocalCache.java:4154) ~[guava-21.0.jar:?] at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4158) ~[guava-21.0.jar:?] at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:5147) ~[guava-21.0.jar:?] at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:5153) ~[guava-21.0.jar:?] at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService.fillProfileProperties(YggdrasilMinecraftSessionService.java:170) ~[authlib-1.5.25.jar:?] at net.minecraft.client.Minecraft.getProfileProperties(Minecraft.java:1855) ~[?:?] at net.minecraft.client.resources.SkinManager.func_210275_a(SourceFile:111) ~[?:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:514) [?:?] at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264) [?:?] at java.util.concurrent.FutureTask.run(FutureTask.java) [?:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?] at java.lang.Thread.run(Thread.java:844) [?:?] [01Apr2020 16:31:52.186] [Server thread/DEBUG] [net.minecraftforge.fml.FMLWorldPersistenceHook/WP]: Gathering id map for writing to world save New World [01Apr2020 16:31:52.222] [Server thread/DEBUG] [net.minecraftforge.fml.network.FMLLoginWrapper/FMLHANDSHAKE]: Recieved login wrapper packet event for channel fml:handshake with index -1 [01Apr2020 16:31:52.222] [Server thread/ERROR] [net.minecraftforge.fml.network.simple.IndexedMessageCodec/SIMPLENET]: Received empty payload on channel fml:handshake [01Apr2020 16:32:13.336] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: [Dev: Gave 1 [block.examplemod.firstblock] to Dev] [01Apr2020 16:32:13.363] [Client thread/INFO] [net.minecraft.client.gui.NewChatGui/]: [CHAT] Gave 1 [block.examplemod.firstblock] to Dev [01Apr2020 16:32:30.101] [Server thread/INFO] [net.minecraft.server.integrated.IntegratedServer/]: Saving and pausing game... [01Apr2020 16:32:30.109] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: Saving chunks for level 'New World'/minecraft:overworld [01Apr2020 16:32:30.814] [Server thread/DEBUG] [net.minecraftforge.fml.FMLWorldPersistenceHook/WP]: Gathering id map for writing to world save New World [01Apr2020 16:32:30.918] [Server thread/INFO] [net.minecraft.network.play.ServerPlayNetHandler/]: Dev lost connection: Disconnected [01Apr2020 16:32:30.919] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: Dev left the game [01Apr2020 16:32:30.928] [Server thread/INFO] [net.minecraft.network.play.ServerPlayNetHandler/]: Stopping singleplayer server as player logged out [01Apr2020 16:32:31.071] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: Stopping server [01Apr2020 16:32:31.075] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: Saving players [01Apr2020 16:32:31.075] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: Saving worlds [01Apr2020 16:32:31.076] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: Saving chunks for level 'New World'/minecraft:overworld [01Apr2020 16:32:31.733] [Server thread/INFO] [net.minecraft.world.server.ChunkManager/]: ThreadedAnvilChunkStorage (New World): All chunks are saved [01Apr2020 16:32:31.759] [Server thread/DEBUG] [net.minecraftforge.fml.FMLWorldPersistenceHook/WP]: Gathering id map for writing to world save New World [01Apr2020 16:32:31.781] [Server thread/INFO] [net.minecraft.world.server.ChunkManager/]: ThreadedAnvilChunkStorage (New World): All chunks are saved [01Apr2020 16:32:32.816] [Client thread/INFO] [net.minecraft.client.Minecraft/]: Stopping!
    • Please post your debug log as described in the EAQ. It would also help to see your code in a github repository
    • I have made a custom boom item and I would like to add default NBT data: the author the title and the pages.   This is my code:  package com.scottbot.testmod.objects.items; import com.scottbot.testmod.TestMod; import com.scottbot.testmod.gui.ModBookReadScreen; import net.minecraft.client.Minecraft; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.WrittenBookItem; import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.ListNBT; import net.minecraft.nbt.StringNBT; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import net.minecraft.util.StringUtils; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TranslationTextComponent; import net.minecraft.world.World; import javax.annotation.Nullable; import java.util.List; public class ModBookItem extends WrittenBookItem { public ModBookItem(Properties builder) { super(builder); ItemStack stack = new ItemStack(this); TestMod.LOGGER.info("tagging"); addTags(stack); } public void addTags(ItemStack stack) { CompoundNBT nbt = stack.getOrCreateTag(); TestMod.LOGGER.info(stack.getTag()); ListNBT bookPages = new ListNBT(); String[] values = {"test", "test2", "test3", "test4"}; for (String text : values) { bookPages.add(StringNBT.valueOf("{\"text\":\"" + text + "}\""));} nbt.put("pages", bookPages); nbt.putString("author", "Test Author"); nbt.putString("title", "Test Title"); stack.setTag(nbt); TestMod.LOGGER.info(stack.hasTag()); TestMod.LOGGER.info(stack.getTag()); } @Override public void onCreated(ItemStack stack, World worldIn, PlayerEntity playerIn) { addTags(stack); super.onCreated(stack, worldIn, playerIn); } @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) { ItemStack stack = playerIn.getHeldItem(handIn); Minecraft.getInstance().displayGuiScreen(new ModBookReadScreen(new ModBookReadScreen.WrittenBookInfo(stack))); return ActionResult.resultSuccess(stack); } @Override public void addInformation(ItemStack stack, @Nullable World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) { TestMod.LOGGER.info(stack.getTag()); TestMod.LOGGER.info(stack.hasTag()); if (stack.hasTag()) { CompoundNBT compoundnbt = stack.getTag(); TestMod.LOGGER.info(compoundnbt); assert compoundnbt != null; String s = compoundnbt.getString("author"); TestMod.LOGGER.info(s); if (!StringUtils.isNullOrEmpty(s)) { tooltip.add((new TranslationTextComponent("book.byAuthor", s)).applyTextStyle(TextFormatting.GRAY)); } } }   When I start the game, it logs that the tags were added:    But when I actually get it from the creative menu it doesn't have the author tag and when I open the book it says invalid tag.   Any help would be appreciated, thanks!    
    • HI guys  i have Error my block doesn't drop the itemfirstblock.json 
  • Topics

  • Who's Online (See full list)