Jump to content

FreakzBoy

Members
  • Posts

    8
  • Joined

  • Last visited

FreakzBoy's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I forgot to mention that i'm not working on a mod thats going to be added, but on a whole minecraft client that should connect to the database. I basically export my client jar and place the things that are inside it into a normal minecraft jar, thats how i can basically start my client in the launcher. I dont know if you had experience with clients in general yet or only with mods, but it should be close to the same. By the way the link you have posted above, tells me, that i have to put dependency jars into my jar, which i can only get by converting my project into Maven. Is that correct?
  2. Yes i did, I've also tried putting the jar into my minecraft jar, which forge is supposed to extract into the mod repository and load them. For me this is not the case tho. That's why i've also tried the method written above
  3. Ok, i tried packaging the mysql-connector-java.jar after i exported my minecraft project and (put the com folder as well as the META-INF folder into my minecraft jar). Unfortunately, its still throwing the ClassNotFoundException: com.mysql.cj.jdbc.Driver and doesnt connect to my mysql database. I did some research on the internet too, and people were talking about dependencies in the META-INF folder and pom.xml which I'm not familiar. Any ideas?
  4. Hey, thanks for you responses. Wouldn't packaging the mysql-connector-java.jar file also be a solution to this?
  5. Hello, i'm currently working on a mysql database which im trying implement in with my minecraft project. My problem is, that if i export my project (with the minecraft classes of course) it throws an ClassNotFoundException for "com.mysql.cj.jdbc.Driver" Strangely, its working in debug mode but not when i export it. I have also already added the correct mysql-connector.jar to the libraries, as well as searching for reasons online.. I hope that someone will the cause for this and help me out with it. Console output: 01:47:16 game info java.lang.ClassNotFoundException: com.mysql.cj.jdbc.Driver 01:47:16 game info at java.net.URLClassLoader.findClass(URLClassLoader.java:381) 01:47:16 game info at java.lang.ClassLoader.loadClass(ClassLoader.java:424) 01:47:16 game info at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) 01:47:16 game info at java.lang.ClassLoader.loadClass(ClassLoader.java:357) 01:47:16 game info at java.lang.Class.forName0(Native Method) 01:47:16 game info at java.lang.Class.forName(Class.java:264) 01:47:16 game info at me.freakzboy.testclient.TestClient.startClient(CountDown.java:41) 01:47:16 game info at net.minecraft.client.Minecraft.startGame(Minecraft.java:575) 01:47:16 game info at net.minecraft.client.Minecraft.run(Minecraft.java:410) 01:47:16 game info at net.minecraft.client.main.Main.main(Main.java:114) 01:47:16 game info jdbc driver unavailable! public void startClient() { instance = this; try { Class.forName("com.mysql.cj.jdbc.Driver"); //this accesses Driver in jdbc. } catch (ClassNotFoundException e) { e.printStackTrace(); System.err.println("jdbc driver unavailable!"); return; } MySQL.connect(); } public static void connect() { if(isConnected() == false) { try { con = DriverManager.getConnection("jdbc:mysql://" + host + ":" + port + "/" + database, username, password); System.out.println("[MySQL] Successfully connected!"); } catch (SQLException e) { System.out.println("[MySQL] Error."); e.printStackTrace(); } } } Thanks, Freakz
  6. Update: I forgot to call the faceEntity in my render method. Thank you for reminding me! Your promised gift: ?
  7. Thank you for your quick response, so the reason regarding to the stutter, is my update() method with the EventUpdate e that is calling my faceEntity only 20 times a second?
  8. Hello, i was working on my minecraft client trying to make an automatic entity facing module and it works perfectly fine. The only problem that is bothering me is that there are stutters in between the yaw updating of the player which I don't know the reason to. The code is from this youtube video: Facing smoothly Here is a clip of it ingame to understand my problem more easily: Facing Stuttery (My version) It's a bit strange, since for the guy in the video its running smoothly. Here's the code: @EventTarget public void update(EventUpdate e) { ticks1 += 1; for(Iterator<Object> entities = mc.theWorld.loadedEntityList.iterator(); entities.hasNext();) { Object theObject = entities.next(); if(theObject instanceof EntityLivingBase) { EntityLivingBase entityplayer = (EntityLivingBase) theObject; if(entityplayer.getName() == mc.thePlayer.getName()){ continue; } if(entityplayer instanceof EntityPig) { if(mc.thePlayer.getDistanceSqToEntity(entityplayer) <= 10F) { this.faceEntity(entityplayer); } } } } } public static float[] getRotationsNeeded(Entity entity) { if(entity == null) return null; double diffX = entity.posX - Minecraft.getMinecraft().thePlayer.posX; double diffY; if(entity instanceof EntityLivingBase) { EntityLivingBase entityLivingBase = (EntityLivingBase)entity; diffY = entityLivingBase.posY + entityLivingBase.getEyeHeight() * 0.9 - (Minecraft.getMinecraft().thePlayer.posY + Minecraft .getMinecraft().thePlayer.getEyeHeight()); }else diffY = (entity.boundingBox.minY + entity.boundingBox.maxY) / 2.0D - (Minecraft.getMinecraft().thePlayer.posY + Minecraft .getMinecraft().thePlayer.getEyeHeight()); double diffZ = entity.posZ - Minecraft.getMinecraft().thePlayer.posZ; double dist = MathHelper.sqrt_double(diffX * diffX + diffZ * diffZ); float yaw = (float)(Math.atan2(diffZ, diffX) * 180.0 / Math.PI) - 90.0F; float pitch = (float)-(Math.atan2(diffY, dist) * 180.0 / Math.PI); return new float[]{ Minecraft.getMinecraft().thePlayer.prevCameraYaw + MathHelper.wrapAngleTo180_float(yaw - Minecraft.getMinecraft().thePlayer.prevCameraYaw), Minecraft.getMinecraft().thePlayer.rotationPitch + MathHelper.wrapAngleTo180_float(pitch - Minecraft.getMinecraft().thePlayer.rotationPitch)}; } public static void faceEntity(EntityLivingBase entity) { float[] rotations = getRotationsNeeded(entity); if (rotations != null) { Minecraft.getMinecraft().thePlayer.rotationYaw = rotations[0]; Minecraft.getMinecraft().thePlayer.rotationPitch = rotations[1] + 1; } } I would really appreciate it if someone would help me out with my problem! The person that will help me gets a cookie ? Best Regards, Freakz :)
×
×
  • Create New...

Important Information

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