diff --git a/src/main/java/vazkii/botania/common/block/BlockAltGrass.java b/src/main/java/vazkii/botania/common/block/BlockAltGrass.java index 4c0270d6c..0bb2f00a9 100644 --- a/src/main/java/vazkii/botania/common/block/BlockAltGrass.java +++ b/src/main/java/vazkii/botania/common/block/BlockAltGrass.java @@ -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); diff --git a/src/main/java/vazkii/botania/common/block/decor/BlockFloatingFlower.java b/src/main/java/vazkii/botania/common/block/decor/BlockFloatingFlower.java index b86f54c7e..fc1fae8f9 100644 --- a/src/main/java/vazkii/botania/common/block/decor/BlockFloatingFlower.java +++ b/src/main/java/vazkii/botania/common/block/decor/BlockFloatingFlower.java @@ -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) { diff --git a/src/main/java/vazkii/botania/common/item/ItemGrassSeeds.java b/src/main/java/vazkii/botania/common/item/ItemGrassSeeds.java index 35985a50a..0ae989bd2 100644 --- a/src/main/java/vazkii/botania/common/item/ItemGrassSeeds.java +++ b/src/main/java/vazkii/botania/common/item/ItemGrassSeeds.java @@ -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> 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)); } diff --git a/src/main/resources/assets/botania/lang/en_US.lang b/src/main/resources/assets/botania/lang/en_US.lang index 4f929963e..06e64218c 100644 --- a/src/main/resources/assets/botania/lang/en_US.lang +++ b/src/main/resources/assets/botania/lang/en_US.lang @@ -1415,6 +1415,12 @@ item.botania:fertilizer.name=Floral Fertilizer item.botania:grassSeeds0.name=Pasture Seeds item.botania:grassSeeds1.name=Boreal Seeds item.botania:grassSeeds2.name=Infestation Spores +item.botania:grassSeeds3.name=Dry Pasture Seeds +item.botania:grassSeeds4.name=Golden Pasture Seeds +item.botania:grassSeeds5.name=Vivid Pasture Seeds +item.botania:grassSeeds6.name=Scorched Pasture Seeds +item.botania:grassSeeds7.name=Infused Pasture Seeds +item.botania:grassSeeds8.name=Mutated Pasture Seeds item.botania:livingwoodTwig.name=Livingwood Twig item.botania:dirtRod.name=Rod of the Lands item.botania:terraformRod.name=Rod of the Terra Firma diff --git a/src/main/resources/assets/botania/textures/items/grassSeeds9.png b/src/main/resources/assets/botania/textures/items/grassSeeds3.png similarity index 86% rename from src/main/resources/assets/botania/textures/items/grassSeeds9.png rename to src/main/resources/assets/botania/textures/items/grassSeeds3.png index 4bccf737f..abd76123b 100644 Binary files a/src/main/resources/assets/botania/textures/items/grassSeeds9.png and b/src/main/resources/assets/botania/textures/items/grassSeeds3.png differ diff --git a/src/main/resources/assets/botania/textures/items/grassSeeds4.png b/src/main/resources/assets/botania/textures/items/grassSeeds4.png index a303a694b..53ce0f6ff 100644 Binary files a/src/main/resources/assets/botania/textures/items/grassSeeds4.png and b/src/main/resources/assets/botania/textures/items/grassSeeds4.png differ diff --git a/src/main/resources/assets/botania/textures/items/grassSeeds5.png b/src/main/resources/assets/botania/textures/items/grassSeeds5.png index abd76123b..a303a694b 100644 Binary files a/src/main/resources/assets/botania/textures/items/grassSeeds5.png and b/src/main/resources/assets/botania/textures/items/grassSeeds5.png differ diff --git a/src/main/resources/assets/botania/textures/items/grassSeeds6.png b/src/main/resources/assets/botania/textures/items/grassSeeds6.png index 53ce0f6ff..a0f186b6c 100644 Binary files a/src/main/resources/assets/botania/textures/items/grassSeeds6.png and b/src/main/resources/assets/botania/textures/items/grassSeeds6.png differ diff --git a/src/main/resources/assets/botania/textures/items/grassSeeds7.png b/src/main/resources/assets/botania/textures/items/grassSeeds7.png index a0f186b6c..dea69f9e3 100644 Binary files a/src/main/resources/assets/botania/textures/items/grassSeeds7.png and b/src/main/resources/assets/botania/textures/items/grassSeeds7.png differ diff --git a/src/main/resources/assets/botania/textures/items/grassSeeds8.png b/src/main/resources/assets/botania/textures/items/grassSeeds8.png index dea69f9e3..4bccf737f 100644 Binary files a/src/main/resources/assets/botania/textures/items/grassSeeds8.png and b/src/main/resources/assets/botania/textures/items/grassSeeds8.png differ