Skip to content

Commit

Permalink
Fix green bird's feet texture
Browse files Browse the repository at this point in the history
-Sugar Lumps now only heal one hunger
-Initial implementation of step sounds to several mobs
  • Loading branch information
IcarussOne committed Nov 2, 2023
1 parent 05e11ef commit 1c5c254
Show file tree
Hide file tree
Showing 11 changed files with 105 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import drzhark.mocreatures.entity.MoCEntityMob;
import drzhark.mocreatures.init.MoCItems;
import drzhark.mocreatures.init.MoCSoundEvents;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EnumCreatureAttribute;
import net.minecraft.entity.SharedMonsterAttributes;
Expand All @@ -16,7 +18,9 @@
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.Item;
import net.minecraft.util.DamageSource;
import net.minecraft.util.ResourceLocation;
Expand All @@ -25,6 +29,7 @@
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;

@SuppressWarnings("deprecation")
public class MoCEntityHorseMob extends MoCEntityMob {

public int mouthCounter;
Expand Down Expand Up @@ -165,6 +170,23 @@ protected SoundEvent getAmbientSound() {
}
return MoCSoundEvents.ENTITY_HORSE_AMBIENT_UNDEAD;
}

@Override
protected void playStepSound(BlockPos pos, Block blockIn) {
if (!blockIn.getDefaultState().getMaterial().isLiquid()) {
SoundType soundtype = blockIn.getSoundType();

if (this.world.getBlockState(pos.up()).getBlock() == Blocks.SNOW_LAYER) {
soundtype = Blocks.SNOW_LAYER.getSoundType();
}
else if (soundtype == SoundType.WOOD) {
this.playSound(SoundEvents.ENTITY_HORSE_STEP_WOOD, soundtype.getVolume() * 0.15F, soundtype.getPitch());
}
else {
this.playSound(SoundEvents.ENTITY_HORSE_STEP, soundtype.getVolume() * 0.15F, soundtype.getPitch());
}
}
}

public boolean isOnAir() {
return this.world.isAirBlock(new BlockPos(MathHelper.floor(this.posX), MathHelper.floor(this.posY - 0.2D), MathHelper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ public EnumCreatureAttribute getCreatureAttribute() {
return EnumCreatureAttribute.UNDEAD;
}

// TODO: Add unique step sound
@Override
protected void playStepSound(BlockPos pos, Block block) {
this.playSound(SoundEvents.ENTITY_SKELETON_STEP, 0.15F, 1.0F);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import drzhark.mocreatures.init.MoCSoundEvents;
import drzhark.mocreatures.network.MoCMessageHandler;
import drzhark.mocreatures.network.message.MoCMessageAnimation;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
Expand All @@ -33,6 +34,7 @@
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumHand;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint;

Expand Down Expand Up @@ -257,6 +259,12 @@ protected SoundEvent getAmbientSound() {
openMouth();
return MoCSoundEvents.ENTITY_BEAR_AMBIENT;
}

// TODO: Add unique sound event
@Override
protected void playStepSound(BlockPos pos, Block blockIn) {
this.playSound(SoundEvents.ENTITY_POLAR_BEAR_STEP, 0.15F, 1.0F);
}

private void openMouth() {
this.mouthCounter = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import drzhark.mocreatures.entity.ai.EntityAIFollowAdult;
import drzhark.mocreatures.entity.ai.EntityAIWanderMoC2;
import drzhark.mocreatures.init.MoCLootTables;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
Expand All @@ -20,6 +21,7 @@
import net.minecraft.util.DamageSource;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

import javax.annotation.Nullable;
Expand Down Expand Up @@ -99,6 +101,12 @@ protected SoundEvent getHurtSound(DamageSource source) {
protected SoundEvent getDeathSound() {
return SoundEvents.ENTITY_PIG_DEATH;
}

// TODO: Add unique sound event
@Override
protected void playStepSound(BlockPos pos, Block blockIn) {
this.playSound(SoundEvents.ENTITY_PIG_STEP, 0.15F, 1.0F);
}

@Nullable
protected ResourceLocation getLootTable() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import drzhark.mocreatures.entity.tameable.MoCEntityTameableAnimal;
import drzhark.mocreatures.init.MoCLootTables;
import drzhark.mocreatures.init.MoCSoundEvents;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
Expand All @@ -21,6 +22,7 @@
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.init.MobEffects;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
import net.minecraft.network.datasync.DataParameter;
import net.minecraft.network.datasync.DataSerializers;
Expand All @@ -29,6 +31,7 @@
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;

Expand Down Expand Up @@ -584,6 +587,12 @@ protected SoundEvent getAmbientSound() {
protected SoundEvent getDeathSound() {
return MoCSoundEvents.ENTITY_GOAT_DEATH;
}

// TODO: Add unique step sound
@Override
protected void playStepSound(BlockPos pos, Block block) {
this.playSound(SoundEvents.ENTITY_SHEEP_STEP, 0.15F, 1.0F);
}

@Nullable
protected ResourceLocation getLootTable() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import drzhark.mocreatures.entity.tameable.MoCEntityTameableAnimal;
import drzhark.mocreatures.init.MoCLootTables;
import drzhark.mocreatures.init.MoCSoundEvents;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
Expand All @@ -21,6 +22,7 @@
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
import net.minecraft.network.datasync.DataParameter;
import net.minecraft.network.datasync.DataSerializers;
Expand Down Expand Up @@ -282,6 +284,12 @@ protected SoundEvent getAmbientSound() {
return MoCSoundEvents.ENTITY_BIRD_AMBIENT_RED;
}
}

// TODO: Add unique sound event
@Override
protected void playStepSound(BlockPos pos, Block blockIn) {
this.playSound(SoundEvents.ENTITY_PARROT_STEP, 0.15F, 1.0F);
}

@Nullable
protected ResourceLocation getLootTable() {
Expand Down Expand Up @@ -327,6 +335,7 @@ public boolean processInteract(EntityPlayer player, EnumHand hand) {
return super.processInteract(player, hand);
}

// TODO: Add updated flap ai based on vanilla's parrot
@Override
public void onLivingUpdate() {
super.onLivingUpdate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@
import drzhark.mocreatures.entity.ai.EntityAIWanderMoC2;
import drzhark.mocreatures.init.MoCLootTables;
import drzhark.mocreatures.init.MoCSoundEvents;
import net.minecraft.block.Block;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIPanic;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.util.DamageSource;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

import javax.annotation.Nullable;
Expand Down Expand Up @@ -64,6 +67,12 @@ protected SoundEvent getHurtSound(DamageSource source) {
protected SoundEvent getAmbientSound() {
return MoCSoundEvents.ENTITY_DUCK_AMBIENT;
}

// TODO: Add unique step sound
@Override
protected void playStepSound(BlockPos pos, Block blockIn) {
this.playSound(SoundEvents.ENTITY_CHICKEN_STEP, 0.15F, 1.0F);
}

@Nullable
protected ResourceLocation getLootTable() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import java.util.List;
import java.util.UUID;

@SuppressWarnings("deprecation")
public class MoCEntityHorse extends MoCEntityTameableAnimal {

private static final DataParameter<Boolean> RIDEABLE = EntityDataManager.createKey(MoCEntityHorse.class, DataSerializers.BOOLEAN);
Expand Down Expand Up @@ -505,6 +506,34 @@ protected SoundEvent getDeathSound() {
if (this.getType() > 64 && this.getType() < 68) return MoCSoundEvents.ENTITY_HORSE_DEATH_DONKEY;
return MoCSoundEvents.ENTITY_HORSE_DEATH;
}

@Override
protected void playStepSound(BlockPos pos, Block blockIn) {
if (!blockIn.getDefaultState().getMaterial().isLiquid()) {
SoundType soundtype = blockIn.getSoundType();

if (this.world.getBlockState(pos.up()).getBlock() == Blocks.SNOW_LAYER) {
soundtype = Blocks.SNOW_LAYER.getSoundType();
}

/*if (this.isBeingRidden() && this.canGallop) {
++this.gallopTime;
if (this.gallopTime > 5 && this.gallopTime % 3 == 0) {
this.playGallopSound(soundtype);
}
else if (this.gallopTime <= 5) {
this.playSound(SoundEvents.ENTITY_HORSE_STEP_WOOD, soundtype.getVolume() * 0.15F, soundtype.getPitch());
}
}*/
else if (soundtype == SoundType.WOOD) {
this.playSound(SoundEvents.ENTITY_HORSE_STEP_WOOD, soundtype.getVolume() * 0.15F, soundtype.getPitch());
}
else {
this.playSound(SoundEvents.ENTITY_HORSE_STEP, soundtype.getVolume() * 0.15F, soundtype.getPitch());
}
}
}

@Override
public boolean renderName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import drzhark.mocreatures.entity.tameable.MoCEntityTameableAnimal;
import drzhark.mocreatures.init.MoCLootTables;
import drzhark.mocreatures.init.MoCSoundEvents;
import net.minecraft.block.Block;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIPanic;
Expand All @@ -20,11 +21,12 @@
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

Expand All @@ -48,14 +50,6 @@ protected void initEntityAI() {
this.tasks.addTask(3, new EntityAITempt(this, 1.0D, false, TEMPTATION_ITEMS));
this.tasks.addTask(5, new EntityAIWanderMoC2(this, 1.0D));
this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));

Item soyBeanItem = GameRegistry.makeItemStack("almura:food/food/soybean", 0, 1, null).getItem();
Item cornItem = GameRegistry.makeItemStack("almura:food/food/corn", 0, 1, null).getItem();

if (soyBeanItem != ItemStack.EMPTY.getItem())
TEMPTATION_ITEMS.add(soyBeanItem);
if (cornItem != ItemStack.EMPTY.getItem())
TEMPTATION_ITEMS.add(cornItem);
}

@Override
Expand Down Expand Up @@ -105,6 +99,12 @@ protected SoundEvent getHurtSound(DamageSource source) {
protected SoundEvent getAmbientSound() {
return MoCSoundEvents.ENTITY_TURKEY_AMBIENT;
}

// TODO: Add unique sound event
@Override
protected void playStepSound(BlockPos pos, Block blockIn) {
this.playSound(SoundEvents.ENTITY_CHICKEN_STEP, 0.15F, 1.0F);
}

@Nullable
protected ResourceLocation getLootTable() {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/drzhark/mocreatures/init/MoCItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class MoCItems {
public static final MoCItem horsesaddle = new MoCItemHorseSaddle("horsesaddle");
public static final MoCItem sharkteeth = new MoCItem("sharkteeth");
public static final MoCItem haystack = new MoCItemHayStack("haystack");
public static final MoCItemFood sugarlump = (MoCItemFood) new MoCItemFood("sugarlump", 2, 0.1F, false, 12).setPotionEffect(new PotionEffect(MobEffects.NAUSEA, 4 * 20, 0), 0.15F);
public static final MoCItemFood sugarlump = (MoCItemFood) new MoCItemFood("sugarlump", 1, 0.1F, false, 12).setPotionEffect(new PotionEffect(MobEffects.NAUSEA, 4 * 20, 0), 0.15F);
public static final MoCItem mocegg = new MoCItemEgg("mocegg");
public static final MoCItem bigcatclaw = new MoCItem("bigcatclaw");
public static final MoCItem whip = new MoCItemWhip("whip");
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1c5c254

Please sign in to comment.