Jump to content

Recommended Posts

Posted

I recompiled and reobfuscated my mod and put it in the minecraft mod folder with forge installed and it works fine. But when I try and put it in the .zip format or .jar format it doesn't load in forge, it doesn't crash it just simply doesn't show up.

 

Also when I put an mcmod.info file in the non zipped version that works it says I still don't have a mcmod.info file, help!

Posted

Could I have a copy of the zip/jar that fails?

 

Nothing personal but I've worked long and hard on my mod and I'm not sure I'm ready to just give it away to a total stranger on the internet. I will however tell you anything you'd like to know about the structure and files.

 

Also I know why the mcmod.info file didn't work, there was an error in the syntax.

Posted

Could I have a copy of the zip/jar that fails?

 

Nothing personal but I've worked long and hard on my mod and I'm not sure I'm ready to just give it away to a total stranger on the internet. I will however tell you anything you'd like to know about the structure and files.

 

Also I know why the mcmod.info file didn't work, there was an error in the syntax.

Sorry, but I've worked long and hard on gaining my knowledge of Minecraft and I'm not sure I'm ready to just give it away to a total stranger on the Internet.

 

I'M NOT EVEN ASKING FOR THE SOURCE.

BEWARE OF GOD

---

Co-author of Pentachoron Labs' SBFP Tech.

Posted

I don't believe your a bad person I just simply don't know you so call me paranoid if you'd like, I just don't want to run the risk of putting my trust in the wrong person. If you know what's wrong or what might be wrong please answer, if not, or if you don't feel like helping serious developers move on.

 

Also a little more insight on my problem. When I run reobfuscate.sh instead of reobfuscate_srg.sh it still works in the normal folder format but when I zip it or jar it it crashes with some class not found error, however all the classes are there I double checked and triple checked. I'm on a mac, may that be my problem? Btw I have no base edits so that's why I used the _srg instead of the normal one.

Posted

You've most likely got the mod files in a subfolder in the .zip file at a guess.

If you could give us some idea of the structure of the files in the zip (so much as a screenshot would be good) then we might be able to give some more help.

Posted

You've most likely got the mod files in a subfolder in the .zip file at a guess.

If you could give us some idea of the structure of the files in the zip (so much as a screenshot would be good) then we might be able to give some more help.

 

This is how it is the minecraft mods folder.

 

b8928225amrwa.png

 

 

And here's the mcp folder screenshot, just in case you need that too.

 

8719b2e7eexu6.png

 

Posted

I don't believe your a bad person I just simply don't know you so call me paranoid if you'd like, I just don't want to run the risk of putting my trust in the wrong person. If you know what's wrong or what might be wrong please answer, if not, or if you don't feel like helping serious developers move on.

 

You're going to have a hell of a time releasing it then.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

You're going to have a hell of a time releasing it then.

Exactly what I was thinking.

I don't believe your a bad person I just simply don't know you so call me paranoid if you'd like, I just don't want to run the risk of putting my trust in the wrong person. If you know what's wrong or what might be wrong please answer, if not, or if you don't feel like helping serious developers move on.

Y'know what? I could solve your problem by asking for the folder setup. You might misunderstand me. I might have to ask for other things. And it would be so much easier if you just gave me the jar. I don't even care about seeing the source!

 

If I were interested in stealing other people's mods, I would have to ask for the source. Otherwise I couldn't update it. I'm not afraid to do work, but I do it ON MY OWN MOD. And guess what? It's a universal thing among coders: I would probably look at your source, were you to show it to me, and gag. I had a problem, recently, with someone's config. I looked at their code, ran from the computer, and cried. I'm sure it works for them, but I hate reading anyone's code but my own. Not to mention that I would probably think your mod idea is stupid.

 

I never say this to people, of course. If I'm going to decide to help other modders, I may as well be nice about it. I try not to judge people. I'm not even judging your mod. But when people come here asking for help? They had better be prepared to help me help them. I'm an advocate of open-source; it says so in my profile. That doesn't mean I can't deal with closed-source; I'm a Minecraft modder after all. But, even among open-source coders (perhaps especially among open-source coders) there is an unwritten law: you do *not* steal others' code. You use it to help learn something, or to find out what's wrong with yours. But you do not take others' ideas. Nor do I want to. I have no interest in adding a spear to my mod, and, to be honest, it would take twice as much work to decompile yours and fit it to the rest of my mod than it would be to simply code one myself. Or perhaps you think I would just take your jar, touch up the license a bit, and then post it on the MC forums? Apart from the fact that it doesn't work, I might just as easily distribute IronChests and say it's mine. And I couldn't do anything with it either.

 

TL;DR: If you're asking for help and you're not prepared to show us what you're working with, DON'T EXPECT ANY.

 

Ugh, perhaps not a very well-written rant... but then I guess that few actually are.

BEWARE OF GOD

---

Co-author of Pentachoron Labs' SBFP Tech.

Posted

here's the thing, ObsequiousNewt is right. nobody can do anything without the source unless you really want to spend the time deobfuscating it, I had to for the mod that i took over development for. so asking for a copy of the offending folder is a small price to pay for getting an answer to your question. hell, pm him or me the folder, ill be glad to zip it up send it back. you just need to trust someone who's trying to help you.

I took over Hunting Traps Mod and work on helping the forge community as much as I can. View my work here: http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/wip-mods/1443756-1-7-2-1-6-4-1-5-2-1-4-7-hunting-traps-mod-v-0-4-0

Posted

Not that anyone here steals source code either.  Borrow it to see how someone did something that they might be trying to figure out how to do (I recently looked up the source code to a backpack mod so that I didn't have to write the GUI code myself because I hate it, but I added functionality to it that was specific to my mod) but they aren't going to outright steal your mod.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Okay, what's the big deal? I try to protect my code from potential scumbags and you blow up in my face? What's wrong with wanting to keep your hard work safe? By the way you're responding you are truly leading me to believe you want my code for the wrong reasons, why else would you fight a budding young developer for what he believes is right? If you were in my situation would you trust some random guy on the internet, which by the way is the best place in the world to lie and get away with it, with your months of hard work? Now, you can make the argument that your code would be superior to mine because you have had more modding experience then I. Well I strongly disagree with that, just because the code might be better doesn't mean the content is, it doesn't mean the textures are worse, it doesn't mean the models are worse, my mod is a lot more than a simple spear. You have made the argument that you couldn't do anything without the source, I'm sorry to tell you but java decompilers do exist, do a quick search on google and you'll find them. If the computer can decompile, a program can too, the logic is that simple. For anything one piece of software can do, another can undo, that is one of the beauties, and dangers of computers. This isn't about, "It would take more work to incorporate your mod into mine" that is completely dependent on the situation and as I said before you are a complete stranger to me, I don't know you, I don't know your situation you could be anyone doing anything.  You said you can solve my problem with screenshots? Ask for them, do not ask for months of hard work that is vulnerable because it has not yet been released. Every part of that jar is an asset and some you wouldn't even need a decompiler to take and exploit.

 

I never attacked you or your open-source coder law so why are you defending yourself? You are taking this way to personally. I respect you and everyone who answers questions here on the forums even if they openly disagree with a mod and that won't change, you put up with a lot of noobs here and don't get thanked enough for what you do, but even so there are some things I will not give you when you try to help me. Because there are bad people out there and I don't want to run the risk of being a victim of any of there shenanigans. I will give you a few pieces and parts that I feel are causing me trouble, but I will not give you everything.

 

I have given you my screenshots in a previous post if you'd still like to answer my question.

Posted

Okay, what's the big deal? I try to protect my code from potential scumbags and you blow up in my face? What's wrong with wanting to keep your hard work safe? By the way you're responding you are truly leading me to believe you want my code for the wrong reasons, why else would you fight a budding young developer for what he believes is right? If you were in my situation would you trust some random guy on the internet, which by the way is the best place in the world to lie and get away with it, with your months of hard work? Now, you can make the argument that your code would be superior to mine because you have had more modding experience then I. Well I strongly disagree with that, just because the code might be better doesn't mean the content is, it doesn't mean the textures are worse, it doesn't mean the models are worse, my mod is a lot more than a simple spear. You have made the argument that you couldn't do anything without the source, I'm sorry to tell you but java decompilers do exist, do a quick search on google and you'll find them. If the computer can decompile, a program can too, the logic is that simple. For anything one piece of software can do, another can undo, that is one of the beauties, and dangers of computers. This isn't about, "It would take more work to incorporate your mod into mine" that is completely dependent on the situation and as I said before you are a complete stranger to me, I don't know you, I don't know your situation you could be anyone doing anything.  You said you can solve my problem with screenshots? Ask for them, do not ask for months of hard work that is vulnerable because it has not yet been released. Every part of that jar is an asset and some you wouldn't even need a decompiler to take and exploit.

Speaking as one of the aforementioned scumbags, I would like to say that if you want help, you're going to have to trust those people that you're asking. If you want to deal with the Internet at all, YOU'LL HAVE TO TALK TO COMPLETE STRANGERS. I'm not trying to argue that my code is superior; I'm just saying that other developers' code, as a general rule, looks wrong. This does not only apply to me. You'd probably hate the way I wrote my code.

 

I do not have the time, patience, or dishonor to try to steal anyone's code. Perhaps there are some who do. They can download your mod and distribute it as theirs. They can use decompilers, like you say. But you'll have to take that risk, unless your mod is intended for your eyes only. By sealing us out from your code, you have sealed yourself in. You're trying to say, "Help me with this circuit board. Only I won't let you touch it, or even see it. I'll show you pictures of certain parts if you like." If that gets you help, it'll take umpteen times as long as if you let me glance at your jar and say, "This folder is in the wrong place." Oh, and you think I'm likely a "scumbag" because I'm trying to make a point? Let me give you a lesson, henceforth to be known as the First Law of Flame: The worst way to get someone on the Internet to agree with you is to argue with them. The only reason why I'm bothering right now? Honor, if it means anything to you, and because I'm annoyed with near-hypocrites, and additionally because I'm feeling in an argumentative mood right now. Oh, and because of the Second Law of Flame: To leave an argument on the Internet is to admit defeat.

I never attacked you or your open-source coder law so why are you defending yourself? You are taking this way to personally. I respect you and everyone who answers questions here on the forums even if they openly disagree with a mod and that won't change, you put up with a lot of noobs here and don't get thanked enough for what you do, but even so there are some things I will not give you when you try to help me. Because there are bad people out there and I don't want to run the risk of being a victim of any of there shenanigans. I will give you a few pieces and parts that I feel are causing me trouble, but I will not give you everything.

We live in a sad world, where intellectual property is such a huge issue. As an open-source coder, I believe in credit where it's due, I believe in sharing, and I believe in the potential of others to act the same way. This is a philosophy shared by many. Look at what is perhaps the second most popular open-source licence, the CC-BY-SA. It says in the title that you must attribute your code to where you got it. I don't like the fact that Minecraft is closed-source, but that's something you have to deal with. I can deal with the fact that it costs, what, 30 dollars now? Because it's a great game, and I think that Mojang deserves to be rewarded for their work. For me, credit is all I desire, and I believe that you deserve it too. I came here because I wanted to help make Minecraft better, and because it was a game I liked to play. (I don't play much any more.) And I do have to put up with a lot here. I commend you, for being able to speak grammatical English. That's one of the most annoying things here. (Not that it's necessarily their fault.) But I will help you as much as I would help anyone... and if you refuse my help because you're paranoid, then there's nothing I can do about that.

 

If you would like to check your mod jar against mine, you can find it here, and my Github is here—but be warned that that is the *last* energy I will expend on your problem.

BEWARE OF GOD

---

Co-author of Pentachoron Labs' SBFP Tech.

Posted

Well.

 

There went any remaining empathy I had for you.

 

You do have the right to protect your code, but some problems are unsolvable without being able to actually look at what's going on.

 

And for the record, we never once asked for your source code, we asked for your release zip.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

If I may ask for only one minor file..... Your base class file.....

it should not include any major information

 

and if it will make you feel better i can show you my base mod class

I took over Hunting Traps Mod and work on helping the forge community as much as I can. View my work here: http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/wip-mods/1443756-1-7-2-1-6-4-1-5-2-1-4-7-hunting-traps-mod-v-0-4-0

Posted

And for the record, we never once asked for your source code, we asked for your release zip.

 

^^ What he said.

If you don't want to share the release zip with us, I have no idea how you plan on releasing your mod. Even once you've got a working zip or jar, it's all of about 6 seconds for absolutely anyone to unzip that.

width=463 height=200

http://s13.postimg.org/z9mlly2av/siglogo.png[/img]

My mods (Links coming soon)

Cities | Roads | Remula | SilvaniaMod | MoreStats

Posted

A little bit off-topic to enforce his paranoia: it is indeed possible to decompile Java classes back to Java code.

 

So if you don't want people to leak your source code, you'll have to do what Mojang does: obfuscate. But it still doesn't fully protect your source code, as you as a developer can see yourself. ;) So throw your paranoia into the corner. If somebody really wants your source code, they can get it...

Posted

A little bit off-topic to enforce his paranoia: it is indeed possible to decompile Java classes back to Java code.

 

So if you don't want people to leak your source code, you'll have to do what Mojang does: obfuscate. But it still doesn't fully protect your source code, as you as a developer can see yourself. ;) So throw your paranoia into the corner. If somebody really wants your source code, they can get it...

We know it's possible. If you mod Minecraft, you're already doing it :P

BEWARE OF GOD

---

Co-author of Pentachoron Labs' SBFP Tech.

Posted

After the release I'm perfectly fine with you looking at the jar, it's just pre-release when it's vulnerable. I don't have any copyrights or any lawyers so if you just took it pre-release no one would know or be able to fight it. Post-release yes there will be people who try to take it and redistribute it but at least then I'll have a page to prove that I am the original author. Also with numerous references to my name in the code it won't be hard to prove that I am the owner of the mod, and I will be able to take legal action against all who try and rip me off.

 

Look, I trust people on the internet to an extent. You made an analogy to a circuit board, that does not apply even remotely to this situation. First off if you were having troubles and you went onto the internet to see if you could get your problem solved it would much harder to give your questioner your circuit board. If you had a problem with a circuit board you would take it to someone who was knowledgeable about this kind of thing in your area, and if your smart you'll watch him as he fixes your problem to A find out what's wrong and how to fix it, and B make sure he doesn't steal it. After I send you or anyone my jar I have no way to know what you are doing with it, and that scares me. Sure I could go by word of mouth, but that simply isn't enough for me. And by the way ObsequiousNewt, don't fool yourself, you were the one who started this argument. You were the one who felt it was so important to uphold your "honor" after I politely declined to give you my mod. Read back, open your eyes, while I simply wanted to protect what was mine you wanted to turn this into a flame war. YOU started this, never forget. You are the CEO of Pentachoron Labs, it says so in your description. If you are planning to make any money I advise you strongly to not post all of your work on github before release. You're a complete idiot for posting all your code on github pre-release. It's not like it's hard to find either! I searched Pentachoron Labs on google and that link was the first that showed up. Not only that but you have the name in your signature. What if some scumbag who has been browsing the forums sees you and does a little research on your little Pentachoron Labs and steals all your source. I'm assuming if you're a CEO you're company plans to make money, I'm telling you right now that is the WORST business plan I have ever heard. Justify your actions, I dare you. Justify going after a small developer who doesn't want to be a victim of internet theft, I challenge you. Justify what moral cause you think you have in pursuing this argument. You talk about honor, what you have is not honor, it is pride.

 

Btw, I like the like the laws of flame.  :P

Posted

Fuck didn't mean to press thankyou! was trying to get the quote button!!!

 

I searched Pentachoron Labs on google and that link was the first that showed up. Not only that but you have the name in your signature. What if some scumbag who has been browsing the forums sees you and does a little research on your little Pentachoron Labs and steals all your source. I'm assuming if you're a CEO you're company plans to make money, I'm telling you right now that is the WORST business plan I have ever heard.

 

If you (ThauxCraft) had any sense you would quickly realize that "Pentachron Labs" is not a serious business attempt, but a name for his dev-team. Also if you thought he was trying to make money from modding, or if you even thought that modding was a way to make any decent amount of money you are massively incorrect. Modding is allowed for by Mojang, but not the sale of mods, which would be an infringement of their copyrights (you can find all this on the Minecraft website).

 

Also lets assume that he is a corporate CEO trying to steal your code. Do you really think that he would a) try to do this through a SUPPORT forums, on which he has a superb track record for helping people out, and b) make all his projects opensource? Also why would a corporate giant like "Pentachoron labs" even waste their time on support forums when they could be working on their own code making it better so they get more people to downloads and ergo more money?

 

Your argument for not giving away your source is valid, it's your property to distribute, but refusing to give away a broken jar, then asking for advice on how to fix it is just stupid.

 

 

 

Who the Fuck put the thank you button next to the quote button!!

Posted
Who the Fuck put the thank you button next to the quote button!!

 

I've almost done it half a dozen times myself.

 

As for copyrights:

You have an intrinsic copyright on everything you create.  It's automatic.

 

Under the Berne Convention, copyrights for creative works do not have to be asserted or declared, as they are automatically in force at creation: an author need not "register" or "apply for" a copyright in countries adhering to the Berne Convention. As soon as a work is "fixed", that is, written or recorded on some physical medium, its author is automatically entitled to all copyrights in the work, and to any derivative works unless and until the author explicitly disclaims them, or until the copyright expires.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Can I just say this? Everyone calm the heck down! Look, Newt is a really good guy, he wouldn't steal your code, second, you can't do anything without the source. Newt, Tux was just saying he wants a closed source mod and didn't want to give it away, he was accusing you of stealing, he just didn't want his source out, this thing has gotten WAAAY out of hand. To put this thread out of its misery, Tux, stick your unzipped folder in the zip, not the conents of the unzipped folder, the entire folder. And try that. If that doesn't work, you'll have to show us how you have it set up, (NOT YOUR SOURCE!), so we can see if you have too many folders or something.

Posted

Can I just say this? Everyone calm the heck down! Look, Newt is a really good guy, he wouldn't steal your code, second, you can't do anything without the source. Newt, Tux was just saying he wants a closed source mod and didn't want to give it away, he was accusing you of stealing, he just didn't want his source out, this thing has gotten WAAAY out of hand. To put this thread out of its misery, Tux, stick your unzipped folder in the zip, not the conents of the unzipped folder, the entire folder. And try that. If that doesn't work, you'll have to show us how you have it set up, (NOT YOUR SOURCE!), so we can see if you have too many folders or something.

Agreed. This has gotten out of hand. I regret making a big deal of it myself; I should have just ignored him once he refused to give me his jar. I guess I wanted to make a point.

Fuck didn't mean to press thankyou! was trying to get the quote button!!!

 

I searched Pentachoron Labs on google and that link was the first that showed up. Not only that but you have the name in your signature. What if some scumbag who has been browsing the forums sees you and does a little research on your little Pentachoron Labs and steals all your source. I'm assuming if you're a CEO you're company plans to make money, I'm telling you right now that is the WORST business plan I have ever heard.

 

If you (ThauxCraft) had any sense you would quickly realize that "Pentachron Labs" is not a serious business attempt, but a name for his dev-team. Also if you thought he was trying to make money from modding, or if you even thought that modding was a way to make any decent amount of money you are massively incorrect. Modding is allowed for by Mojang, but not the sale of mods, which would be an infringement of their copyrights (you can find all this on the Minecraft website).

Too true. To be a "CEO" is even too much of a claim for me, seeing as I'm equal partners with AJ. We're not trying to make any money off any of our code. Heck, I'm only a teenager!

 

Now, I understand that TuxCraft is more worried about credit than he is about money. I have given my response to that.

Also lets assume that he is a corporate CEO trying to steal your code. Do you really think that he would a) try to do this through a SUPPORT forums, on which he has a superb track record for helping people out, and b) make all his projects opensource? Also why would a corporate giant like "Pentachoron labs" even waste their time on support forums when they could be working on their own code making it better so they get more people to downloads and ergo more money?

I'm a corporate giant! Whee! Business is fun!

My point all along. And maybe it's time to leave it at that. I hope you (TuxCraft) solve your problem!

 

I had been wondering why you thanked both of us... :D

BEWARE OF GOD

---

Co-author of Pentachoron Labs' SBFP Tech.

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

    • Version 1.19 - Forge 41.0.63 I want to create a wolf entity that I can ride, so far it seems to be working, but the problem is that when I get on the wolf, I can’t control it. I then discovered that the issue is that the server doesn’t detect that I’m riding the wolf, so I’m struggling with synchronization. However, it seems to not be working properly. As I understand it, the server receives the packet but doesn’t register it correctly. I’m a bit new to Java, and I’ll try to provide all the relevant code and prints *The comments and prints are translated by chatgpt since they were originally in Spanish* Thank you very much in advance No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. MountableWolfEntity package com.vals.valscraft.entity; import com.vals.valscraft.network.MountSyncPacket; import com.vals.valscraft.network.NetworkHandler; import net.minecraft.client.Minecraft; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.animal.Wolf; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.Entity; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.network.PacketDistributor; public class MountableWolfEntity extends Wolf { private boolean hasSaddle; private static final EntityDataAccessor<Byte> DATA_ID_FLAGS = SynchedEntityData.defineId(MountableWolfEntity.class, EntityDataSerializers.BYTE); public MountableWolfEntity(EntityType<? extends Wolf> type, Level level) { super(type, level); this.hasSaddle = false; } @Override protected void defineSynchedData() { super.defineSynchedData(); this.entityData.define(DATA_ID_FLAGS, (byte)0); } public static AttributeSupplier.Builder createAttributes() { return Wolf.createAttributes() .add(Attributes.MAX_HEALTH, 20.0) .add(Attributes.MOVEMENT_SPEED, 0.3); } @Override public InteractionResult mobInteract(Player player, InteractionHand hand) { ItemStack itemstack = player.getItemInHand(hand); if (itemstack.getItem() == Items.SADDLE && !this.hasSaddle()) { if (!player.isCreative()) { itemstack.shrink(1); } this.setSaddle(true); return InteractionResult.SUCCESS; } else if (!level.isClientSide && this.hasSaddle()) { player.startRiding(this); MountSyncPacket packet = new MountSyncPacket(true); // 'true' means the player is mounted NetworkHandler.CHANNEL.sendToServer(packet); // Ensure the server handles the packet return InteractionResult.SUCCESS; } return InteractionResult.PASS; } @Override public void travel(Vec3 travelVector) { if (this.isVehicle() && this.getControllingPassenger() instanceof Player) { System.out.println("The wolf has a passenger."); System.out.println("The passenger is a player."); Player player = (Player) this.getControllingPassenger(); // Ensure the player is the controller this.setYRot(player.getYRot()); this.yRotO = this.getYRot(); this.setXRot(player.getXRot() * 0.5F); this.setRot(this.getYRot(), this.getXRot()); this.yBodyRot = this.getYRot(); this.yHeadRot = this.yBodyRot; float forward = player.zza; float strafe = player.xxa; if (forward <= 0.0F) { forward *= 0.25F; } this.flyingSpeed = this.getSpeed() * 0.1F; this.setSpeed((float) this.getAttributeValue(Attributes.MOVEMENT_SPEED) * 1.5F); this.setDeltaMovement(new Vec3(strafe, travelVector.y, forward).scale(this.getSpeed())); this.calculateEntityAnimation(this, false); } else { // The wolf does not have a passenger or the passenger is not a player System.out.println("No player is mounted, or the passenger is not a player."); super.travel(travelVector); } } public boolean hasSaddle() { return this.hasSaddle; } public void setSaddle(boolean hasSaddle) { this.hasSaddle = hasSaddle; } @Override protected void dropEquipment() { super.dropEquipment(); if (this.hasSaddle()) { this.spawnAtLocation(Items.SADDLE); this.setSaddle(false); } } @SubscribeEvent public static void onServerTick(TickEvent.ServerTickEvent event) { if (event.phase == TickEvent.Phase.START) { MinecraftServer server = net.minecraftforge.server.ServerLifecycleHooks.getCurrentServer(); if (server != null) { for (ServerPlayer player : server.getPlayerList().getPlayers()) { if (player.isPassenger() && player.getVehicle() instanceof MountableWolfEntity) { MountableWolfEntity wolf = (MountableWolfEntity) player.getVehicle(); System.out.println("Tick: " + player.getName().getString() + " is correctly mounted on " + wolf); } } } } } private boolean lastMountedState = false; @Override public void tick() { super.tick(); if (!this.level.isClientSide) { // Only on the server boolean isMounted = this.isVehicle() && this.getControllingPassenger() instanceof Player; // Only print if the state changed if (isMounted != lastMountedState) { if (isMounted) { Player player = (Player) this.getControllingPassenger(); // Verify the passenger is a player System.out.println("Server: Player " + player.getName().getString() + " is now mounted."); } else { System.out.println("Server: The wolf no longer has a passenger."); } lastMountedState = isMounted; } } } @Override public void addPassenger(Entity passenger) { super.addPassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(true)); } } } @Override public void removePassenger(Entity passenger) { super.removePassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is no longer mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(false)); } } } @Override public boolean isControlledByLocalInstance() { Entity entity = this.getControllingPassenger(); return entity instanceof Player; } @Override public void positionRider(Entity passenger) { if (this.hasPassenger(passenger)) { double xOffset = Math.cos(Math.toRadians(this.getYRot() + 90)) * 0.4; double zOffset = Math.sin(Math.toRadians(this.getYRot() + 90)) * 0.4; passenger.setPos(this.getX() + xOffset, this.getY() + this.getPassengersRidingOffset() + passenger.getMyRidingOffset(), this.getZ() + zOffset); } } } MountSyncPacket package com.vals.valscraft.network; import com.vals.valscraft.entity.MountableWolfEntity; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class MountSyncPacket { private final boolean isMounted; public MountSyncPacket(boolean isMounted) { this.isMounted = isMounted; } public void encode(FriendlyByteBuf buffer) { buffer.writeBoolean(isMounted); } public static MountSyncPacket decode(FriendlyByteBuf buffer) { return new MountSyncPacket(buffer.readBoolean()); } public void handle(NetworkEvent.Context context) { context.enqueueWork(() -> { ServerPlayer player = context.getSender(); // Get the player from the context if (player != null) { // Verifies if the player has dismounted if (!isMounted) { Entity vehicle = player.getVehicle(); if (vehicle instanceof MountableWolfEntity wolf) { // Logic to remove the player as a passenger wolf.removePassenger(player); System.out.println("Server: Player " + player.getName().getString() + " is no longer mounted."); } } } }); context.setPacketHandled(true); // Marks the packet as handled } } networkHandler package com.vals.valscraft.network; import com.vals.valscraft.valscraft; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.network.NetworkRegistry; import net.minecraftforge.network.simple.SimpleChannel; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class NetworkHandler { private static final String PROTOCOL_VERSION = "1"; public static final SimpleChannel CHANNEL = NetworkRegistry.newSimpleChannel( new ResourceLocation(valscraft.MODID, "main"), () -> PROTOCOL_VERSION, PROTOCOL_VERSION::equals, PROTOCOL_VERSION::equals ); public static void init() { int packetId = 0; // Register the mount synchronization packet CHANNEL.registerMessage( packetId++, MountSyncPacket.class, MountSyncPacket::encode, MountSyncPacket::decode, (msg, context) -> msg.handle(context.get()) // Get the context with context.get() ); } }  
    • Do you use features of inventory profiles next (ipnext) or is there a change without it?
    • Remove rubidium - you are already using embeddium, which is a fork of rubidium
  • Topics

×
×
  • Create New...

Important Information

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