mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-17 10:55:17 +00:00
S E E D S B O Y Z
This commit is contained in:
1 parent
411c14199e
commit
18bdd6d32d
10 files changed
+58
-21
No files matched your search
@@ -22,7 +22,12 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
|
||||
@@ -70,19 +75,19 @@ public class BlockAltGrass extends BlockMod {
|
||||
return side == 0 || meta >= SUBTYPES ? Blocks.dirt.getIcon(side, meta) : side == 1 ? icons[meta * 2] : icons[meta * 2 + 1];
|
||||
}
|
||||
|
||||
// All from below is from BlockMycelium (adapted a bit)
|
||||
|
||||
@Override
|
||||
public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_) {
|
||||
if(!p_149674_1_.isRemote && p_149674_1_.getBlockLightValue(p_149674_2_, p_149674_3_ + 1, p_149674_4_) >= 9) {
|
||||
public void updateTick(World world, int x, int y, int z, Random rand) {
|
||||
if(!world.isRemote && world.getBlockLightValue(x, y + 1, z) >= 9) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
for(int l = 0; l < 4; ++l) {
|
||||
int i1 = p_149674_2_ + p_149674_5_.nextInt(3) - 1;
|
||||
int j1 = p_149674_3_ + p_149674_5_.nextInt(5) - 3;
|
||||
int k1 = p_149674_4_ + p_149674_5_.nextInt(3) - 1;
|
||||
Block block = p_149674_1_.getBlock(i1, j1 + 1, k1);
|
||||
int i1 = x + rand.nextInt(3) - 1;
|
||||
int j1 = y + rand.nextInt(5) - 3;
|
||||
int k1 = z + rand.nextInt(3) - 1;
|
||||
|
||||
Block block = world.getBlock(i1, j1 + 1, k1);
|
||||
|
||||
if(p_149674_1_.getBlock(i1, j1, k1) == Blocks.dirt && p_149674_1_.getBlockMetadata(i1, j1, k1) == 0 && p_149674_1_.getBlockLightValue(i1, j1 + 1, k1) >= 4 && p_149674_1_.getBlockLightOpacity(i1, j1 + 1, k1) <= 2)
|
||||
p_149674_1_.setBlock(i1, j1, k1, this);
|
||||
if(world.getBlock(i1, j1, k1) == Blocks.dirt && world.getBlockMetadata(i1, j1, k1) == 0 && world.getBlockLightValue(i1, j1 + 1, k1) >= 4 && world.getBlockLightOpacity(i1, j1 + 1, k1) <= 2)
|
||||
world.setBlock(i1, j1, k1, this, meta, 1 | 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -92,6 +97,16 @@ public class BlockAltGrass extends BlockMod {
|
||||
return Blocks.dirt.getItemDropped(0, p_149650_2_, p_149650_3_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
|
||||
return new ItemStack(this, 1, world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSustainPlant(IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plantable) {
|
||||
return plantable.getPlantType(world, x, y - 1, z) == EnumPlantType.Plains;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random r) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
@@ -133,8 +133,11 @@ public class BlockFloatingFlower extends BlockModContainer implements ILexiconab
|
||||
IslandType type = null;
|
||||
if(stack.getItem() == Items.snowball)
|
||||
type = IslandType.SNOW;
|
||||
else if(stack.getItem() == ModItems.grassSeeds)
|
||||
type = ItemGrassSeeds.getIslandType(stack);
|
||||
else if(stack.getItem() == ModItems.grassSeeds) {
|
||||
IslandType newType = ItemGrassSeeds.getIslandType(stack);
|
||||
if(newType != null)
|
||||
type = newType;
|
||||
}
|
||||
|
||||
if(type != null && type != flower.getIslandType()) {
|
||||
if(!world.isRemote) {
|
||||
|
||||
@@ -28,6 +28,7 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.decor.IFloatingFlower.IslandType;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
@@ -42,10 +43,11 @@ public class ItemGrassSeeds extends ItemMod {
|
||||
private static Map<Integer, List<BlockSwapper>> blockSwappers = new HashMap();
|
||||
|
||||
private static final IslandType[] ISLAND_TYPES = {
|
||||
IslandType.GRASS, IslandType.PODZOL, IslandType.MYCEL
|
||||
IslandType.GRASS, IslandType.PODZOL, IslandType.MYCEL,
|
||||
null, null, null, null, null, null
|
||||
};
|
||||
|
||||
private static final int types = 3;
|
||||
private static final int SUBTYPES = 9;
|
||||
IIcon[] icons;
|
||||
|
||||
public ItemGrassSeeds() {
|
||||
@@ -57,15 +59,15 @@ public class ItemGrassSeeds extends ItemMod {
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item par1, CreativeTabs par2, List par3) {
|
||||
for(int i = 0; i < types; i++)
|
||||
for(int i = 0; i < SUBTYPES; i++)
|
||||
par3.add(new ItemStack(par1, 1, i));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister par1IconRegister) {
|
||||
icons = new IIcon[types];
|
||||
for(int i = 0; i < types; i++)
|
||||
icons = new IIcon[SUBTYPES];
|
||||
for(int i = 0; i < SUBTYPES; i++)
|
||||
icons[i] = IconHelper.forItem(par1IconRegister, this, i);
|
||||
}
|
||||
|
||||
@@ -85,7 +87,7 @@ public class ItemGrassSeeds extends ItemMod {
|
||||
Block block = par3World.getBlock(par4, par5, par6);
|
||||
int bmeta = par3World.getBlockMetadata(par4, par5, par6);
|
||||
|
||||
if(block == Blocks.dirt && bmeta == 0) {
|
||||
if((block == Blocks.dirt || (block == Blocks.grass && par1ItemStack.getItemDamage() != 0)) && bmeta == 0) {
|
||||
int meta = par1ItemStack.getItemDamage();
|
||||
|
||||
BlockSwapper swapper = addBlockSwapper(par3World, par4, par5, par6, meta);
|
||||
@@ -98,14 +100,19 @@ public class ItemGrassSeeds extends ItemMod {
|
||||
float r = 0F;
|
||||
float g = 0.4F;
|
||||
float b = 0F;
|
||||
if(meta == 1) {
|
||||
switch(meta) {
|
||||
case 1: {
|
||||
r = 0.5F;
|
||||
g = 0.37F;
|
||||
b = 0F;
|
||||
} else if(meta == 2) {
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
r = 0.27F;
|
||||
g = 0F;
|
||||
b = 0.33F;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
float velMul = 0.025F;
|
||||
@@ -148,6 +155,12 @@ public class ItemGrassSeeds extends ItemMod {
|
||||
switch(meta) {
|
||||
case 1 : return new BlockSwapper(world, new ChunkCoordinates(x, y, z), Blocks.dirt, 2);
|
||||
case 2 : return new BlockSwapper(world, new ChunkCoordinates(x, y, z), Blocks.mycelium, 0);
|
||||
case 3 : return new BlockSwapper(world, new ChunkCoordinates(x, y, z), ModBlocks.altGrass, 0);
|
||||
case 4 : return new BlockSwapper(world, new ChunkCoordinates(x, y, z), ModBlocks.altGrass, 1);
|
||||
case 5 : return new BlockSwapper(world, new ChunkCoordinates(x, y, z), ModBlocks.altGrass, 2);
|
||||
case 6 : return new BlockSwapper(world, new ChunkCoordinates(x, y, z), ModBlocks.altGrass, 3);
|
||||
case 7 : return new BlockSwapper(world, new ChunkCoordinates(x, y, z), ModBlocks.altGrass, 4);
|
||||
case 8 : return new BlockSwapper(world, new ChunkCoordinates(x, y, z), ModBlocks.altGrass, 5);
|
||||
default : return new BlockSwapper(world, new ChunkCoordinates(x, y, z), Blocks.grass, 0);
|
||||
}
|
||||
}
|
||||
@@ -191,7 +204,7 @@ public class ItemGrassSeeds extends ItemMod {
|
||||
int z1 = z + l;
|
||||
Block block1 = world.getBlock(x1, y, z1);
|
||||
int meta1 = world.getBlockMetadata(x1, y, z1);
|
||||
if(block1 == Blocks.dirt && meta1 == 0)
|
||||
if((block1 == Blocks.dirt || block1 == Blocks.grass) && meta1 == 0)
|
||||
validCoords.add(new ChunkCoordinates(x1, y, z1));
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user