• Recently Browsing

    No registered users viewing this page.

  • Posts

    • 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 
    • Hi, I am trying to make that powered creepers could appear naturally in the world. I did it editing the NBT Tags of the spawning creepers but I wanted to do it in a more efficient way so I tried to change directly the DataManager powered parameter to true but it raise an error. Can you help me with this error or give me another way of doing it?   Here is my code: package com.srgnis.testia; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import net.minecraft.entity.Entity; import net.minecraft.entity.monster.CreeperEntity; import net.minecraft.nbt.CompoundNBT; import net.minecraft.network.datasync.DataParameter; import net.minecraft.network.datasync.DataSerializers; import net.minecraft.network.datasync.EntityDataManager; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingSpawnEvent.SpecialSpawn; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @Mod("testia") public class TestIA { private static final Logger LOGGER = LogManager.getLogger(); public static final String MOD_ID = "testia"; public static TestIA instance; private static final DataParameter<Boolean> POWERED = EntityDataManager.createKey(CreeperEntity.class, DataSerializers.BOOLEAN); public TestIA() { instance = this; MinecraftForge.EVENT_BUS.register(this); } @SubscribeEvent public void onEntitySpawn(SpecialSpawn event) { if(event.getWorld().isRemote()) { return; } Entity entity = event.getEntity(); if (entity instanceof CreeperEntity ) { // is a creeper if(Math.random() > 0.3) { return; } CreeperEntity centity = ((CreeperEntity) entity); //cast to CreeperEntity if( !centity.func_225509_J__()) { // is not powered centity.getDataManager().set(POWERED, true); // set the creeper to powered } } } }       Here is my logg: -- Head -- Thread: Render thread Stacktrace: at net.minecraft.network.datasync.DataSerializers$1.copyValue(DataSerializers.java:25) at net.minecraft.network.datasync.EntityDataManager$DataEntry.copy(EntityDataManager.java:299) at net.minecraft.network.datasync.EntityDataManager.getDirty(EntityDataManager.java:161) at net.minecraft.network.play.server.SEntityMetadataPacket.<init>(SEntityMetadataPacket.java:25) at net.minecraft.world.TrackedEntity.sendMetadata(TrackedEntity.java:265) at net.minecraft.world.TrackedEntity.tick(TrackedEntity.java:155) at net.minecraft.world.server.ChunkManager.tickEntityTracker(ChunkManager.java:998) at net.minecraft.world.server.ServerChunkProvider.func_217220_m(ServerChunkProvider.java:390) at net.minecraft.world.server.ServerChunkProvider.tick(ServerChunkProvider.java:328) at net.minecraft.world.server.ServerWorld.tick(ServerWorld.java:316) -- Affected level -- Details: All players: 1 total; [ServerPlayerEntity['Dev'/1, l='guardar', x=8.37, y=56.00, z=7.04]] Chunk stats: ServerChunkCache: 2209 Level dimension: DimensionType{minecraft:overworld} Level name: guardar Level seed: 2590508466852485413 Level generator: ID 01 - flat, ver 0. Features enabled: true Level generator options: {biome:"minecraft:desert",layers:[{block:"minecraft:bedrock",height:1b},{block:"minecraft:stone",height:3b},{block:"minecraft:sandstone",height:52b}],structures:{}} Level spawn location: World: (8,55,8), Chunk: (at 8,3,8 in 0,0; contains blocks 0,0,0 to 15,255,15), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511) Level time: 421 game time, 421 day time Known server brands: forge Level was modded: true Level storage version: 0x04ABD - Anvil Level weather: Rain time: 19098 (now: false), thunder time: 52778 (now: false) Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true Stacktrace: at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:883) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:818) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:120) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:659) at java.lang.Thread.run(Unknown Source) -- 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_241, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 315149192 bytes (300 MB) / 1173356544 bytes (1119 MB) up to 1890582528 bytes (1803 MB) CPUs: 4 JVM Flags: 1 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump ModLauncher: 5.0.0-milestone.4+67+b1a340b ModLauncher launch target: fmluserdevclient ModLauncher naming: mcp ModLauncher services: /eventbus-2.0.0-milestone.1-service.jar eventbus PLUGINSERVICE /forge-1.15.2-31.1.0_mapped_snapshot_20190719-1.14.3-launcher.jar object_holder_definalize PLUGINSERVICE /forge-1.15.2-31.1.0_mapped_snapshot_20190719-1.14.3-launcher.jar runtime_enum_extender PLUGINSERVICE /accesstransformers-2.0.0-milestone.1-shadowed.jar accesstransformer PLUGINSERVICE /forge-1.15.2-31.1.0_mapped_snapshot_20190719-1.14.3-launcher.jar capability_inject_definalize PLUGINSERVICE /forge-1.15.2-31.1.0_mapped_snapshot_20190719-1.14.3-launcher.jar runtimedistcleaner PLUGINSERVICE /forge-1.15.2-31.1.0_mapped_snapshot_20190719-1.14.3-launcher.jar fml TRANSFORMATIONSERVICE FML: 31.1 Forge: net.minecraftforge:31.1.0 FML Language Providers: javafml@31.1 minecraft@1 Mod List: client-extra.jar Minecraft {minecraft@1.15.2 DONE} forge-1.15.2-31.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar Forge {forge@31.1.0 DONE} main Test IA {testia@1.0 DONE} Player Count: 1 / 8; [ServerPlayerEntity['Dev'/1, l='guardar', x=8.37, y=56.00, z=7.04]] Data Packs: vanilla, mod:forge (incompatible), mod:testia Type: Integrated Server (map_client.txt) Is Modded: Definitely; Client brand changed to 'forge' [m[32m[14:32:06] [Render thread/INFO] [STDOUT/]: [net.minecraft.util.registry.Bootstrap:printToSYSOUT:109]: #@!@# Game crashed! Crash report saved to: #@!@# .\crash-reports\crash-2020-04-01_14.32.06-server.txt [m[1;31m[14:32:06] [Server thread/ERROR] [minecraft/ChunkSerializer]: An Entity type net.minecraft.entity.EntityType@1c00d406 has thrown an exception trying to write state. It will not persist. Report this to the mod author net.minecraft.crash.ReportedException: Saving entity NBT at net.minecraft.entity.Entity.writeWithoutTypeId(Entity.java:1548) ~[?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.entity.Entity.writeUnlessRemoved(Entity.java:1453) ~[?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.entity.Entity.writeUnlessPassenger(Entity.java:1469) ~[?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.world.chunk.storage.ChunkSerializer.write(ChunkSerializer.java:302) ~[?:?] {re:classloading} at net.minecraft.world.server.ChunkManager.func_219229_a(ChunkManager.java:688) ~[?:?] {re:classloading} at java.util.stream.ReferencePipeline$2$1.accept(Unknown Source) [?:1.8.0_241] {} at java.util.stream.ReferencePipeline$2$1.accept(Unknown Source) [?:1.8.0_241] {} at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source) [?:1.8.0_241] {} at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source) [?:1.8.0_241] {} at java.util.stream.AbstractPipeline.copyInto(Unknown Source) [?:1.8.0_241] {} at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) [?:1.8.0_241] {} at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source) [?:1.8.0_241] {} at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source) [?:1.8.0_241] {} at java.util.stream.AbstractPipeline.evaluate(Unknown Source) [?:1.8.0_241] {} at java.util.stream.ReferencePipeline.forEach(Unknown Source) [?:1.8.0_241] {} at net.minecraft.world.server.ChunkManager.save(ChunkManager.java:341) [?:?] {re:classloading} at net.minecraft.world.server.ServerChunkProvider.save(ServerChunkProvider.java:314) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.world.server.ServerWorld.save(ServerWorld.java:778) [?:?] {re:classloading} at net.minecraft.server.MinecraftServer.save(MinecraftServer.java:541) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.stopServer(MinecraftServer.java:584) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.integrated.IntegratedServer.stopServer(IntegratedServer.java:241) [?:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:698) [?:?] {re:classloading,pl:accesstransformer:B} at java.lang.Thread.run(Unknown Source) [?:1.8.0_241] {} Caused by: java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.Byte at net.minecraft.entity.MobEntity.isLeftHanded(MobEntity.java:1257) ~[?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.entity.MobEntity.writeAdditional(MobEntity.java:398) ~[?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.entity.monster.CreeperEntity.writeAdditional(CreeperEntity.java:101) ~[?:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.entity.Entity.writeWithoutTypeId(Entity.java:1527) ~[?:?] {re:classloading,pl:accesstransformer:B} ... 22 more  
  • Topics

  • Who's Online (See full list)