Refactoring & cleaning

This commit is contained in:
ProfessorProspector 2018-09-16 13:48:38 -07:00
parent 874559c21e
commit e5736669ca
200 changed files with 1382 additions and 1596 deletions

View file

@ -30,10 +30,10 @@ import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.IChunkGenerator;
import net.minecraft.world.gen.feature.WorldGenLakes;
import net.minecraftforge.fml.common.IWorldGenerator;
import reborncore.common.registration.RebornRegistry;
import reborncore.common.registration.RebornRegister;
import reborncore.common.registration.impl.ConfigRegistry;
import techreborn.TechReborn;
import techreborn.init.ModFluids;
import techreborn.lib.ModInfo;
import java.util.Random;
@ -41,7 +41,7 @@ import java.util.Random;
* Created by modmuss50 on 13/06/2017.
*/
@RebornRegistry(modID = ModInfo.MOD_ID)
@RebornRegister(modID = TechReborn.MOD_ID)
public class OilLakeGenerator implements IWorldGenerator {
@ConfigRegistry(config = "world", category = "oil_lakes", comment = "Enable the generation of underground oil lakes")

View file

@ -31,7 +31,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;
import net.minecraftforge.common.IPlantable;
import techreborn.Core;
import techreborn.TechReborn;
import techreborn.blocks.BlockRubberLeaves;
import techreborn.blocks.BlockRubberLog;
import techreborn.init.ModBlocks;
@ -70,7 +70,7 @@ public class RubberTreeGenerator extends WorldGenerator {
}
public boolean growTree(World world, Random rand, int x, int y, int z) {
int treeHeight = rand.nextInt(5) + Core.worldGen.config.rubberTreeConfig.treeBaseHeight;
int treeHeight = rand.nextInt(5) + TechReborn.worldGen.config.rubberTreeConfig.treeBaseHeight;
int worldHeight = world.getHeight();
if (y >= 1 && y + treeHeight + 1 <= worldHeight) {
int xOffset;
@ -146,7 +146,7 @@ public class RubberTreeGenerator extends WorldGenerator {
|| block.isReplaceable(world, blockpos)) {
IBlockState newState = ModBlocks.RUBBER_LOG.getDefaultState();
boolean isAddingSap = false;
if (rand.nextInt(Core.worldGen.config.rubberTreeConfig.sapRarity) == 0) {
if (rand.nextInt(TechReborn.worldGen.config.rubberTreeConfig.sapRarity) == 0) {
newState = newState.withProperty(BlockRubberLog.HAS_SAP, true)
.withProperty(BlockRubberLog.SAP_SIDE, EnumFacing.byHorizontalIndex(rand.nextInt(4)));
isAddingSap = true;
@ -161,7 +161,7 @@ public class RubberTreeGenerator extends WorldGenerator {
}
}
if (topLogPos != null) {
for (int i = 0; i < Core.worldGen.config.rubberTreeConfig.spireHeight; i++) {
for (int i = 0; i < TechReborn.worldGen.config.rubberTreeConfig.spireHeight; i++) {
BlockPos spikePos = topLogPos.up(i);
this.setBlockAndNotifyAdequately(world, spikePos, ModBlocks.RUBBER_LEAVES.getDefaultState()
.withProperty(BlockRubberLeaves.DECAYABLE, true).withProperty(BlockRubberLeaves.CHECK_DECAY, false));

View file

@ -32,7 +32,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import net.minecraftforge.fml.relauncher.Side;
import reborncore.common.misc.ChunkCoord;
import techreborn.Core;
import techreborn.TechReborn;
import java.util.ArrayDeque;
import java.util.Deque;
@ -48,7 +48,7 @@ public class TechRebornRetroGen {
private final Deque<ChunkCoord> chunksToRetroGen = new ArrayDeque<>(64);
private boolean isChunkEligibleForRetroGen(ChunkDataEvent.Load event) {
return Core.worldGen.config.retroGenOres && event.getWorld().provider.getDimension() == 0
return TechReborn.worldGen.config.retroGenOres && event.getWorld().provider.getDimension() == 0
&& event.getData().getString(RETROGEN_TAG).isEmpty();
}
@ -65,7 +65,7 @@ public class TechRebornRetroGen {
if (isTickEligibleForRetroGen(event)) {
if (!chunksToRetroGen.isEmpty()) {
final ChunkCoord coord = chunksToRetroGen.pollFirst();
Core.logHelper.info("Regenerating ore in " + coord + '.');
TechReborn.LOGGER.info("Regenerating ore in " + coord + '.');
final World world = event.world;
if (world.getChunkProvider().getLoadedChunk(coord.getX(), coord.getZ()) != null) {
final long seed = world.getSeed();
@ -74,7 +74,7 @@ public class TechRebornRetroGen {
final long zSeed = rng.nextLong() >> 2 + 1L;
final long chunkSeed = (xSeed * coord.getX() + zSeed * coord.getZ()) * seed;
rng.setSeed(chunkSeed);
Core.worldGen.generate(rng, coord.getX() << 4, coord.getZ() << 4, world, null, null);
TechReborn.worldGen.generate(rng, coord.getX() << 4, coord.getZ() << 4, world, null, null);
}
}
}
@ -84,7 +84,7 @@ public class TechRebornRetroGen {
public void onChunkLoad(ChunkDataEvent.Load event) {
if (isChunkEligibleForRetroGen(event)) {
final ChunkCoord coord = ChunkCoord.of(event);
Core.logHelper.info("Queueing retro ore gen for " + coord + '.');
TechReborn.LOGGER.info("Queueing retro ore gen for " + coord + '.');
chunksToRetroGen.addLast(coord);
}
}

View file

@ -40,8 +40,7 @@ import net.minecraftforge.common.BiomeDictionary;
import net.minecraftforge.fml.common.IWorldGenerator;
import org.apache.commons.io.FileUtils;
import reborncore.common.misc.ChunkCoord;
import techreborn.Core;
import techreborn.init.ModBlocks;
import techreborn.TechReborn;
import techreborn.world.config.OreConfig;
import techreborn.world.config.WorldGenConfig;
@ -146,22 +145,22 @@ public class TechRebornWorldGen implements IWorldGenerator {
//
// });
} catch (Exception e) {
Core.logHelper.error(
TechReborn.LOGGER.error(
"The ores.json file was invalid, bad things are about to happen, I will try and save the world now :");
config = defaultConfig;
jsonInvalid = true;
Core.logHelper.error(
TechReborn.LOGGER.error(
"The ores.json file was ignored and the default values loaded, you file will NOT be over written");
e.printStackTrace();
}
}
public void printError(String string) {
Core.logHelper.error("###############-ERROR-####################");
Core.logHelper.error("");
Core.logHelper.error(string);
Core.logHelper.error("");
Core.logHelper.error("###############-ERROR-####################");
TechReborn.LOGGER.error("###############-ERROR-####################");
TechReborn.LOGGER.error("");
TechReborn.LOGGER.error(string);
TechReborn.LOGGER.error("");
TechReborn.LOGGER.error("###############-ERROR-####################");
}
private void save() {
@ -237,7 +236,7 @@ public class TechRebornWorldGen implements IWorldGenerator {
try {
worldGenMinable.generate(world, random, pos);
} catch (ArrayIndexOutOfBoundsException e) {
Core.logHelper.error("Something bad is happening during world gen the ore "
TechReborn.LOGGER.error("Something bad is happening during world gen the ore "
+ ore.blockNiceName
+ " caused a crash when generating. Report this to the TechReborn devs with a log");
}

View file

@ -26,10 +26,10 @@ package techreborn.world.village;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.storage.loot.LootTableList;
import techreborn.lib.ModInfo;
import techreborn.TechReborn;
public class ModLootTables {
public static final ResourceLocation CHESTS_RUBBER_PLANTATION = LootTableList.register(new ResourceLocation(ModInfo.MOD_ID, "chests/rubber_plantation"));
public static final ResourceLocation CHESTS_RUBBER_PLANTATION = LootTableList.register(new ResourceLocation(TechReborn.MOD_ID, "chests/rubber_plantation"));
}