-
Notifications
You must be signed in to change notification settings - Fork 33
More balance settings and GT Ore integration #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
b8ef1d3
e6bffc1
0af5478
a099f7c
0b62035
60cce95
11d94a2
5dd9b5b
c4c3d00
967a0eb
a8bc6e4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -158,13 +158,16 @@ protected void genDecorations(BiomeGenBase biome) { | |
| } | ||
|
|
||
| // random features! | ||
| if (randomGenerator.nextInt(6) == 0) { | ||
| int rx = chunk_X + randomGenerator.nextInt(16) + 8; | ||
| int rz = chunk_Z + randomGenerator.nextInt(16) + 8; | ||
| int ry = currentWorld.getHeightValue(rx, rz); | ||
| if (ry < 75) { | ||
| TFGenerator rf = randomFeature(randomGenerator); | ||
| rf.generate(currentWorld, randomGenerator, rx, ry, rz); | ||
| // now with chance | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The "now" part of "now with chance" isn't going to be very helpful to future readers of the code, for which that comment will always have been there. If the intent of the comment is to indicate that there's a chance of the feature not happening then you might want to encode that knowledge about the code's intent into a well named function instead. |
||
| if (TFFeature.getRandom(randomGenerator, TwilightForestMod.minorFeatureGenChance)) { | ||
| if (randomGenerator.nextInt(6) == 0) { | ||
| int rx = chunk_X + randomGenerator.nextInt(16) + 8; | ||
| int rz = chunk_Z + randomGenerator.nextInt(16) + 8; | ||
| int ry = currentWorld.getHeightValue(rx, rz); | ||
| if (ry < 75) { | ||
| TFGenerator rf = randomFeature(randomGenerator); | ||
| rf.generate(currentWorld, randomGenerator, rx, ry, rz); | ||
| } | ||
|
||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| package twilightforest.gt_integration; | ||
|
|
||
| import net.minecraft.block.Block; | ||
| import net.minecraft.world.World; | ||
|
|
||
| public class GT_Integration_Utils { | ||
|
|
||
| static GT_OrePlacer orePlacer; | ||
|
|
||
| public static void init() { | ||
| // Create worker obj | ||
| orePlacer = new GT_OrePlacer(); | ||
|
|
||
| } | ||
|
|
||
| public static boolean isInit() { | ||
| return orePlacer != null; | ||
| } | ||
|
|
||
| public static boolean doPlaceGTOre(World aWorld, int aX, int aY, int aZ, Block mcOreBlock) { | ||
| if (!isInit()) { | ||
| return false; | ||
| } | ||
| return orePlacer.placeGTOre(aWorld, aX, aY, aZ, mcOreBlock); | ||
| } | ||
|
|
||
| public static GT_OrePlacer getOrePlacer() { | ||
| return orePlacer; | ||
| } | ||
|
|
||
| } | ||
|
Comment on lines
1
to
27
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should reduce the visibility of this class's members.
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| package twilightforest.gt_integration; | ||
|
|
||
| import net.minecraft.block.Block; | ||
| import net.minecraft.init.Blocks; | ||
| import net.minecraft.world.World; | ||
|
|
||
| import gregtech.common.blocks.GT_TileEntity_Ores; | ||
| import twilightforest.TwilightForestMod; | ||
|
|
||
| public class GT_OrePlacer { | ||
|
|
||
| public int getMappedGTMetaForOre(Block mOre) { | ||
|
Comment on lines
+1
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| if (mOre == Blocks.coal_ore) { | ||
| return TwilightForestMod.GT_coalOreMeta; | ||
| } | ||
|
|
||
| if (mOre == Blocks.iron_ore) { | ||
| return TwilightForestMod.GT_ironOreMeta; | ||
|
|
||
| } | ||
| if (mOre == Blocks.gold_ore) { | ||
| return TwilightForestMod.GT_goldOreMeta; | ||
| } | ||
|
|
||
| if (mOre == Blocks.redstone_ore) { | ||
| return TwilightForestMod.GT_redstoneOreMeta; | ||
| } | ||
|
|
||
| if (mOre == Blocks.lapis_ore) { | ||
| return TwilightForestMod.GT_lapisOreMeta; | ||
| } | ||
|
|
||
| if (mOre == Blocks.emerald_ore) { | ||
| return TwilightForestMod.GT_emeraldOreMeta; | ||
| } | ||
| if (mOre == Blocks.diamond_ore) { | ||
| return TwilightForestMod.GT_diamondOreMeta; | ||
| } | ||
|
|
||
| return -1; | ||
| } | ||
|
|
||
| public boolean placeGTOre(World aWorld, int aX, int aY, int aZ, Block mcOreBlock) { | ||
|
|
||
| int mappedMeta = getMappedGTMetaForOre(mcOreBlock); | ||
| if (mappedMeta <= 0) { | ||
| return false; | ||
| } | ||
| return GT_TileEntity_Ores.setOreBlock(aWorld, aX, aY, aZ, mappedMeta, TwilightForestMod.GT_useSmallOres, true); | ||
|
|
||
| } | ||
|
|
||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears this function isn't only used when generating a feature (as its name would suggest) but also when looking up which feature should exist in a given region.
Changing the configurated change post-worldgen affects functionality that check against existing features such as the magic map.
Is this intended? If so you might want to document the caveat that this config isn't meant to be modified on an existing world.

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, definitely need a warning, I was worried that this would happen