Skip to content

Instantly share code, notes, and snippets.

@killerjdog51
Created February 2, 2016 01:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save killerjdog51/fca2d765eb4c4c8bde4f to your computer and use it in GitHub Desktop.
Save killerjdog51/fca2d765eb4c4c8bde4f to your computer and use it in GitHub Desktop.
package com.chocolatemod.worldgen;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import com.chocolatemod.mobs.Entitychocolateninja;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
public class MapGenChocolateBridge extends MapGenChocolateStructure
{
public static List FortressSpawnBiomes = Arrays.asList(new BiomeGenBase[] {BiomeGenChocolateBase.chocolateMountians});
private int field_82665_g;
private int field_82666_h;
private List spawnList = new ArrayList();
private static final String __OBFID = "CL_00000451";
private static int XCoord;
private static int YCoord;
private static int ZCoord;
public MapGenChocolateBridge()
{
this.spawnList.add(new BiomeGenBase.SpawnListEntry(Entitychocolateninja.class, 10, 4, 4));
this.field_82665_g = 32;
this.field_82666_h = 8;
System.out.println("My Bridge structure generated at " + XCoord +"/" + YCoord + "/" + ZCoord + " coordinates");
}
public String func_143025_a()
{
return "Chocolate Fortress";
}
public List getSpawnList()
{
return this.spawnList;
}
protected boolean canSpawnStructureAtCoords(int p_75047_1_, int p_75047_2_)
{
int k = p_75047_1_ >> 4;
int l = p_75047_2_ >> 4;
if (p_75047_1_ < 0)
{
p_75047_1_ -= this.field_82665_g - 1;
}
if (p_75047_2_ < 0)
{
p_75047_2_ -= this.field_82665_g - 1;
}
int i1 = p_75047_1_ / this.field_82665_g;
int j1 = p_75047_2_ / this.field_82665_g;
Random random = this.worldObj.setRandomSeed(i1, j1, 10387312);
i1 *= this.field_82665_g;
j1 *= this.field_82665_g;
i1 += random.nextInt(this.field_82665_g - this.field_82666_h);
j1 += random.nextInt(this.field_82665_g - this.field_82666_h);
XCoord = k;
YCoord = l;
if (k == i1 && l == j1)
{
boolean flag = this.worldObj.getWorldChunkManager().areBiomesViable(k * 16 + 8, l * 16 + 8, 0, FortressSpawnBiomes);
if (flag)
{
return true;
}
}
return false;
}
protected ChocolateStructureStart getStructureStart(int p_75049_1_, int p_75049_2_)
{
return new MapGenChocolateBridge.Start(this.worldObj, this.rand, p_75049_1_, p_75049_2_);
}
public static class Start extends ChocolateStructureStart
{
private static final String __OBFID = "CL_00000452";
public Start() {}
public Start(World p_i2040_1_, Random p_i2040_2_, int p_i2040_3_, int p_i2040_4_)
{
super(p_i2040_3_, p_i2040_4_);
StructureChocolateBridgePieces.Start start = new StructureChocolateBridgePieces.Start(p_i2040_2_, (p_i2040_3_ << 4) + 2, (p_i2040_4_ << 4) + 2);
this.components.add(start);
start.buildComponent(start, this.components, p_i2040_2_);
ArrayList arraylist = start.field_74967_d;
while (!arraylist.isEmpty())
{
int k = p_i2040_2_.nextInt(arraylist.size());
ChocolateStructureComponent structurecomponent = (ChocolateStructureComponent)arraylist.remove(k);
structurecomponent.buildComponent(start, this.components, p_i2040_2_);
}
this.updateBoundingBox();
this.setRandomHeight(p_i2040_1_, p_i2040_2_, 80, 110);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment