Skip to content

Commit

Permalink
WIP Bush Cherry Tree (renaming old Cherry)
Browse files Browse the repository at this point in the history
  • Loading branch information
thedarkcolour committed Nov 30, 2024
1 parent c0bec51 commit 4122a11
Show file tree
Hide file tree
Showing 14 changed files with 49 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,20 @@ public class ForestryTreeSpecies {
public static final ResourceLocation OAK = forestry("tree_oak");
public static final ResourceLocation DARK_OAK = forestry("tree_dark_oak");
public static final ResourceLocation BIRCH = forestry("tree_birch");
/**
* The species for the Acacia trees added by Vanilla Minecraft.
*/
public static final ResourceLocation ACACIA_VANILLA = forestry("tree_acacia");
public static final ResourceLocation SPRUCE = forestry("tree_spruce");
public static final ResourceLocation JUNGLE = forestry("tree_jungle");
/**
* The species for the Cherry Blossom trees added by Vanilla Minecraft.
*/
public static final ResourceLocation CHERRY_VANILLA = forestry("tree_cherry");
public static final ResourceLocation LIME = forestry("tree_lime");
public static final ResourceLocation WALNUT = forestry("tree_walnut");
public static final ResourceLocation CHESTNUT = forestry("tree_chestnut");
public static final ResourceLocation CHERRY = forestry("tree_cherry");
public static final ResourceLocation BUSH_CHERRY = forestry("tree_bush_cherry");
public static final ResourceLocation LEMON = forestry("tree_lemon");
public static final ResourceLocation PLUM = forestry("tree_plum");
public static final ResourceLocation MAPLE = forestry("tree_maple");
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/forestry/api/genetics/ForestryTaxa.java
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ public class ForestryTaxa {
public static final String SPECIES_LIME = "tomentosa";
public static final String SPECIES_WALNUT = "regia";
public static final String SPECIES_CHESTNUT = "sativa";
public static final String SPECIES_CHERRY = "serrulata";
public static final String SPECIES_CHERRY_VANILLA = "serrulata";
public static final String SPECIES_BUSH_CHERRY = "glandulosa";
public static final String SPECIES_LEMON = "limon";
public static final String SPECIES_PLUM = "domestica";
public static final String SPECIES_MAPLE = "saccharum";
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/forestry/arboriculture/ForestryWoodType.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public enum ForestryWoodType implements IWoodType {
WILLOW(ForestryLeafType.WILLOW),
WALNUT(ForestryLeafType.WALNUT),
GREENHEART(ForestryLeafType.SIPIRI, 7.5f),
CHERRY(ForestryLeafType.CHERRY),
CHERRY(ForestryLeafType.BUSH_CHERRY),

MAHOE(ForestryLeafType.MAHOE),
POPLAR(ForestryLeafType.POPLAR),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import net.minecraft.resources.ResourceLocation;

import forestry.api.arboriculture.ForestryTreeSpecies;
import forestry.api.client.arboriculture.ILeafSprite;
import forestry.api.arboriculture.ITreeSpecies;
import forestry.api.arboriculture.genetics.IFruit;
import forestry.api.arboriculture.genetics.ITree;
Expand All @@ -31,7 +30,7 @@ public final class ForestryLeafType implements IBlockSubtype {
public static final ForestryLeafType LIME = new ForestryLeafType(ForestryTreeSpecies.LIME);
public static final ForestryLeafType WALNUT = new ForestryLeafType(ForestryTreeSpecies.WALNUT);
public static final ForestryLeafType CHESTNUT = new ForestryLeafType(ForestryTreeSpecies.CHESTNUT);
public static final ForestryLeafType CHERRY = new ForestryLeafType(ForestryTreeSpecies.CHERRY);
public static final ForestryLeafType BUSH_CHERRY = new ForestryLeafType(ForestryTreeSpecies.BUSH_CHERRY);
public static final ForestryLeafType LEMON = new ForestryLeafType(ForestryTreeSpecies.LEMON);
public static final ForestryLeafType PLUM = new ForestryLeafType(ForestryTreeSpecies.PLUM);
public static final ForestryLeafType MAPLE = new ForestryLeafType(ForestryTreeSpecies.MAPLE);
Expand Down Expand Up @@ -103,7 +102,7 @@ public static Set<ForestryLeafType> allValues() {
// Default values used by Forestry to make its leaf blocks (includes all the fields)
@ApiStatus.Internal
public static List<ForestryLeafType> values() {
return Arrays.asList(OAK, DARK_OAK, BIRCH, LIME, WALNUT, CHESTNUT, CHERRY, LEMON, PLUM, MAPLE, SPRUCE, LARCH, PINE, SEQUOIA, GIANT_SEQUOIA, JUNGLE, TEAK, IPE, KAPOK, EBONY, ZEBRAWOOD, MAHOGANY, ACACIA_VANILLA, DESERT_ACACIA, PADAUK, BALSA, COCOBOLO, WENGE, BAOBAB, MAHOE, WILLOW, SIPIRI, PAPAYA, DATE, POPLAR);
return Arrays.asList(OAK, DARK_OAK, BIRCH, LIME, WALNUT, CHESTNUT, BUSH_CHERRY, LEMON, PLUM, MAPLE, SPRUCE, LARCH, PINE, SEQUOIA, GIANT_SEQUOIA, JUNGLE, TEAK, IPE, KAPOK, EBONY, ZEBRAWOOD, MAHOGANY, ACACIA_VANILLA, DESERT_ACACIA, PADAUK, BALSA, COCOBOLO, WENGE, BAOBAB, MAHOE, WILLOW, SIPIRI, PAPAYA, DATE, POPLAR);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,6 @@ public void createElements(DatabaseElement container, ITree tree, ILifeStage sta

@Override
public ItemStack getIconStack() {
return SpeciesUtil.getTreeSpecies(ForestryTreeSpecies.CHERRY).createStack(mode == DatabaseMode.ACTIVE ? TreeLifeStage.SAPLING : TreeLifeStage.POLLEN);
return SpeciesUtil.getTreeSpecies(ForestryTreeSpecies.BUSH_CHERRY).createStack(mode == DatabaseMode.ACTIVE ? TreeLifeStage.SAPLING : TreeLifeStage.POLLEN);
}
}
2 changes: 1 addition & 1 deletion src/main/java/forestry/arboriculture/tiles/TileLeaves.java
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ public int getFruitColour() {
private int determineFruitColour() {
ITree tree = getTree();
if (tree == null) {
tree = SpeciesUtil.getTreeSpecies(ForestryTreeSpecies.CHERRY).createIndividual();
tree = SpeciesUtil.getTreeSpecies(ForestryTreeSpecies.BUSH_CHERRY).createIndividual();
}
IGenome genome = tree.getGenome();
IFruit fruit = genome.getActiveValue(TreeChromosomes.FRUIT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import forestry.core.worldgen.FeatureHelper;

public class FeatureAcacia extends FeatureTree {

public FeatureAcacia(ITreeGenData tree) {
super(tree, 5, 2);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
import forestry.api.arboriculture.ITreeGenData;

public class FeatureAcaciaVanilla extends FeatureTreeVanilla {

public FeatureAcaciaVanilla(ITreeGenData tree) {
super(tree);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
import forestry.api.arboriculture.ITreeGenData;
import forestry.core.worldgen.FeatureHelper;

public class FeatureCherry extends FeatureTree {
public class FeatureBushCherry extends FeatureTree {

public FeatureCherry(ITreeGenData tree) {
public FeatureBushCherry(ITreeGenData tree) {
super(tree, 4, 4);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package forestry.arboriculture.worldgen;

import forestry.api.arboriculture.ITreeGenData;

public class FeatureCherryVanilla {
public FeatureCherryVanilla(ITreeGenData data) {

}
}
2 changes: 1 addition & 1 deletion src/main/java/forestry/core/data/LootTableHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public LootTableHelper() {
.setRolls(ConstantValue.exactly(3))
.add(LootItem.lootTableItem(ArboricultureItems.GRAFTER.item()))
.add(saplingLoot(ForestryTreeSpecies.LIME).apply(SetItemCountFunction.setCount(UniformGenerator.between(1, 3))))
.add(saplingLoot(ForestryTreeSpecies.CHERRY).apply(SetItemCountFunction.setCount(UniformGenerator.between(1, 3))))
.add(saplingLoot(ForestryTreeSpecies.BUSH_CHERRY).apply(SetItemCountFunction.setCount(UniformGenerator.between(1, 3))))
.add(saplingLoot(ForestryTreeSpecies.LARCH).apply(SetItemCountFunction.setCount(UniformGenerator.between(1, 3))))
.add(saplingLoot(ForestryTreeSpecies.TEAK))
.add(saplingLoot(ForestryTreeSpecies.PADAUK))
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/forestry/core/worldgen/FeatureHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public static void generateSphere(LevelAccessor world, BlockPos center, int radi
* Returns a list of trunk top coordinates
*/
public static Set<BlockPos> generateTreeTrunk(
LevelAccessor world,
LevelAccessor level,
RandomSource rand,
ITreeBlockType wood,
BlockPos startPos,
Expand Down Expand Up @@ -175,14 +175,14 @@ public static Set<BlockPos> generateTreeTrunk(
if (leanDirection != null) {
wood.setDirection(leanDirection);
}
addBlock(world, startPos.offset(x + xOffset, y - 1, z + zOffset), wood, EnumReplaceMode.ALL);
addBlock(level, startPos.offset(x + xOffset, y - 1, z + zOffset), wood, EnumReplaceMode.ALL);
wood.setDirection(Direction.UP);
}
}

BlockPos pos = startPos.offset(x + xOffset, y, z + zOffset);
addBlock(world, pos, wood, EnumReplaceMode.ALL);
addVines(world, rand, pos, vinesChance);
addBlock(level, pos, wood, EnumReplaceMode.ALL);
addVines(level, rand, pos, vinesChance);

if (y + 1 == height) {
treeTops.add(pos);
Expand Down
29 changes: 17 additions & 12 deletions src/main/java/forestry/plugin/DefaultTreeSpecies.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
import forestry.arboriculture.worldgen.FeatureBalsa;
import forestry.arboriculture.worldgen.FeatureBaobab;
import forestry.arboriculture.worldgen.FeatureBirch;
import forestry.arboriculture.worldgen.FeatureCherry;
import forestry.arboriculture.worldgen.FeatureBushCherry;
import forestry.arboriculture.worldgen.FeatureCherryVanilla;
import forestry.arboriculture.worldgen.FeatureChestnut;
import forestry.arboriculture.worldgen.FeatureCocobolo;
import forestry.arboriculture.worldgen.FeatureDarkOak;
Expand Down Expand Up @@ -129,7 +130,7 @@ public static void register(IArboricultureRegistration arboriculture) {
genome.set(TreeChromosomes.GIRTH, ForestryAlleles.GIRTH_2);
})
.addMutations(mutations -> {
mutations.add(ForestryTreeSpecies.LIME, ForestryTreeSpecies.CHERRY, 10);
mutations.add(ForestryTreeSpecies.LIME, ForestryTreeSpecies.BUSH_CHERRY, 10);
});

// Chestnut (Spanish Chestnut)
Expand All @@ -147,19 +148,19 @@ public static void register(IArboricultureRegistration arboriculture) {
})
.addMutations(mutations -> {
mutations.add(ForestryTreeSpecies.WALNUT, ForestryTreeSpecies.LIME, 10);
mutations.add(ForestryTreeSpecies.WALNUT, ForestryTreeSpecies.CHERRY, 10);
mutations.add(ForestryTreeSpecies.WALNUT, ForestryTreeSpecies.BUSH_CHERRY, 10);
});

// Cherry (East Asian Cherry) TODO This should be replaced by Vanilla cherry tree in 1.20
// Cherry (East Asian Cherry)
// The real life version of this tree doesn't actually produce fruit.
arboriculture.registerSpecies(ForestryTreeSpecies.CHERRY, GENUS_PRUNUS, SPECIES_CHERRY, true, new Color(0xe691da), ForestryWoodType.CHERRY)
.setTreeFeature(FeatureCherry::new)
.setDecorativeLeaves(ArboricultureBlocks.LEAVES_DECORATIVE.stack(ForestryLeafType.CHERRY))
arboriculture.registerSpecies(ForestryTreeSpecies.BUSH_CHERRY, GENUS_PRUNUS, SPECIES_BUSH_CHERRY, true, new Color(0xe691da), ForestryWoodType.CHERRY)
.setTreeFeature(FeatureBushCherry::new)
.setDecorativeLeaves(ArboricultureBlocks.LEAVES_DECORATIVE.stack(ForestryLeafType.BUSH_CHERRY))
//.addVanillaStates(Blocks.CHERRY_LEAVES.getStateDefinition().getPossibleStates())
//.addVanillaItems(Items.CHERRY_SAPLING)
// todo remove these two lines in 1.20
.addVanillaStates(ArboricultureBlocks.LEAVES_DEFAULT.get(ForestryLeafType.CHERRY).block().getStateDefinition().getPossibleStates())
.addVanillaStates(ArboricultureBlocks.LEAVES_DEFAULT_FRUIT.get(ForestryLeafType.CHERRY).block().getStateDefinition().getPossibleStates())
.addVanillaStates(ArboricultureBlocks.LEAVES_DEFAULT.get(ForestryLeafType.BUSH_CHERRY).block().getStateDefinition().getPossibleStates())
.addVanillaStates(ArboricultureBlocks.LEAVES_DEFAULT_FRUIT.get(ForestryLeafType.BUSH_CHERRY).block().getStateDefinition().getPossibleStates())
.setGenome(genome -> {
genome.set(TreeChromosomes.FRUIT, ForestryAlleles.FRUIT_CHERRY);
genome.set(TreeChromosomes.SAPLINGS, ForestryAlleles.SAPLINGS_LOW);
Expand All @@ -173,6 +174,10 @@ public static void register(IArboricultureRegistration arboriculture) {
})
.setRarity(0.0015f);

// Bush Cherry (Chinese Bush Cherry)
arboriculture.registerSpecies(ForestryTreeSpecies.CHERRY_VANILLA, GENUS_PRUNUS, SPECIES_CHERRY_VANILLA)
.setTreeFeature(FeatureCherryVanilla::new);

// Lemon
arboriculture.registerSpecies(ForestryTreeSpecies.LEMON, GENUS_CITRUS, SPECIES_LEMON, true, new Color(0x88af54), ForestryWoodType.CITRUS)
.setTreeFeature(FeatureLemon::new)
Expand All @@ -187,7 +192,7 @@ public static void register(IArboricultureRegistration arboriculture) {

})
.addMutations(mutations -> {
mutations.add(ForestryTreeSpecies.LIME, ForestryTreeSpecies.CHERRY, 5);
mutations.add(ForestryTreeSpecies.LIME, ForestryTreeSpecies.BUSH_CHERRY, 5);
});

// Plum (Common Plum)
Expand All @@ -205,7 +210,7 @@ public static void register(IArboricultureRegistration arboriculture) {
genome.set(TreeChromosomes.HEIGHT, ForestryAlleles.HEIGHT_SMALLEST);
})
.addMutations(mutations -> {
mutations.add(ForestryTreeSpecies.LEMON, ForestryTreeSpecies.CHERRY, 5);
mutations.add(ForestryTreeSpecies.LEMON, ForestryTreeSpecies.BUSH_CHERRY, 5);
})
.setRarity(0.005f);

Expand Down Expand Up @@ -611,7 +616,7 @@ public static void register(IArboricultureRegistration arboriculture) {
genome.set(TreeChromosomes.HEIGHT, ForestryAlleles.HEIGHT_AVERAGE);
})
.addMutations(mutations -> {
mutations.add(ForestryTreeSpecies.JUNGLE, ForestryTreeSpecies.CHERRY, 5);
mutations.add(ForestryTreeSpecies.JUNGLE, ForestryTreeSpecies.BUSH_CHERRY, 5);
})
.setRarity(0.005f);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ private static void registerArboriculture(IClientRegistration client) {
client.setLeafSprite(ForestryTreeSpecies.LIME, ForestryLeafSprites.BIRCH);
client.setLeafSprite(ForestryTreeSpecies.WALNUT, ForestryLeafSprites.ACACIA);
client.setLeafSprite(ForestryTreeSpecies.CHESTNUT, ForestryLeafSprites.BIRCH);
client.setLeafSprite(ForestryTreeSpecies.CHERRY, ForestryLeafSprites.BIRCH);
client.setLeafSprite(ForestryTreeSpecies.BUSH_CHERRY, ForestryLeafSprites.BIRCH);
client.setLeafSprite(ForestryTreeSpecies.LEMON, ForestryLeafSprites.OAK);
client.setLeafSprite(ForestryTreeSpecies.PLUM, ForestryLeafSprites.OAK);
client.setLeafSprite(ForestryTreeSpecies.MAPLE, ForestryLeafSprites.MAPLE);
Expand Down

0 comments on commit 4122a11

Please sign in to comment.