Description Resource Path Location TypeDescription Resource Path Location TypeThe method getPosition() in the type EntityPlayerSP is not applicable for the arguments (float) TcpAckFrequencyTweaker.java /MDKExample/src/main/java/net/kohi/tcpackfrequency line 60 Java Problem
package net.kohi.tcpackfrequency;
import net.minecraft.init.Blocks;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.PlayerControllerMP;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.entity.Entity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraftforge.classloading.FMLForgePlugin;
import net.minecraftforge.client.event.MouseEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@Mod(modid = TcpAckFrequencyTweaker.MODID, version = TcpAckFrequencyTweaker.VERSION)
public class TcpAckFrequencyTweaker
{
public static final String MODID = "TcpAckFrequency";
public static final String VERSION = "1.0";
@EventHandler
public void init(FMLInitializationEvent event)
{
MinecraftForge.EVENT_BUS.register(this);
FMLCommonHandler.instance().bus().register(this);
}
@SubscribeEvent
public void onMouseEvent(MouseEvent e)
{
Minecraft mc = Minecraft.getMinecraft();
if ((mc.gameSettings.fovSetting != 80.0F) &&
(e.buttonstate) &&
(e.button == 0) && (
(mc.objectMouseOver == null) || (mc.objectMouseOver.entityHit == null)))
{
Entity ent = findEnt(4.0D);
if ((ent != null) &&
(Math.random() > 0.14D)) {
mc.playerController.attackEntity(Minecraft.getMinecraft().thePlayer, ent);
}
}
}
public Entity findEnt(double a)
{
Minecraft func_71410_x;
Minecraft minecraft = func_71410_x = Minecraft.getMinecraft();
MovingObjectPosition rayTrace = func_71410_x.thePlayer.rayTrace(a, 1.0F);
double distanceTo = a;
Vec3 getPosition = func_71410_x.thePlayer.getPosition(1.0F);
if (rayTrace != null) {
distanceTo = rayTrace.hitVec.distanceTo(getPosition);
}
Minecraft minecraft2 = minecraft;
Vec3 getLook = minecraft2.thePlayer.getLook(1.0F);
Vec3 addVector = getPosition.addVector(getLook.xCoord * a, getLook.yCoord * a, getLook.zCoord * a);
Entity entity = null;
float n = 1.0F;
WorldClient theWorld = minecraft2.theWorld;
Minecraft minecraft3 = minecraft;
List func_72839_b = theWorld.getEntitiesWithinAABBExcludingEntity(minecraft3.thePlayer, minecraft3.thePlayer.getBoundingBox().addCoord(getLook.xCoord * a, getLook.yCoord * a, getLook.zCoord * a).expand(1.0D, 1.0D, 1.0D));
double n2 = distanceTo;
int n3;
for (int i = n3 = 0; i < func_72839_b.size(); i = n3)
{
Entity entity2;
if ((entity2 = (Entity)func_72839_b.get(n3)).canBeCollidedWith())
{
Entity entity3 = entity2;
float func_70111_Y = entity3.getCollisionBorderSize();
AxisAlignedBB expand = entity3.getBoundingBox().expand(func_70111_Y, func_70111_Y, func_70111_Y);
MovingObjectPosition func_72327_a = expand.calculateIntercept(getPosition, addVector);
if (expand.isVecInside(getPosition))
{
if ((0.0D < n2) || (n2 == 0.0D))
{
entity = entity2;
n2 = 0.0D;
}
}
else
{
double distanceTo2;
if ((func_72327_a != null) && (((distanceTo2 = getPosition.distanceTo(func_72327_a.hitVec)) < n2) || (n2 == 0.0D))) {
if (entity2 == minecraft.thePlayer.ridingEntity)
{
if (n2 == 0.0D) {
entity = entity2;
}
}
else
{
entity = entity2;
n2 = distanceTo2;
}
}
}
}
n3++;
}
return entity;
}
}
The error message tells you exactly what you're doing wrong: The EntityPlayerSP#getPosition method doesn't take any arguments, but you're calling it with a float.
You must have a solid understanding of Java and OO programming before you can make a mod.
In future, please use Gist or Pastebin to post logs/crash reports (if applicable) and code with syntax highlighting. To get syntax highlighting on Gist, give each file the appropriate extension (.java for Java code). To get syntax highlighting on Pastebin, select the language from the dropdown at the bottom of the page.
It's much easier to read code with proper formatting and syntax highlighting.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Helpp!!!!!!!!!!!! :c
This is the error:
Description Resource Path Location TypeDescription Resource Path Location TypeThe method getPosition() in the type EntityPlayerSP is not applicable for the arguments (float) TcpAckFrequencyTweaker.java /MDKExample/src/main/java/net/kohi/tcpackfrequency line 60 Java Problem
The error message tells you exactly what you're doing wrong: The EntityPlayerSP#getPosition method doesn't take any arguments, but you're calling it with a float.
You must have a solid understanding of Java and OO programming before you can make a mod.
In future, please use Gist or Pastebin to post logs/crash reports (if applicable) and code with syntax highlighting. To get syntax highlighting on Gist, give each file the appropriate extension (.java for Java code). To get syntax highlighting on Pastebin, select the language from the dropdown at the bottom of the page.
It's much easier to read code with proper formatting and syntax highlighting.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.