Most of my modding knowledge came from looking at the vanilla source and modifying it, pretty much like this ("I multiplied some random number"), though I had prior experience in coding in other languages, but they are all pretty similar:
Notice how I multiplied some random number , which I believe is width, or maybe height, idk. And then I added 5 zeros to what I think is length. I honestly can't be certain, it was mostly a trial and error system while making this mod.
It doesn't help that many variables aren't given proper names but you can look at how they are used in the code; the variable they call "width" is indeed the width (or actually, radius variance; the game sets the radius to 1.5 + sin * variance, where sin varies from 0 at the ends to 1 in the middle; the actual width is thus 3 to (1.5 + variance) * 2 and the vanilla values give a width of 3 to 15, thus, here they range from 3 to 63). The value they called "length" is actually the width:height ratio, where they are normally 3 times deeper than their width.
For comparison, this is some of the code from my first cave mod (the "length" is a new parameter which replaces a hardcoded value which sets the actual maximum length in blocks as length * 8 - 16, or 112 in vanilla where length = 16; my modded code gives 112 to 1008. "width" varies from 0 to 12, corresponding to an actual maximum width of 27 and the height ratio varies from 3-4; the widest ravines can get up to 108 blocks deep, compared to 45 in vanilla):
// Controls frequency of ravines; lower = more (default is 50); number after == changes placement
if (this.rand.nextInt(60) == 10)
{
double d0 = (double)(par2 * 16 + this.rand.nextInt(16));
double d1 = (double)(this.rand.nextInt(this.rand.nextInt(40) + 8) + 20);
double d2 = (double)(par3 * 16 + this.rand.nextInt(16));
float f = this.rand.nextFloat() * (float)Math.PI;
float f1 = (this.rand.nextFloat() - 0.5F) * 2.0F / 8.0F;
// Controls the width of ravines
float width = this.rand.nextFloat() * 3.0F + 1.0F;
float f2 = (this.rand.nextFloat() * 2.0F + this.rand.nextFloat()) * width;
// Controls the depth of ravines
double height = this.rand.nextDouble() + 3.0D;
// Controls the length of ravines (default is 16, range here is 16 to 128, biased towards lower values)
int length = this.rand.nextInt(this.rand.nextInt(this.rand.nextInt(17) + 1) + 1) * 8;
if (length < 16) length = 16;
this.generateRavine(this.rand.nextLong(), par4, par5, par6ArrayOfByte, d0, d1, d2, f2, f, f1, 0, 0, height, length);
}
hat has since evolved into this monstrosity which includes multiple special variants (TMCW is probably the most complex cave mod in terms of cave structures; the entire cave/ravine generator class is over 350 KB and generates dozens of different types of caves and cave systems, all evolving from my earliest mods):
// Generates normal ravines, including larger variants. Ravines always start in the center of a chunk; the lack of a
// random offset is not noticable
double x = (double)(chunkX << 4 | 8);
double y = (double)(this.rand.nextInt(this.rand.nextInt(50) + 8) + 13);
double z = (double)(chunkZ << 4 | 8);
float directionXZ = this.rand.nextFloat() * MathHelper.PI;
float directionY = (this.rand.nextFloat() - 0.5F) * 0.25F;
if (ravineType == TMCWv1_RAVINE)
{
// These ravines are based on the ravines in TMCWv1 with some minor adjustments
float width = (this.rand.nextFloat() * 2.0F + this.rand.nextFloat()) * (this.rand.nextFloat() * this.rand.nextFloat() * 3.0F + 1.0F);
double heightRatio = (double)(this.rand.nextFloat() * 2.0F + 2.0F);
int length = Math.min(256, this.rand.nextInt(this.rand.nextInt(256) + 1) + 64);
float curviness = this.rand.nextFloat() * (float)length / 320.0F + (float)length / 640.0F + 0.1F;
if (curviness > 0.8F) curviness = 0.8F;
this.initializeRavineData(width, 2, 5);
length >>= 1;
// Sets ravineType (last parameter) to -1 as a flag that a TMCWv1 ravine is being generated
this.generateRavineHalf(this.rand.nextLong(), x, y, z, width, directionXZ, directionY, heightRatio, length, curviness, curviness, -1);
this.generateRavineHalf(this.rand.nextLong(), x, y, z, width, directionXZ + MathHelper.PI, -directionY, heightRatio, length, curviness, curviness, -1);
return;
}
float width = this.rand.nextFloat() * 4.0F + this.rand.nextFloat() * 2.0F;
if (ravineType == SMALL_RAVINE)
{
// Small ravines have 1/3 the width variation of normal ravines (only initial width > 2 is affected)
if (width >= 2.0F) width *= 0.3333333F;
}
else if ((ravineType == LARGE_RAVINE || width >= 2.0F) && this.rand.nextInt(4) == 0)
{
// 25% chance of adding 0-2 to width if width is 2 or more or ravine is large (not giant or mega)
width += this.rand.nextFloat() * 2.0F;
}
// Length of normal ravines varies from 84-112, same as vanilla. Increases in steps of 2 due to the way ravines
// generate (two halves with half the length each, thus odd values will be rounded down).
int length = 84 + this.rand.nextInt(15) * 2;
double heightRatio = 3.0D;
// 33% of ravines have increased curviness for either x/z or y (1/9 chance of both being increased)
float curvinessXZ = (this.rand.nextInt(3) == 0 ? (this.rand.nextInt(3) == 0 ? 0.6F : 0.4F) : 0.2F);
float curvinessY = (this.rand.nextInt(3) == 0 ? (this.rand.nextInt(3) == 0 ? 0.2F : 0.15F) : 0.1F);
if (ravineType == NORMAL_RAVINE)
{
// 50% (100%) of normal ravines in mesa, volcanic wasteland, and savanna plateau (mountain) biomes are taller and
// located higher up if they are below y=32; note that this is exclusive from big ravines
int add = (biomeList[this.worldObj.getBiomeID(chunkX << 4 | 8, chunkZ << 4 | 8)] >> 3) & 3;
// Note that only one random call is used so CaveFinder can accurately show deeper biome-specific ravines (will still
// not be the same depth/altitude/width but will otherwise have the same structure).
int d = this.rand.nextInt(20);
if (d < add * 10)
{
add = (d & 1) + 1;
if (y < 31.5D) y += (double)(add * 8);
heightRatio += (double)add;
// Limits maximum width and maximum depth
if (width > (float)(6 - add)) width *= 0.5F;
}
else if (d < 2)
{
// 10% of ravines have an increased height ratio of 4-5 instead of 3
heightRatio += (double)(d + 1);
}
}
else if (ravineType != SMALL_RAVINE)
{
// Large ravines; length is 112(140)-266 and width is 2-18 (28 is added later on if length is less than 168)
length += (28 + this.rand.nextInt(64) * 2);
if (width < 2.0F)
{
width += 1.0F;
if (width < 2.0F) width += 1.0F;
}
width *= (this.rand.nextFloat() * this.rand.nextFloat() * 1.5F + 1.0F);
// Giant ravines; length is 192-368 and width is 5-23.5 (18 for length < 300). Note that only these ravines may exceed
// maximum length of 368 blocks, so limit is only needed here.
if (ravineType == GIANT_RAVINE)
{
length += (80 + this.rand.nextInt(48) * 2);
if (length > 368) length = 368;
width += (this.rand.nextFloat() * (float)(length / (length >= 300 && this.rand.nextBoolean() ? 35 : 56)) + 3.0F);
}
else if (ravineType == MEGA_RAVINE)
{
// Mega ravines; length is 320-368 and width is 8-23.5. & 1022 masks out bit 1 so length / 2 is even (converted from
// 112-266 to 56-132). Length is up to 396 prior to clamping; adds up to 18 to width.
length = (length >> 1 & 1022) + 264;
width += (this.rand.nextFloat() * (float)(length / 18 - 10) + 6.0F);
// Width of special ravines added when there are none near the origin ranges from 32-43 blocks
if (this.isSpecialMegaRavine(chunkX, chunkZ))
{
if (width < 14.5F)
{
width = width * 0.5F + 10.5F; // min width is normally 8
}
else if (width > 20.0F)
{
width = Math.min(20.0F, width - 3.5F); // max width is normally 23.5, but limited later on
}
}
if (length > 368) length = 368;
}
else if (length < 168)
{
// Increases length of shorter ravines by 28
length += 28;
}
// Limits width to 18 (39 blocks) if length is less than 300, otherwise limited to 23.5 (50 blocks), and 12 (27 blocks)
// within the near-origin exclusion zone
if (length < 300)
{
if (distance < EXCLUSION_DISTANCE)
{
if (width > 6.0F) width = width * 0.5F + 3.0F;
}
else if (width > 18.0F)
{
width = 18.0F;
}
}
else if (width > 23.5F)
{
width = 23.5F;
}
// Shifts ravines up or down according to their width and elevation so larger ravines are biased towards the middle
// of the ground layer
if (y < 23.5D)
{
y += (double)(width / 1.5F);
}
else if (y > 42.5D)
{
y -= (double)(width / 1.5F);
}
// curvinessXZ varies from 0.2-0.6 at minimum length to 0.2-0.3 at maximum length
curvinessXZ = (curvinessXZ - 0.2F) / ((float)(length - 27) / 85.333F) + 0.2F;
// Reduces curviness of mega ravines to 0.2-0.25
if (ravineType == MEGA_RAVINE) curvinessXZ = curvinessXZ * 0.5F + 0.1F;
// 10% of large ravines and 20% of giant/mega ravines have an increased height ratio of up to 5 instead of 3.
// Only applied if width is less than 18 and scaled from 5 at 0 to 4 at 9 to 3 at 18.
if (width < 18.0F && this.rand.nextInt(ravineType == LARGE_RAVINE ? 10 : 5) == 0) heightRatio = (double)(5.0F - width / 9.0F);
}
// Initializes data for the contours/ledges, set to change every 2-5 layers
this.initializeRavineData(width, 2, 5);
// Ravines are generated in two halves from their center instead of from one end so the full width of the gen-range can
// be utilized (max length = range * 2 instead of just range). Length is divided by two to get the length of each half.
length >>= 1;
this.generateRavineHalf(this.rand.nextLong(), x, y, z, width, directionXZ, directionY, heightRatio, length, curvinessXZ, curvinessY, ravineType);
this.generateRavineHalf(this.rand.nextLong(), x, y, z, width, directionXZ + MathHelper.PI, -directionY, heightRatio, length, curvinessXZ, curvinessY, ravineType);
Most of my modding knowledge came from looking at the vanilla source and modifying it, pretty much like this ("I multiplied some random number"), though I had prior experience in coding in other languages, but they are all pretty similar:
It doesn't help that many variables aren't given proper names but you can look at how they are used in the code; the variable they call "width" is indeed the width (or actually, radius variance; the game sets the radius to 1.5 + sin * variance, where sin varies from 0 at the ends to 1 in the middle; the actual width is thus 3 to (1.5 + variance) * 2 and the vanilla values give a width of 3 to 15, thus, here they range from 3 to 63). The value they called "length" is actually the width:height ratio, where they are normally 3 times deeper than their width.
For comparison, this is some of the code from my first cave mod (the "length" is a new parameter which replaces a hardcoded value which sets the actual maximum length in blocks as length * 8 - 16, or 112 in vanilla where length = 16; my modded code gives 112 to 1008. "width" varies from 0 to 12, corresponding to an actual maximum width of 27 and the height ratio varies from 3-4; the widest ravines can get up to 108 blocks deep, compared to 45 in vanilla):
// Controls frequency of ravines; lower = more (default is 50); number after == changes placement
if (this.rand.nextInt(60) == 10)
{
double d0 = (double)(par2 * 16 + this.rand.nextInt(16));
double d1 = (double)(this.rand.nextInt(this.rand.nextInt(40) + 8) + 20);
double d2 = (double)(par3 * 16 + this.rand.nextInt(16));
float f = this.rand.nextFloat() * (float)Math.PI;
float f1 = (this.rand.nextFloat() - 0.5F) * 2.0F / 8.0F;
// Controls the width of ravines
float width = this.rand.nextFloat() * 3.0F + 1.0F;
float f2 = (this.rand.nextFloat() * 2.0F + this.rand.nextFloat()) * width;
// Controls the depth of ravines
double height = this.rand.nextDouble() + 3.0D;
// Controls the length of ravines (default is 16, range here is 16 to 128, biased towards lower values)
int length = this.rand.nextInt(this.rand.nextInt(this.rand.nextInt(17) + 1) + 1) * 8;
if (length < 16) length = 16;
this.generateRavine(this.rand.nextLong(), par4, par5, par6ArrayOfByte, d0, d1, d2, f2, f, f1, 0, 0, height, length);
}
hat has since evolved into this monstrosity which includes multiple special variants (TMCW is probably the most complex cave mod in terms of cave structures; the entire cave/ravine generator class is over 350 KB and generates dozens of different types of caves and cave systems, all evolving from my earliest mods):
// Generates normal ravines, including larger variants. Ravines always start in the center of a chunk; the lack of a
// random offset is not noticable
double x = (double)(chunkX << 4 | 8);
double y = (double)(this.rand.nextInt(this.rand.nextInt(50) + 8) + 13);
double z = (double)(chunkZ << 4 | 8);
float directionXZ = this.rand.nextFloat() * MathHelper.PI;
float directionY = (this.rand.nextFloat() - 0.5F) * 0.25F;
if (ravineType == TMCWv1_RAVINE)
{
// These ravines are based on the ravines in TMCWv1 with some minor adjustments
float width = (this.rand.nextFloat() * 2.0F + this.rand.nextFloat()) * (this.rand.nextFloat() * this.rand.nextFloat() * 3.0F + 1.0F);
double heightRatio = (double)(this.rand.nextFloat() * 2.0F + 2.0F);
int length = Math.min(256, this.rand.nextInt(this.rand.nextInt(256) + 1) + 64);
float curviness = this.rand.nextFloat() * (float)length / 320.0F + (float)length / 640.0F + 0.1F;
if (curviness > 0.8F) curviness = 0.8F;
this.initializeRavineData(width, 2, 5);
length >>= 1;
// Sets ravineType (last parameter) to -1 as a flag that a TMCWv1 ravine is being generated
this.generateRavineHalf(this.rand.nextLong(), x, y, z, width, directionXZ, directionY, heightRatio, length, curviness, curviness, -1);
this.generateRavineHalf(this.rand.nextLong(), x, y, z, width, directionXZ + MathHelper.PI, -directionY, heightRatio, length, curviness, curviness, -1);
return;
}
float width = this.rand.nextFloat() * 4.0F + this.rand.nextFloat() * 2.0F;
if (ravineType == SMALL_RAVINE)
{
// Small ravines have 1/3 the width variation of normal ravines (only initial width > 2 is affected)
if (width >= 2.0F) width *= 0.3333333F;
}
else if ((ravineType == LARGE_RAVINE || width >= 2.0F) && this.rand.nextInt(4) == 0)
{
// 25% chance of adding 0-2 to width if width is 2 or more or ravine is large (not giant or mega)
width += this.rand.nextFloat() * 2.0F;
}
// Length of normal ravines varies from 84-112, same as vanilla. Increases in steps of 2 due to the way ravines
// generate (two halves with half the length each, thus odd values will be rounded down).
int length = 84 + this.rand.nextInt(15) * 2;
double heightRatio = 3.0D;
// 33% of ravines have increased curviness for either x/z or y (1/9 chance of both being increased)
float curvinessXZ = (this.rand.nextInt(3) == 0 ? (this.rand.nextInt(3) == 0 ? 0.6F : 0.4F) : 0.2F);
float curvinessY = (this.rand.nextInt(3) == 0 ? (this.rand.nextInt(3) == 0 ? 0.2F : 0.15F) : 0.1F);
if (ravineType == NORMAL_RAVINE)
{
// 50% (100%) of normal ravines in mesa, volcanic wasteland, and savanna plateau (mountain) biomes are taller and
// located higher up if they are below y=32; note that this is exclusive from big ravines
int add = (biomeList[this.worldObj.getBiomeID(chunkX << 4 | 8, chunkZ << 4 | 8)] >> 3) & 3;
// Note that only one random call is used so CaveFinder can accurately show deeper biome-specific ravines (will still
// not be the same depth/altitude/width but will otherwise have the same structure).
int d = this.rand.nextInt(20);
if (d < add * 10)
{
add = (d & 1) + 1;
if (y < 31.5D) y += (double)(add * 8);
heightRatio += (double)add;
// Limits maximum width and maximum depth
if (width > (float)(6 - add)) width *= 0.5F;
}
else if (d < 2)
{
// 10% of ravines have an increased height ratio of 4-5 instead of 3
heightRatio += (double)(d + 1);
}
}
else if (ravineType != SMALL_RAVINE)
{
// Large ravines; length is 112(140)-266 and width is 2-18 (28 is added later on if length is less than 168)
length += (28 + this.rand.nextInt(64) * 2);
if (width < 2.0F)
{
width += 1.0F;
if (width < 2.0F) width += 1.0F;
}
width *= (this.rand.nextFloat() * this.rand.nextFloat() * 1.5F + 1.0F);
// Giant ravines; length is 192-368 and width is 5-23.5 (18 for length < 300). Note that only these ravines may exceed
// maximum length of 368 blocks, so limit is only needed here.
if (ravineType == GIANT_RAVINE)
{
length += (80 + this.rand.nextInt(48) * 2);
if (length > 368) length = 368;
width += (this.rand.nextFloat() * (float)(length / (length >= 300 && this.rand.nextBoolean() ? 35 : 56)) + 3.0F);
}
else if (ravineType == MEGA_RAVINE)
{
// Mega ravines; length is 320-368 and width is 8-23.5. & 1022 masks out bit 1 so length / 2 is even (converted from
// 112-266 to 56-132). Length is up to 396 prior to clamping; adds up to 18 to width.
length = (length >> 1 & 1022) + 264;
width += (this.rand.nextFloat() * (float)(length / 18 - 10) + 6.0F);
// Width of special ravines added when there are none near the origin ranges from 32-43 blocks
if (this.isSpecialMegaRavine(chunkX, chunkZ))
{
if (width < 14.5F)
{
width = width * 0.5F + 10.5F; // min width is normally 8
}
else if (width > 20.0F)
{
width = Math.min(20.0F, width - 3.5F); // max width is normally 23.5, but limited later on
}
}
if (length > 368) length = 368;
}
else if (length < 168)
{
// Increases length of shorter ravines by 28
length += 28;
}
// Limits width to 18 (39 blocks) if length is less than 300, otherwise limited to 23.5 (50 blocks), and 12 (27 blocks)
// within the near-origin exclusion zone
if (length < 300)
{
if (distance < EXCLUSION_DISTANCE)
{
if (width > 6.0F) width = width * 0.5F + 3.0F;
}
else if (width > 18.0F)
{
width = 18.0F;
}
}
else if (width > 23.5F)
{
width = 23.5F;
}
// Shifts ravines up or down according to their width and elevation so larger ravines are biased towards the middle
// of the ground layer
if (y < 23.5D)
{
y += (double)(width / 1.5F);
}
else if (y > 42.5D)
{
y -= (double)(width / 1.5F);
}
// curvinessXZ varies from 0.2-0.6 at minimum length to 0.2-0.3 at maximum length
curvinessXZ = (curvinessXZ - 0.2F) / ((float)(length - 27) / 85.333F) + 0.2F;
// Reduces curviness of mega ravines to 0.2-0.25
if (ravineType == MEGA_RAVINE) curvinessXZ = curvinessXZ * 0.5F + 0.1F;
// 10% of large ravines and 20% of giant/mega ravines have an increased height ratio of up to 5 instead of 3.
// Only applied if width is less than 18 and scaled from 5 at 0 to 4 at 9 to 3 at 18.
if (width < 18.0F && this.rand.nextInt(ravineType == LARGE_RAVINE ? 10 : 5) == 0) heightRatio = (double)(5.0F - width / 9.0F);
}
// Initializes data for the contours/ledges, set to change every 2-5 layers
this.initializeRavineData(width, 2, 5);
// Ravines are generated in two halves from their center instead of from one end so the full width of the gen-range can
// be utilized (max length = range * 2 instead of just range). Length is divided by two to get the length of each half.
length >>= 1;
this.generateRavineHalf(this.rand.nextLong(), x, y, z, width, directionXZ, directionY, heightRatio, length, curvinessXZ, curvinessY, ravineType);
this.generateRavineHalf(this.rand.nextLong(), x, y, z, width, directionXZ + MathHelper.PI, -directionY, heightRatio, length, curvinessXZ, curvinessY, ravineType);
I started modding with MCP, too. I made basic mods with MCP but now I am using Forge 1.7.10-10.13.4.1614 for modding. I just ignore new up(!)dates rather than waiting for them because majority of up(!)dates are just ruining the game and performace is gradually degrading.
Rollback Post to RevisionRollBack
My mod with manually registered ItemBlocks of technical blocks:
So I want to make mods where should I start?
GTA 5 is a kid's game, and candy crush is an adult's game what has humanity come to?
Are you using Java or Bedrock? I use Bedrock and I am starting with this site
https://learn.microsoft.com/en-us/minecraft/creator/
I'm a java player
GTA 5 is a kid's game, and candy crush is an adult's game what has humanity come to?
If you are a Java Edition player, you should start with Forge 1.7.10 (as I started) and making basic item and blocks.
Other stuff (such as fluids, biomes etc.) is complicated for new modders.
My mod with manually registered ItemBlocks of technical blocks:
[mod]obtain-blocks-mod[/mod
Why 1.7.10? Because:
-You do not have to worry about item and block models, because they do not exist in 1.7.10. Instead, setTextureName
and setBlockTextureName are used for defining textures for items and blocks rather than defining JSON models.
-1.7.10 has a large mod collection
-1.7.10 runs faster than latest version
My mod with manually registered ItemBlocks of technical blocks:
[mod]obtain-blocks-mod[/mod
ty for your help now... I just have to learn java xD
GTA 5 is a kid's game, and candy crush is an adult's game what has humanity come to?
Most of my modding knowledge came from looking at the vanilla source and modifying it, pretty much like this ("I multiplied some random number"), though I had prior experience in coding in other languages, but they are all pretty similar:
It doesn't help that many variables aren't given proper names but you can look at how they are used in the code; the variable they call "width" is indeed the width (or actually, radius variance; the game sets the radius to 1.5 + sin * variance, where sin varies from 0 at the ends to 1 in the middle; the actual width is thus 3 to (1.5 + variance) * 2 and the vanilla values give a width of 3 to 15, thus, here they range from 3 to 63). The value they called "length" is actually the width:height ratio, where they are normally 3 times deeper than their width.
For comparison, this is some of the code from my first cave mod (the "length" is a new parameter which replaces a hardcoded value which sets the actual maximum length in blocks as length * 8 - 16, or 112 in vanilla where length = 16; my modded code gives 112 to 1008. "width" varies from 0 to 12, corresponding to an actual maximum width of 27 and the height ratio varies from 3-4; the widest ravines can get up to 108 blocks deep, compared to 45 in vanilla):
hat has since evolved into this monstrosity which includes multiple special variants (TMCW is probably the most complex cave mod in terms of cave structures; the entire cave/ravine generator class is over 350 KB and generates dozens of different types of caves and cave systems, all evolving from my earliest mods):
TheMasterCaver's First World - possibly the most caved-out world in Minecraft history - includes world download.
TheMasterCaver's World - my own version of Minecraft largely based on my views of how the game should have evolved since 1.6.4.
Why do I still play in 1.6.4?
I started modding with MCP, too. I made basic mods with MCP but now I am using Forge 1.7.10-10.13.4.1614 for modding. I just ignore new up(!)dates rather than waiting for them because majority of up(!)dates are just ruining the game and performace is gradually degrading.
My mod with manually registered ItemBlocks of technical blocks:
[mod]obtain-blocks-mod[/mod