Skip to content

Commit a41b1ac

Browse files
committed
get everything I can done before deadline
1 parent 86fad56 commit a41b1ac

20 files changed

Lines changed: 643 additions & 20 deletions

File tree

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<img src="icon.png" align="right" width="180px"/>
22

3-
# Mycoturge
3+
# Mycoturgy
44

55

6-
[>> Downloads <<](https://github.com/Boundarybreaker/Mycoturge/releases)
6+
[>> Downloads <<](https://github.com/Boundarybreaker/Mycoturgy/releases)
77

8-
*Purify yourself!*
8+
*Grow mushrooms, save the world!*
99

1010
**This mod is open source and under a permissive license.** As such, it can be included in any modpack on any platform without prior permission. We appreciate hearing about people using our mods, but you do not need to ask to use them. See the [LICENSE file](LICENSE) for more details.
1111

12-
Mycoturge is a Minecraft mod for Minecraft 1.16 and above, made for ModFest 1.16. It adds various witching equipment based off of SPorebrush, a symbiotic system between a plant and a magical fungus.
12+
Mycoturgy is a story-focused Minecraft mod for Minecraft 1.16 and above, made for ModFest 1.16. It adds various witching equipment based off of Sporebrush, a symbiotic system between a plant and a magical fungus.
1313

1414
Asset credits:
15-
Sporebrush item - @Coda#1552 on discord
15+
Sporebrush item and Haustor Sequester block - @Coda#1552 on discord
1616
Spore bundle and sporebrush ash items - edited from assets in ["RPG Items - Retro Pack"](https://emberheartgames.itch.io/rpg-items-retro-pack) by Emberheart Games

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ yarn_build=4
88
loader_version=0.8.8+build.202
99

1010
# Mod Properties
11-
mod_version = 1.0.0
11+
mod_version = 0.1.0
1212
maven_group = space.bbkr
1313
archives_base_name = mycoturgy
1414

src/main/java/space/bbkr/mycoturgy/MycoturgyClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class MycoturgyClient implements ClientModInitializer {
2424

2525
@Override
2626
public void onInitializeClient() {
27-
BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getCutout(), MycoturgyBlocks.SPOREBRUSH_CROP, MycoturgyBlocks.HAUSTOR_SEQUESTER);
27+
BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getCutout(), MycoturgyBlocks.SPOREBRUSH_CROP, MycoturgyBlocks.HAUSTOR_SEQUESTER, MycoturgyBlocks.SCATTERED_ASHES);
2828
BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getTranslucent(), MycoturgyBlocks.MASON_JAR);
2929
//TODO: change color if ashes in jar?
3030
ColorProviderRegistry.BLOCK.register((state, world, pos, index) -> FluidRenderHandlerRegistry.INSTANCE.get(Fluids.WATER).getFluidColor(world, pos, Fluids.WATER.getDefaultState()), MycoturgyBlocks.MASON_JAR);

src/main/java/space/bbkr/mycoturgy/block/MasonJarBlock.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
import net.minecraft.potion.Potion;
2121
import net.minecraft.potion.PotionUtil;
2222
import net.minecraft.potion.Potions;
23+
import net.minecraft.sound.SoundCategory;
24+
import net.minecraft.sound.SoundEvents;
2325
import net.minecraft.state.StateManager;
2426
import net.minecraft.state.property.BooleanProperty;
2527
import net.minecraft.text.TranslatableText;
@@ -54,20 +56,23 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt
5456
Potion pot = PotionUtil.getPotion(stack);
5557
if (pot == Potions.WATER) {
5658
world.setBlockState(pos, state.with(FILLED, true), 2);
59+
world.playSound(null, pos, SoundEvents.ITEM_BOTTLE_EMPTY, SoundCategory.BLOCKS, 1f, 1f);
5760
if (!player.isCreative()) {
5861
player.setStackInHand(hand, new ItemStack(Items.GLASS_BOTTLE));
5962
}
6063
return ActionResult.SUCCESS;
6164
}
6265
} else if (stack.getItem() == Items.GLASS_BOTTLE && state.get(FILLED)) {
6366
world.setBlockState(pos, state.with(FILLED, false), 2);
67+
world.playSound(null, pos, SoundEvents.ITEM_BOTTLE_FILL, SoundCategory.BLOCKS, 1f, 1f);
6468
ItemUsage.method_30012(stack, player, PotionUtil.setPotion(new ItemStack(Items.POTION), Potions.WATER));
6569
return ActionResult.SUCCESS;
6670
} else if (stack.getItem() == MycoturgyItems.SPOREBRUSH_ASH) {
6771
BlockEntity be = world.getBlockEntity(pos);
6872
if (be instanceof MasonJarBlockEntity) {
6973
MasonJarBlockEntity jar = (MasonJarBlockEntity)be;
7074
if (jar.getAshes() <= 12) {
75+
world.playSound(null, pos, SoundEvents.ITEM_CROP_PLANT, SoundCategory.BLOCKS, 1f, 1f);
7176
jar.addAshes();
7277
if (!player.isCreative()) {
7378
player.getStackInHand(hand).decrement(1);

src/main/java/space/bbkr/mycoturgy/block/ScatteredAshesBlock.java

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,36 @@
99
import space.bbkr.mycoturgy.component.HaustorComponent;
1010
import space.bbkr.mycoturgy.init.MycoturgyItems;
1111

12+
import net.minecraft.advancement.Advancement;
1213
import net.minecraft.block.Block;
1314
import net.minecraft.block.BlockState;
1415
import net.minecraft.block.Blocks;
1516
import net.minecraft.block.MushroomPlantBlock;
1617
import net.minecraft.block.ShapeContext;
1718
import net.minecraft.entity.player.PlayerEntity;
1819
import net.minecraft.item.ItemStack;
20+
import net.minecraft.server.MinecraftServer;
21+
import net.minecraft.server.network.ServerPlayerEntity;
1922
import net.minecraft.server.world.ServerWorld;
23+
import net.minecraft.sound.SoundCategory;
24+
import net.minecraft.sound.SoundEvents;
2025
import net.minecraft.util.ActionResult;
2126
import net.minecraft.util.Hand;
27+
import net.minecraft.util.Identifier;
2228
import net.minecraft.util.hit.BlockHitResult;
2329
import net.minecraft.util.math.BlockPos;
30+
import net.minecraft.util.math.Direction;
2431
import net.minecraft.util.shape.VoxelShape;
2532
import net.minecraft.world.BlockView;
2633
import net.minecraft.world.World;
34+
import net.minecraft.world.WorldAccess;
35+
import net.minecraft.world.WorldView;
36+
import net.minecraft.world.gen.feature.ConfiguredFeature;
37+
import net.minecraft.world.gen.feature.DefaultBiomeFeatures;
38+
import net.minecraft.world.gen.feature.Feature;
2739

2840
public class ScatteredAshesBlock extends Block {
41+
public static final Identifier CAST_SPELL = new Identifier(Mycoturgy.MODID, "research/cast_spell");
2942
public static final VoxelShape SHAPE = Block.createCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 2D, 16.0D);
3043
public static final Map<Block, Spell> SPELLS = new HashMap<>();
3144

@@ -47,30 +60,56 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt
4760
if (SPELLS.containsKey(down.getBlock())) {
4861
Spell spell = SPELLS.get(down.getBlock());
4962
if (spell.perform(down, (ServerWorld)world, pos.down(), player, Mycoturgy.HAUSTOR_COMPONENT.get(world.getChunk(pos)))) {
63+
world.playSound(null, pos, SoundEvents.ITEM_FIRECHARGE_USE, SoundCategory.BLOCKS, 1f, 1f);
5064
if (world.getBlockState(pos).equals(state)) world.breakBlock(pos, false);
65+
MinecraftServer server = player.world.getServer();
66+
Advancement advancement = server.getAdvancementLoader().get(CAST_SPELL);
67+
server.getPlayerManager().getAdvancementTracker((ServerPlayerEntity)player).grantCriterion(advancement, "cast_spell");
5168
return ActionResult.SUCCESS;
5269
}
5370
}
5471
}
5572
return super.onUse(state, world, pos, player, hand, hit);
5673
}
5774

75+
@Override
76+
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState newState, WorldAccess world, BlockPos pos, BlockPos posFrom) {
77+
return direction == Direction.DOWN && !state.canPlaceAt(world, pos) ? Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, direction, newState, world, pos, posFrom);
78+
}
79+
80+
@Override
81+
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) {
82+
BlockPos blockPos = pos.down();
83+
return hasTopRim(world, blockPos) || sideCoversSmallSquare(world, blockPos, Direction.UP);
84+
}
85+
5886
public interface Spell {
5987
boolean perform(BlockState state, ServerWorld world, BlockPos pos, PlayerEntity caster, HaustorComponent component);
6088
}
6189

6290
static {
63-
SPELLS.put(Blocks.MYCELIUM, (state, world, pos, caster, component) -> {
91+
SPELLS.put(Blocks.PODZOL, (state, world, pos, caster, component) -> {
6492
Random random = new Random();
6593
if (component.getHypha() >= 10) {
66-
component.spawnLamella(2);
6794
BlockPos upPos = pos.up();
68-
world.setBlockState(upPos, random.nextBoolean()? Blocks.RED_MUSHROOM.getDefaultState() : Blocks.BROWN_MUSHROOM.getDefaultState());
69-
BlockState mushState = world.getBlockState(upPos);
70-
if (((MushroomPlantBlock)state.getBlock()).trySpawningBigMushroom(world, upPos, mushState, random)) {
71-
component.spawnLamella(3);
95+
BlockState upState = world.getBlockState(upPos);
96+
world.setBlockState(upPos, Blocks.AIR.getDefaultState());
97+
System.out.println(world.getBlockState(upPos));
98+
ConfiguredFeature<?, ?> feature = random.nextBoolean()? Feature.HUGE_BROWN_MUSHROOM.configure(DefaultBiomeFeatures.HUGE_BROWN_MUSHROOM_CONFIG) : Feature.HUGE_RED_MUSHROOM.configure(DefaultBiomeFeatures.HUGE_RED_MUSHROOM_CONFIG);
99+
if (feature.generate(world, world.getStructureAccessor(), world.getChunkManager().getChunkGenerator(), random, upPos)) {
100+
world.setBlockState(pos, Blocks.MYCELIUM.getDefaultState());
101+
for (int i = -2; i <=2; i++) {
102+
for (int j = -2; j <= 2; j++) {
103+
BlockPos newPos = pos.add(i, 0, j);
104+
if (Feature.isSoil(world, newPos)) {
105+
world.setBlockState(newPos, Blocks.MYCELIUM.getDefaultState());
106+
}
107+
}
108+
}
109+
component.spawnLamella(5);
72110
return true;
73111
}
112+
world.setBlockState(upPos, upState);
74113
}
75114
return false;
76115
});

src/main/java/space/bbkr/mycoturgy/block/entity/HaustorSequesterBlockEntity.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package space.bbkr.mycoturgy.block.entity;
22

3-
import space.bbkr.mycoturgy.Mycoturgy;
43
import space.bbkr.mycoturgy.init.MycoturgyBlocks;
54

65
import net.minecraft.block.entity.BlockEntity;

src/main/java/space/bbkr/mycoturgy/block/entity/MasonJarBlockEntity.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package space.bbkr.mycoturgy.block.entity;
22

33
import java.util.Optional;
4+
import java.util.Random;
45

56
import space.bbkr.mycoturgy.Mycoturgy;
67
import space.bbkr.mycoturgy.block.MasonJarBlock;
@@ -14,9 +15,15 @@
1415
import net.minecraft.block.entity.BlockEntity;
1516
import net.minecraft.item.ItemStack;
1617
import net.minecraft.nbt.CompoundTag;
18+
import net.minecraft.particle.ParticleEffect;
19+
import net.minecraft.particle.ParticleTypes;
1720
import net.minecraft.recipe.Recipe;
21+
import net.minecraft.server.world.ServerWorld;
22+
import net.minecraft.sound.SoundCategory;
23+
import net.minecraft.sound.SoundEvents;
1824
import net.minecraft.util.Identifier;
1925
import net.minecraft.util.Tickable;
26+
import net.minecraft.util.math.Vec3d;
2027

2128
import net.fabricmc.fabric.api.block.entity.BlockEntityClientSerializable;
2229
import net.fabricmc.fabric.api.util.NbtType;
@@ -41,7 +48,10 @@ public void tick() {
4148
potentialRecipe.ifPresent(jarBrewingRecipe -> currentRecipe = jarBrewingRecipe);
4249
} else {
4350
if (currentRecipe.matches(inv, world)) {
51+
Vec3d jarPos = new Vec3d(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5).add(getCachedState().getModelOffset(world, pos));
52+
Random random = new Random();
4453
processTime++;
54+
if (processTime % 10 == 0) ((ServerWorld)world).spawnParticles(ParticleTypes.BUBBLE, jarPos.x + random.nextDouble() * (1/8D) * (double)(random.nextBoolean() ? 1 : -1), jarPos.y + random.nextDouble() * (3/8D), jarPos.z + random.nextDouble() * (1/8D) * (double)(random.nextBoolean() ? 1 : -1), random.nextInt(5), 0.0, 0.1, 0.0, 0.1);
4555
if (processTime >= currentRecipe.getTime()) {
4656
HaustorComponent component = Mycoturgy.HAUSTOR_COMPONENT.get(world.getChunk(this.pos));
4757
component.changeHypha(currentRecipe.getHyphaCost() * -1);
@@ -53,6 +63,8 @@ public void tick() {
5363
currentRecipe = null;
5464
ashes--;
5565
if (ashes < 0) ashes = 0;
66+
world.playSound(null, pos, SoundEvents.ENTITY_WITCH_DRINK, SoundCategory.BLOCKS, 1f, 1f);
67+
((ServerWorld)world).spawnParticles(ParticleTypes.SPLASH, jarPos.x + random.nextDouble() * (3/16D) * (double)(random.nextBoolean() ? 1 : -1), jarPos.y + random.nextDouble() * (1/2D), jarPos.z + random.nextDouble() * (3/16D) * (double)(random.nextBoolean() ? 1 : -1), 30, 0.0, 0.7, 0.0, 0.7);
5668
world.setBlockState(pos, getCachedState().with(MasonJarBlock.FILLED, false));
5769
}
5870
markDirty();

src/main/java/space/bbkr/mycoturgy/init/MycoturgyBlocks.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import net.minecraft.block.entity.BlockEntityType;
1818
import net.minecraft.item.BlockItem;
1919
import net.minecraft.item.Item;
20+
import net.minecraft.sound.BlockSoundGroup;
2021
import net.minecraft.util.Identifier;
2122
import net.minecraft.util.registry.Registry;
2223

@@ -36,7 +37,7 @@ public static void init() {
3637
SPOREBRUSH_CROP = register("sporebrush", new CustomCropBlock(FabricBlockSettings.copyOf(Blocks.WHEAT).breakByHand(true)));
3738
HAUSTOR_SEQUESTER = register("haustor_sequester", new HaustorSequesterBlock(FabricBlockSettings.copyOf(Blocks.GRASS).breakByHand(true)), new Item.Settings().group(MycoturgyItems.MYCOTURGY_GROUP));
3839
MASON_JAR = register("mason_jar", new MasonJarBlock(FabricBlockSettings.of(Material.GLASS).breakByTool(FabricToolTags.PICKAXES).nonOpaque()), new Item.Settings().group(MycoturgyItems.MYCOTURGY_GROUP));
39-
SCATTERED_ASHES = register("scattered_ashes", new ScatteredAshesBlock(FabricBlockSettings.of(Material.SUPPORTED).breakByHand(true).nonOpaque()));
40+
SCATTERED_ASHES = register("scattered_ashes", new ScatteredAshesBlock(FabricBlockSettings.of(Material.SUPPORTED).breakByHand(true).breakInstantly().nonOpaque().noCollision().sounds(BlockSoundGroup.SAND)));
4041

4142
HAUSTOR_SEQUESTER_BLOCK_ENTITY = register("haustor_sequester", HaustorSequesterBlockEntity::new, HAUSTOR_SEQUESTER);
4243
MASON_JAR_BLOCK_ENTITY = register("mason_jar", MasonJarBlockEntity::new, MASON_JAR);

src/main/java/space/bbkr/mycoturgy/init/MycoturgyItems.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import net.minecraft.item.ItemStack;
1010
import net.minecraft.tag.Tag;
1111
import net.minecraft.util.Identifier;
12+
import net.minecraft.util.Rarity;
1213
import net.minecraft.util.registry.Registry;
1314

1415
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
@@ -30,8 +31,9 @@ public static void init() {
3031
SPORE_BUNDLE = register("spore_bundle", new Item(new Item.Settings().group(MYCOTURGY_GROUP)));
3132
SPOREBRUSH = register("sporebrush", new Item(new Item.Settings().group(MYCOTURGY_GROUP)));
3233
GLITTERING_SPORES = register("glimmering_spores", new AliasedBlockItem(MycoturgyBlocks.SPOREBRUSH_CROP, new Item.Settings().group(MYCOTURGY_GROUP)));
33-
SPOREBRUSH_ASH = register("sporebrush_ash", new Item(new Item.Settings().group(MYCOTURGY_GROUP)));
34-
HAUSTORAL_BAND = register("haustoral_band", new HaustoralBandItem(new Item.Settings().maxCount(1).group(MYCOTURGY_GROUP)));
34+
SPOREBRUSH_ASH = register("sporebrush_ash", new AliasedBlockItem(MycoturgyBlocks.SCATTERED_ASHES, new Item.Settings().group(MYCOTURGY_GROUP)));
35+
HAUSTORAL_BAND = register("haustoral_band", new HaustoralBandItem(new Item.Settings().maxCount(1).rarity(Rarity.RARE).group(MYCOTURGY_GROUP)));
36+
3537
NETHERITE_COMPOSED = TagRegistry.item(new Identifier(Mycoturgy.MODID, "netherite_composed"));
3638
}
3739

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"variants": {
3+
"": { "model": "mycoturgy:block/scattered_ashes" }
4+
}
5+
}

0 commit comments

Comments
 (0)