Skip to content
This repository has been archived by the owner on Aug 22, 2019. It is now read-only.

Commit

Permalink
Better End Update part 2
Browse files Browse the repository at this point in the history
I have finally finished this update after several weeks of almost sleepless nights!
  • Loading branch information
Noah Jelen committed Jun 16, 2019
1 parent 70b2a4b commit 0803651
Show file tree
Hide file tree
Showing 12 changed files with 276 additions and 249 deletions.
9 changes: 4 additions & 5 deletions src/main/java/com/NetherNoah/ParadiseMod/ParadiseMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@

@Mod(modid = Reference.MOD_ID, name = Reference.NAME, version = Reference.VERSION, acceptedMinecraftVersions = Reference.ACCEPTED_VERSIONS)
public class ParadiseMod {
//custom material for ender acid so endermen can swim in it
public final static Material ENDER_ACID = (new MaterialLiquid(MapColor.WATER));

public static final CreativeTabs xmas = new ChristmasTab();
private AntiMobLampHandler AntiMobLampHandler;
Expand All @@ -138,7 +136,7 @@ public void preInit(FMLPreInitializationEvent event) {

//events
MinecraftForge.EVENT_BUS.register(Events.class);

//some modifications to vanilla blocks
//This is NOT a coremod!
Blocks.REDSTONE_BLOCK.setResistance(2000F);
Expand All @@ -150,6 +148,7 @@ public void preInit(FMLPreInitializationEvent event) {
Blocks.CHAIN_COMMAND_BLOCK.setCreativeTab(CreativeTabs.REDSTONE);
Blocks.BARRIER.setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
Blocks.MOB_SPAWNER.setCreativeTab(CreativeTabs.DECORATIONS);

//liquids
LiquidRedstone.register();
EnderAcid.register();
Expand Down Expand Up @@ -249,8 +248,8 @@ public void preInit(FMLPreInitializationEvent event) {
for(int i=0;i<misc.length;i++)
GameRegistry.registerWorldGenerator(misc[i],5);

GameRegistry.registerWorldGenerator(new EndGrass(),2);
GameRegistry.registerWorldGenerator(new EndLakes(),2);
GameRegistry.registerWorldGenerator(new EndGrass(),0);
GameRegistry.registerWorldGenerator(new EndLakes(),1);

//block categories
Lamps.initAndRegister();
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/NetherNoah/ParadiseMod/handlers/Events.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.gen.MapGenCaves;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.event.entity.player.BonemealEvent;
import net.minecraftforge.event.terraingen.ChunkGeneratorEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ public class MapGenDUCaves extends MapGenBase{
protected static final IBlockState AIR = Blocks.AIR.getDefaultState();
protected static final IBlockState WATER = Blocks.WATER.getDefaultState();

protected void addRoom(long p_180703_1_, int p_180703_3_, int p_180703_4_, ChunkPrimer primer, double p_180703_6_, double p_180703_8_, double p_180703_10_){
addTunnel(p_180703_1_, p_180703_3_, p_180703_4_, primer, p_180703_6_, p_180703_8_, p_180703_10_, 1.0F + this.rand.nextFloat() * 6.0F, 0.0F, 0.0F, -1, -1, 0.5D);
protected void addRoom(long seed, int originalX, int originalZ, ChunkPrimer primer, double d0, double d1, double d2){
addTunnel(seed, originalX, originalZ, primer, d0, d1, d2, 1.0F + this.rand.nextFloat() * 6.0F, 0.0F, 0.0F, -1, -1, 0.5D);
}

protected void addTunnel(long p_180702_1_, int p_180702_3_, int p_180702_4_, ChunkPrimer primer, double p_180702_6_, double p_180702_8_, double p_180702_10_, float p_180702_12_, float p_180702_13_, float p_180702_14_, int p_180702_15_, int p_180702_16_, double p_180702_17_){
double d0 = (double)(p_180702_3_ * 16 + 8);
double d1 = (double)(p_180702_4_ * 16 + 8);
protected void addTunnel(long seed, int chunkX, int chunkZ, ChunkPrimer primer, double p_180702_6_, double p_180702_8_, double p_180702_10_, float p_180702_12_, float p_180702_13_, float p_180702_14_, int p_180702_15_, int p_180702_16_, double p_180702_17_){
double d0 = (double)(chunkX * 16 + 8);
double d1 = (double)(chunkZ * 16 + 8);
float f = 0.0F;
float f1 = 0.0F;
Random random = new Random(p_180702_1_);
Random random = new Random(seed);

if (p_180702_16_ <= 0){
int i = range * 16 - 16;
Expand Down Expand Up @@ -66,8 +66,8 @@ protected void addTunnel(long p_180702_1_, int p_180702_3_, int p_180702_4_, Chu
f = f + (random.nextFloat() - random.nextFloat()) * random.nextFloat() * 4.0F;

if (!flag2 && p_180702_15_ == j && p_180702_12_ > 1.0F && p_180702_16_ > 0){
addTunnel(random.nextLong(), p_180702_3_, p_180702_4_, primer, p_180702_6_, p_180702_8_, p_180702_10_, random.nextFloat() * 0.5F + 0.5F, p_180702_13_ - ((float)Math.PI / 2F), p_180702_14_ / 3.0F, p_180702_15_, p_180702_16_, 1.0D);
addTunnel(random.nextLong(), p_180702_3_, p_180702_4_, primer, p_180702_6_, p_180702_8_, p_180702_10_, random.nextFloat() * 0.5F + 0.5F, p_180702_13_ + ((float)Math.PI / 2F), p_180702_14_ / 3.0F, p_180702_15_, p_180702_16_, 1.0D);
addTunnel(random.nextLong(), chunkX, chunkZ, primer, p_180702_6_, p_180702_8_, p_180702_10_, random.nextFloat() * 0.5F + 0.5F, p_180702_13_ - ((float)Math.PI / 2F), p_180702_14_ / 3.0F, p_180702_15_, p_180702_16_, 1.0D);
addTunnel(random.nextLong(), chunkX, chunkZ, primer, p_180702_6_, p_180702_8_, p_180702_10_, random.nextFloat() * 0.5F + 0.5F, p_180702_13_ + ((float)Math.PI / 2F), p_180702_14_ / 3.0F, p_180702_15_, p_180702_16_, 1.0D);
return;
}

Expand All @@ -81,12 +81,12 @@ protected void addTunnel(long p_180702_1_, int p_180702_3_, int p_180702_4_, Chu
return;

if (p_180702_6_ >= d0 - 16.0D - d2 * 2.0D && p_180702_10_ >= d1 - 16.0D - d2 * 2.0D && p_180702_6_ <= d0 + 16.0D + d2 * 2.0D && p_180702_10_ <= d1 + 16.0D + d2 * 2.0D){
int k2 = MathHelper.floor(p_180702_6_ - d2) - p_180702_3_ * 16 - 1;
int k = MathHelper.floor(p_180702_6_ + d2) - p_180702_3_ * 16 + 1;
int k2 = MathHelper.floor(p_180702_6_ - d2) - chunkX * 16 - 1;
int k = MathHelper.floor(p_180702_6_ + d2) - chunkX * 16 + 1;
int l2 = MathHelper.floor(p_180702_8_ - d3) - 1;
int l = MathHelper.floor(p_180702_8_ + d3) + 1;
int i3 = MathHelper.floor(p_180702_10_ - d2) - p_180702_4_ * 16 - 1;
int i1 = MathHelper.floor(p_180702_10_ + d2) - p_180702_4_ * 16 + 1;
int i3 = MathHelper.floor(p_180702_10_ - d2) - chunkZ * 16 - 1;
int i1 = MathHelper.floor(p_180702_10_ + d2) - chunkZ * 16 + 1;

if (k2 < 0) k2 = 0;
if (k > 16) k = 16;
Expand All @@ -108,22 +108,22 @@ protected void addTunnel(long p_180702_1_, int p_180702_3_, int p_180702_4_, Chu
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();

for (int j3 = k2; j3 < k; ++j3){
double d10 = ((double)(j3 + p_180702_3_ * 16) + 0.5D - p_180702_6_) / d2;
double d10 = ((double)(j3 + chunkX * 16) + 0.5D - p_180702_6_) / d2;

for (int i2 = i3; i2 < i1; ++i2){
double d8 = ((double)(i2 + p_180702_4_ * 16) + 0.5D - p_180702_10_) / d2;
double d8 = ((double)(i2 + chunkZ * 16) + 0.5D - p_180702_10_) / d2;
boolean flag1 = false;

if (d10 * d10 + d8 * d8 < 1.0D){
for (int j2 = l; j2 > l2; --j2){
double d9 = ((double)(j2 - 1) + 0.5D - p_180702_8_) / d3;

if (d9 > -0.7D && d10 * d10 + d9 * d9 + d8 * d8 < 1.0D){
IBlockState iblockstate1 = primer.getBlockState(j3, j2, i2);
IBlockState iblockstate2 = (IBlockState)MoreObjects.firstNonNull(primer.getBlockState(j3, j2 + 1, i2), AIR);
flag1 = isTopBlock(primer, j3, j2, i2, p_180702_3_, p_180702_4_);
IBlockState state = primer.getBlockState(j3, j2, i2);
IBlockState up = (IBlockState)MoreObjects.firstNonNull(primer.getBlockState(j3, j2 + 1, i2), AIR);
flag1 = isTopBlock(primer, j3, j2, i2, chunkX, chunkZ);

digBlock(primer, j3, j2, i2, p_180702_3_, p_180702_4_, flag1, iblockstate1, iblockstate2);
digBlock(primer, j3, j2, i2, chunkX, chunkZ, flag1, state, up);
}
}
}
Expand Down Expand Up @@ -153,7 +153,6 @@ protected boolean canReplaceBlock(IBlockState block1, IBlockState block2){

protected void recursiveGenerate(World worldIn, int chunkX, int chunkZ, int originalX, int originalZ, ChunkPrimer chunkPrimerIn){
int i = this.rand.nextInt(this.rand.nextInt(this.rand.nextInt(15) + 1) + 1);

if (this.rand.nextInt(7) != 0)
i = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,35 +22,32 @@
import net.minecraftforge.fml.common.IWorldGenerator;

public class EndGrass implements IWorldGenerator {
public static int height;
public static boolean webs = false;

@Override
public void generate(Random rand, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,
IChunkProvider chunkProvider) {
if (world.provider.getDimension()!=1)
return;
Chunk theChunk = world.getChunkFromChunkCoords(chunkX, chunkZ);
height=255;
Chunk chunk = world.getChunkFromChunkCoords(chunkX, chunkZ);
Block[] plants= {Misc.EnderRose,Misc.EndGrass,Misc.TallEndGrass};

for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
for (int y = 0; y < height; y++) {
for (int y = 0; y < 80; y++) {

// the block to be replaced
Block blockToReplace = theChunk.getBlockState(x, y, z).getBlock();
Block blockToReplace = chunk.getBlockState(x, y, z).getBlock();

// the block above it
Block blockAbove = theChunk.getBlockState(x, y + 1, z).getBlock();
Block blockAbove = chunk.getBlockState(x, y + 1, z).getBlock();

// replace exposed end stone
if ((blockToReplace == Blocks.END_STONE||blockToReplace == Ores.EnderPearlOre||blockToReplace == Ores.EndRubyOre||blockToReplace == Ores.VoidPearlOre) && blockAbove==Blocks.AIR)
theChunk.setBlockState(new BlockPos(x, y, z), Misc.OvergrownEndStone.getDefaultState());
chunk.setBlockState(new BlockPos(x, y, z), Misc.OvergrownEndStone.getDefaultState());

// ender roses and grass
if (rand.nextInt(15)==0 && (blockToReplace == Blocks.END_STONE||blockToReplace==Misc.OvergrownEndStone) && blockAbove==Blocks.AIR)
theChunk.setBlockState(new BlockPos(x, y+1, z), plants[rand.nextInt(3)].getDefaultState());
chunk.setBlockState(new BlockPos(x, y+1, z), plants[rand.nextInt(3)].getDefaultState());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,46 +3,76 @@
import java.util.Random;

import com.NetherNoah.ParadiseMod.blocks.misc.EnderAcid;
import com.NetherNoah.ParadiseMod.config.ModConfig;
import com.NetherNoah.ParadiseMod.init.ModBlocks.Crystals;
import com.NetherNoah.ParadiseMod.init.ModBlocks.Misc;
import com.NetherNoah.ParadiseMod.init.ModBlocks.Ores;
import com.NetherNoah.ParadiseMod.world.dimension.DimensionRegistry;

import net.minecraft.block.Block;
import net.minecraft.block.BlockDirectional;
import net.minecraft.init.Biomes;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.EnumSkyBlock;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.IChunkGenerator;
import net.minecraft.world.gen.feature.WorldGenLakes;
import net.minecraft.world.gen.feature.WorldGenerator;
import net.minecraftforge.fml.common.IWorldGenerator;

public class EndLakes implements IWorldGenerator {
public static int height;
public static boolean webs = false;
public static WorldGenLakes endlakes = new WorldGenLakes(EnderAcid.BlockEnderAcid.instance);

public class EndLakes implements IWorldGenerator
{
@Override
public void generate(Random rand, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,
IChunkProvider chunkProvider) {
//if (world.provider.getDimension()!=1)
//return;
Chunk theChunk = world.getChunkFromChunkCoords(chunkX, chunkZ);
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
for (int y = 0; y < height; y++) {
// the block to be replaced
Block blockToReplace = theChunk.getBlockState(x, y, z).getBlock();
if (rand.nextInt(15)==0 && blockToReplace==Misc.OvergrownEndStone)
endlakes.generate(world, rand, new BlockPos(x,y,z));
}
}
}
}
public void generate(Random rand, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
BlockPos position = new BlockPos(chunkX*16 + rand.nextInt(16),rand.nextInt(66),chunkZ*16 + rand.nextInt(16));

if (world.provider.getDimension()!=1)
return;

if (world.getBlockState(position).getBlock()==Blocks.AIR)
return;

for (position = position.add(-8, 0, -8); position.getY() > 5 && world.isAirBlock(position); position = position.down())
;

if (position.getY() <= 4)
return;
else {
position = position.down(4);
boolean[] aboolean = new boolean[2048];
int i = rand.nextInt(4) + 4;

for (int j = 0; j < i; ++j) {
double d0 = rand.nextDouble() * 6.0D + 3.0D;
double d1 = rand.nextDouble() * 4.0D + 2.0D;
double d2 = rand.nextDouble() * 6.0D + 3.0D;
double d3 = rand.nextDouble() * (16.0D - d0 - 2.0D) + 1.0D + d0 / 2.0D;
double d4 = rand.nextDouble() * (8.0D - d1 - 4.0D) + 2.0D + d1 / 2.0D;
double d5 = rand.nextDouble() * (16.0D - d2 - 2.0D) + 1.0D + d2 / 2.0D;

for (int l = 1; l < 15; ++l) {
for (int i1 = 1; i1 < 15; ++i1) {
for (int j1 = 1; j1 < 7; ++j1) {
double d6 = ((double)l - d3) / (d0 / 2.0D);
double d7 = ((double)j1 - d4) / (d1 / 2.0D);
double d8 = ((double)i1 - d5) / (d2 / 2.0D);
double d9 = d6 * d6 + d7 * d7 + d8 * d8;

if (d9 < 1.0D)
aboolean[(l * 16 + i1) * 8 + j1] = true;
}
}
}
}

for (int l1 = 0; l1 < 16; ++l1) {
for (int i3 = 0; i3 < 16; ++i3) {
for (int i4 = 0; i4 < 8; ++i4) {
if (aboolean[(l1 * 16 + i3) * 8 + i4]) {
if (position.getY()>=38)
world.setBlockState(position.add(l1, i4, i3), i4 >= 4 ? Blocks.AIR.getDefaultState() : EnderAcid.BlockEnderAcid.instance.getDefaultState(), 2);
}
}
}
}
return;
}
}
}
Loading

0 comments on commit 0803651

Please sign in to comment.