generated from jaredlll08/MultiLoader-Template
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Multiple tweaks to flower spreading.
- Loading branch information
1 parent
a30b8f1
commit d8d6ca1
Showing
12 changed files
with
156 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,10 @@ | ||
## Changes | ||
- Removed distance restriction on custom block renderers. | ||
- Updated Moobloom Spawn Egg to match Minecraft Earth's spawn egg. | ||
- Updated Moobloom Spawn Egg to match Minecraft Earth's spawn egg. | ||
- Allowed Mooblooms to spawn flowers every 4 seconds that a flower hasn't been placed if they are not moving enough. | ||
- Added a plant sound whenever Mooblooms plant flowers. | ||
- Mooblooms now emit game events when planting flowers. | ||
|
||
## Bugfixes | ||
- Fixed Mooblooms spreading flowers immediately upon feeding them bone meal. | ||
- Fixed Mooblooms being able to spread flowers on blocks where flowers cannot be placed. |
2 changes: 1 addition & 1 deletion
2
buildSrc/src/main/kotlin/house/greenhouse/bovinesandbuttercups/gradle/Versions.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
...use/greenhouse/bovinesandbuttercups/content/block/entity/MoobloomEatDispenseBehavior.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package house.greenhouse.bovinesandbuttercups.content.block.entity; | ||
|
||
import house.greenhouse.bovinesandbuttercups.content.entity.Moobloom; | ||
import house.greenhouse.bovinesandbuttercups.mixin.DefaultDispenseItemBehaviorAccessor; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.core.dispenser.BlockSource; | ||
import net.minecraft.core.dispenser.DispenseItemBehavior; | ||
import net.minecraft.core.dispenser.OptionalDispenseItemBehavior; | ||
import net.minecraft.server.level.ServerLevel; | ||
import net.minecraft.world.entity.EntitySelector; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.item.Items; | ||
import net.minecraft.world.level.block.DispenserBlock; | ||
import net.minecraft.world.phys.AABB; | ||
|
||
import java.util.List; | ||
|
||
public class MoobloomEatDispenseBehavior extends OptionalDispenseItemBehavior { | ||
public static final MoobloomEatDispenseBehavior INSTANCE = new MoobloomEatDispenseBehavior(DispenserBlock.DISPENSER_REGISTRY.get(Items.BONE_MEAL)); | ||
private final DispenseItemBehavior boneMealBehavior; | ||
|
||
protected MoobloomEatDispenseBehavior(DispenseItemBehavior boneMealBehavior) { | ||
this.boneMealBehavior = boneMealBehavior; | ||
} | ||
|
||
public static void registerBehavior(MoobloomEatDispenseBehavior behavior) { | ||
DispenserBlock.registerBehavior(Items.BONE_MEAL, behavior); | ||
} | ||
|
||
@Override | ||
public ItemStack execute(BlockSource source, ItemStack stack) { | ||
setSuccess(true); | ||
if (handleMoobloom(source, stack)) { | ||
return stack; | ||
} | ||
|
||
if (boneMealBehavior instanceof OptionalDispenseItemBehavior optional) { | ||
((DefaultDispenseItemBehaviorAccessor)optional).bovinesandbuttercups$invokeExecute(source, stack); | ||
if (!optional.isSuccess()) | ||
setSuccess(false); | ||
return stack; | ||
} | ||
|
||
boneMealBehavior.dispense(source, stack); | ||
return stack; | ||
} | ||
|
||
private boolean handleMoobloom(BlockSource source, ItemStack stack) { | ||
ServerLevel level = source.level(); | ||
BlockPos relativePos = source.pos().relative(source.state().getValue(DispenserBlock.FACING)); | ||
List<Moobloom> mooblooms = level.getEntitiesOfClass(Moobloom.class, new AABB(relativePos), EntitySelector.NO_SPECTATORS); | ||
|
||
if (mooblooms.isEmpty()) | ||
return false; | ||
else { | ||
for (Moobloom moobloom : mooblooms) { | ||
moobloom.feed(); | ||
stack.shrink(1); | ||
} | ||
|
||
return true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...java/house/greenhouse/bovinesandbuttercups/mixin/DefaultDispenseItemBehaviorAccessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package house.greenhouse.bovinesandbuttercups.mixin; | ||
|
||
import net.minecraft.core.dispenser.BlockSource; | ||
import net.minecraft.core.dispenser.DefaultDispenseItemBehavior; | ||
import net.minecraft.world.item.ItemStack; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Invoker; | ||
|
||
@Mixin(DefaultDispenseItemBehavior.class) | ||
public interface DefaultDispenseItemBehaviorAccessor { | ||
@Invoker("execute") | ||
ItemStack bovinesandbuttercups$invokeExecute(BlockSource blockSource, ItemStack item); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+6.17 KB
common/src/main/resources/assets/bovinesandbuttercups/sounds/mob/moobloom/plant.ogg
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters