Jump to content

Recommended Posts

Posted

Hello, I'm making an Entity that extends AbstractArrow, but when I was making the Renderer and the Model. I realized that the "setupAnim(...)" method was running on entities that it shouldn't run on. In the case,  an entity's "animation" was running on another entity animation.

I think the problem is in the renderer, here's the code.  

Spoiler
public class AmethystBoulderRenderer extends EntityRenderer<AmethystBoulder> {
    private static final ResourceLocation TEXTURE_LOCATION = new ResourceLocation(ModMain.MODID, "textures/entity/amethyst_boulder.png");
    protected AmethystBoulderModel<AmethystBoulder> model;

    public AmethystBoulderRenderer(EntityRendererProvider.Context p_174368_) {
        super(p_174368_);
        this.model = new AmethystBoulderModel<>(p_174368_.bakeLayer(ModModelLayers.SLIME_BALL));
    }

    @Override
    public void render(AmethystBoulder p_114080_, float p_114081_, float p_114082_, PoseStack p_114083_, MultiBufferSource p_114084_, int p_114085_) {
        int size = p_114080_.getSize();
        this.shadowRadius = 0.35F * size;

        p_114083_.pushPose();
        p_114083_.mulPose(Vector3f.YP.rotationDegrees(Mth.lerp(p_114082_, p_114080_.yRotO, p_114080_.getYRot()) - 90.0F));
        p_114083_.mulPose(Vector3f.ZP.rotationDegrees(Mth.lerp(p_114082_, p_114080_.xRotO, p_114080_.getXRot())));
        p_114083_.scale(-0.5F * size, -0.5F * size, 0.5F * size);
        if(!p_114080_.inGround() && !p_114080_.isNoGravity()) {
            this.model.setupAnim(p_114080_, p_114082_, 0, 0, 0, p_114080_.getTicksSinceLastKick());
        }
        VertexConsumer vertexconsumer = p_114084_.getBuffer(this.model.renderType(TEXTURE_LOCATION));
        this.model.renderToBuffer(p_114083_, vertexconsumer, p_114085_, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F);
        p_114083_.popPose();
        super.render(p_114080_, p_114081_, p_114081_, p_114083_, p_114084_, p_114085_);
    }
    
    @Override
    public @NotNull ResourceLocation getTextureLocation(AmethystBoulder p_115860_) {
        return TEXTURE_LOCATION;
    }
}

 

Here's the Model class too:

Spoiler
public class AmethystBoulderModel<T extends AmethystBoulder> extends HierarchicalModel<T> {
    private final ModelPart root;
    private final ModelPart main;

    public AmethystBoulderModel(ModelPart p_170916_) {
        this.root = p_170916_;
        this.main = p_170916_.getChild("main");
    }

    public static LayerDefinition createBodyLayer() {
        MeshDefinition meshdefinition = new MeshDefinition();
        PartDefinition partdefinition = meshdefinition.getRoot();
        //-8, -16, -8
        partdefinition.addOrReplaceChild("main", CubeListBuilder.create().texOffs(0, 0).addBox(-8.0F, -8.0F, -8.0F, 16.0F, 16.0F, 16.0F), PartPose.offset(0,-8,0));
        return LayerDefinition.create(meshdefinition, 64, 32);
    }

    public ModelPart root() {
        return this.root;
    }


    private double log(float tick){
        double base = 1.1D;
        return Math.log(tick + 1) / Math.log(base);
    }

    @Override
    public void setupAnim(T p_102618_, float p_102619_, float p_102620_, float p_102621_, float p_102622_, float tick) {
        if(!p_102618_.isNoGravity() && !p_102618_.inGround()) {
            this.main.zRot = (float) (-5 * (log(tick)) * (Math.PI / 180F));
        }
    }

 

 

Posted (edited)

Show your registration code.

While you are at it show all the code, so we don't have to play a guessing game on what you might be doing wrong.

Edited by warjort

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted
Spoiler
public class ModEntityTypes {

    public static final DeferredRegister<EntityType<?>> ENTITIES = DeferredRegister.create(ForgeRegistries.ENTITY_TYPES, ModMain.MODID);


    public static final RegistryObject<EntityType<IceIsolator>> ICE_ISOLATOR = ENTITIES.register("ice_isolator", () -> EntityType.Builder.of(
            IceIsolator::new,
            MobCategory.CREATURE)
            .canSpawnFarFromPlayer()
            .sized(0.6F, 1.95F)
            .clientTrackingRange(8).build("ice_isolator"));

    public static final RegistryObject<EntityType<SpiritualNomadEntity>> NOMAD = ENTITIES.register("spiritual_nomad", () ->
            EntityType.Builder.of(
            SpiritualNomadEntity::new,
            MobCategory.MISC)
            .canSpawnFarFromPlayer()
            .sized(0.6F, 1.95F)
            .clientTrackingRange(8).build("spiritual_nomad"));

    public static final RegistryObject<EntityType<ThrownAlgidAxe>> ALGID_AXE = ENTITIES.register("algid_axe", () ->
            EntityType.Builder.<ThrownAlgidAxe>of(
            ThrownAlgidAxe::new,
            MobCategory.MISC)
            .sized(0.5F, 0.5F)
            .clientTrackingRange(4)
            .updateInterval(20).build("algid_axe"));

    public static final RegistryObject<EntityType<ColdFireball>> COLD_FIREBALL = ENTITIES.register("cold_fireball", () ->
            EntityType.Builder.<ColdFireball>of(ColdFireball::new, MobCategory.MISC)
            .sized(0.3125F, 0.3125F).clientTrackingRange(4).updateInterval(10).build("cold_fireball"));

    public static final RegistryObject<EntityType<AmethystBoulder>> AMETHYST_BOULDER = ENTITIES.register("amethyst_boulder", () ->
            EntityType.Builder.<AmethystBoulder>of(AmethystBoulder::new, MobCategory.MISC)
                    .sized(0.5F, 0.5F).clientTrackingRange(4).updateInterval(10).build("amethyst_boulder"));



}

 

All the other entities model work fine.

Posted (edited)

No the registration of entity renders. That's why I said post all the code.

Otherwise, this will be another time sink of a thread trying to track down a simple typo in code we can't see.

Edited by warjort

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted

Oh, I see. Sorry, here's the repository https://github.com/luccaPossamai/M.O.Hard-FORGE

I will send the renderers registration anyway.

Spoiler
@Mod.EventBusSubscriber(modid = ModMain.MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class EntitiesRenderer {

    @SubscribeEvent
    public static void register(EntityRenderersEvent.RegisterRenderers event){
        event.registerEntityRenderer(ModEntityTypes.ICE_ISOLATOR.get(), IceIsolatorRenderer::new);
        event.registerEntityRenderer(ModEntityTypes.NOMAD.get(), SpiritualNomadRenderer::new);
        event.registerEntityRenderer(ModEntityTypes.ALGID_AXE.get(), AlgidAxeRenderer::new);
        event.registerEntityRenderer(ModEntityTypes.COLD_FIREBALL.get(), ColdFireballRenderer::new);
        event.registerEntityRenderer(ModEntityTypes.AMETHYST_BOULDER.get(), AmethystBoulderRenderer::new);
    }

}

 

 

Posted

I don't see an obvious typo or incorrect use of static methods/fields.

So I tried to run your mod, but I get this error.

Quote

Caused by: java.io.FileNotFoundException: mohard:particles/vilio.json
        at net.minecraft.server.packs.resources.ResourceProvider.lambda$getResourceOrThrow$0(ResourceProvider.java:20) ~[forge-1.19.2-43.1.52_mapped_official_1.19.2.jar%23183!/:?] {re:classloading}
 

Can you make sure the repo is up-to-date with what you are testing.

Also can you give instructions on how I can reproduce the issue.

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted

Oh I'm sorry, now It's fixed in the repository.

To see the problem you must right click an item called "Wand"(Artifacts tab). This way you'll launch an amethyst boulder, when it stops bouncing, if you press right click again you'll launch another boulder, but, the one that is in the ground will rotate too.

Posted (edited)

Ok, I understand the problem now.

When you said 

Quote

I realized that the "setupAnim(...)" method was running on entities that it shouldn't run on. In the case,  an entity's "animation" was running on another entity animation.

I thought you meant it was drawing the model for a completely different entity type. I was looking for where you had a miss typed a resource location.

 

Your problem is the model is shared by all entities. So if you rotate one entity, you need to reset the model when doing the next entity.

You only changing it conditionally so the entity will have the rotation from the previous entity if your condition check fails.

For some reason you are double checking the condition as well?

https://github.com/luccaPossamai/M.O.Hard-FORGE/blob/deabf4f1850ea3ea30f8220ed067a1709229cee6/src/main/java/net/lucca/mohard/entities/amethystBoulder/AmethystBoulderRenderer.java#L34

https://github.com/luccaPossamai/M.O.Hard-FORGE/blob/deabf4f1850ea3ea30f8220ed067a1709229cee6/src/main/java/net/lucca/mohard/entities/amethystBoulder/AmethystBoulderModel.java#L40

Edited by warjort

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • So, we have a 5 player server running the Hexxit modpack, with the sole addition of one extra mod, CustomNPCs. Something about CustomNPCs doesn't play nice with the server. Only three players are playing it, all of them have CustomNPCs installed in their own game files, and we have CustomNPCs installed in our server. We can all hold the tools and use the custom recipes added by the mod or by players using the NPC spawner tool. However, I'm the only one who can actually use them. If either other player uses them, they immediately crash and are booted off the server. I can make NPCs, the NPCs can detect them and attack them, all that, but they cannot see them, nor can they interact with them in any way. What could be causing this? I will add, as far as I know, I'm the only one to have run the modpack in single player as well as in multiplayer, I believe the other two have only run it in multiplayer for the server. Could this possibly be part of the problem? Any help would be appreciated.
    • Hello, Thank you so much for the suggestion, I will create a post.
    • You're using the wrong FACING property in Mechanism#getStateForPlacement, BlockStateProperties.FACING instead of Mechanism.FACING, HorizontalDirectionalBlock.FACING or BlockStateProperties.HORIZONTAL_FACING (which all refer to the same value). The former includes all six Direction values, the latter only includes the four horizontal values.
    • quiero que me digan como hago para instalar bien el java y forge nada mas hasta el momento lo hice pero java no ejecuta el forge   
    • Mod Idea: Server-Specific Mod Disabler & Anti-Cheat Helper Overview: This mod allows players to seamlessly play on Minecraft servers without worrying about banned or incompatible mods. It automatically disables specific mods based on the server's configuration, ensuring that players are only using allowed mods. Additionally, it provides a safeguard against hacking mods by instantly blocking them from being used, promoting fair gameplay on multiplayer servers. Key Features: 1. Server-Specific Mod Disabling: Automatic Mod Detection: The mod will automatically detect which mods are allowed or blocked on a particular server. Server Configurable Lists: Server admins can maintain a list of banned or whitelisted mods, which will be dynamically applied when a player joins. Player Customization: Players can choose whether the mod should automatically disable specific mods when joining servers, or allow them to be used based on the server's settings. 2. Anti-Cheat and Hack Protection: Instant Hack Detection: The mod will automatically identify and block known hacking mods when joining a server. If a player attempts to join with a hacking mod, the server can receive an alert, and the mod will prevent the player from joining until the mod is removed. Real-Time Monitoring: The mod will continuously monitor the player's mods while on the server, ensuring that no banned or suspicious mods are activated. 3. Community-Driven Mod Management: Custom Blocklists and Whitelists: Server admins can manage custom mod lists directly through a configuration file or via an in-game interface. These lists would allow mods to be either whitelisted, banned, or marked for temporary disabling. Integration with Modding Communities: The mod can gather mod compatibility reports from other players, sharing knowledge about which mods work together and which are problematic. 4. Player-Friendly Experience: Less Hassle for Players: With this mod, players no longer need to manually disable or enable mods when switching between servers. The mod takes care of everything for them. Seamless Gameplay: Players can freely switch between servers with different rules and mod requirements without worrying about compatibility issues or getting banned for using the wrong mods. 5. Open-Source and Extensible: Community Contributions: The mod will be open-source, allowing the Minecraft community to contribute by adding new features, bug fixes, and support for more mods. Customizable for Future Versions: The mod will be updated to support future Minecraft versions, ensuring long-term usability. Additional Ideas for Future Expansion: 1. Integration with Minecraft Servers (Optional): Server-Side Mod Configuration: In addition to client-side mod management, server owners can opt to install a server-side version of this mod, which can enforce mod restrictions for all players. Server Feedback System: When a mod is disabled, the server can automatically provide feedback to the player about why it was disabled and whether they need to install an alternative. 2. Donation and Support System: Monetization for Future Development: The mod could offer a donation-based system or a paid premium version with advanced features like real-time support or a larger mod compatibility database. Community Support: Players could report issues directly through the mod, ensuring faster resolutions and support from the mod development community. Benefits: 1. For Players: No Need for Constant Mod Configuration: Players no longer need to manually switch between different mod sets based on the server they join. Reduced Risk of Getting Banned: The mod automatically prevents the use of banned or incompatible mods, reducing the risk of being kicked or banned from servers. Hassle-Free Experience: The mod removes the need for players to learn about different server mod policies, providing a smoother experience overall. 2. For Server Owners: Simplified Server Management: Server admins no longer need to constantly monitor which mods players are using. The mod ensures players are only using compliant mods. Better Anti-Cheat Measures: Server owners can trust that hacking mods will be automatically blocked, improving server security. Easy Integration: With a simple configuration file, server owners can quickly set up their mod policies and get started. 3. For the Minecraft Community: Encourages Fair Play: The mod promotes fair gameplay by automatically preventing the use of cheating mods, ensuring a better multiplayer environment. Better Mod Compatibility: As the mod grows, it can help players and server owners discover which mods are compatible with others, making the modding ecosystem more reliable. Potential Challenges and Solutions: 1. Resistance from Players Using Hacking Mods: Solution: Allow server admins to configure a warning system where players can receive notifications about the mod being blocked before they are kicked. This gives them a chance to fix their setup. 2. Keeping Mod Lists Up-to-Date: Solution: Implement a community-driven reporting system where players and server owners can submit their mod lists, keeping the database current with new mods and changes in mod compatibility. 3. Cross-Platform Compatibility: Solution: Ensure that the mod is built to support both Java and Bedrock editions (if applicable) by using cross-platform modding tools and making the mod adaptable to both versions. Conclusion: This mod has the potential to significantly improve the Minecraft multiplayer experience by making it easier for players to manage mods and preventing hacks from ruining gameplay. By focusing on server-specific mod management and providing automated protection from cheating mods, this mod could change how Minecraft servers handle modding and create a safer, more enjoyable experience for everyone involved.
  • Topics

×
×
  • Create New...

Important Information

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