Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

LeeCrafts

Members
  • Posts

    49
  • Joined

  • Last visited

Everything posted by LeeCrafts

  1. Yea I dunno if it’s a bug or expected behavior, it worked for the 1.18.2 version of my mod though (it’s been a while since I last tested for that version so maybe I should try again lol). Anyways, my GitHub repo has like >50 commits…so it’s kind of a good idea to do a shallow clone. 😅 .git keeps track of all history by default.
  2. My bad I that I wasn’t clear enough. It does work fine when I try to join the server as Dev—that is, using ./gradlew runClient. But the error appears when I run a Minecraft launcher with the mod’s .jar file (e.g. putting it in the mods folder). Then when I join the localhost server using an account like Lee_Crafts, I get kicked out instantly and receive those aforementioned errors.
  3. Update: I've tried /op-ing my account and now I have a new error: Internal Exception: io.netty.handler.codec.DecoderException: java.lang.IndexOutOfBoundsException: readerIndex(17768) + length(1) exceeds writerIndex(17768): UnpooledHeapByteBuf(ridx: 17768, widx: 17768, cap: 17768/17768) What’s more confusing is that it worked for 1.18.2, before I updated my mod for 1.19.
  4. Hmm, to be honest I do not know how I would reproduce this. But if this worked for you, then it must be a problem from my end. I guess I’ll just re-clone my project and try again
  5. Log: https://mclo.gs/deeEs09 Error message: Internal Exception: io.netty.handler.codec.DecoderException: VarIntArray with size 112 is bigger than allowed 6 I have no clue how this error is occurring. It happens when I attempt join a dedicated server for my mod (i.e. ./gradlew runServer) via my personal Minecraft account. But strangely enough, I don't experience any issues when I join the server using ./gradlew runClient on another Terminal window. I'm not even sure if this issue relates to my mod at all.
  6. I am personally having trouble with this as well. Like with 1.18.2, I only want simple text to be displayed on the middle of the screen. But I am unsure what Component methods I should use. EDIT: The code below worked for me. player.displayClientMessage(Component.literal(message), true);
  7. I have now tried the other method of downloading the newest MDK for 1.19 and copying the src files over. So far I have tried building without ParchmentMC, and the build succeeded in ~4 mins. But strangely enough, another task "createMcpToSrg" was running for two hours (I eventually stopped it because I felt like it was going nowhere), and it kept printing that same message: 1:44:14 PM: Executing ':createMcpToSrg :createMcpToSrg :createMcpToSrg'... > Configure project : Java: 17.0.2, JVM: 17.0.2+8-LTS-86 (Oracle Corporation), Arch: x86_64 WARNING: This project is configured to use the official obfuscation mappings provided by Mojang. These mapping fall under their associated license, you should be fully aware of this license. For the latest license text, refer below, or the reference copy here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md, You can hide this warning by running the `hideOfficialWarningUntilChanged` task WARNING: (c) 2020 Microsoft Corporation. These mappings are provided "as-is" and you bear the risk of using them. You may copy and use the mappings for development purposes, but you may not redistribute the mappings complete and unmodified. Microsoft makes no warranties, express or implied, with respect to the mappings provided here. Use and modification of this document or the source code (in any form) of Minecraft: Java Edition is governed by the Minecraft End User License Agreement available at https://account.mojang.com/documents/minecraft_eula. /Users/wsl/Downloads/example mod/build/tmp/expandedArchives/forge-1.19-41.0.45_mapped_official_1.19-sources.jar_e563b5d4e301a8df6a6751389455afd1/net/minecraft/world/level/LevelReader.java:185: warning: [dep-ann] deprecated item is not annotated with @Deprecated default boolean isAreaLoaded(BlockPos center, int range) { ^ /Users/wsl/Downloads/example mod/build/tmp/expandedArchives/forge-1.19-41.0.45_mapped_official_1.19-sources.jar_e563b5d4e301a8df6a6751389455afd1/net/minecraft/network/FriendlyByteBuf.java:104: warning: [dep-ann] deprecated item is not annotated with @Deprecated public <T> T readWithCodec(Codec<T> p_130058_) { ^ /Users/wsl/Downloads/example mod/build/tmp/expandedArchives/forge-1.19-41.0.45_mapped_official_1.19-sources.jar_e563b5d4e301a8df6a6751389455afd1/net/minecraft/network/FriendlyByteBuf.java:114: warning: [dep-ann] deprecated item is not annotated with @Deprecated public <T> void writeWithCodec(Codec<T> p_130060_, T p_130061_) { ^ /Users/wsl/Downloads/example mod/build/tmp/expandedArchives/forge-1.19-41.0.45_mapped_official_1.19-sources.jar_e563b5d4e301a8df6a6751389455afd1/net/minecraft/world/level/biome/BiomeSpecialEffects.java:216: warning: [removal] BIOME_INFO_NOISE in Biome has been deprecated and marked for removal double d0 = Biome.BIOME_INFO_NOISE.getValue(p_48097_ * 0.0225D, p_48098_ * 0.0225D, false); ^ /Users/wsl/Downloads/example mod/build/tmp/expandedArchives/forge-1.19-41.0.45_mapped_official_1.19-sources.jar_e563b5d4e301a8df6a6751389455afd1/net/minecraft/world/level/levelgen/structure/pieces/StructurePiecesBuilder.java:48: warning: [dep-ann] deprecated item is not annotated with @Deprecated public void moveInsideHeights(RandomSource p_226971_, int p_226972_, int p_226973_) { ^ /Users/wsl/Downloads/example mod/build/tmp/expandedArchives/forge-1.19-41.0.45_mapped_official_1.19-sources.jar_e563b5d4e301a8df6a6751389455afd1/net/minecraft/world/level/levelgen/placement/NoiseBasedCountPlacement.java:34: warning: [removal] BIOME_INFO_NOISE in Biome has been deprecated and marked for removal double d0 = Biome.BIOME_INFO_NOISE.getValue((double)p_226353_.getX() / this.noiseFactor, (double)p_226353_.getZ() / this.noiseFactor, false); ^ /Users/wsl/Downloads/example mod/build/tmp/expandedArchives/forge-1.19-41.0.45_mapped_official_1.19-sources.jar_e563b5d4e301a8df6a6751389455afd1/net/minecraft/world/level/levelgen/placement/NoiseThresholdCountPlacement.java:34: warning: [removal] BIOME_INFO_NOISE in Biome has been deprecated and marked for removal double d0 = Biome.BIOME_INFO_NOISE.getValue((double)p_226356_.getX() / 200.0D, (double)p_226356_.getZ() / 200.0D, false); ^ Expiring Daemon because JVM heap space is exhausted Daemon will be stopped at the end of the build after running out of JVM memory Expiring Daemon because JVM heap space is exhausted Expiring Daemon because JVM heap space is exhausted Expiring Daemon because JVM heap space is exhausted Expiring Daemon because JVM heap space is exhausted Expiring Daemon because JVM heap space is exhausted Expiring Daemon because JVM heap space is exhausted Expiring Daemon because JVM heap space is exhausted Expiring Daemon because JVM heap space is exhausted Expiring Daemon because JVM heap space is exhausted Expiring Daemon because JVM heap space is exhausted Expiring Daemon because JVM heap space is exhausted Expiring Daemon because JVM heap space is exhausted Expiring Daemon because JVM heap space is exhausted Expiring Daemon because JVM heap space is exhausted Expiring Daemon because JVM heap space is exhausted Expiring Daemon because JVM heap space is exhausted Expiring Daemon because JVM heap space is exhausted Expiring Daemon because JVM heap space is exhausted Expiring Daemon because JVM heap space is exhausted Expiring Daemon because JVM heap space is exhausted Expiring Daemon because JVM heap space is exhausted Expiring Daemon because JVM heap space is exhausted Expiring Daemon because JVM heap space is exhausted Expiring Daemon because JVM heap space is exhausted Expiring Daemon because JVM heap space is exhausted Expiring Daemon because JVM heap space is exhausted Expiring Daemon because JVM heap space is exhausted Expiring Daemon because JVM heap space is exhausted Expiring Daemon because JVM heap space is exhausted Expiring Daemon because JVM heap space is exhausted Expiring Daemon because JVM heap space is exhausted Expiring Daemon because JVM heap space is exhausted Expiring Daemon because JVM heap space is exhausted Expiring Daemon because JVM heap space is exhausted Expiring Daemon because JVM heap space is exhausted Expiring Daemon because JVM heap space is exhausted Expiring Daemon because JVM heap space is exhausted Expiring Daemon because JVM heap space is exhausted Expiring Daemon because JVM heap space is exhausted Should I be worried about this? Currently my game runs without issue.
  8. My changes: buildscript { repositories { maven { url = 'https://maven.minecraftforge.net' } // maven { url = 'https://maven.parchmentmc.org' } mavenCentral() } dependencies { classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true // classpath 'org.parchmentmc:librarian:1.+' } } plugins { id 'eclipse' id 'maven-publish' } apply plugin: 'net.minecraftforge.gradle' //apply plugin: 'org.parchmentmc.librarian.forgegradle' version = '1.18.2-0.0.1' group = 'com.leecrafts.examplemod' archivesBaseName = 'examplemod' java.toolchain.languageVersion = JavaLanguageVersion.of(17) println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}" minecraft { mappings channel: 'official', version: '1.19' ... } ... Output still has same error (but somehow the build is "successful"): https://pastebin.com/YhPZpgaf
  9. Hello, I am trying to update my mod to 1.19 by changing some parameters in the build.gradle file, but the output starts repeatedly printing "Expiring Daemon because JVM heap space is exhausted" upon build. It did not seem to matter when I increased my IDE maximum heap size or my shared build process heap size (e.g. to 4GB), which has left me quite confused. Here is my build.gradle: buildscript { repositories { maven { url = 'https://maven.minecraftforge.net' } maven { url = 'https://maven.parchmentmc.org' } mavenCentral() } dependencies { classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true classpath 'org.parchmentmc:librarian:1.+' } } plugins { id 'eclipse' id 'maven-publish' } apply plugin: 'net.minecraftforge.gradle' apply plugin: 'org.parchmentmc.librarian.forgegradle' version = '1.18.2-0.0.1' group = 'com.leecrafts.examplemod' archivesBaseName = 'examplemod' java.toolchain.languageVersion = JavaLanguageVersion.of(17) println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}" minecraft { mappings channel: 'parchment', version: '1.18.2-2022.03.13-1.19' runs { client { workingDirectory project.file('run') property 'forge.logging.markers', 'REGISTRIES' property 'forge.logging.console.level', 'debug' property 'forge.enabledGameTestNamespaces', 'examplemod' mods { examplemod { source sourceSets.main } } } server { workingDirectory project.file('run') property 'forge.logging.markers', 'REGISTRIES' property 'forge.logging.console.level', 'debug' property 'forge.enabledGameTestNamespaces', 'examplemod' mods { examplemod { source sourceSets.main } } } gameTestServer { workingDirectory project.file('run') property 'forge.logging.markers', 'REGISTRIES' property 'forge.logging.console.level', 'debug' property 'forge.enabledGameTestNamespaces', 'examplemod' mods { examplemod { source sourceSets.main } } } data { workingDirectory project.file('run') property 'forge.logging.markers', 'REGISTRIES' property 'forge.logging.console.level', 'debug' args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') mods { examplemod { source sourceSets.main } } } } } sourceSets.main.resources { srcDir 'src/generated/resources' } repositories { } dependencies { minecraft 'net.minecraftforge:forge:1.19-41.0.35' } jar { manifest { attributes([ "Specification-Title" : "examplemod", "Specification-Vendor" : "examplemodsareus", "Specification-Version" : "1", // We are version 1 of ourselves "Implementation-Title" : project.name, "Implementation-Version" : project.jar.archiveVersion, "Implementation-Vendor" : "examplemodsareus", "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") ]) } } jar.finalizedBy('reobfJar') publishing { publications { mavenJava(MavenPublication) { artifact jar } } repositories { maven { url "file://${project.projectDir}/mcmodsrepo" } } } tasks.withType(JavaCompile).configureEach { options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation } And here is the (very long) output when I run Gradle build: https://pastebin.com/bz2f3aGZ Is there anything else I need to do to fix this?
  10. Solved. I needed to change the player's animationSpeed upon handling a RenderLivingEvent event.
  11. I am trying to implement a goofy mechanic in which--when a player tries to run--it runs in place for like 1 second before taking off with greater speed. Currently I am able to cancel the player's movement temporarily, but the player does not display a running animation (i.e. arms and legs are not swinging) while being "frozen." Is there any way to make a player look like its running in place without having to manually render custom animations?
  12. I want to give a player a status effect whenever it presses a certain key. This was my first attempt: @SubscribeEvent public static void pressCKey(InputEvent.KeyInputEvent event) { LocalPlayer localPlayer = Minecraft.getInstance().player; if (localPlayer != null && event.getKey() == 67 && event.getAction() == GLFW.GLFW_PRESS) { if (localPlayer.getActiveEffectsMap() != null) localPlayer.addEffect(new MobEffectInstance(MobEffects.MOVEMENT_SPEED, 1000)); } } I quickly realized this didn't work because it was adding the effect to the client-side player (LocalPlayer), and not the server-side player. I then searched through some older forums and found out that I would need to send a packet to the server whenever a key is pressed. There was a vanilla packet called ServerboundKeyPacket, but it confused me when I saw its constructor. I am unsure if this packet is the right one to use because it apparently does not consider which player pressed the key. Should I just use a custom packet instead?
  13. Bump. Just wanna make sure I'm doing this memory leak prevention correctly.
  14. Learning the basics of Java is essential. There are a lot of good tutorials out there (and this is a great starting point), but without knowing Java...there's not much you can do. Good luck on your modding journey.
  15. Got the rotation working. I had to look at LivingEntityRenderer#render and setupRotations a little more closely, and I realized that I needed to change the custom entity's yBodyRot and yBodyRotO. private static boolean renderingCustomEntity = false; private static CustomEntity customEntity; private static void refreshCustomEntity(LocalPlayer localPlayer, LivingEntity livingEntity) { // If the level changes, remove the custom entity by assigning its reference to a new custom entity. // The previous custom entity will eventually be garbage collected. if (customEntity == null || customEntity.level != livingEntity.level) { customEntity = ModEntities.CUSTOM_ENTITY.get().create(localPlayer.clientLevel); } } @SubscribeEvent public static void replaceMobModel(RenderLivingEvent.Pre<LivingEntity, EntityModel<LivingEntity>> event) { LocalPlayer localPlayer = Minecraft.getInstance().player; if (localPlayer != null && event.getEntity() instanceof Mob mob) { if (/* put your own condition here */) { if (!renderingCustomEntity) { try { renderingCustomEntity = true; event.setCanceled(true); refreshCustomEntity(localPlayer, mob); // (truth be told, my custom entity does not have a "head", so these lines aren't needed) // customEntity.setYHeadRot(mob.getYHeadRot()); // customEntity.yHeadRotO = mob.yHeadRotO; customEntity.setYBodyRot(mob.yBodyRot); customEntity.yBodyRotO = mob.yBodyRotO; customEntity.setPose(mob.getPose()); Minecraft.getInstance().getEntityRenderDispatcher().getRenderer(customEntity).render( customEntity, customEntity.yBodyRot, event.getPartialTick(), event.getPoseStack(), event.getMultiBufferSource(), event.getPackedLight() ); } finally { renderingCustomEntity = false; } } } } } As shown in my code, if the mob whose model is replaced moves to a different dimension, I unload the custom entity with Entity#discard and then reinitialize it on the next tick. I wonder if I also have to unload the custom entity when the mob it is "replacing" dies. ^ Edit: I have changed the code due to @diesieben07's most recent comment.
  16. Although I am not exactly sure how a try-finally block would help (i.e. what code I should run even if a runtime exception is thrown), I have made some progress. The custom mob renders, but it does not rotate--even when I apply rotations to it before calling render(). private static boolean renderingCustomEntity = false; private static CustomEntity customEntity; private static void initializeCustomEntityIfNull(LocalPlayer localPlayer) { if (customEntity == null) { customEntity = ModEntities.CUSTOM_ENTITY.get().create(localPlayer.clientLevel); } } @SubscribeEvent public static void replaceMobModel(RenderLivingEvent.Pre<LivingEntity, EntityModel<LivingEntity>> event) { LocalPlayer localPlayer = Minecraft.getInstance().player; if (localPlayer != null && event.getEntity() instanceof Mob mob) { try { if (!renderingCustomEntity) { renderingCustomEntity = true; event.setCanceled(true); initializeCustomEntityIfNull(localPlayer); // I try to apply rotations to the custom entity before it rendered, but it still does not rotate at all. customEntity.setYRot(mob.getYRot()); customEntity.setYHeadRot(mob.getYHeadRot()); customEntity.setPose(mob.getPose()); // For some reason, the custom mob did not render when I called EntityRenderDispatcher#render. // So I called render() from EntityRenderDispatcher#getRenderer instead. Minecraft.getInstance().getEntityRenderDispatcher().getRenderer(customEntity).render( customEntity, customEntity.getYRot(), event.getPartialTick(), event.getPoseStack(), event.getMultiBufferSource(), event.getPackedLight() ); } } finally { renderingCustomEntity = false; } } } What would I be missing? Thank you for the help.
  17. I suggest looking here: https://youtu.be/dloDcKe3Hn8?t=32
  18. Hello, I am trying to replace every rendered mob's model (not the mob itself) with the model of a custom entity, under certain conditions. This is how it would work: @SubscribeEvent public static void replaceMobModel(RenderLivingEvent.Pre<LivingEntity, EntityModel<LivingEntity>> event) { if (condition A is reached) { // replace every rendered mob's model with the model of a custom entity } // if condition A is not met, then every rendered mob's model reverts back to normal (e.g. villagers start looking like villagers again) } I was looking at this forum (https://forums.minecraftforge.net/topic/75986-114-how-to-change-rendered-entity/) and found out that I need to use EntityRenderManager#renderEntity. But since that is from a previous version, I assume it would be EntityRenderDispatcher#render. Here's what I tried to do so far: @SubscribeEvent public static void replaceMobModel(RenderLivingEvent.Pre<LivingEntity, EntityModel<LivingEntity>> event) { LocalPlayer localPlayer = Minecraft.getInstance().player; if (localPlayer != null && event.getEntity() instanceof Mob mob) { // I'll set up the conditions later once I get this working event.setCanceled(true); CustomEntity customEntity = ModEntities.CUSTOM_ENTITY.get().create(localPlayer.clientLevel); if (customEntity != null) { customEntity.setXRot(mob.getXRot()); customEntity.setYRot(mob.getYRot()); Minecraft.getInstance().getEntityRenderDispatcher().render( customEntity, mob.getX(), mob.getY(), mob.getZ(), mob.getViewYRot(event.getPartialTick()), event.getPartialTick(), event.getPoseStack(), event.getMultiBufferSource(), event.getPackedLight() ); } } } This results in a stack overflow (EntityRenderDispatcher#render seems to cause RenderLivingEvent to fire, causing an infinite recursion). Is this even the right thing to do? Or do I have to go to my CustomEntity renderer class and override render()? If that's the case, I don't know what I should put in that method.
  19. Just now I have made my repo private again for privacy reasons, but if you wanna take a look, lemme know if you want it to be public again. Here is my repo Event handler in which the size is changed Custom effect class Note: The effect that I used to make the entity larger is actually called "fat."
  20. When I tried using EntityEvent.Size, this is the code: @SubscribeEvent public static void entityHitboxSizeChange(EntityEvent.Size event) { if (event.getEntity() instanceof LivingEntity livingEntity && livingEntity.getActiveEffectsMap() != null) { EntityDimensions entityDimensions = livingEntity.getDimensions(livingEntity.getPose()); if (livingEntity.hasEffect(ModEffects.BIG.get())) { event.setNewSize(entityDimensions.scale(8, 2)); } else { event.setNewSize(entityDimensions); } } } // When I refreshDimensions in removeAttributeModifiers(), the size still does not revert immediately unless the pose changes (i.e. player crouching). // This is under the assumption that refreshDimensions() always triggers an EntityEvent.Size event @Override public void addAttributeModifiers(@NotNull LivingEntity pLivingEntity, @NotNull AttributeMap pAttributeMap, int pAmplifier) { if (!pLivingEntity.level.isClientSide()) { // other stuff ... pLivingEntity.refreshDimensions(); } super.addAttributeModifiers(pLivingEntity, pAttributeMap, pAmplifier); } @Override public void removeAttributeModifiers(@NotNull LivingEntity pLivingEntity, @NotNull AttributeMap pAttributeMap, int pAmplifier) { if (!pLivingEntity.level.isClientSide()) { // other stuff ... pLivingEntity.refreshDimensions(); } super.removeAttributeModifiers(pLivingEntity, pAttributeMap, pAmplifier); }
  21. (updated the code in my previous comment) The reason why I have been reluctant to use EntityEvent.Size is because whenever I increase the hitbox size of the living entity via setNewSize(), the enlarged hitbox starts jittering whenever it touches a solid block. Would there be anything else I have to do besides call setNewSize()?
×
×
  • Create New...

Important Information

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