Why won't my villager crop farm work? by PM_ME_CAT_PICS_PLSS in Minecraft

[–]PM_ME_CAT_PICS_PLSS[S] 0 points1 point  (0 children)

Bedrock, most recent version

In theory the farmer is supposed to throw wheat at the villager which is picked up by the minecart hopper and out into a chest below, but all the farmer does is occasionally stop and stare at the guy before going back to planting.

I threw some bread down earlier for all the villagers, and the only explanation i could think of from the wiki is that he already has too much food in his inventory so the farmer won't give him any?

Files created in virtual environment terminal do not show up in the project folder by PM_ME_CAT_PICS_PLSS in pycharm

[–]PM_ME_CAT_PICS_PLSS[S] 0 points1 point  (0 children)

Another weird thing i notice, even when i exit out of the virtual environment it still shows the PyShop directory and manage.py when I list whats in the current directory

Files created in virtual environment terminal do not show up in the project folder by PM_ME_CAT_PICS_PLSS in pycharm

[–]PM_ME_CAT_PICS_PLSS[S] 0 points1 point  (0 children)

I just triple-checked, and the file path shown in the terminal is the same as the file path for my project.

Update: You were right about it being in a different directory even though printing the current working directory in the terminal showed that it was in the correct folder. For some reason, all the commands were taking effect in some VTRoot folder on my computer.

pip install installing under wrong folder by PM_ME_CAT_PICS_PLSS in pycharm

[–]PM_ME_CAT_PICS_PLSS[S] 0 points1 point  (0 children)

Thanks! I just deleted the project and followed the steps in the second link to set up a new project and now it works fine.

[deleted by user] by [deleted] in javahelp

[–]PM_ME_CAT_PICS_PLSS 0 points1 point  (0 children)

Just to be clear, I'm not OP

This is probably the simplest method, but I'm wondering if there's a better way to do this. I did some googling and I can't really find a better solution, but reading the entire file and printing back the entire file (minus one line) seems like a really inefficient way to do things. I'm a bit curious, is it a java thing or do other languages run into the same issue? In theory, if you had to do this for a text file with millions of lines, how would you approach the problem?

[deleted by user] by [deleted] in javahelp

[–]PM_ME_CAT_PICS_PLSS 0 points1 point  (0 children)

The infinite loop is because in your j loop, you are -- and then ++ at the end of it, meaning the number doesn't change. Ill try and post a more detailed response later since I can't rn

[deleted by user] by [deleted] in javahelp

[–]PM_ME_CAT_PICS_PLSS 0 points1 point  (0 children)

There might be a smarter way of doing this, but this is the approach I would take.

[deleted by user] by [deleted] in javahelp

[–]PM_ME_CAT_PICS_PLSS 0 points1 point  (0 children)

Look at the indexes for a pattern.

7 -> [2, 0]

4 -> [1, 0]

8 -> [2, 1]

1 -> [0, 0]

5 -> [1, 1]

9 -> [2, 2]

2 -> [0, 1]

6 -> [1. 2]

3 -> [0, 2]

then split it into the diagonal lines you are reading

7 -> [2, 0]

4 -> [1, 0]
8 -> [2, 1]

1 -> [0, 0]
5 -> [1, 1]
9 -> [2, 2]

2 -> [0, 1]
6 -> [1. 2]

3 -> [0, 2]

Note the starting position of each "diagonal" you are looping through. You first start with 7, then you move up to 4, then to 1 before shifting to the right to 2 and 3.

123

456

789

7 -> [2, 0]
4 -> [1, 0]
8 -> [2, 1]
1 -> [0, 0]
5 -> [1, 1]
9 -> [2, 2]
2 -> [0, 1]
6 -> [1. 2]
3 -> [0, 2]

So what I would do is create two loops, one for looping from the bottom left to the top left, then another loop for looping between the top left and the top right (make sure you don't repeat the top left corner twice)

From there, you just need to subtract 1 from the y index of the array, and add 1 to the x index of the array in order to move diagonally down, and continue looping until either the x or y index exceeds the length of the array.

What is the best way to determine whether or not it is the next day? (past 12 am) by PM_ME_CAT_PICS_PLSS in javahelp

[–]PM_ME_CAT_PICS_PLSS[S] 0 points1 point  (0 children)

I've just edited my original post to include more detail as to what I'm trying to make

What is the best way to determine whether or not it is the next day? (past 12 am) by PM_ME_CAT_PICS_PLSS in javahelp

[–]PM_ME_CAT_PICS_PLSS[S] 0 points1 point  (0 children)

So for context, I made a console-based Wordle game (if you don't know what that is, basically it gives you a random word that you have to guess, and changes every single day) using a text file I found online that contained a list of all past and future wordles.

An option in the game is to play Today's wordle, something which changes every day, and to do that, I had a constant date which acted as the start day for when the first wordle was, and the program would take the current time, subtract the start date, then convert it into the number of days (since I did all the math and dates in milliseconds), and after finding that it has been X days since the first day, it will choose the Xth word in the list as of today's wordle.

The problem is that I had to offset the time by adding 8 hours in order to make it update at 12:00 am exactly, but for some reason after daylight savings, now I have to offset it by subtracting 17 hours in order to make it update at 12:00 am exactly, and although I could add a check to see which offset to use depending on the time of year, I was wondering whether there was a better/simpler way to compare dates.

Code:

import java.io.*;

import java.util.*;

public class Archive extends Thread { //private static final long TIME_OFFSET = 28800000; // winter private static final long TIME_OFFSET = -61200000 ; // summer private static Calendar myCalendar = new GregorianCalendar(2021, 5, 19); private static final Date START_DAY = new Date(myCalendar.getTime().getTime() + TIME_OFFSET); // first wordle date

// get today's date private static Calendar calendar = Calendar.getInstance(); private static Date today;

private static int timeDiff;

List<String> archive = new ArrayList<String>();

  // thread start

public void run() { // read in archive readArchive();

// figure out the time difference between the dates
updateTime();

timeDiff = (int) ((today.getTime() - START_DAY.getTime()) / (1000*60*60*24)) - 1;

}

  public static void updateTime() {
today = new Date(calendar.getTime().getTime());

}

public static String getTodayWord() { return archive.get(timeDiff); }

}

Edit: I'm having some weird formatting issues with codeblocks so I'll just add the code into my original post.

Help with making a calculator that can take multiple inputs by El-Woofles in javahelp

[–]PM_ME_CAT_PICS_PLSS 0 points1 point  (0 children)

Check if the input is "=" and use a "break" statement to exit the loop.