Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7512621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:55:12+00:00 2026-05-29T23:55:12+00:00

I am well into creating my 2d remake of minecraft in java. I know

  • 0

I am well into creating my 2d remake of minecraft in java. I know it can be done well, orange451 on youtube inspired me to try and make this. I have all blocks on the map loading from text files, and when the game loads, it adds all of the blocks from the text files to an ArrayList. I created an algorithm for calculating the index of the block your cursor is on in the game, and added a MouseListener so that when i clicked it would replace the block with an air block (basically destroying the block). To replace the block in the ArrayList, I used the ArrayList set(index, obj) method. In theory, it should be working correctly, and it in a way does. The only problem is that it also creates a black space in the map a few blocks away. This is extremly frustrating, especially since I have come so far. ADDITIONAL INFO: I need a method that will replace the object in the ArrayList, or a better way to do it because my collision detection method also uses the ArrayList to detect a blocks position. PLEASE HELP ME! I cant post images but its setting the block to the air texture but creating a black square (a gap in the arraylist mabey?) near it. Because theres too much code to post, heres the source code for the whole project: Blockworld 2D Source

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T23:55:13+00:00Added an answer on May 29, 2026 at 11:55 pm

    You’re struggling with this because an ArrayList of objects that know their coordinate is an insane way to represent this 2d structure. It’s unordered – you could reverse or shuffle your ArrayList and it would paint the same. It has O(N) update, as you have to search the ArrayList for an object of the appropriate coordinate before you can replace it. It can have more than one object with the same coordinate. It can be in a state where visible coordinates do not have corresponding objects at all — which is what you’ve encountered, here.

    PLEASE HELP ME

    OK. Start with a two dimensional array (array, not ArrayList) of byte. Which allows you 256 kinds of block, and which allows your players to dig without constantly allocating memory with your new AirBlock(0, 0) madness. To draw the world, iterate over visible coordinates and map bytes to Bitmap or like.

    Also: a 2d Minecraft already exists. It’s called Terraria.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Picture this: you are creating a little module that people can incorporate into their
How do I make a Constant Applicative Form into, well, not a Constant Applicative
Well, I am creating a minecraft like terrain thing which - like minecraft is
Well, I am creating a minecraft terrain thing just for the heck of it.
I'm creating a java open source utility package and I would like to know
Alright well I recently got into normalizing my database for this little side project
I'm well into implementing a REST service (on a Windows CE platform if that
Well I am using the following code to take any old image into a
Well, my latest contract is forcing me into the antique world of .Net 1.1.
Since the GOF book was put together well before .Net came into being, are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.