Questions tagged [java]

Java is both a popular object-oriented programming language and runtime environment which allows Java programs to run unchanged on most hardware and software platforms.

Filter by
Sorted by
Tagged with
0
votes
0answers
2 views

What math function represents Minecraft bow angle/height?

I am working on a mod in Minecraft Forge/MCP using Java. Aiming a bow is controlled by your head pitch and yaw rotation. Right now I have a math function that automatically looks at the target. But I ...
-1
votes
0answers
23 views

How to get the exact hit position in Minecraft Forge/MCP?

I am working on a project for Minecraft. I want to figure out exactly where a player was hit. For example, I want to be able to display a particle effect exactly where the player was hit (like chest ...
0
votes
1answer
30 views

How do I predict where a player will be next in Forge/MCP?

I am trying to predict where a player will be next based on where they are now in Java. I have their XYZ position, their XYZ motion, but I don't have their speed. How can I predict where they will be ...
0
votes
0answers
25 views

Can a 2 player mobile game support P2P if a dedicated server is used to establish the network?

The dedicated server would be a lobby where all the players connect and find matches. Once a match is found the server hooks to two players and sends them off on a p2p network. Once the match is over, ...
0
votes
1answer
41 views

How to execute code more frequently than once per tick in Minecraft Forge/MCP?

I'm working on a mod for Minecraft in Java. How can I make something happen every half tick? If I run my code in the tick function, my code is called 20 times a ...
0
votes
1answer
62 views

Java Simple 2D Grid Pathfinding

I want to code some basic pathfinding for my bot in Java. Below is a 2D grid representation of the 3D world. 0s being the places you can go, and 1s being the places that you cannot go. ...
1
vote
0answers
24 views

How to find player movement speed in Forge/MCP?

I want to predict where a player will be next based on where they are now. I have access to their XYZ, their motion in each direction, but I don't know how fast they are moving. Let's say that the ...
0
votes
0answers
24 views

ECS multithreading without value types?

Im working with an Java based ECS framework called "Artemis ODB". Its great so far but it lacks multithreading or jobs. So i wanted to add them by myself. I actually wanted to give each job ...
0
votes
1answer
16 views

Move between two points at a constant speed in LWJGL

I've been making a game engine in lwjgl and I have been trying to get an ai to move from one point to another. I used a lerp method but the speed is dependent on the distance between the two points, ...
0
votes
0answers
20 views

Weird Collision Response occurring between 2 objects

I have been trying to program collision response between two objects (with AABBs) and the response is not what I except. Instead of bouncing off (reflective to the collision normal) each other the ...
0
votes
1answer
57 views

How to interact with inventory only and not the game

I have created an inventory in which you can select some objects that you can spawn. This is a button in a table in a inventory class. Spawning is done via left mouse button (just click on some ...
1
vote
0answers
26 views

LWJGL Using gl_VertexID properly?

I've gotten back to making lwjgl games, and I'm trying to make a sort of wave type vertex shader. I call this to make it wave: ...
0
votes
1answer
30 views

2d zooming function using transformation matrix

I'm trying to create a sort of "graphing calculator coordinate system" where you can zoom into a point by scrolling with the mouse wheel. I'm using javafx's transformation matrices (Affines) ...
0
votes
0answers
21 views

In the ECS on my server, how should I organize components along with systems?

A quick note about my server is that it executes game logic in 250ms intervals. I am trying to wrap my head around how to do this. The main issue I have is currently that I have the map of entityIds ...
0
votes
0answers
31 views

How can i fix my enemy movement, and collision?

I recently started a project with some friends, Its a simple java game and im having issue getting the Collision and enemy movement working properly. Using this: ...
0
votes
0answers
22 views

implementation of a b-spline curve n points

hi i'm trying to implement the n points spline curve, but it seems like it requires some calculus knowledge. Unfortunately I did not follow the calculation of high school. I would like a function that ...
2
votes
1answer
28 views

LIBGDX ShaderProgram not passing uniforms

I'm trying to implement a Shader that turns any RGB values below 190 into black. LIBGDX code: ...
0
votes
0answers
13 views

How to convert normalized positions into screen positions LWJGL

Recently, I've been making 2D games, working on things, etc, and I've been wondering how I could make it so that the coordinates of glVertex2f() would be the same ...
0
votes
1answer
29 views
0
votes
0answers
17 views

In my Online multiplayer quiz game how can i make players to join and compete at a time?

I am creating a multiplayer Online quiz game in Android Studio using Java. I am having players registered using Firebase in my app. Ok so the main thing is , I'm having different set of quiz ...
0
votes
1answer
60 views

Very small line when two sprites are exactly next from eachother

Recently, I have been thinking about a hangout game, not really need to go into detail, because I am focusing on creating the engine itself. Basically just to make my brain not hurt while making the ...
0
votes
0answers
54 views

OBJ file loader texture coordinates ‘scrambled’

Edit I've rewritten the loader to duplicate data if only one element (v, vt, vn) is different. I get a much better result, but it is still incorrect. The seams on the mesh match what they should look ...
0
votes
1answer
28 views

How do I get the player from the LivingEntity so I can make this knockback effect on the amethyst sword?

Like the title says, how do I get the player from the LivingEntity so I can make this knockback effect on the amethyst sword? i want the amethyst sword to give knockback 10 to any entity i hit and in ...
0
votes
0answers
27 views

Delayed rendering of object sprite

I'm trying to replicate an odd feature of an 2.5D online Fighting Game named Grand Chase - that I believe it's is made to hide the latency between players. However, I do not know what exactly is this ...
2
votes
1answer
33 views

Building an LWJGL jar file - java.lang.NoClassDefFoundError

EDIT: Recently got it working by making a batch file that does this: set /p CP=<cp.txt java -cp %CP%;testing.jar me.pale.main.Main and cp.txt is this ...
1
vote
0answers
26 views

Looking for a 1.17 fabric minecraft mod that announces when nether portals are used

Does anyone know of a simple way to make a mod that puts a player's name and coords in chat on use of a nether portal (both ways), for a server that I have?
-1
votes
2answers
35 views

Rendering to BufferStrategy gives absolutely no output despite following instructions

I am following this YouTube tutorial by TheCherno to make 3D graphics using Java Standard Library. Display.java ...
2
votes
0answers
37 views

LibGDX: How to grow button height downwards in Table?

For my layout, I have a Table in which I add TextButtons with a height of 20. I also set the height of the table to 30. When I now increase the height of one button to 30, the height grows not ...
0
votes
0answers
14 views

Directional lighting messups with uniforms

Recently, I've been making a 3D game, and I have more progress! I am trying to implement lighting, but when I want to change the directional light uniform manually, it gets weird. Here's an example ...
0
votes
0answers
24 views

How to add level-by-level game camera following in 2D java game?

I've been working on my first game recently, and I've built a player tracking camera that works great, but my goal for the game would be to have a camera that is fixed for each area that the player ...
0
votes
1answer
39 views

opengl (lwjgl) - only white triangle gets rendered, vertex and fragment shader not responsive

Currently my program can only render my vertices as white and changes in my vertex and fragment shader don't change what gets rendered for some reason i.e: (...
0
votes
1answer
57 views

How resource-intensive is the java.awt.Graphics2D object at different screen resolutions?

I'm currently making a 2D RPG in pure Java (yes, I know other frameworks/engines exist xD). I just created a resizing algorithm and I've noticed that different resolutions result in different FPS ...
0
votes
0answers
25 views

How can I parse all items in the Minecraft chest getting all data from each item? (including custom item description on servers)

There is an items store on the server I'm playing on. What I would like to do is to parse all items in this store so I can quickly find a needed one. Since I'm 99% sure there is no ready-made ...
0
votes
0answers
20 views

Setting a TiledMapTiledLayer equal to another TiledMapTileLayer?

I am attempting to create a reset button in a simple isometric libgdx puzzle game I am making utilizing libgdx. I am using the TiledMap object in order to render my map. Within my code, I edit some ...
0
votes
1answer
36 views

Timing User Inputs for Inventory on 60UPS game loop

I'm making an inventory system for my pure Java game right now. Currently, the game runs at a 60UPS, and inputs are checked each update. I have inputs set up using arrays of the current update and ...
0
votes
2answers
51 views

How to port/convert a Java program to mobile?

I have coded a simple video game in Java. It works fine on all computers that have Java installed. However, I would really like to play it on my smartphone and it would also be nice to be able to play ...
2
votes
0answers
51 views

How to move player camera with mouse in LWJGL 2?

I making a 3D game like Minecraft in LWJGL 2 and now, I want to move player camera with mouse like Minecraft. Here are the codes I have: com/kg/kgcraft/KGCraft.java: ...
0
votes
1answer
67 views

Shaders overriding other shaders

Recently, I've been making a 3D game and I have been having trouble with making multiple shaders. I've researched this for a bit, and told that I had to use ...
1
vote
0answers
21 views

Slick-Utils texture not loading after binding to FBO

Recently, I am making a 3D game using LWJGL, and finally got framebuffer textures to work! The problem is, though, is that I think the default shader that is used for the cube doesn't work or the ...
0
votes
1answer
30 views

FBO not rendering or changing anything

Recently, I am making a 3D game. I want to do special post processing effects, like pixelization. I used this to load do everything with FBOS, but it's kindof weird... In some code for the ...
0
votes
2answers
71 views

Structuring a game in Java

I am currently programming my first game in Java and I'm having trouble structuring it. My biggest concern is regarding the game loop. Currently I have implemented a class with only a main function ...
0
votes
2answers
58 views

Placing a circle as close as possible to a specific coordinate without overlapping another circle

I am working on a 2D game in Java. My goal is to place a ball as close as possible to the center without overlapping the balls that are already there. How can this be done?
0
votes
0answers
7 views

Adding JPanel updates after being out of focus and back in focus of window

The title says it all, I am creating a chess game in Java using Swing, but using MouseListener and adding a JPanel using it, updates only after window goes out of focus, and then back in focus. Video ...
0
votes
0answers
12 views

How to create and add a JPanel from a class that is being extended by MouseListener

The title says it all. How can I create a JPanel from a MouseListener class? This is the code I have now: import java.awt.Color; import java.awt.Container; import ...
0
votes
0answers
21 views

Invisible pieces

I am making a chess game, and I made the background, but now, when I try to place the pieces, they are not added into the window. I tried instead of images text, but that doesn't show up neither. Code:...
0
votes
0answers
22 views

OpenGL never reverts to default FrameBuffer

So I'm trying to change the texture using FBOs, When I run it, The whole game gets drawn in the new FBO that I created then deleted, Here's the function ...
0
votes
1answer
34 views

Get on what tile has mouse clicked

I am writing a chess game using Java and Swing, And I wanted to get the tile position on which a mouse clicked. I searched through internet, but all of them were really off, and never accurate. When I ...
0
votes
0answers
21 views

Get tile position on what a mouse clicked [duplicate]

I am writing a chess game using Java and Swing, And I wanted to get the tile position on which a mouse clicked. I searched through internet, but all of them were really off, and never accurate. When I ...
2
votes
1answer
51 views

Where should I handle player movements in a Java Game?

I had an old pure Java 2D top-down game that I'm trying to reformat a bit. Before, I had a bit of a messy game loop that didn't use delta timing for any movements or animations. Now, I'm trying to ...
0
votes
0answers
23 views

How to set camera coordinates without making a Camera class?

Recently, I have been making a 3D game (and asking alot of questions about it), and yet again, I've run into another problem. I'm trying to rotate a cube across the "camera" origin, which is ...

1
2 3 4 5
68