Well that makes a lot more sense, thanks! And don't worry about the packages, I can figure that bit out. I should be able to get it up and running in eclipse now.
Operator means a word or symbol that does something in java. For example, +, -, = and * are all operators, and so is new.
I'm not sure what @AstroNoodles means by 'return the method' either!
The lines in question are lines 73 and 114 in the ClientHandler class. Using line 114 as an example, it currently looks like this:
AxisAlignedBB.getBoundingBoxFromPool aabb = new AxisAlignedBB.getBoundingBoxFromPool(
What you're trying to do here is make a new AxisAlignedBB object called aabb. The way this is done (in 1.7.10) is to call the static method AxisAlignedBB.getBoundingBoxFromPool(...), with the coordinates you want inside of the brackets, and this returns an AxisAlignedBB object with those coordinates. So line 114 should look like this:
Edit: @Electroblob_ said everything I was going to say, my page refreshed as I made this post.
But simply, he's right. I meant to say that you just needed to receive the AxisAlignedBB without the extra getBoundingBoxFromPool in the first part of the statement. (before the equals sign)
I'll try to be clearer from now on.
BTW: For more info on static, here is a small tutorial on it: Link Removed
Okay, I've got it working fully in eclipse now, so here are all the errors and how to fix them:
ClientHandler, line 72: change mc.renderViewEntity() to mc.renderViewEntity
This is something that is different in 1.7 to 1.8; I think I mentioned it in an earlier post. Useful tip: in eclipse, if you want to find a method or field but don't know its exact name, you can type the name of the object (mc in this case) followed by a dot and eclipse will display a list of all the methods and fields that are avaiable, which you can scroll through to find the one you want.
ClientHandler, lines 154 and 161: change new Vec3 to Vec3.createVectorHelper
Again, this is a difference between Minecraft versions.
MessageExtendedReachAttack, line 4: change com.oracle.webservices.internal.api.message.MessageContext to cpw.mods.fml.common.network.simpleimpl.MessageContext
Here you have imported the wrong class out of two classes that share the same name. The fact that the package is com.oracle.webservices suggests it's not what you want; on the other hand, cpw.mods.fml is part of Forge which means it is the right one to use.
In MessageExtendedReachAttack.Handler, replace the entire contents of the onMessage method with this:
// DEBUG
System.out.println("Message received");
if (ctx.side.isServer()){
final EntityPlayerMP thePlayer = ctx.getServerHandler().playerEntity;
Entity theEntity = thePlayer.worldObj.
getEntityByID(message.entityId);
// DEBUG
System.out.println("Entity = "+theEntity);
// Need to ensure that hackers can't cause trick kills,
// so double check weapon type and reach
if (thePlayer.getCurrentEquippedItem() == null)
{
return null;
}
if (thePlayer.getCurrentEquippedItem().getItem() instanceof
IExtendedReach)
{
IExtendedReach theExtendedReachWeapon =
(IExtendedReach)thePlayer.getCurrentEquippedItem().
getItem();
double distanceSq = thePlayer.getDistanceSqToEntity(
theEntity);
double reachSq =theExtendedReachWeapon.getReach()*
theExtendedReachWeapon.getReach();
if (reachSq >= distanceSq)
{
thePlayer.attackTargetEntityWithCurrentItem(
theEntity);
}
}
return null; // no response in this case
}
return null; // no response message
Again, this is another version difference. In 1.8, networking should be threadsafe - I'll admit that I don't know exactly what was going on with the Runnable thing before, but what I do know is that in 1.7.10 it is unnecessary.
That should fix all the compile errors, but when I launched the game after doing that it crashed several times, so you need to fix these things as well:
Main.NETWORK_CHANNEL_NAME needs to be non-null. (Why did you make it null in the first place?)
ModBlocks.Main() and ZModWeapons.Main() are missing from the PreLoad method, so add those in.
Creative tabs must return an item from the getTabIconItem method, not null. I'm guessing you hadn't finished them, but you'll run into problems if you return null, so just use Items.brick or something until you have something better to put in there.
It should work once you've done all that, I've tested the reach thing and it works as expected.
Here are a few things I would recommend you do to make your code nicer:
The Axe, Pickaxe, Shovel and Hoe classes you have written are pointless in their current form. If you're planning to add stuff then that's fine, but otherwise you might as well use ItemAxe, ItemPickaxe, etc. directly.
You can define creative tabs in anonymous classes or nested classes, which can reduce the number of tiny classes that are each in their own separate file.
Use consistent naming conventions for your methods, fields, classes, etc. Normally, methods and fields use camelCase, constants use UPPER_CASE (which you have done), and classes use CapitalisedWords.
I would also personally advise against using 12 different creative tabs. As a user, I find it a bit of a pain to page through loads of them, but that's just my opinion.
Hopefully you can get it working now, let me know if not.
The Meaning of Life, the Universe, and Everything.
Location:
Colorado
Join Date:
3/27/2016
Posts:
208
Location:
Colorado
Minecraft:
ProfessorOro
Discord:
gargatheoro
PMC:
GargatheOro
Member Details
I got some good news and some bad news:
Yay! It finally works, launches, plays, and doesn't crash. My other features so far still work.
There is one error in the client handler that can still run MC, but bugs the crap out of my OCD at ClientHandler line 73. And also, the whole entire extended reach doesn't work. I cannot shorten or extend reach. Well, I can but it is still a 5 block range for all of the weapons. I have updated the GitHub repository at https://github.com/ArIlIlI/1.7.10-Modding
I have tested it in my eclipse and it is working, I was able to stand at a certain distance from a creeper where I could not hit it with a regular sword but I could with your modded item. Is the Github completely up-to-date? I can compare my code to yours then.
The Meaning of Life, the Universe, and Everything.
Location:
Colorado
Join Date:
3/27/2016
Posts:
208
Location:
Colorado
Minecraft:
ProfessorOro
Discord:
gargatheoro
PMC:
GargatheOro
Member Details
I have figured out my issue! I had my init and post init proxy methods in my main class commented out! That solved my extended reach. Now the flip side, what about shortened reach? And github should now be up to date.
The Meaning of Life, the Universe, and Everything.
Location:
Colorado
Join Date:
3/27/2016
Posts:
208
Location:
Colorado
Minecraft:
ProfessorOro
Discord:
gargatheoro
PMC:
GargatheOro
Member Details
Also, may I have your permission to use Electroblob's wizardry on my fantasy server I am making?
EDIT: I tested to make sure the mod even worked and your mod does not work with my server for some reason. It does not conflict with any mod because I tested this client side, but the server crashes right when it starts because this mod sends a message to make the server stop.
Please reply ASAP. I finally got the server working again after four hours part of it is the server host is not user friendly.
I have figured out my issue! I had my init and post init proxy methods in my main class commented out! That solved my extended reach. Now the flip side, what about shortened reach? And github should now be up to date.
For shortened reach, you can use events. In your CommonHandler class, create a new method that looks like this:
// This is pseudo-code, it definitely won't compile!
@SubscribeEvent
public void onLivingAttackEvent(LivingAttackEvent event){
if(attacking entity is holding your item){
// check distance between attacker and target and cancel the event with event.setCanceled(true) if it is higher
// than a certain value
}
}
That's the general idea, but you'll need to fill in the details. Now, if you want to do this for more than one item, the best way to do that would be to create an interface IReducedReach that's exactly the same as IExtendedReach. Then you can check if the item held by the attacker is an instance of IReducedReach, and if so use the getReach method to get the distance limit to be tested.
Also, may I have your permission to use Electroblob's wizardry on my fantasy server I am making?
EDIT: I tested to make sure the mod even worked and your mod does not work with my server for some reason. It does not conflict with any mod because I tested this client side, but the server crashes right when it starts because this mod sends a message to make the server stop.
Please reply ASAP. I finally got the server working again after four hours part of it is the server host is not user friendly.
The mod can't possibly be telling the server to stop. Do you have a log or a crash report? If so, please post it. As for permissions, this is taken directly from the Wizardry thread and should answer your question:
You may run a server with wizardry installed, and you may make money from such a server through adverts, paid ranks, donations etc., provided that you do not sell content from the mod (such as selling spell books) or sell access to content from the mod.
The Meaning of Life, the Universe, and Everything.
Location:
Colorado
Join Date:
3/27/2016
Posts:
208
Location:
Colorado
Minecraft:
ProfessorOro
Discord:
gargatheoro
PMC:
GargatheOro
Member Details
I do have an FML startup log #1 at a different github repository. Link is: To Crash Report
Funny thing is is that it works just fine on the client side, but not the server side. This all started when I popped your mod into the server so it has to be your mod or a preexisting mod clashing with yours on the serverside.
Modlist:
Lichlandcore (My mod)
Et Futurum
Your Mod
Forge Essentials
Mine Tweaker 3
EDIT: As I was reading the report myself, I found line 1163 had some good info.
Second Edit: Forge Essentials is the error so your mod clashes with it. Saying repeatedly an error of something to do with the ItemScroll. Looks like the server successfully started when I removed ForgeEssentials, but it might be something to look in to for your own sake. I would really appreciate if it worked with forge essentials. Luckily that was the mod I could most afford to remove.
The Meaning of Life, the Universe, and Everything.
Location:
Colorado
Join Date:
3/27/2016
Posts:
208
Location:
Colorado
Minecraft:
ProfessorOro
Discord:
gargatheoro
PMC:
GargatheOro
Member Details
Your mod works awesomely. I want to know however if there is a way to redo the schools of magic. I want to make the traditional 8 schools of magic. I want to make healing a cleric thing cast from Clerical Censors, charged on a Clerical Alter. I also want to make Earth become Druid spells that use staffs and use some kind of druid alter table. There is nothing wrong with your mod it is just I am looking for a traditional set of magic most my player base is used to.
8 schools:
Abjuration: Shielding magic, some healing
Alteration: Changes physical properties of objects and creatures
Conjuration: Summons (Non-Undead normally) creatures and objects (Like your spectral sword spell)
Divination: True sight of the past, present, and future (Like the sixth sense. Also maybe a spell to look at server logs?)
Evocation: Harnesses raw magic into a powerful force (Like the fire and lightning stuff)
Enchantment: Spells to charm creatures or bestow power upon objects
Illusion: Makes things that aren't real (Invisibility spell and the decoy are good examples)
Necromancy: Already exists in the mod, spot on (My favorite school of magic )
Well that makes a lot more sense, thanks! And don't worry about the packages, I can figure that bit out. I should be able to get it up and running in eclipse now.
Operator means a word or symbol that does something in java. For example, +, -, = and * are all operators, and so is new.
I'm not sure what @AstroNoodles means by 'return the method' either!
The lines in question are lines 73 and 114 in the ClientHandler class. Using line 114 as an example, it currently looks like this:
What you're trying to do here is make a new AxisAlignedBB object called aabb. The way this is done (in 1.7.10) is to call the static method AxisAlignedBB.getBoundingBoxFromPool(...), with the coordinates you want inside of the brackets, and this returns an AxisAlignedBB object with those coordinates. So line 114 should look like this:
Likewise, line 73 should look like this:
In both cases the stuff inside the brackets stays the same, but that's on the next line anyway.
Hopefully that's a bit easier to understand.
Edit: @Electroblob_ said everything I was going to say, my page refreshed as I made this post.
But simply, he's right. I meant to say that you just needed to receive the AxisAlignedBB without the extra getBoundingBoxFromPool in the first part of the statement. (before the equals sign)
I'll try to be clearer from now on.
BTW: For more info on static, here is a small tutorial on it: Link Removed
I still get a crash. I have updated the repository. https://github.com/ArIlIlI/1.7.10-Modding
An SF Towny server! Join our Discord: Click here
You guys got any ideas?
An SF Towny server! Join our Discord: Click here
Okay, I've got it working fully in eclipse now, so here are all the errors and how to fix them:
ClientHandler, line 72: change mc.renderViewEntity() to mc.renderViewEntity
This is something that is different in 1.7 to 1.8; I think I mentioned it in an earlier post. Useful tip: in eclipse, if you want to find a method or field but don't know its exact name, you can type the name of the object (mc in this case) followed by a dot and eclipse will display a list of all the methods and fields that are avaiable, which you can scroll through to find the one you want.
ClientHandler, lines 154 and 161: change new Vec3 to Vec3.createVectorHelper
Again, this is a difference between Minecraft versions.
MessageExtendedReachAttack, line 4: change com.oracle.webservices.internal.api.message.MessageContext to
cpw.mods.fml.common.network.simpleimpl.MessageContext
Here you have imported the wrong class out of two classes that share the same name. The fact that the package is com.oracle.webservices suggests it's not what you want; on the other hand, cpw.mods.fml is part of Forge which means it is the right one to use.
In MessageExtendedReachAttack.Handler, replace the entire contents of the onMessage method with this:
Again, this is another version difference. In 1.8, networking should be threadsafe - I'll admit that I don't know exactly what was going on with the Runnable thing before, but what I do know is that in 1.7.10 it is unnecessary.
That should fix all the compile errors, but when I launched the game after doing that it crashed several times, so you need to fix these things as well:
Main.NETWORK_CHANNEL_NAME needs to be non-null. (Why did you make it null in the first place?)
ModBlocks.Main() and ZModWeapons.Main() are missing from the PreLoad method, so add those in.
Creative tabs must return an item from the getTabIconItem method, not null. I'm guessing you hadn't finished them, but you'll run into problems if you return null, so just use Items.brick or something until you have something better to put in there.
It should work once you've done all that, I've tested the reach thing and it works as expected.
Here are a few things I would recommend you do to make your code nicer:
The Axe, Pickaxe, Shovel and Hoe classes you have written are pointless in their current form. If you're planning to add stuff then that's fine, but otherwise you might as well use ItemAxe, ItemPickaxe, etc. directly.
You can define creative tabs in anonymous classes or nested classes, which can reduce the number of tiny classes that are each in their own separate file.
Use consistent naming conventions for your methods, fields, classes, etc. Normally, methods and fields use camelCase, constants use UPPER_CASE (which you have done), and classes use CapitalisedWords.
I would also personally advise against using 12 different creative tabs. As a user, I find it a bit of a pain to page through loads of them, but that's just my opinion.
Hopefully you can get it working now, let me know if not.
I got some good news and some bad news:
Yay! It finally works, launches, plays, and doesn't crash. My other features so far still work.
There is one error in the client handler that can still run MC, but bugs the crap out of my OCD at ClientHandler line 73. And also, the whole entire extended reach doesn't work. I cannot shorten or extend reach. Well, I can but it is still a 5 block range for all of the weapons. I have updated the GitHub repository at https://github.com/ArIlIlI/1.7.10-Modding
An SF Towny server! Join our Discord: Click here
Perhaps that one error has something to do with it?
An SF Towny server! Join our Discord: Click here
It certainly does! See post #21 above, I think you forgot to change line 73 as well as line 114. Line 73 should look like this:
Glad to hear it's nearly working for you.
It doesn't seem to work still
Note: It doesn't like the "FromPool" part. It wants me to have it be getBoundingBox.
Thank you! I have no errors now at least.
An SF Towny server! Join our Discord: Click here
Ah, my apologies, it is getBoundingBox, not getBoundingBoxFromPool. Good to hear it's working!
Well, it doesn't work for some reason still, which is odd. I even tried a 20 block range to dramatically test it but no
An SF Towny server! Join our Discord: Click here
Any ideas on what would be causing that? I don't understand why either. Perhaps it is because the vec boolean is weird?
An SF Towny server! Join our Discord: Click here
I have tested it in my eclipse and it is working, I was able to stand at a certain distance from a creeper where I could not hit it with a regular sword but I could with your modded item. Is the Github completely up-to-date? I can compare my code to yours then.
I have figured out my issue! I had my init and post init proxy methods in my main class commented out! That solved my extended reach. Now the flip side, what about shortened reach? And github should now be up to date.
An SF Towny server! Join our Discord: Click here
Also, may I have your permission to use Electroblob's wizardry on my fantasy server I am making?
EDIT: I tested to make sure the mod even worked and your mod does not work with my server for some reason. It does not conflict with any mod because I tested this client side, but the server crashes right when it starts because this mod sends a message to make the server stop.
Please reply ASAP. I finally got the server working again after four hours part of it is the server host is not user friendly.
An SF Towny server! Join our Discord: Click here
For shortened reach, you can use events. In your CommonHandler class, create a new method that looks like this:
That's the general idea, but you'll need to fill in the details. Now, if you want to do this for more than one item, the best way to do that would be to create an interface IReducedReach that's exactly the same as IExtendedReach. Then you can check if the item held by the attacker is an instance of IReducedReach, and if so use the getReach method to get the distance limit to be tested.
The mod can't possibly be telling the server to stop. Do you have a log or a crash report? If so, please post it. As for permissions, this is taken directly from the Wizardry thread and should answer your question:
I do have an FML startup log #1 at a different github repository. Link is: To Crash Report
Funny thing is is that it works just fine on the client side, but not the server side. This all started when I popped your mod into the server so it has to be your mod or a preexisting mod clashing with yours on the serverside.
Modlist:
Lichlandcore (My mod)
Et Futurum
Your Mod
Forge Essentials
Mine Tweaker 3
EDIT: As I was reading the report myself, I found line 1163 had some good info.
Second Edit: Forge Essentials is the error so your mod clashes with it. Saying repeatedly an error of something to do with the ItemScroll. Looks like the server successfully started when I removed ForgeEssentials, but it might be something to look in to for your own sake. I would really appreciate if it worked with forge essentials. Luckily that was the mod I could most afford to remove.
An SF Towny server! Join our Discord: Click here
Your mod works awesomely. I want to know however if there is a way to redo the schools of magic. I want to make the traditional 8 schools of magic. I want to make healing a cleric thing cast from Clerical Censors, charged on a Clerical Alter. I also want to make Earth become Druid spells that use staffs and use some kind of druid alter table. There is nothing wrong with your mod it is just I am looking for a traditional set of magic most my player base is used to.
8 schools:
Abjuration: Shielding magic, some healing
Alteration: Changes physical properties of objects and creatures
Conjuration: Summons (Non-Undead normally) creatures and objects (Like your spectral sword spell)
Divination: True sight of the past, present, and future (Like the sixth sense. Also maybe a spell to look at server logs?)
Evocation: Harnesses raw magic into a powerful force (Like the fire and lightning stuff)
Enchantment: Spells to charm creatures or bestow power upon objects
Illusion: Makes things that aren't real (Invisibility spell and the decoy are good examples)
Necromancy: Already exists in the mod, spot on (My favorite school of magic )
An SF Towny server! Join our Discord: Click here
@Electroblob_?
An SF Towny server! Join our Discord: Click here
Too much off-topic. Discuss everything on the mod's page.