Skip to content

Instantly share code, notes, and snippets.

View radfast's full-sized avatar

radfast radfast

View GitHub Profile
@radfast
radfast / gist:7ea7577fe2c0fdae1ac90d4b26d6198c
Last active March 22, 2018 13:03
Guide to successfully making your first PR in Galacticraft

A link to instructions for setting up your workspace is on the main page of the Galacticraft repository, follow the instructions carefully. Check the build.gradle to see which Forge version and mappings snapshot you should use. (If you use something different, Galacticraft code may show up in your IDE as having compile errors.)

Your Ideas

  • If you want to add a completely new feature to the mod, that could be fun - you'd need to code all parts of it of course, including any needed textures, GUIs, sounds and other assets.

  • PRs which fix a currently open issue are extremely welcome. Please state with a # which issue you are fixing.

@radfast
radfast / gist:fc561c19d28e6b70f05f25054b316482
Last active March 2, 2017 20:21
How Galacticraft background mapping works
There are three levels of map:
A. An overworld map covering approximately 48000 x 24000 blocks, centered on 0,0
- scale: 1 map data point represents a 64x64 block area
- this produces a 768 x 376 data point map - visually the image of that is made 1536 x 768 pixels to give 4 pixels per map data point
- the reason for using 4 pixels per data point that is some map biomes e.g. forest are drawn with two colours, and so 4 pixels per map data point allows both colours to be used
- the map size is chosen because on most servers players don't travel much further than 12000 blocks from spawn (sometimes a WorldBorder plugin limits them to even less than that)
- also this size is good for making something which "looks" like a world map, with several continents and several large bodies of water
- (a smaller map would maybe only cover 1 continent, a larger map would show that Minecraft has endless repeating continents)
@radfast
radfast / mc18.txt
Created February 12, 2016 21:02
Memory Use and Performance in Minecraft 1.8
[From an original post by sp614x here: http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/1272953-optifine-hd-h2-fps-boost-hd-textures-shaders-and?comment=43757]
Minecraft 1.8 has so many performance problems that I just don't know where to start with.
Maybe the biggest and the ugliest problem is the memory allocation. Currently the game allocates (and throws away immediately) 50 MB/sec when standing still and up to 200 MB/sec when moving. That is just crazy.
What happens when the game allocates 200 MB memory every second and discards them immediately?
1. With a default memory limit of 1GB (1000 MB) and working memory of about 200 MB Java has to make a full garbage collection every 4 seconds otherwise it would run out of memory. When running with 60 fps, one frame takes about 16 ms. In order not to be noticeable, the garbage collection should run in 10-15 ms maximum. In this minimal time it has to decide which of the several hundred thausand newly generated objects are garbage and can
@radfast
radfast / WorldProviderSpace.java
Created January 8, 2016 22:03
WorldProviderSpace for GC API
package micdoodle8.mods.galacticraft.api.prefab.world.gen;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import micdoodle8.mods.galacticraft.api.vector.Vector3;
import micdoodle8.mods.galacticraft.api.world.IAtmosphericGas;
import micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.MathHelper;
@radfast
radfast / ProcLang.java
Created July 25, 2014 09:46
Automatic Language files update syncer for Galacticraft
package langs;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.nio.charset.Charset;
@radfast
radfast / excerpt.java
Created June 10, 2014 23:24
An exercise for the reader - what is wrong with this code?
public void doExplode()
{
if (!world().isRemote)
{
for (int x = (int)-getRadius(); x < getRadius(); x++)
{
for (int y = (int)-getRadius(); y < getRadius(); y++)
{
for (int z = (int)-getRadius(); z < getRadius(); z++)
{