Skip to content
Permalink
Browse files

tallgrass now uses the new plant system

  • Loading branch information
Konlii committed Mar 6, 2019
1 parent bf143ca commit 0de57b561c2b261bcc6c77795a43a1899e315054
Showing with 979 additions and 755 deletions.
  1. +4 −6 src/main/java/net/dries007/tfc/api/types/Plant.java
  2. +0 −16 src/main/java/net/dries007/tfc/client/ClientRegisterEvents.java
  3. +8 −8 src/main/java/net/dries007/tfc/objects/blocks/BlocksTFC.java
  4. +6 −0 src/main/java/net/dries007/tfc/objects/blocks/plants/BlockCactusTFC.java
  5. +3 −3 src/main/java/net/dries007/tfc/objects/blocks/plants/BlockDoublePlantTFC.java
  6. +0 −296 src/main/java/net/dries007/tfc/objects/blocks/plants/BlockDoubleTallGrassTFC.java
  7. +1 −14 src/main/java/net/dries007/tfc/objects/blocks/plants/BlockPlantTFC.java
  8. +204 −0 src/main/java/net/dries007/tfc/objects/blocks/plants/BlockShortGrassTFC.java
  9. +1 −8 src/main/java/net/dries007/tfc/objects/blocks/plants/BlockStackPlantTFC.java
  10. +86 −226 src/main/java/net/dries007/tfc/objects/blocks/plants/BlockTallGrassTFC.java
  11. +7 −1 src/main/java/net/dries007/tfc/types/DefaultPlants.java
  12. +15 −7 src/main/java/net/dries007/tfc/util/Helpers.java
  13. +17 −40 src/main/java/net/dries007/tfc/world/classic/biomes/BiomeDecoratorTFC.java
  14. +45 −2 src/main/java/net/dries007/tfc/world/classic/worldgen/WorldGenPlantTFC.java
  15. +0 −62 src/main/java/net/dries007/tfc/world/classic/worldgen/WorldGenTallGrassTFC.java
  16. +40 −0 src/main/resources/assets/tfc/blockstates/plants/ryegrass.json
  17. +40 −0 src/main/resources/assets/tfc/blockstates/plants/switchgrass.json
  18. +0 −42 src/main/resources/assets/tfc/blockstates/plants/tallgrass.json
  19. +19 −19 src/main/resources/assets/tfc/lang/en_us.lang
  20. +6 −0 src/main/resources/assets/tfc/models/block/plants/ryegrass_0.json
  21. +46 −0 src/main/resources/assets/tfc/models/block/plants/ryegrass_0b.json
  22. +6 −0 src/main/resources/assets/tfc/models/block/plants/ryegrass_1.json
  23. +46 −0 src/main/resources/assets/tfc/models/block/plants/ryegrass_1b.json
  24. +6 −0 src/main/resources/assets/tfc/models/block/plants/ryegrass_short_0.json
  25. +6 −0 src/main/resources/assets/tfc/models/block/plants/ryegrass_short_0b.json
  26. +6 −0 src/main/resources/assets/tfc/models/block/plants/ryegrass_short_1.json
  27. +6 −0 src/main/resources/assets/tfc/models/block/plants/ryegrass_short_1b.json
  28. +6 −0 src/main/resources/assets/tfc/models/block/plants/ryegrass_shorter_0.json
  29. +6 −0 src/main/resources/assets/tfc/models/block/plants/ryegrass_shorter_0b.json
  30. +6 −0 src/main/resources/assets/tfc/models/block/plants/ryegrass_shorter_1.json
  31. +6 −0 src/main/resources/assets/tfc/models/block/plants/ryegrass_shorter_1b.json
  32. +6 −0 src/main/resources/assets/tfc/models/block/plants/ryegrass_shortest_0.json
  33. +6 −0 src/main/resources/assets/tfc/models/block/plants/ryegrass_shortest_0b.json
  34. +6 −0 src/main/resources/assets/tfc/models/block/plants/ryegrass_shortest_1.json
  35. +6 −0 src/main/resources/assets/tfc/models/block/plants/ryegrass_shortest_1b.json
  36. +46 −0 src/main/resources/assets/tfc/models/block/plants/switchgrass_double_0.json
  37. +27 −0 src/main/resources/assets/tfc/models/block/plants/switchgrass_double_0b.json
  38. +46 −0 src/main/resources/assets/tfc/models/block/plants/switchgrass_double_1.json
  39. +46 −0 src/main/resources/assets/tfc/models/block/plants/switchgrass_double_short_0.json
  40. +27 −0 src/main/resources/assets/tfc/models/block/plants/switchgrass_double_short_0b.json
  41. +46 −0 src/main/resources/assets/tfc/models/block/plants/switchgrass_double_short_1.json
  42. +6 −0 src/main/resources/assets/tfc/models/block/plants/switchgrass_shorter_0.json
  43. +27 −0 src/main/resources/assets/tfc/models/block/plants/switchgrass_shorter_0b.json
  44. +6 −0 src/main/resources/assets/tfc/models/block/plants/switchgrass_shorter_1.json
  45. +6 −0 src/main/resources/assets/tfc/models/block/plants/switchgrass_shortest_0.json
  46. +6 −5 src/main/resources/assets/tfc/models/block/plants/{tallgrass.json → switchgrass_shortest_0b.json}
  47. +6 −0 src/main/resources/assets/tfc/models/block/plants/switchgrass_shortest_1.json
  48. +6 −0 src/main/resources/assets/tfc/models/item/plants/ryegrass.json
  49. +6 −0 src/main/resources/assets/tfc/models/item/plants/switchgrass.json
  50. BIN src/main/resources/assets/tfc/textures/blocks/plants/double_paeonia_bottom.png
  51. BIN src/main/resources/assets/tfc/textures/blocks/plants/double_paeonia_top.png
  52. BIN src/main/resources/assets/tfc/textures/blocks/plants/grass/double_grass_bottom.png
  53. BIN src/main/resources/assets/tfc/textures/blocks/plants/grass/double_grass_desert_bottom.png
  54. BIN src/main/resources/assets/tfc/textures/blocks/plants/grass/double_grass_desert_top.png
  55. BIN src/main/resources/assets/tfc/textures/blocks/plants/grass/double_grass_lush_bottom.png
  56. BIN src/main/resources/assets/tfc/textures/blocks/plants/grass/double_grass_lush_top.png
  57. BIN src/main/resources/assets/tfc/textures/blocks/plants/grass/double_grass_sparse_bottom.png
  58. BIN src/main/resources/assets/tfc/textures/blocks/plants/grass/double_grass_sparse_top.png
  59. BIN src/main/resources/assets/tfc/textures/blocks/plants/grass/double_grass_top.png
  60. BIN src/main/resources/assets/tfc/textures/blocks/plants/grass/double_shortergrass_bottom.png
  61. BIN src/main/resources/assets/tfc/textures/blocks/plants/grass/double_shortergrass_desert_bottom.png
  62. BIN src/main/resources/assets/tfc/textures/blocks/plants/grass/double_shortergrass_desert_top.png
  63. BIN src/main/resources/assets/tfc/textures/blocks/plants/grass/double_shortergrass_lush_bottom.png
  64. BIN src/main/resources/assets/tfc/textures/blocks/plants/grass/double_shortergrass_lush_top.png
  65. BIN src/main/resources/assets/tfc/textures/blocks/plants/grass/double_shortergrass_sparse_bottom.png
  66. BIN src/main/resources/assets/tfc/textures/blocks/plants/grass/double_shortergrass_sparse_top.png
  67. BIN src/main/resources/assets/tfc/textures/blocks/plants/grass/double_shortergrass_top.png
  68. BIN src/main/resources/assets/tfc/textures/blocks/plants/grass/double_shortgrass_bottom.png
  69. BIN src/main/resources/assets/tfc/textures/blocks/plants/grass/double_shortgrass_desert_bottom.png
  70. BIN src/main/resources/assets/tfc/textures/blocks/plants/grass/double_shortgrass_desert_top.png
  71. BIN src/main/resources/assets/tfc/textures/blocks/plants/grass/double_shortgrass_lush_bottom.png
  72. BIN src/main/resources/assets/tfc/textures/blocks/plants/grass/double_shortgrass_lush_top.png
  73. BIN src/main/resources/assets/tfc/textures/blocks/plants/grass/double_shortgrass_sparse_bottom.png
  74. BIN src/main/resources/assets/tfc/textures/blocks/plants/grass/double_shortgrass_sparse_top.png
  75. BIN src/main/resources/assets/tfc/textures/blocks/plants/grass/double_shortgrass_top.png
  76. BIN src/main/resources/assets/tfc/textures/blocks/plants/grass/shortergrass.png
  77. BIN src/main/resources/assets/tfc/textures/blocks/plants/grass/shortergrass_desert.png
  78. BIN src/main/resources/assets/tfc/textures/blocks/plants/grass/shortergrass_lush.png
  79. BIN src/main/resources/assets/tfc/textures/blocks/plants/grass/shortergrass_sparse.png
  80. BIN src/main/resources/assets/tfc/textures/blocks/plants/grass/shortgrass.png
  81. BIN src/main/resources/assets/tfc/textures/blocks/plants/grass/shortgrass_desert.png
  82. BIN src/main/resources/assets/tfc/textures/blocks/plants/grass/shortgrass_lush.png
  83. BIN src/main/resources/assets/tfc/textures/blocks/plants/grass/shortgrass_sparse.png
  84. BIN src/main/resources/assets/tfc/textures/blocks/plants/grass/tallgrass.png
  85. BIN src/main/resources/assets/tfc/textures/blocks/plants/grass/tallgrass_desert.png
  86. BIN src/main/resources/assets/tfc/textures/blocks/plants/grass/tallgrass_lush.png
  87. BIN src/main/resources/assets/tfc/textures/blocks/plants/grass/tallgrass_sparse.png
  88. BIN src/main/resources/assets/tfc/textures/blocks/plants/paeonia.png
  89. BIN src/main/resources/assets/tfc/textures/blocks/plants/ryegrass/ryegrass_0.png
  90. BIN src/main/resources/assets/tfc/textures/blocks/plants/ryegrass/ryegrass_1.png
  91. BIN src/main/resources/assets/tfc/textures/blocks/plants/ryegrass/ryegrass_lower_0b.png
  92. BIN src/main/resources/assets/tfc/textures/blocks/plants/ryegrass/ryegrass_lower_1b.png
  93. BIN src/main/resources/assets/tfc/textures/blocks/plants/ryegrass/ryegrass_short_0.png
  94. BIN src/main/resources/assets/tfc/textures/blocks/plants/ryegrass/ryegrass_short_0b.png
  95. BIN src/main/resources/assets/tfc/textures/blocks/plants/ryegrass/ryegrass_short_1.png
  96. BIN src/main/resources/assets/tfc/textures/blocks/plants/ryegrass/ryegrass_short_1b.png
  97. BIN src/main/resources/assets/tfc/textures/blocks/plants/ryegrass/ryegrass_shorter_0.png
  98. BIN src/main/resources/assets/tfc/textures/blocks/plants/ryegrass/ryegrass_shorter_0b.png
  99. BIN src/main/resources/assets/tfc/textures/blocks/plants/ryegrass/ryegrass_shorter_1.png
  100. BIN src/main/resources/assets/tfc/textures/blocks/plants/ryegrass/ryegrass_shorter_1b.png
  101. BIN src/main/resources/assets/tfc/textures/blocks/plants/ryegrass/ryegrass_shortest_0.png
  102. BIN src/main/resources/assets/tfc/textures/blocks/plants/ryegrass/ryegrass_shortest_0b.png
  103. BIN src/main/resources/assets/tfc/textures/blocks/plants/ryegrass/ryegrass_shortest_1.png
  104. BIN src/main/resources/assets/tfc/textures/blocks/plants/ryegrass/ryegrass_shortest_1b.png
  105. BIN src/main/resources/assets/tfc/textures/blocks/plants/ryegrass/ryegrass_upper_0b.png
  106. BIN src/main/resources/assets/tfc/textures/blocks/plants/ryegrass/ryegrass_upper_1b.png
  107. BIN src/main/resources/assets/tfc/textures/blocks/plants/switchgrass/switchgrass_0b.png
  108. BIN src/main/resources/assets/tfc/textures/blocks/plants/switchgrass/switchgrass_bottom_0.png
  109. BIN src/main/resources/assets/tfc/textures/blocks/plants/switchgrass/switchgrass_bottom_1.png
  110. BIN src/main/resources/assets/tfc/textures/blocks/plants/switchgrass/switchgrass_bottom_short_0.png
  111. BIN src/main/resources/assets/tfc/textures/blocks/plants/switchgrass/switchgrass_bottom_short_1.png
  112. BIN src/main/resources/assets/tfc/textures/blocks/plants/switchgrass/switchgrass_shorter_0.png
  113. BIN src/main/resources/assets/tfc/textures/blocks/plants/switchgrass/switchgrass_shorter_1.png
  114. BIN src/main/resources/assets/tfc/textures/blocks/plants/switchgrass/switchgrass_shortest_0.png
  115. BIN src/main/resources/assets/tfc/textures/blocks/plants/switchgrass/switchgrass_shortest_0b.png
  116. BIN src/main/resources/assets/tfc/textures/blocks/plants/switchgrass/switchgrass_shortest_1.png
  117. BIN src/main/resources/assets/tfc/textures/blocks/plants/switchgrass/switchgrass_top_0.png
  118. BIN src/main/resources/assets/tfc/textures/blocks/plants/switchgrass/switchgrass_top_1.png
  119. BIN src/main/resources/assets/tfc/textures/blocks/plants/switchgrass/switchgrass_top_short_0.png
  120. BIN src/main/resources/assets/tfc/textures/blocks/plants/switchgrass/switchgrass_top_short_1.png
@@ -15,10 +15,7 @@
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.registries.IForgeRegistryEntry;

import net.dries007.tfc.objects.blocks.plants.BlockCreepingPlantTFC;
import net.dries007.tfc.objects.blocks.plants.BlockDoublePlantTFC;
import net.dries007.tfc.objects.blocks.plants.BlockLilyPadTFC;
import net.dries007.tfc.objects.blocks.plants.BlockPlantTFC;
import net.dries007.tfc.objects.blocks.plants.*;

public class Plant extends IForgeRegistryEntry.Impl<Plant>
{
@@ -106,8 +103,9 @@ public Material getMaterial()
CREEPINGPLANT(BlockCreepingPlantTFC::new),
LILYPAD(BlockLilyPadTFC::new),
DESERTPLANT(BlockPlantTFC::new),
STACKPLANT(BlockPlantTFC::new),
CACTUS(BlockPlantTFC::new);
CACTUS(BlockCactusTFC::new),
SHORTGRASS(BlockShortGrassTFC::new),
TALLGRASS(BlockTallGrassTFC::new);

public static Block create(Plant plant, PlantType type)
{
@@ -225,14 +225,6 @@ public static void registerColorHandlerBlocks(ColorHandlerEvent.Block event)
worldIn != null && pos != null ? BiomeColorHelper.getFoliageColorAtPos(worldIn, pos) : ColorizerFoliage.getFoliageColorBasic(),
BlocksTFC.getAllLeafBlocks().toArray(new Block[0]));

blockcolors.registerBlockColorHandler((state, worldIn, pos, tintIndex) ->
worldIn != null && pos != null ? BiomeColorHelper.getGrassColorAtPos(worldIn, pos) : ColorizerGrass.getGrassColor(0.5D, 1.0D),
BlocksTFC.TALL_GRASS);

blockcolors.registerBlockColorHandler((state, worldIn, pos, tintIndex) ->
worldIn != null && pos != null ? BiomeColorHelper.getGrassColorAtPos(worldIn, pos) : ColorizerGrass.getGrassColor(0.5D, 1.0D),
BlocksTFC.DOUBLE_TALL_GRASS);

blockcolors.registerBlockColorHandler((state, worldIn, pos, tintIndex) ->
worldIn != null && pos != null ? BiomeColorHelper.getFoliageColorAtPos(worldIn, pos) : ColorizerFoliage.getFoliageColorBasic(),
BlocksTFC.getAllPlantBlocks().toArray(new Block[0]));
@@ -260,14 +252,6 @@ public static void registerColorHandlerItems(ColorHandlerEvent.Item event)
itemColors.registerItemColorHandler((stack, tintIndex) -> tintIndex == 1 ? EnumDyeColor.byDyeDamage(stack.getItemDamage()).getColorValue() : 0xFFFFFF,
ItemsTFC.CERAMICS_UNFIRED_VESSEL_GLAZED, ItemsTFC.CERAMICS_FIRED_VESSEL_GLAZED);

itemColors.registerItemColorHandler((stack, tintIndex) ->
event.getBlockColors().colorMultiplier(((ItemBlock) stack.getItem()).getBlock().getStateFromMeta(stack.getMetadata()), null, null, tintIndex),
BlocksTFC.TALL_GRASS);

itemColors.registerItemColorHandler((stack, tintIndex) ->
event.getBlockColors().colorMultiplier(((ItemBlock) stack.getItem()).getBlock().getStateFromMeta(stack.getMetadata()), null, null, tintIndex),
BlocksTFC.DOUBLE_TALL_GRASS);

itemColors.registerItemColorHandler((stack, tintIndex) ->
event.getBlockColors().colorMultiplier(((ItemBlock) stack.getItem()).getBlock().getStateFromMeta(stack.getMetadata()), null, null, tintIndex),
BlocksTFC.getAllPlantBlocks().toArray(new BlockPlantTFC[0]));
@@ -106,11 +106,6 @@
public static final BlockIngotPile INGOT_PILE = null;
public static final BlockTorchTFC TORCH = null;

@GameRegistry.ObjectHolder("plants/tallgrass")
public static final BlockTallGrassTFC TALL_GRASS = null;
@GameRegistry.ObjectHolder("plants/double_grass")
public static final BlockDoubleTallGrassTFC DOUBLE_TALL_GRASS = null;

// All these are for use in model registration. Do not use for block lookups.
// Use the static get methods in the classes instead.
private static ImmutableList<ItemBlock> allNormalItemBlocks;
@@ -248,9 +243,6 @@ public static void registerBlocks(RegistryEvent.Register<Block> event)

normalItemBlocks.add(new ItemBlock(register(r, "thatch", new BlockThatch(Material.PLANTS), CT_DECORATIONS)));

normalItemBlocks.add(new ItemBlock(register(r, "plants/tallgrass", new BlockTallGrassTFC(), CT_DECORATIONS)));
normalItemBlocks.add(new ItemBlock(register(r, "plants/double_grass", new BlockDoubleTallGrassTFC(), CT_DECORATIONS)));

register(r, "firepit", new BlockFirePit()); // No item or creative tab.

{
@@ -423,6 +415,14 @@ else if (plant.getPlantType() == Plant.PlantType.CACTUS)
{
b.add(register(r, "plants/" + plant.getRegistryName().getPath(), new BlockCactusTFC(plant, Plant.PlantType.CACTUS), CT_DECORATIONS));
}
else if (plant.getPlantType() == Plant.PlantType.SHORTGRASS)
{
b.add(register(r, "plants/" + plant.getRegistryName().getPath(), new BlockShortGrassTFC(plant, Plant.PlantType.SHORTGRASS), CT_DECORATIONS));
}
else if (plant.getPlantType() == Plant.PlantType.TALLGRASS)
{
b.add(register(r, "plants/" + plant.getRegistryName().getPath(), new BlockTallGrassTFC(plant, Plant.PlantType.TALLGRASS), CT_DECORATIONS));
}
}
allPlantBlocks = b.build();
for (BlockPlantTFC blockPlant : allPlantBlocks)
@@ -131,6 +131,12 @@ public IBlockState getStateFromMeta(int meta)
return this.getDefaultState().withProperty(AGE, meta).withProperty(GROWTHSTAGE, CalenderTFC.getMonthOfYear().id());
}

@Override
public boolean isReplaceable(IBlockAccess worldIn, BlockPos pos)
{
return false;
}

@Override
public void randomTick(World worldIn, BlockPos pos, IBlockState state, Random random)
{
@@ -146,7 +146,7 @@ public int getMetaFromState(IBlockState state)
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
{
return state.withProperty(TIME, state.getValue(TIME)).withProperty(AGE, state.getValue(AGE)).withProperty(GROWTHSTAGE, state.getValue(GROWTHSTAGE)).withProperty(PART, getPlantPart(worldIn, pos));
return state.withProperty(TIME, state.getValue(TIME)).withProperty(AGE, state.getValue(AGE)).withProperty(GROWTHSTAGE, CalenderTFC.getMonthOfYear().id()).withProperty(PART, getPlantPart(worldIn, pos));
}

@Override
@@ -204,13 +204,13 @@ public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random ra

if (rand.nextFloat() < getGrowthRate(worldIn, pos) && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(worldIn, pos, state, true))
{
if (j == 15)
if (j == 0)
{
shrink(worldIn, rand, pos, state);
}
else
{
worldIn.setBlockState(pos, state.withProperty(AGE, j + 1).withProperty(GROWTHSTAGE, state.getValue(GROWTHSTAGE)).withProperty(PART, state.getValue(PART)));
worldIn.setBlockState(pos, state.withProperty(AGE, j - 1).withProperty(GROWTHSTAGE, state.getValue(GROWTHSTAGE)).withProperty(PART, state.getValue(PART)));
}
net.minecraftforge.common.ForgeHooks.onCropsGrowPost(worldIn, pos, state, worldIn.getBlockState(pos));
}

0 comments on commit 0de57b5

Please sign in to comment.
You can’t perform that action at this time.