Skip to content

Commit

Permalink
Incubator speed increase
Browse files Browse the repository at this point in the history
Put a cherine lantern above for 20% hatch time decrease and an extra 10% with an amadrys bundle under it
  • Loading branch information
MrXBlade committed Nov 9, 2024
1 parent 56390d9 commit b616f53
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.id.paradiselost.blocks.blockentity;

import net.id.paradiselost.blocks.ParadiseLostBlocks;
import net.id.paradiselost.component.MoaGenes;
import net.id.paradiselost.items.ParadiseLostItems;
import net.id.paradiselost.util.ParadiseLostSoundEvents;
Expand Down Expand Up @@ -34,6 +35,16 @@ public IncubatorBlockEntity(BlockPos pos, BlockState state) {
public static <T extends BlockEntity> void tickServer(World world, BlockPos pos, BlockState state, T entity) {
IncubatorBlockEntity incubator = (IncubatorBlockEntity) entity;
if (incubator.egg.getItem() == ParadiseLostItems.MOA_EGG) {

if (world.getTime() % 10 == 0) {
if (world.getBlockState(pos.up()).isOf(ParadiseLostBlocks.CHERINE_LANTERN)) { //Whoever would like to change this to use block tags is allowed to, thank you :)
incubator.hatchTicks -= 2;
}
if (world.getBlockState(pos.down()).isOf(ParadiseLostBlocks.AMADRYS_BUNDLE)) {
incubator.hatchTicks -= 1;
}
}

incubator.hatchTicks--;
if (incubator.hatchTicks <= 0) {
incubator.hatchTicks = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ public float getWingRoll() {
}

public float getWingYaw() {
if (flapCount <= 0 || hasPassengers()) {
if (flapCount <= 0 || isSaddled()) {
float baseWingYaw = isGliding() ? 0.95626F : 0.174533F;
float lDif = -baseWingYaw - curWingYaw;
if (Math.abs(lDif) > 0.005F) {
Expand Down Expand Up @@ -336,8 +336,8 @@ public float getRandomFloat(float from, float to){
private float songChance = 0;
public void attemptMoaSound()
{
if (random.nextFloat() < 0.2f + soundChance) {
if (this.random.nextFloat() > 0.05f + songChance || isBaby()) {
if (this.random.nextFloat() < 0.2f + this.soundChance) {
if (this.random.nextFloat() > 0.05f + this.songChance || isBaby()) {
//Small chirp
this.moaSoundCallCooldown = 60 + random.nextInt(55);
this.songChance += MathHelper.clamp(this.random.nextFloat(), 0.1f, 0.04f);
Expand All @@ -349,16 +349,16 @@ public void attemptMoaSound()
}
} else {
//Play little song sometimes so it doesn't get annoying
this.moaSoundCallCooldown = 200 + random.nextInt(25);
this.moaSoundCallCooldown = 200 + this.random.nextInt(25);
this.songChance = 0;
this.getWorld().playSound(null, this.getX(), this.getY(), this.getZ(), ParadiseLostSoundEvents.ENTITY_MOA_AMBIENT_SING, SoundCategory.NEUTRAL, 0.23f, getRandomFloat(0.98f, 1.02f));
}
} else {
if (isSaddled()) {
this.moaSoundCallCooldown = 150 + random.nextInt(150);
this.moaSoundCallCooldown = 150 + this.random.nextInt(150);
this.soundChance += getRandomFloat(0.04f, 0.13f);
} else {
this.moaSoundCallCooldown = 100 + random.nextInt(250);
this.moaSoundCallCooldown = 100 + this.random.nextInt(250);
this.soundChance += getRandomFloat(0.04f, 0.16f);
}
}
Expand Down Expand Up @@ -387,10 +387,10 @@ protected void playHurtSound(DamageSource source) {
public void tick() {
isInAir = !isOnGround();

if (moaSoundCallCooldown > 0) {
if (this.moaSoundCallCooldown > 0) {
this.moaSoundCallCooldown--;
} else {
attemptMoaSound();
this.attemptMoaSound();
}

if (flapCount > 0 && !isSaddled()) {
Expand Down

0 comments on commit b616f53

Please sign in to comment.