Reading Minecraft-like binary files

I decompiled the first Minecraft version (rd-132211) using jd-gui and recompiled it. After recompiling, running Minecraft had no problem except screen size problem and I can make sure the source code has no problem.

Now, I looked at com.mojang.rubydung.level Level.java file. But I can’t understand lot.

Here is the code I understood and used in my code:

package com.kg.jopenattack.level;  import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.util.zip.GZIPInputStream; import java.util.zip.GZIPOutputStream;  public class Level {     private byte[] bytes = new byte[1];     public void load() throws FileNotFoundException, IOException {         DataInputStream dis = new DataInputStream(new GZIPInputStream(new FileInputStream(new File("level.lvl"))));         dis.readFully(bytes);         dis.close();     }     public void save() throws FileNotFoundException, IOException {         DataOutputStream dos = new DataOutputStream(new GZIPOutputStream(new FileOutputStream(new File("level.lvl"))));         dos.write(bytes);         dos.close();     } } 

But this code reads nothing.

To decompile Minecraft rd-132211, enable historical option in Minecraft launcher settings and create rd-132211 installation.

reading input from multiple mice in QB64 in Windows 10?

I am looking to write a non-network multiplayer game for Windows 10 with QB64 that accepts input from 2 or more USB mice plugged into the system. Like a simple Pong game where additional players plug mice into a USB hub to use as game controllers.

I have been googling this and found some older threads

  • Is it possible to detect two different mice at the same time, and have their movements recorded seperately? Asked 8 years, 9 months ago
  • How do I read input from multiple keyboards/mice on one computer? Asked 7 years, 6 months ago

however these are pretty old threads from before Windows 10, also they seem to be more oriented towards C++ or .NET.

Can anyone provide some example how it might be done with QB64 under Windows 10?

Thanks

Does reading the Book of Exalted Deeds prevent casting non-upcast 5th-level spells into a Ring of Spell Storing?

The Ring of Spell Storing states (emphasis mine):

This ring stores spells cast into it, holding them until the attuned wearer uses them. The ring can store up to 5 levels worth of spells at a time. When found, it contains 1d6 − 1 levels of stored spells chosen by the GM.

Any creature can cast a spell of 1st through 5th level into the ring by touching the ring as the spell is cast. The spell has no effect, other than to be stored in the ring. If the ring can’t hold the spell, the spell is expended without effect. The level of the slot used to cast the spell determines how much space it uses.

While wearing this ring, you can cast any spell stored in it. The spell uses the slot level, spell save DC, spell attack bonus, and spellcasting ability of the original caster, but is otherwise treated as if you cast the spell. The spell cast from the ring is no longer stored in it, freeing up space.

The Book of Exalted Deeds states:

[…] Once you’ve read and studied the book, any spell slot you expend to cast a cleric or paladin spell counts as a spell slot of one level higher. […]

Thus, any 5th-level spell cast using a 5th-level spell slot would count as using a 6th-level spell slot, which cannot be stored into a Ring of Spell Storing. Is this correct? Is there some rule I’ve missed or way around this besides ending the benefits from the Book?

Reading from Streaming Assets in WebGL

I’m trying to set up my Unity game for WebGL, but I quickly found out that you can’t access your streaming assets as you would in a standalone build. For example, I have a code snippet below of how I load in all of my game’s text for localization (i.e. get english translations of all text in my UI).

public void LoadLocalizedText(string fileName) {         localizedText = new Dictionary<string, string>();         // StreamingAssetsPath will always be known to unity, regardless of hardware         string filePath = Path.Combine(Application.streamingAssetsPath, fileName);           if (File.Exists(filePath)) {             string dataAsJson = File.ReadAllText(filePath);              // deserialize text from text to a LocalizationData object             LocalizationData loadedData = JsonUtility.FromJson<LocalizationData>(dataAsJson);              for(int i = 0; i < loadedData.texts.Length; i++) {                 localizedText.Add(loadedData.texts[i].key, loadedData.texts[i].value);             }         }         else {             // ideally would handle this more gracefully, than just throwing an error (e.g. a pop up)             Debug.LogError("Cannot find file");         }                  isReady = true;     } 

I’ve been looking at online examples, and there’s a lot of obsolete examples regarding the use of unity’s WWW class and php. From what I understand the UnityWebRequest is now the way to go, but I’m confused how to use it with regards to the example above. I’m also trying to figure out how to connect to my SQLite database which is also stored in streamingAssets.

        public SqliteHelper(string databaseFileName) {         if (Application.platform == RuntimePlatform.WebGLPlayer) {             // ????????         }         else {             tag = databaseFileName + ":\t";              string dbPath = Path.Combine(Application.streamingAssetsPath, databaseFileName);               if (System.IO.File.Exists(dbPath)) {                 dbConnectionString = "URI=file:" + dbPath;             }             else {                 Debug.Log ("ERROR: the file DB named " + databaseFileName + " doesn't exist anywhere");             }         }     } 

Now that I can’t just open an SqliteConnection, I have no idea if there’s a c# only solution, or if I have to learn php as suggested from tutorials such as this one. If someone could walk me through how to solve either of these problems I would greatly appreciate it.

Why is Read(Q) timestamp is not checked when a transaction issues a command reading Q?

Consider a concurrent schedule of two transactions $ T_1,T_2$ :

$ R_x(Q): T_x$ Reads $ Q$

$ W_x(Q): T_x$ Writes $ Q$

$ S:R_2(A),R_1(A),W_1(A),W_2(A)$ , this schedule is not conflict serializable.However, if we follow timestamping protocol, where $ TS(T_1)<TS(T_2)$ S is allowed because $ T_1$ can read a variable after $ T_2$ has read it, which is not conflict equivalent to schedule $ T_1 T_2$ and is contradictory to the fact that timestamping protocol gives a conflict serializable schedule. What am I missing here?

reading a file with other read permissions set

For this question assume a file with 604 perms in a directory with 700 permissions. Assume this file exists: /test/file

A non-root user can techincally read that file but in practice to read it the process must be given the pathname to the file, and the kernel will check that the directory /test has the executable bit set. Because it is not set, the read will fail.

If the one does a chmod o+x /test, then a non-root user can do a cat /test/file and read the file. Is there a way to read the file without setting the execute bit on the directory /test.?

Can alchemists prepare alchemical items without reading their formula book?

The Pathfinder 2 alchemist class can prepare alchemical items if they have the item’s formula in their formula book. However, the class features never explicitly say that the alchemist needs to read the formula book, or have the formula book nearby, when crafting these items during their daily preparations.

You can use this feat to create alchemical items as long as you have the items’ formulas in your formula book.

… choose an alchemical item of your advanced alchemy level or lower that’s in your formula book …

You create a single alchemical item of your advanced alchemy level or lower that’s in your formula book…

The items you can select depend on your research field and must be in your formula book.

As a point of comparison, the wizard class explicitly requires that wizards must study their spellbook daily in order to prepare spells. So a wizard can’t feasibly go adventuring without it.

At 1st level, you can prepare up to two 1st-level spells and five cantrips each morning from the spells in your spellbook…

You start with a spellbook worth 10 sp or less, which you receive for free and must study to prepare your spells each day.

But the alchemist class has no such wording. Taken literally, this would mean that the alchemist can prepare items as long as (1) their formula book exists somewhere and (2) the item’s formula is written in the formula book. They could leave their 1-bulk formula book in a safe location and go adventuring without penalty.

In terms of rules-as-written, is this interpretation correct? Or do they need their formula book on hand during their daily preparations?

Write an algorithm reading some numbers and print the ones with the sum of their digits greater than $35$


Write an algorithm reading some numbers and print the ones with the sum of their digits greater than $ 35$ .

My try:

1) Start

2) $ N\leftarrow 0$

3) $ S \leftarrow 0$

4) $ R \leftarrow N-10\lfloor\frac{n}{10}\rfloor$

5) $ S \leftarrow R+S$

6) $ N\leftarrow\lfloor\frac{n}{10}\rfloor$

7) If $ N>0$ , go to $ 4$ , otherwise print $ S$

8) If $ S\le35$ then $ N\leftarrow N+1$ , otherwise print $ N$

9) end


I’m not sure if this algorithm works,so can someone please check that? plus does there exist any algorithm that determines the numbers such that the sum of their digits is greater than $ 35$ , besides determines how many such numbers exist? (I think they are infinity many such numbers)