Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.3.0.0 #111

Merged
merged 146 commits into from
Jan 10, 2024
Merged
Changes from 1 commit
Commits
Show all changes
146 commits
Select commit Hold shift + click to select a range
430d54e
fix: fix machine menus displaying wrong crafting cost
Elenterius Sep 14, 2023
bd03595
chore: update language file
Elenterius Sep 14, 2023
10e80c7
feat: tweak primal flesh block recipe
Elenterius Sep 14, 2023
8f8f086
chore: refactor BlockPropertyUtil
Elenterius Sep 17, 2023
2749d03
refactor: move recipes and crafting states into one shared crafting n…
Elenterius Sep 17, 2023
c6d0bdc
chore: add space, new line and ellipsis chat components
Elenterius Sep 17, 2023
12dfe8c
refactor: move ComponentUtil inside uitl package
Elenterius Sep 17, 2023
47ae062
refactor: refactor mob loot item
Elenterius Sep 17, 2023
bffef36
chore: add addValue method to EnhancedIntegerProperty
Elenterius Sep 18, 2023
12b883c
refactor: refactor FleshSpikeBlock
Elenterius Sep 18, 2023
4e115ae
refactor: refactor EffectCureItem
Elenterius Sep 18, 2023
633c014
refactor: make preconfigured projectiles shoot-able with origin and t…
Elenterius Sep 20, 2023
6d575d2
feat: add Malignant Bloom and Sapberry
Elenterius Sep 20, 2023
90acf5f
chore(release): 1.19.2-v2.2.1.0 [skip ci]
invalid-email-address Sep 21, 2023
9db734f
chore: refactor level util class and add additional helper methods
Elenterius Oct 14, 2023
d483871
feat: improve make malignant bloom shooting and check for blocks obst…
Elenterius Oct 14, 2023
1989d6f
chore: tweak flesh spreading in regards to the cellular noise borders
Elenterius Oct 14, 2023
c6aa30e
chore: add dev feature for dumping temperature and downfall for all r…
Elenterius Oct 14, 2023
1137763
fix: fix serum duplication bug with Injector
Elenterius Oct 14, 2023
11fcd4d
feat: remove the ability of mob effects to influence the hostility of…
Elenterius Oct 14, 2023
9ab0c36
feat: make it possible to add more cradle tributes via code
Elenterius Oct 14, 2023
cdfde73
chore: refactor MobEffectTribute to avoid creation of new empty objects
Elenterius Oct 14, 2023
0abd696
feat(tetra-compat): make Dragon Sinew a valid cradle tribute
Elenterius Oct 14, 2023
9dd10ee
fix: add workaround for NERB incompatibility ("unlocks" all recipes w…
Elenterius Oct 28, 2023
e9f4eb5
fix: fix Wide Flesh Doors incompatibility with Quark's double door fe…
Elenterius Oct 28, 2023
6f4732b
feat(tetra-compat): make Dragon Sinew decomposable
Elenterius Oct 28, 2023
ca75b23
feat: make life energy affect the energy charge of the Primordial Cra…
Elenterius Oct 28, 2023
aa92c3a
feat: make nether stars a valid sacrifice source
Elenterius Oct 28, 2023
8a9df68
chore(release): 1.19.2-v2.2.2.0 [skip ci]
invalid-email-address Oct 28, 2023
dd31596
feat: remove legacy item tags for biomass
Elenterius Nov 1, 2023
47a8b12
feat: add server config for BioForge recipe unlocking and villager tr…
Elenterius Nov 2, 2023
0eb8f80
feat: make wandering trader trades less expensive
Elenterius Nov 2, 2023
8a5cc93
chore: update Modonomicon maven and version
Elenterius Nov 2, 2023
ee4096b
chore(guide-book): do guide book stuff
MissionArcher Mar 10, 2023
66e4349
chore(guide-book): add guide book textures
MissionArcher Mar 13, 2023
106a796
chore(guide-book): add Living Flesh page entry
MissionArcher Mar 13, 2023
e3aab81
chore(guide-book): reorder book entries
MissionArcher Mar 14, 2023
d575148
chore(guide-book): rework Flesh Blob entry
MissionArcher Mar 16, 2023
cdb2308
chore(guide-book): refactor guide book datagen
Elenterius Nov 2, 2023
5999030
chore: refactor primal energy charge handling and mitigate int overflow
Elenterius Nov 3, 2023
826c988
feat: add config for enabling unlimited flesh growth near cradles
Elenterius Nov 3, 2023
50df048
feat: remove infinite flesh growth near cradles (distance < 8)
Elenterius Nov 3, 2023
e28dc68
feat: add config for enabling unlimited flesh growth globally
Elenterius Nov 3, 2023
320cc67
feat: increase life/primal energy value of sacrificed Nether Stars te…
Elenterius Nov 3, 2023
c574f3d
feat: make malignant flesh veins replaceable
Elenterius Nov 3, 2023
18e7c96
chore(release): 1.19.2-v2.2.3.0 [skip ci]
invalid-email-address Nov 3, 2023
0596b36
build(gradle): simplify client run configurations for Hot-Swapping
Elenterius Nov 8, 2023
ac17061
fix: fix Primordial Cradle not persisting internal sacrifice values w…
Elenterius Nov 8, 2023
f244c70
feat: make Primordial Cradle block items display their internal sacri…
Elenterius Nov 8, 2023
b3923db
feat(buff): increase primal energy conversion of sacrifices in the Pr…
Elenterius Nov 8, 2023
dc1beb9
feat(nerf): decrease Malignant Bloom spawn rate
Elenterius Nov 8, 2023
e67d7c8
docs(readme): replace outdated Trello links with Github Project links
Elenterius Nov 10, 2023
b319e1e
fix: fix flesh veins inability to spread over dirt paths
Elenterius Nov 10, 2023
8fbe8a5
chore: refactor flesh veins block
Elenterius Nov 10, 2023
f02208e
feat: make overworld logs replaceable by malignant veins
Elenterius Nov 10, 2023
c75eb04
chore(release): 1.19.2-v2.2.4.0 [skip ci]
invalid-email-address Nov 11, 2023
c87b9c7
docs(readme): fix Github Project link
Elenterius Nov 13, 2023
77c1fee
feat: add block tags to explicitly allow/disallow attachment of flesh…
Elenterius Nov 13, 2023
19f3e6c
chore: refactor flesh veins
Elenterius Nov 13, 2023
37baff2
chore: add biome temperature utils
Elenterius Nov 19, 2023
891e4f4
chore: add getIndices method to Bit32Set
Elenterius Nov 19, 2023
8175714
feat(flesh-mound): add first iteration of the flesh mound growth to t…
Elenterius Nov 19, 2023
e528ba8
feat(flesh-mound): decrease volume of growth
Elenterius Nov 19, 2023
4b31341
chore(release): 1.19.2-v2.2.5.0 [skip ci]
invalid-email-address Nov 19, 2023
6e9b2e5
refactor(flesh-mound): refactor mound shape generation
Elenterius Nov 21, 2023
593f9c9
feat(flesh-mound): allow flesh mounds to excavate chambers and conver…
Elenterius Nov 21, 2023
bdfa12f
feat(flesh-mound): add bloomlight block as flesh type replacement of …
Elenterius Nov 21, 2023
32c2efd
feat(flesh-mound): make mound shapes persist across unloaded chunks a…
Elenterius Nov 29, 2023
0af5924
feat(flesh-mound): prevent natural spawning of mobs inside flesh mounds
Elenterius Nov 29, 2023
a0ea6e8
feat: add primal membrane block for living mobs
Elenterius Nov 29, 2023
2680d0e
feat(flesh-mound): create "Doors" between two adjacent chambers with …
Elenterius Nov 29, 2023
a5cb46b
fix(flesh-mound): fix unintentional MoundShape removal when the Cradl…
Elenterius Nov 29, 2023
e127cf6
feat(flesh-mound): improve storage and lookup of mound shapes
Elenterius Dec 4, 2023
36b6e65
feat(flesh-mound): prevent flesh veins from eating living flesh
Elenterius Dec 4, 2023
b1309ef
chore(flesh-mound): count primal membrane as full block
Elenterius Dec 4, 2023
eb763b2
chore: refactor mob spawning checks and improve spatial query
Elenterius Dec 5, 2023
0902a3b
feat: add undead-permeable membrane
Elenterius Dec 5, 2023
d2904fd
chore(spatial): add cuboid shape and allow spatial querying with box …
Elenterius Dec 7, 2023
4a06b22
chore(spatial): add a wrapper shape that is a mob spawn filter and ho…
Elenterius Dec 7, 2023
4ecc094
feat: add neural interceptor block
Elenterius Dec 7, 2023
9d71212
chore(spatial): add logging to the storage handler
Elenterius Dec 7, 2023
60d4ad0
chore(release): 1.19.2-v2.2.6.0 [skip ci]
invalid-email-address Dec 9, 2023
95c32e7
fix(gradle): fix build configuration not including the api sourceset …
Elenterius Dec 9, 2023
3acb916
feat(flesh-mound): make Malignant Bloom spawn less likely inside the …
Elenterius Dec 9, 2023
8750164
fix(flesh-mound): fix flesh veins being unable to find the flesh moun…
Elenterius Dec 9, 2023
be7e5d9
feat: change chiseled flesh block/texture
Elenterius Dec 10, 2023
0ce643b
chore: remove unused/old textures
Elenterius Dec 10, 2023
6c48122
chore: reorganize mod blocks registry
Elenterius Dec 10, 2023
02a2c84
feat: add primal orifice block
Elenterius Dec 10, 2023
7f06b15
feat(flesh-mound): tweak default mound gen settings
Elenterius Dec 10, 2023
d656a79
chore(flesh-mound): make radius, height and spire modifiers capable t…
Elenterius Dec 10, 2023
6924fff
chore: add helper methods for acid damage
Elenterius Dec 11, 2023
f3fb0b9
chore: add fluid registry
Elenterius May 3, 2023
61da539
feat(acid): add acid fluid
Elenterius May 3, 2023
050bf47
feat(acid): add fluid interaction with lava & water
Elenterius Dec 11, 2023
dc17391
feat(acid): add fluid compat for open pipes from Create
Elenterius May 3, 2023
dd32f9d
feat(acid): add dripping acid particle
Elenterius Dec 11, 2023
ac10f68
chore(release): 1.19.2-v2.2.7.0 [skip ci]
invalid-email-address Dec 11, 2023
df8e315
feat(acid): reduce probability for acid particles to produce fizzling…
Elenterius Dec 12, 2023
2949671
feat: make primal orifices milk-able with empty buckets
Elenterius Dec 12, 2023
52d2b60
feat(item-tag): add `cannot_be_eaten_by_cradle` tag for items that sh…
Elenterius Dec 19, 2023
138f2f1
feat(item-tag): add items to forge tags for doors, trapdoors and chests
Elenterius Dec 19, 2023
d1e9c66
fix: prevent storage sac from being eaten by the Cradle
Elenterius Dec 19, 2023
2de5134
feat: add bloomlight recipe
Elenterius Dec 19, 2023
33f3c25
feat: change Primordial Lantern recipe to require a Sapberry
Elenterius Dec 19, 2023
844b217
feat: tweak decomposing recipe of bloomlight
Elenterius Dec 19, 2023
2c9074a
feat: change the block material of Flesh Pillar, Chiseled Flesh and O…
Elenterius Dec 21, 2023
9b7bf5c
feat: buff strength of `FleshyBone` material (increase destroy time f…
Elenterius Dec 21, 2023
cf05380
feat: increase explosion resistance of Packed Flesh from 6 to 12
Elenterius Dec 21, 2023
648650c
feat: make bony flesh blocks play flesh or bone sounds (with equal pr…
Elenterius Dec 21, 2023
8f0bdb2
feat(flesh-mound): add chamber decorations such as pillars, orifices,…
Elenterius Dec 24, 2023
1ae0440
chore(release): 1.19.2-v2.2.8.0 [skip ci]
invalid-email-address Dec 24, 2023
6435e3a
feat: make primal membrane consider golems as not alive
Elenterius Dec 27, 2023
8835483
chore(flesh-mound): refactor mound shape stuff
Elenterius Dec 29, 2023
f7acee8
feat(flesh-mound): allow destruction of melons, pumpkins and moss
Elenterius Dec 29, 2023
6c65cc1
feat(flesh-mound): add bone pillar generation
Elenterius Dec 29, 2023
3db8c25
feat(flesh-mound): make Primal Membrane self-spreading inside flesh m…
Elenterius Dec 29, 2023
0448cd8
feat(flesh-mound): make mounds slightly smaller
Elenterius Dec 29, 2023
28f3c50
chore(release): 1.19.2-v2.2.9.0 [skip ci]
invalid-email-address Dec 29, 2023
d6e1db9
feat(acid-fluid): make acid randomly destroy flesh veins or crack sto…
Elenterius Dec 31, 2023
4dd6645
feat(acid-effect): increase acid effect damage for wet entities
Elenterius Dec 31, 2023
17ea367
feat(acid-effect): make entities sensitive to water (water splash pot…
Elenterius Dec 31, 2023
b21faf6
feat: make Bio-Forge reduce fall damage
Elenterius Dec 31, 2023
bd8a36a
chore: refactor entity type registration for projectiles
Elenterius Dec 31, 2023
d076e73
feat: add acid blob projectile and spawn it from primal orifices
Elenterius Dec 31, 2023
1cb2b2b
chore: partially fix geo projectile renderer
Elenterius Jan 2, 2024
d317313
chore: add custom shooting sound support to ConfiguredProjectiles
Elenterius Jan 2, 2024
00e2d9a
chore: improve debug messages for the spatial store
Elenterius Jan 8, 2024
be5fa53
chore: remove unused chunk section related code
Elenterius Jan 8, 2024
3e5b9c3
feat: prevent low acid fluid levels from destroying flesh veins
Elenterius Jan 8, 2024
7eeaa1a
feat: make acid fluid erode dirt
Elenterius Jan 8, 2024
ed54252
feat: replace acid fluid erosion of stone into cobblestone with cobbl…
Elenterius Jan 8, 2024
b255ea9
feat(flesh-mound): make flowers replaceable
Elenterius Jan 8, 2024
5243068
fix: fix flesh veins not being being mineable with a hoe
Elenterius Jan 8, 2024
9fd7c6c
feat(tags)!: rename primordial_ecosystem_replaceable tag to flesh_rep…
Elenterius Jan 8, 2024
2b59be1
feat(server-config)!: remove doUnlimitedGrowth settings
Elenterius Jan 8, 2024
6e51737
feat(acid-fluid): make acid fluid able to sweep away flesh veins
Elenterius Jan 8, 2024
56e4ccf
feat(acid-fluid): make acid fluid able to slowly destroy blocks with …
Elenterius Jan 8, 2024
4fb1312
feat(flesh-mound): tweak flesh mound size
Elenterius Jan 9, 2024
40621ee
chore: improve debug message for the spatial store
Elenterius Jan 9, 2024
509b93d
fix(flesh-mound): prevent chamber intersections with the main cradle …
Elenterius Jan 10, 2024
b4c9e99
feat!: remove neural interceptor block
Elenterius Jan 10, 2024
a4fee52
feat: rename Bloom related stuff
Elenterius Jan 10, 2024
6d98ccd
feat(tributes): make totem of undying a valid cradle sacrifice and bu…
Elenterius Jan 10, 2024
b2a82d3
build(workflow): fix download url in discord message
Elenterius Jan 10, 2024
3bcd2c8
fix: fix wrong file name for bloomberry item texture
Elenterius Jan 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: add Malignant Bloom and Sapberry
  • Loading branch information
Elenterius committed Sep 21, 2023
commit 6d575d2200399b14d28af7793892d92fb54d447a
Original file line number Diff line number Diff line change
@@ -361,6 +361,7 @@ private void addItemTranslations() {
addItem(ModItems.NUTRIENTS, "Nutrients", "Very hard pellets rich in energy that almost look like vitamin pills.");
addItem(ModItems.NUTRIENT_PASTE, "Nutrient Paste", "Nutrients combined with Biotic Matter to moisten the hard pellets, producing a paste.\nIt almost looks like yellowish cake, and is a convenient source of energy.");
addItem(ModItems.NUTRIENT_BAR, "Nutrient Bar", "Nutrient Paste compressed into the shape of a bar. Looks edible, if a bit bland.");
addItem(ModItems.SAPBERRY, "Sapberry", "An exotic delicacy which grants random potion effects.");

addItem(ModItems.REGENERATIVE_FLUID, "Regenerative Fluid", "A fluid with regenerative properties, used to concoct healing additives.");
addItem(ModItems.WITHERING_OOZE, "Withering Ooze", "A corrosive extract. It likely has uses in bio-alchemy.");
@@ -496,6 +497,7 @@ private void addBlockTranslations() {
addBlock(ModBlocks.MALIGNANT_FLESH_STAIRS, "Malignant Flesh Stairs", "Stairs made of malignant flesh.\nLooks diseased...");
addBlock(ModBlocks.MALIGNANT_FLESH_WALL, "Malignant Flesh Wall", "Wall of malignant flesh.\nIt's coming for you! ;)");
addBlock(ModBlocks.MALIGNANT_FLESH_VEINS, "Malignant Flesh Veins", "They look almost feral...\nyou better not touch them.");
addBlock(ModBlocks.MALIGNANT_BLOOM, "Malignant Bloom", "An exotic flower of primordial beauty.\n\nIt will spread itself by launching it's ripe berry into the air.\nOn impact the berry explodes and spreads malignant veins as well.");
}

private void addEntityTranslations() {
Original file line number Diff line number Diff line change
@@ -155,6 +155,7 @@ protected void addTables() {
dropSelf(ModBlocks.MALIGNANT_FLESH_STAIRS.get());
dropSelf(ModBlocks.MALIGNANT_FLESH_WALL.get());
add(ModBlocks.MALIGNANT_FLESH_VEINS.get(), block -> createMultifaceBlockDrops(block, HAS_SHEARS_OR_SILK_TOUCH));
add(ModBlocks.MALIGNANT_BLOOM.get(), noDrop());

dropSelf(ModBlocks.VOICE_BOX.get());
dropSelf(ModBlocks.IMPERMEABLE_MEMBRANE.get());
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@
import com.github.elenterius.biomancy.BiomancyMod;
import com.github.elenterius.biomancy.block.*;
import com.github.elenterius.biomancy.block.fleshspike.FleshSpikeBlock;
import com.github.elenterius.biomancy.block.malignantbloom.MalignantBloomBlock;
import com.github.elenterius.biomancy.block.ownable.OwnablePressurePlateBlock;
import com.github.elenterius.biomancy.block.property.DirectionalSlabType;
import com.github.elenterius.biomancy.block.property.Orientation;
@@ -89,6 +90,7 @@ protected void registerStatesAndModels() {
stairsBlockWithItem(ModBlocks.MALIGNANT_FLESH_STAIRS, ModBlocks.MALIGNANT_FLESH);
wallBlock(ModBlocks.MALIGNANT_FLESH_WALL, ModBlocks.MALIGNANT_FLESH);
veinsBlock(ModBlocks.MALIGNANT_FLESH_VEINS);
malignantBloom(ModBlocks.MALIGNANT_BLOOM);

irisDoor(ModBlocks.FLESH_IRIS_DOOR, true);
fleshDoor(ModBlocks.FLESH_DOOR);
@@ -309,6 +311,26 @@ public void directionalBlock(Block block, Function<BlockState, ModelFile> modelF
}, ignored);
}

public <T extends MalignantBloomBlock> void malignantBloom(RegistryObject<T> block) {
malignantBloom(block.get());
}

public void malignantBloom(MalignantBloomBlock block) {
ResourceLocation model = blockAsset(block);

ModelFile.ExistingModelFile[] models = {
models().getExistingFile(extend(model, "_1")),
models().getExistingFile(extend(model, "_2")),
models().getExistingFile(extend(model, "_3")),
models().getExistingFile(extend(model, "_4")),
models().getExistingFile(extend(model, "_5"))
};

directionalBlock(block, blockState -> models[MalignantBloomBlock.getStage(blockState)], BlockStateProperties.WATERLOGGED);

simpleBlockItem(block, models[0]);
}

public void fleshSpikes(Block block) {
ResourceLocation model = blockAsset(block);
ModelFile.ExistingModelFile[] models = {
Original file line number Diff line number Diff line change
@@ -86,6 +86,7 @@ protected void registerModels() {
basicItem(ModItems.CREATOR_MIX);
basicItem(ModItems.NUTRIENT_PASTE);
basicItem(ModItems.NUTRIENT_BAR);
basicItem(ModItems.SAPBERRY);
serumItem(ModItems.VIAL);
basicItem(ModItems.GIFT_SAC);
basicItem(ModItems.FERTILIZER);
Original file line number Diff line number Diff line change
@@ -610,6 +610,12 @@ private void registerDecomposingRecipes(Consumer<FinishedRecipe> consumer) {
.addOutput(ModItems.FLESH_BITS.get(), 3, 6)
.addOutput(ModItems.EXOTIC_DUST.get(), 0, 2)
.unlockedBy(ModItems.LIVING_FLESH).save(consumer);
DecomposerRecipeBuilder.create().setIngredient(ModItems.SAPBERRY)
.addOutput(ModItems.BIO_LUMENS.get(), 0, 2)
.addOutput(ModItems.ORGANIC_MATTER.get(), 0, 1)
.addOutput(ModItems.EXOTIC_DUST.get(), 0, 3)
.addOutput(ModItems.BILE.get(), 1, 2)
.unlockedBy(ModItems.SAPBERRY).save(consumer);

registerDecomposerRecipesFor119(consumer);
registerDecomposerRecipesForBiomesOPlenty(consumer);
4 changes: 4 additions & 0 deletions src/generated/resources/assets/biomancy/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -44,6 +44,8 @@
"item.biomancy.nutrient_paste.tooltip": "Nutrients combined with Biotic Matter to moisten the hard pellets, producing a paste.\nIt almost looks like yellowish cake, and is a convenient source of energy.",
"item.biomancy.nutrient_bar": "Nutrient Bar",
"item.biomancy.nutrient_bar.tooltip": "Nutrient Paste compressed into the shape of a bar. Looks edible, if a bit bland.",
"item.biomancy.sapberry": "Sapberry",
"item.biomancy.sapberry.tooltip": "An exotic delicacy which grants random potion effects.",
"item.biomancy.regenerative_fluid": "Regenerative Fluid",
"item.biomancy.regenerative_fluid.tooltip": "A fluid with regenerative properties, used to concoct healing additives.",
"item.biomancy.withering_ooze": "Withering Ooze",
@@ -225,6 +227,8 @@
"block.biomancy.malignant_flesh_wall.tooltip": "Wall of malignant flesh.\nIt's coming for you! ;)",
"block.biomancy.malignant_flesh_veins": "Malignant Flesh Veins",
"block.biomancy.malignant_flesh_veins.tooltip": "They look almost feral...\nyou better not touch them.",
"block.biomancy.malignant_bloom": "Malignant Bloom",
"block.biomancy.malignant_bloom.tooltip": "An exotic flower of primordial beauty.\n\nIt will spread itself by launching it's ripe berry into the air.\nOn impact the berry explodes and spreads malignant veins as well.",
"entity.biomancy.hungry_flesh_blob": "Hungry Flesh Blob",
"entity.biomancy.flesh_blob": "Flesh Blob",
"entity.biomancy.legacy_flesh_blob": "Legacy Flesh Blob",
Original file line number Diff line number Diff line change
@@ -86,6 +86,19 @@ public BlockState getStateForPlacement(BlockPlaceContext context) {
return defaultBlockState().setValue(TYPE, type).setValue(WATERLOGGED, isWaterlogged);
}

public BlockState getStateForPlacement(BlockGetter level, BlockPos pos, Direction direction) {
BlockState state = level.getBlockState(pos);
boolean isWaterlogged = level.getFluidState(pos).getType() == Fluids.WATER;

if (state.is(this) && state.getValue(TYPE) != DirectionalSlabType.FULL) {
return defaultBlockState().setValue(TYPE, DirectionalSlabType.FULL).setValue(WATERLOGGED, false);
}

DirectionalSlabType type = DirectionalSlabType.getHalfFrom(direction);

return defaultBlockState().setValue(TYPE, type).setValue(WATERLOGGED, isWaterlogged);
}

@Override
public boolean canBeReplaced(BlockState state, BlockPlaceContext useContext) {
ItemStack stack = useContext.getItemInHand();
Original file line number Diff line number Diff line change
@@ -177,6 +177,8 @@ public void onSacrifice(ServerLevel level) {
SoundUtil.broadcastBlockSound(level, pos, ModSoundEvents.FLESH_BLOCK_STEP.get(), 1f, 0.15f + level.random.nextFloat() * 0.5f);
}

//primalSpreadCharge = Integer.MAX_VALUE; //uncomment to unleash the abomination

resetState();
}

Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@ final class Tributes {
.put(ModItems.CREATOR_MIX.get(), Tribute.builder().biomass(20).lifeEnergy(20).successModifier(19).diseaseModifier(6).hostileModifier(-12).create())
.put(ModItems.PRIMORDIAL_CORE.get(), Tribute.builder().biomass(80).successModifier(64).anomalyModifier(100).diseaseModifier(50).create())
.put(ModItems.LIVING_FLESH.get(), Tribute.builder().biomass(10).lifeEnergy(10).successModifier(40).anomalyModifier(55).create())
.put(ModItems.SAPBERRY.get(), Tribute.builder().successModifier(10).lifeEnergy(20).anomalyModifier(20).create())
.put(Items.GOLDEN_APPLE, Tribute.builder().successModifier(10).hostileModifier(-100).create())
.put(Items.ENCHANTED_GOLDEN_APPLE, Tribute.builder().lifeEnergy(15).successModifier(40).hostileModifier(-200).create())
.put(Items.CAKE, Tribute.builder().hostileModifier(-80).diseaseModifier(10).create())
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
package com.github.elenterius.biomancy.block.malignantbloom;

import com.github.elenterius.biomancy.block.base.WaterloggedFacingBlock;
import com.github.elenterius.biomancy.init.ModBlocks;
import com.github.elenterius.biomancy.init.ModItems;
import com.github.elenterius.biomancy.init.ModPlantTypes;
import com.github.elenterius.biomancy.init.ModProjectiles;
import com.github.elenterius.biomancy.util.EnhancedIntegerProperty;
import com.github.elenterius.biomancy.world.PrimordialEcosystem;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.gameevent.GameEvent;
import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.PlantType;

public class MalignantBloomBlock extends WaterloggedFacingBlock implements IPlantable {

public static final EnhancedIntegerProperty AGE = EnhancedIntegerProperty.wrap(BlockStateProperties.AGE_7);

public MalignantBloomBlock(Properties properties) {
super(properties);
registerDefaultState(defaultBlockState().setValue(AGE.get(), AGE.getMin()));
MalignantBloomShapes.computePossibleShapes(stateDefinition.getPossibleStates());
}

public static int getAge(BlockState state) {
return AGE.getValue(state);
}

public static int getStage(BlockState state) {
return getStageFromAge(AGE.getValue(state));
}

public static int getStageFromAge(int age) {
int[] stages = {0, 0, 1, 1, 2, 2, 3, 4};

age = Mth.clamp(age, 0, 7);
return stages[age];
}

private static int getGrowthSpeed(ServerLevel level, BlockPos pos) {
int veins = PrimordialEcosystem.countMalignantVeinsAroundPos(level, pos);
int maxVeins = 3 * 3 * 3 - 1;
return Math.max(maxVeins - veins, 0) + 1;
}

public static int getLightEmission(BlockState state) {
int age = getAge(state);
if (age < 6) return 0;
if (age < 7) return 10;
return 12;
}

@Override
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
super.createBlockStateDefinition(builder);
builder.add(AGE.get());
}

public BlockState getStateForPlacement(BlockGetter level, BlockPos pos, Direction direction) {
boolean isWaterlogged = level.getFluidState(pos).getType() == Fluids.WATER;
return defaultBlockState().setValue(FACING, direction).setValue(WATERLOGGED, isWaterlogged);
}

@Override
public boolean isRandomlyTicking(BlockState state) {
return true;
}

@Override
public void randomTick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) {
if (!level.isAreaLoaded(pos, 1)) return;

int age = AGE.getValue(state);
if (age < AGE.getMax()) {
int growthSpeed = age < AGE.getMax() - 1 ? getGrowthSpeed(level, pos) : 1;

if (ForgeHooks.onCropsGrowPre(level, pos, state, random.nextInt(growthSpeed) == 0)) {
level.setBlock(pos, AGE.addValue(state, 1), Block.UPDATE_CLIENTS);
ForgeHooks.onCropsGrowPost(level, pos, state);
}
}
else {
Direction direction = getFacing(state);

level.sendParticles(ParticleTypes.EXPLOSION, pos.getX() + 0.5d, pos.getY() + 0.5d, pos.getZ() + 0.5d, 1, 0, 0, 0, 0);
level.setBlock(pos, AGE.setValue(state, AGE.getMin()), Block.UPDATE_CLIENTS);

BlockPos target = pos.relative(direction, 10).offset(random.nextIntBetweenInclusive(-5, 5), random.nextIntBetweenInclusive(-5, 5), random.nextIntBetweenInclusive(-5, 5));
ModProjectiles.SAPBERRY.shoot(level, Vec3.atCenterOf(pos), Vec3.atCenterOf(target));
}
}

@Override
public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
int age = AGE.getValue(state);
if (age > 5 && player.getItemInHand(hand).isEmpty()) {
if (!level.isClientSide) {
int count = 1 + (age > 6 ? level.random.nextInt(2) : 0);
popResource(level, pos, new ItemStack(ModItems.SAPBERRY.get(), count));

player.hurt(DamageSource.SWEET_BERRY_BUSH, 1.0F);

level.playSound(null, pos, SoundEvents.CAVE_VINES_PICK_BERRIES, SoundSource.BLOCKS, 1f, 0.5f + level.random.nextFloat() * 0.4f);
BlockState blockState = AGE.setValue(state, AGE.getMin());
level.setBlock(pos, blockState, Block.UPDATE_CLIENTS);
level.gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(player, blockState));
}

return InteractionResult.sidedSuccess(level.isClientSide);
}

return super.use(state, level, pos, player, hand, hit);
}

@Override
public BlockState getPlant(BlockGetter level, BlockPos pos) {
BlockState state = level.getBlockState(pos);
if (state.getBlock() != this) return defaultBlockState();
return state;
}

@Override
public PlantType getPlantType(BlockGetter level, BlockPos pos) {
return ModPlantTypes.FLESH_PLANT_TYPE;
}

@Override
public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos currentPos, BlockPos neighborPos) {
return !state.canSurvive(level, currentPos) ? Blocks.AIR.defaultBlockState() : super.updateShape(state, direction, neighborState, level, currentPos, neighborPos);
}

public boolean mayPlaceOn(BlockGetter level, BlockPos pos, BlockState state) {
return state.is(ModBlocks.PRIMAL_FLESH.get()) || state.is(ModBlocks.MALIGNANT_FLESH.get());
}

@Override
public boolean canSurvive(BlockState state, LevelReader level, BlockPos pos) {
Direction direction = state.getValue(FACING);
BlockPos blockPos = pos.relative(direction.getOpposite());

if (state.getBlock() == this) {
//world gen and placement
return level.getBlockState(blockPos).canSustainPlant(level, blockPos, direction, this);
}

return mayPlaceOn(level, blockPos, level.getBlockState(blockPos));
}

@Override
public boolean propagatesSkylightDown(BlockState state, BlockGetter level, BlockPos pos) {
return state.getFluidState().isEmpty();
}

@Override
public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) {
return MalignantBloomShapes.getBoundingShape(state);
}

@Override
public VoxelShape getCollisionShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) {
return hasCollision ? MalignantBloomShapes.getCollisionShape(state) : Shapes.empty();
}

@Override
public boolean isCollisionShapeFullBlock(BlockState state, BlockGetter level, BlockPos pos) {
return false;
}

}
Loading