More things
This commit is contained in:
parent
a6af72f650
commit
e2009cb743
8 changed files with 246 additions and 16 deletions
152
src/main/java/biomesoplenty/common/biomes/BOPCandyBiome.java
Normal file
152
src/main/java/biomesoplenty/common/biomes/BOPCandyBiome.java
Normal file
|
@ -0,0 +1,152 @@
|
|||
package biomesoplenty.common.biomes;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
import biomesoplenty.api.BOPBlockHelper;
|
||||
import biomesoplenty.common.world.decoration.BOPDecorationManager;
|
||||
import biomesoplenty.common.world.decoration.BOPWorldFeatures;
|
||||
|
||||
public abstract class BOPCandyBiome extends BOPBiome
|
||||
{
|
||||
protected BOPWorldFeatures bopWorldFeatures;
|
||||
|
||||
public BOPCandyBiome(int biomeID)
|
||||
{
|
||||
super(biomeID);
|
||||
|
||||
bopWorldFeatures = BOPDecorationManager.getOrCreateBiomeFeatures(biomeID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decorate(World world, Random random, int x, int z)
|
||||
{
|
||||
try
|
||||
{
|
||||
super.decorate(world, random, x, z);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Throwable cause = e.getCause();
|
||||
|
||||
if (e.getMessage() != null && e.getMessage().equals("Already decorating!!") || (cause != null && cause.getMessage() != null && cause.getMessage().equals("Already decorating!!")))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void genTerrainBlocks(World p_150573_1_, Random p_150573_2_, Block[] p_150573_3_, byte[] p_150573_4_, int p_150573_5_, int p_150573_6_, double p_150573_7_)
|
||||
{
|
||||
this.genCandyTerrain(p_150573_1_, p_150573_2_, p_150573_3_, p_150573_4_, p_150573_5_, p_150573_6_, p_150573_7_);
|
||||
}
|
||||
|
||||
public final void genCandyTerrain(World p_150560_1_, Random p_150560_2_, Block[] p_150560_3_, byte[] p_150560_4_, int p_150560_5_, int p_150560_6_, double p_150560_7_)
|
||||
{
|
||||
boolean flag = true;
|
||||
Block block = this.topBlock;
|
||||
byte b0 = (byte)(this.field_150604_aj & 255);
|
||||
Block block1 = this.fillerBlock;
|
||||
int k = -1;
|
||||
int l = (int)(p_150560_7_ / 3.0D + 3.0D + p_150560_2_.nextDouble() * 0.25D);
|
||||
int i1 = p_150560_5_ & 15;
|
||||
int j1 = p_150560_6_ & 15;
|
||||
int k1 = p_150560_3_.length / 256;
|
||||
|
||||
for (int l1 = 255; l1 >= 0; --l1)
|
||||
{
|
||||
int i2 = (j1 * 16 + i1) * k1 + l1;
|
||||
|
||||
if (l1 <= 0 + p_150560_2_.nextInt(5))
|
||||
{
|
||||
p_150560_3_[i2] = Blocks.bedrock;
|
||||
}
|
||||
else
|
||||
{
|
||||
Block block2 = p_150560_3_[i2];
|
||||
|
||||
if (block2 != null && block2.getMaterial() != Material.air)
|
||||
{
|
||||
if (block2 == BOPBlockHelper.get("cakeBlock"))
|
||||
{
|
||||
if (k == -1)
|
||||
{
|
||||
if (l <= 0)
|
||||
{
|
||||
block = null;
|
||||
b0 = 0;
|
||||
block1 = BOPBlockHelper.get("cakeBlock");
|
||||
}
|
||||
else if (l1 >= 59 && l1 <= 64)
|
||||
{
|
||||
block = this.topBlock;
|
||||
b0 = (byte)(this.field_150604_aj & 255);
|
||||
block1 = this.fillerBlock;
|
||||
}
|
||||
|
||||
if (l1 < 63 && (block == null || block.getMaterial() == Material.air))
|
||||
{
|
||||
if (this.getFloatTemperature(p_150560_5_, l1, p_150560_6_) < 0.15F)
|
||||
{
|
||||
block = Blocks.ice;
|
||||
b0 = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
block = Blocks.water;
|
||||
b0 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
k = l;
|
||||
|
||||
if (l1 >= 62)
|
||||
{
|
||||
p_150560_3_[i2] = block;
|
||||
p_150560_4_[i2] = b0;
|
||||
}
|
||||
else if (l1 < 56 - l)
|
||||
{
|
||||
block = null;
|
||||
block1 = BOPBlockHelper.get("cakeBlock");
|
||||
p_150560_3_[i2] = Blocks.gravel;
|
||||
}
|
||||
else
|
||||
{
|
||||
p_150560_3_[i2] = block1;
|
||||
}
|
||||
}
|
||||
else if (k > 0)
|
||||
{
|
||||
--k;
|
||||
p_150560_3_[i2] = block1;
|
||||
|
||||
if (k == 0 && block1 == Blocks.sand)
|
||||
{
|
||||
k = p_150560_2_.nextInt(4) + Math.max(0, l1 - 63);
|
||||
block1 = Blocks.sandstone;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
k = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BOPWorldFeatures getBiomeFeatures()
|
||||
{
|
||||
return bopWorldFeatures;
|
||||
}
|
||||
}
|
|
@ -2,13 +2,15 @@ package biomesoplenty.common.biomes.overworld;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.world.gen.feature.WorldGenAbstractTree;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase.Height;
|
||||
import biomesoplenty.api.BOPBlockHelper;
|
||||
import biomesoplenty.common.biomes.BOPBiome;
|
||||
import biomesoplenty.common.biomes.BOPCandyBiome;
|
||||
import biomesoplenty.common.configuration.BOPConfigurationMisc;
|
||||
import biomesoplenty.common.world.features.WorldGenCookie;
|
||||
|
||||
public class BiomeGenCandyland extends BOPBiome
|
||||
public class BiomeGenCandyland extends BOPCandyBiome
|
||||
{
|
||||
private static final Height biomeHeight = new Height(0.2F, 0.2F);
|
||||
|
||||
|
@ -65,4 +67,21 @@ public class BiomeGenCandyland extends BOPBiome
|
|||
if (BOPConfigurationMisc.skyColors) return 16760265;
|
||||
else return super.getSkyColorByTemp(par1);
|
||||
}
|
||||
|
||||
public void genTerrainBlocks(World p_150573_1_, Random p_150573_2_, Block[] p_150573_3_, byte[] p_150573_4_, int p_150573_5_, int p_150573_6_, double p_150573_7_)
|
||||
{
|
||||
|
||||
if (p_150573_7_ > 1.75D)
|
||||
{
|
||||
this.topBlock = BOPBlockHelper.get("frostedCake");
|
||||
this.field_150604_aj = 1;
|
||||
}
|
||||
else if (p_150573_7_ > -0.5D)
|
||||
{
|
||||
this.topBlock = BOPBlockHelper.get("frostedCake");
|
||||
this.field_150604_aj = 2;
|
||||
}
|
||||
|
||||
this.genCandyTerrain(p_150573_1_, p_150573_2_, p_150573_3_, p_150573_4_, p_150573_5_, p_150573_6_, p_150573_7_);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
package biomesoplenty.common.blocks;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
|
@ -19,7 +22,8 @@ import biomesoplenty.common.world.WorldTypeBOPA;
|
|||
|
||||
public class BlockFrostedCake extends Block
|
||||
{
|
||||
private IIcon[] icons = new IIcon[6];
|
||||
private static final String[] types = new String[] {"white", "pink"};
|
||||
private IIcon[][] icons = new IIcon[2][6];
|
||||
|
||||
public BlockFrostedCake()
|
||||
{
|
||||
|
@ -49,21 +53,39 @@ public class BlockFrostedCake extends Block
|
|||
//TODO: registerIcons()
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.icons[0] = iconRegister.registerIcon("biomesoplenty:cakeblock_bottom");
|
||||
this.icons[1] = iconRegister.registerIcon("biomesoplenty:cakeblock_top");
|
||||
this.icons[2] = iconRegister.registerIcon("biomesoplenty:cakeblock_side");
|
||||
this.icons[3] = iconRegister.registerIcon("biomesoplenty:cakeblock_side");
|
||||
this.icons[4] = iconRegister.registerIcon("biomesoplenty:cakeblock_side");
|
||||
this.icons[5] = iconRegister.registerIcon("biomesoplenty:cakeblock_side");
|
||||
this.icons[0][0] = iconRegister.registerIcon("biomesoplenty:cakeblock_bottom");
|
||||
this.icons[0][1] = iconRegister.registerIcon("biomesoplenty:cakeblock_top");
|
||||
this.icons[0][2] = iconRegister.registerIcon("biomesoplenty:cakeblock_side");
|
||||
this.icons[0][3] = iconRegister.registerIcon("biomesoplenty:cakeblock_side");
|
||||
this.icons[0][4] = iconRegister.registerIcon("biomesoplenty:cakeblock_side");
|
||||
this.icons[0][5] = iconRegister.registerIcon("biomesoplenty:cakeblock_side");
|
||||
|
||||
this.icons[1][0] = iconRegister.registerIcon("biomesoplenty:cakeblock_bottom");
|
||||
this.icons[1][1] = iconRegister.registerIcon("biomesoplenty:cakeblockpink_top");
|
||||
this.icons[1][2] = iconRegister.registerIcon("biomesoplenty:cakeblockpink_side");
|
||||
this.icons[1][3] = iconRegister.registerIcon("biomesoplenty:cakeblockpink_side");
|
||||
this.icons[1][4] = iconRegister.registerIcon("biomesoplenty:cakeblockpink_side");
|
||||
this.icons[1][5] = iconRegister.registerIcon("biomesoplenty:cakeblockpink_side");
|
||||
}
|
||||
|
||||
@Override
|
||||
//TODO: getIcon()
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
if (side < 0 || side >= this.icons.length) side = 1;
|
||||
|
||||
return this.icons[side];
|
||||
if (meta < 0 || meta >= this.icons.length) meta = 1;
|
||||
if (side < 0 || side >= this.icons[meta].length) side = 1;
|
||||
|
||||
return this.icons[meta][side];
|
||||
}
|
||||
|
||||
@Override
|
||||
//TODO: getSubBlocks()
|
||||
public void getSubBlocks(Item block, CreativeTabs creativeTabs, List list)
|
||||
{
|
||||
for (int i = 0; i < types.length; ++i)
|
||||
{
|
||||
list.add(new ItemStack(block, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -65,6 +65,7 @@ import biomesoplenty.common.itemblocks.ItemBlockCoral;
|
|||
import biomesoplenty.common.itemblocks.ItemBlockFlower;
|
||||
import biomesoplenty.common.itemblocks.ItemBlockFlower2;
|
||||
import biomesoplenty.common.itemblocks.ItemBlockFoliage;
|
||||
import biomesoplenty.common.itemblocks.ItemBlockFrostedCake;
|
||||
import biomesoplenty.common.itemblocks.ItemBlockGems;
|
||||
import biomesoplenty.common.itemblocks.ItemBlockGrave;
|
||||
import biomesoplenty.common.itemblocks.ItemBlockHive;
|
||||
|
@ -165,7 +166,7 @@ public class BOPBlocks
|
|||
|
||||
registerBlock(new BlockJelly().setBlockName("jellyBlock"), ItemBlockJelly.class);
|
||||
|
||||
registerBlock(new BlockFrostedCake().setBlockName("frostedCake"));
|
||||
registerBlock(new BlockFrostedCake().setBlockName("frostedCake"), ItemBlockFrostedCake.class);
|
||||
registerBlock(new BlockCandy(Material.cake, BlockTypeCandy.CAKE).setBlockName("cakeBlock"));
|
||||
registerBlock(new BlockCandy(Material.cake, BlockTypeCandy.COOKIE).setBlockName("cookieBlock"));
|
||||
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package biomesoplenty.common.itemblocks;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemBlockFrostedCake extends ItemBlock
|
||||
{
|
||||
private static final String[] types = new String[] {"white", "pink"};
|
||||
|
||||
public ItemBlockFrostedCake(Block block)
|
||||
{
|
||||
super(block);
|
||||
|
||||
this.setMaxDamage(0);
|
||||
this.setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int meta)
|
||||
{
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack itemstack)
|
||||
{
|
||||
int meta = itemstack.getItemDamage();
|
||||
if (meta < 0 || meta >= types.length) {
|
||||
meta = 0;
|
||||
}
|
||||
|
||||
return super.getUnlocalizedName() + "." + types[meta];
|
||||
}
|
||||
}
|
|
@ -12,7 +12,8 @@ tile.holyDirt.name=Purified Dirt
|
|||
tile.crystal.name=Celestial Crystal
|
||||
|
||||
tile.cakeBlock.name=Cake Block
|
||||
tile.frostedCake.name=Frosted Cake Block
|
||||
tile.frostedCake.white.name=White Frosted Cake Block
|
||||
tile.frostedCake.pink.name=Pink Frosted Cake Block
|
||||
tile.cookieBlock.name=Cookie Block
|
||||
|
||||
tile.redRock.redrock.name=Red Rock
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 238 B |
Binary file not shown.
After Width: | Height: | Size: 350 B |
Loading…
Reference in a new issue