Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hi, working on a compatibliy method to interface with SmartMoving Mod.

 

Normally I use this line of code when using Modloader. Works like a charm and allow my mod to hook in. "Btw when I program with Modloader I use only .txt not eclipse"

net.minecraft.src.BaseMod mod = (BaseMod)iterator.next();

 

However, while using eclipse and Forge. That line of code is red D:

net.minecraft.src.BaseMod mod = (BaseMod)iterator.next();

 

Which states: BaseMod cannot be resolved to a type.

 

Any solutions?

 

Just for added help, here is the rest of the code... for this method.

 

 

java.util.List list = net.minecraft.src.ModLoader.getLoadedMods();
			java.util.Iterator iterator = list.iterator();
			while(iterator.hasNext())
			{
				net.minecraft.src.BaseMod mod = (BaseMod)iterator.next();

				if("mod_SmartMoving".equals(mod.getName()))
				{
       					 try
        				{
       						 java.lang.Class modType = mod.getClass();

         					 java.lang.reflect.Method getInstance = modType
         					       .getMethod("getInstance", net.minecraft.src.EntityPlayer.class);

        					 java.lang.Object instance = getInstance
         					       .invoke(mod, Minecraft.getMinecraft().thePlayer);

       						 java.lang.Class type = instance.getClass();

         					 java.lang.reflect.Method getExhaustion = type
        					        .getMethod("getExhaustion");
       						 java.lang.reflect.Method addExhaustion = type
        					        .getMethod("addExhaustion", float.class);
      						 java.lang.reflect.Method setMaxExhaustionForAction = type
         					       .getMethod("setMaxExhaustionForAction", float.class);
       						 java.lang.reflect.Method setMaxExhaustionToStartAction = type
       						         .getMethod("setMaxExhaustionToStartAction", float.class);

       						 // the current exhaustion
       						 float currentExhaustion = (Float)getExhaustion.invoke(instance);

       						 //ActivateSmartMoving for AsgardShield
       						 mod_AsgardShield.smartMovingModActive = true;
       						 //asgardShieldExhaustion = currentExhaustion;
       						 if (mod_AsgardShield.EnableSmartMovingGuardID == true && mod_AsgardShield.smartMovingModActive == true)
       						 {

       							 // for checking whether a specific
       							 // action/activity is possible right now
       							 if(currentExhaustion <= 100F)
       							 {
       								 if (p.isBlocking())
       								 {
       									 if(ItemAsgardShield.asgardShieldActive == true || ItemZedSword.zedSwordActive == true)
       									 {
       										 // additional exhaustion per tick for the current
       										 // action/activity (may be completely consumed by
       										 // 'exhaustion loss per tick' if too small)
       										 addExhaustion.invoke(instance, .37F); 

       										 // set display to how high the exhaustion may get until
       										 // the current activity can not be continued any more
       										 setMaxExhaustionForAction.invoke(instance, 100F);

       										 // set display to how low the exhaustion need to be for
       										 // the current action/activity to be restarted again
       										 // (should really really be lower than the number above)
       										 setMaxExhaustionToStartAction.invoke(instance, 11.11F);
       									 }
       								 }
       							 }
       							 if (mod_AsgardShield.shieldBroke == false)
       							 {
       								 if (currentExhaustion >= 66.66F){mod_AsgardShield.guardTired = true; p.stopUsingItem();}
       								 if (currentExhaustion <= 33.33F && mod_AsgardShield.guardTired == true){mod_AsgardShield.guardTired = false;}
       							 }
       						 }
        				}
       					catch(java.lang.Exception e)
       					{
       					}

       					break;
				}
			}

 

 

Soo..

You know what importing of types are in java right?

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

  • Author

Full SmartMoving Interface Code. That was said to place anywhere long as it ran every tick.

 

 

 

//****************************************************************			
			java.util.List list = net.minecraft.src.ModLoader.getLoadedMods();
			java.util.Iterator iterator = list.iterator();
			while(iterator.hasNext())
			{
				net.minecraft.src.BaseMod mod = (BaseMod)iterator.next();
				System.out.println(mod.getName());

				if("mod_SmartMoving".equals(mod.getName()))
				{
       					 try
        				{
       						 java.lang.Class modType = mod.getClass();

         					 java.lang.reflect.Method getInstance = modType
         					       .getMethod("getInstance", net.minecraft.src.EntityPlayer.class);

        					 java.lang.Object instance = getInstance
         					       .invoke(mod, Minecraft.getMinecraft().thePlayer);

       						 java.lang.Class type = instance.getClass();

         					 java.lang.reflect.Method getExhaustion = type
        					        .getMethod("getExhaustion");
       						 java.lang.reflect.Method addExhaustion = type
        					        .getMethod("addExhaustion", float.class);
      						 java.lang.reflect.Method setMaxExhaustionForAction = type
         					       .getMethod("setMaxExhaustionForAction", float.class);
       						 java.lang.reflect.Method setMaxExhaustionToStartAction = type
       						         .getMethod("setMaxExhaustionToStartAction", float.class);

       						 // the current exhaustion
       						 float currentExhaustion = (Float)getExhaustion.invoke(instance);

       						 //ActivateSmartMoving for AsgardShield
       						 mod_AsgardShield.smartMovingModActive = true;
       						 //asgardShieldExhaustion = currentExhaustion;
       						 if (mod_AsgardShield.EnableSmartMovingGuardID == true && mod_AsgardShield.smartMovingModActive == true)
       						 {

       							 // for checking whether a specific
       							 // action/activity is possible right now
       							 if(currentExhaustion <= 100F)
       							 {
       								 if (p.isBlocking())
       								 {
       									 if(ItemAsgardShield.asgardShieldActive == true || ItemZedSword.zedSwordActive == true)
       									 {
       										 // additional exhaustion per tick for the current
       										 // action/activity (may be completely consumed by
       										 // 'exhaustion loss per tick' if too small)
       										 addExhaustion.invoke(instance, .37F); 

       										 // set display to how high the exhaustion may get until
       										 // the current activity can not be continued any more
       										 setMaxExhaustionForAction.invoke(instance, 100F);

       										 // set display to how low the exhaustion need to be for
       										 // the current action/activity to be restarted again
       										 // (should really really be lower than the number above)
       										 setMaxExhaustionToStartAction.invoke(instance, 11.11F);
       									 }
       								 }
       							 }
       							 if (mod_AsgardShield.shieldBroke == false)
       							 {
       								 if (currentExhaustion >= 66.66F){mod_AsgardShield.guardTired = true; p.stopUsingItem();}
       								 if (currentExhaustion <= 33.33F && mod_AsgardShield.guardTired == true){mod_AsgardShield.guardTired = false;}
       							 }
       						 }
        				}
       					catch(java.lang.Exception e)
       					{
       					}

       					break;
				}
			}
//*****************************************************************			

 

 

 

I have no more errors, however no response with SmartMoving either =/.

Guest
This topic is now closed to further replies.

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.