Initial Git
This commit is contained in:
parent
e1d8dcff07
commit
a12f6ddce8
347 changed files with 16443 additions and 0 deletions
196
common/MysticWorld/Blocks/BlockBush.java
Normal file
196
common/MysticWorld/Blocks/BlockBush.java
Normal file
|
|
@ -0,0 +1,196 @@
|
|||
package MysticWorld.Blocks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import MysticWorld.MysticWorld;
|
||||
import MysticWorld.Items.ItemHandler$1;
|
||||
import MysticWorld.Lib.BlockIds;
|
||||
import MysticWorld.Lib.Strings;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.projectile.EntityPotion;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.ColorizerFoliage;
|
||||
import net.minecraft.world.ColorizerGrass;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
import net.minecraftforge.common.IShearable;
|
||||
|
||||
public class BlockBush extends Block implements IPlantable{
|
||||
|
||||
Icon[] textures;
|
||||
|
||||
public BlockBush(int id) {
|
||||
super(id, Material.leaves);
|
||||
setCreativeTab(MysticWorld.MysticWorldTab);
|
||||
setHardness(0.3F);
|
||||
setResistance(0.1F);
|
||||
setStepSound(Block.soundGrassFootstep);
|
||||
setBlockBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.5F, 0.75F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IconRegister iconRegister)
|
||||
{
|
||||
textures = new Icon[16];
|
||||
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
textures[i] = iconRegister.registerIcon("MysticTextures" + ":" + "Bush_" + i);
|
||||
}
|
||||
}
|
||||
|
||||
//Plant Specific Stuff
|
||||
|
||||
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
return super.canPlaceBlockAt(par1World, par2, par3, par4) && canBlockStay(par1World, par2, par3, par4);
|
||||
}
|
||||
|
||||
protected boolean canThisPlantGrowOnThisBlockID(int par1)
|
||||
{
|
||||
return par1 == Block.grass.blockID || par1 == Block.dirt.blockID;
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5)
|
||||
{
|
||||
super.onNeighborBlockChange(par1World, par2, par3, par4, par5);
|
||||
this.checkBushChange(par1World, par2, par3, par4);
|
||||
}
|
||||
|
||||
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
|
||||
{
|
||||
this.checkBushChange(par1World, par2, par3, par4);
|
||||
}
|
||||
|
||||
protected final void checkBushChange(World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
if (!this.canBlockStay(par1World, par2, par3, par4))
|
||||
{
|
||||
this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
|
||||
par1World.setBlockToAir(par2, par3, par4);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canBlockStay(World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
Block soil = blocksList[par1World.getBlockId(par2, par3 - 1, par4)];
|
||||
return (par1World.getFullBlockLightValue(par2, par3, par4) >= 8 || par1World.canBlockSeeTheSky(par2, par3, par4)) &&
|
||||
(soil != null && soil.canSustainPlant(par1World, par2, par3 - 1, par4, ForgeDirection.UP, this));
|
||||
}
|
||||
|
||||
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
|
||||
{
|
||||
super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
|
||||
}
|
||||
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumPlantType getPlantType(World world, int x, int y, int z)
|
||||
{
|
||||
return EnumPlantType.Plains;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlantID(World world, int x, int y, int z)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlantMetadata(World world, int x, int y, int z)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
//Sprite Inits
|
||||
@Override
|
||||
public Icon getIcon(int side, int meta)
|
||||
{
|
||||
return textures[meta];
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getBlockColor()
|
||||
{
|
||||
double d0 = 0.5D;
|
||||
double d1 = 1.0D;
|
||||
return ColorizerGrass.getGrassColor(d0, d1);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderColor(int par1)
|
||||
{
|
||||
return par1 == -1 ? 16777215 : ColorizerFoliage.getFoliageColorBasic();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
|
||||
{
|
||||
int l = par1IBlockAccess.getBlockMetadata(par2, par3, par4);
|
||||
return l == -1 ? 16777215 : par1IBlockAccess.getBiomeGenForCoords(par2, par4).getBiomeGrassColor();
|
||||
}
|
||||
|
||||
//Meta Inits
|
||||
|
||||
public int quantityDroppedWithBonus(int par1, Random par2Random)
|
||||
{
|
||||
return 1 + par2Random.nextInt(par1 * 2 + 1);
|
||||
}
|
||||
|
||||
public int idDropped(int par1, Random par2Random, int par3)
|
||||
{
|
||||
return ItemHandler$1.bushFruit.itemID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int j)
|
||||
{
|
||||
return j;
|
||||
}
|
||||
|
||||
public int idPicked(World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
return blockID;
|
||||
}
|
||||
|
||||
public int getDamageValue(World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
return par1World.getBlockMetadata(par2, par3, par4);
|
||||
}
|
||||
|
||||
public void getSubBlocks(int i,CreativeTabs tab, List list)
|
||||
{
|
||||
for(int j=0;j<12;j++)
|
||||
{
|
||||
list.add(new ItemStack(i,1,j));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
46
common/MysticWorld/Blocks/BlockHandler.java
Normal file
46
common/MysticWorld/Blocks/BlockHandler.java
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
package MysticWorld.Blocks;
|
||||
|
||||
import MysticWorld.Lib.BlockIds;
|
||||
import MysticWorld.Lib.Strings;
|
||||
import MysticWorld.WorldGen.StonesGen;
|
||||
import MysticWorld.WorldGen.WorldGenBushes;
|
||||
import MysticWorld.WorldGen.WorldGenStones;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
public class BlockHandler {
|
||||
|
||||
public static Block OreImbuedStone;
|
||||
public static Block bush;
|
||||
|
||||
public static void init() {
|
||||
|
||||
OreImbuedStone = new BlockImbuedStone(BlockIds.ORE_STONE_1).setUnlocalizedName(Strings.IMBUED_STONE_NAME);
|
||||
bush = new BlockBush(BlockIds.BUSH).setUnlocalizedName(Strings.BUSH_NAME);
|
||||
|
||||
registerBlocks();
|
||||
setBlockHarvestLevels();
|
||||
}
|
||||
|
||||
private static void registerBlocks() {
|
||||
GameRegistry.registerBlock(OreImbuedStone, ItemBlockImbuedStone.class, Strings.IMBUED_STONE_NAME);
|
||||
GameRegistry.registerBlock(bush, ItemBlockBush.class, Strings.BUSH_NAME);
|
||||
|
||||
GameRegistry.registerWorldGenerator(new WorldGenBushes());
|
||||
GameRegistry.registerWorldGenerator(new WorldGenStones());
|
||||
|
||||
}
|
||||
|
||||
private static void setBlockHarvestLevels() {
|
||||
MinecraftForge.setBlockHarvestLevel(OreImbuedStone, 0, "pickaxe", 2);
|
||||
MinecraftForge.setBlockHarvestLevel(OreImbuedStone, 1, "pickaxe", 2);
|
||||
MinecraftForge.setBlockHarvestLevel(OreImbuedStone, 2, "pickaxe", 2);
|
||||
MinecraftForge.setBlockHarvestLevel(OreImbuedStone, 3, "pickaxe", 2);
|
||||
MinecraftForge.setBlockHarvestLevel(OreImbuedStone, 4, "pickaxe", 2);
|
||||
}
|
||||
}
|
||||
133
common/MysticWorld/Blocks/BlockImbuedStone.java
Normal file
133
common/MysticWorld/Blocks/BlockImbuedStone.java
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
package MysticWorld.Blocks;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockBreakable;
|
||||
import net.minecraft.block.BlockFence;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.WorldClient;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import cpw.mods.fml.common.ModMetadata;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import MysticWorld.MysticWorld;
|
||||
import MysticWorld.Items.ItemHandler$1;
|
||||
|
||||
public class BlockImbuedStone extends Block {
|
||||
|
||||
Icon[] textures;
|
||||
|
||||
public BlockImbuedStone(int ID) {
|
||||
super(ID, Material.rock);
|
||||
setHardness(0.5F);
|
||||
setResistance(5F);
|
||||
setCreativeTab(MysticWorld.MysticWorldTab);
|
||||
setBlockBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.125F, 0.75F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IconRegister iconRegister)
|
||||
{
|
||||
textures = new Icon[16];
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
textures[i] = iconRegister.registerIcon("MysticTextures" + ":" + "OreStone_" + i);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
return par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4);
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5)
|
||||
{
|
||||
boolean flag = false;
|
||||
|
||||
if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && !BlockFence.isIdAFence(par1World.getBlockId(par2, par3 - 1, par4)))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (flag)
|
||||
{
|
||||
this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
|
||||
par1World.setBlockToAir(par2, par3, par4);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getIcon(int side, int meta)
|
||||
{
|
||||
return textures[meta];
|
||||
}
|
||||
|
||||
public int idDropped(int par1, Random par2Random, int par3)
|
||||
{
|
||||
return ItemHandler$1.imbuedShard.itemID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int j)
|
||||
{
|
||||
return j;
|
||||
}
|
||||
|
||||
public int xpDropAmount(int j)
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean canSilkHarvest()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void onBlockDestroyedByPlayer(World world, int x, int y, int z, int meta)
|
||||
{
|
||||
this.dropXpOnBlockBreak(world, x, y, z, xpDropAmount(meta));
|
||||
}
|
||||
|
||||
//meta specific stuff
|
||||
public int idPicked(World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
return this.blockID;
|
||||
}
|
||||
|
||||
public ItemStack getPickBlock(MovingObjectPosition target,World world, int x, int y, int z)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void getSubBlocks(int i,CreativeTabs tab, List list)
|
||||
{
|
||||
for(int j=0;j<5;j++)
|
||||
{
|
||||
list.add(new ItemStack(i,1,j));
|
||||
}
|
||||
}
|
||||
}
|
||||
53
common/MysticWorld/Blocks/ItemBlockBush.java
Normal file
53
common/MysticWorld/Blocks/ItemBlockBush.java
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
package MysticWorld.Blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import MysticWorld.Lib.Strings;
|
||||
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
|
||||
public class ItemBlockBush extends ItemBlock {
|
||||
|
||||
public ItemBlockBush(int par1) {
|
||||
super(par1);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public String getUnlocalizedName(ItemStack i){
|
||||
switch(i.getItemDamage()){
|
||||
case 0:return Strings.BUSH_NAME;
|
||||
case 1:return Strings.POISON_BUSH_NAME;
|
||||
case 2:return Strings.WEAKNESS_BUSH_NAME;
|
||||
case 3:return Strings.SLOWNESS_BUSH_NAME;
|
||||
case 4:return Strings.HARMING_BUSH_NAME;
|
||||
case 5:return Strings.WITHER_BUSH_NAME;
|
||||
case 6:return Strings.HEALTH_BUSH_NAME;
|
||||
case 7:return Strings.SPEED_BUSH_NAME;
|
||||
case 8:return Strings.FIRE_RESISTANCE_BUSH_NAME;
|
||||
case 9:return Strings.REGEN_BUSH_NAME;
|
||||
case 10:return Strings.NIGHT_VISION_BUSH_NAME;
|
||||
case 11:return Strings.INVISIBILITY_BUSH_NAME;
|
||||
default:return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int getMetadata(int par1)
|
||||
{
|
||||
return par1;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getIconFromDamage(int par1)
|
||||
{
|
||||
return BlockHandler.bush.getIcon(2, par1);
|
||||
}
|
||||
|
||||
}
|
||||
43
common/MysticWorld/Blocks/ItemBlockImbuedStone.java
Normal file
43
common/MysticWorld/Blocks/ItemBlockImbuedStone.java
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
package MysticWorld.Blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
|
||||
public class ItemBlockImbuedStone extends ItemBlock {
|
||||
|
||||
public ItemBlockImbuedStone(int par1) {
|
||||
super(par1);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public String getUnlocalizedName(ItemStack i){
|
||||
switch(i.getItemDamage()){
|
||||
case 0:return "Fire";
|
||||
case 1:return "Water";
|
||||
case 2:return "Earth";
|
||||
case 3:return "Air";
|
||||
case 4:return "Energy";
|
||||
default:return "";
|
||||
}
|
||||
}
|
||||
|
||||
public int getMetadata(int par1)
|
||||
{
|
||||
return par1;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getIconFromDamage(int par1)
|
||||
{
|
||||
return BlockHandler.OreImbuedStone.getIcon(2, par1);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in a new issue