mirror of
https://github.com/ACGaming/Spackenmobs
synced 2024-05-19 20:04:10 +02:00
More Surströmming work
This commit is contained in:
parent
4bc61cafd2
commit
dac25e1ee7
|
@ -57,6 +57,7 @@ public class Spackenmobs
|
|||
public static final SoundEvent ENTITY_JENS_HURT = new SoundEvent(new ResourceLocation("spackenmobs:entities.jens.hurt"));
|
||||
public static final SoundEvent ENTITY_JENS_DEATH = new SoundEvent(new ResourceLocation("spackenmobs:entities.jens.death"));
|
||||
public static final SoundEvent ENTITY_JENS_EAT = new SoundEvent(new ResourceLocation("spackenmobs:entities.jens.eat"));
|
||||
public static final SoundEvent ENTITY_JENS_POOP = new SoundEvent(new ResourceLocation("spackenmobs:entities.jens.poop"));
|
||||
|
||||
@Instance
|
||||
public static Spackenmobs instance;
|
||||
|
|
|
@ -17,15 +17,24 @@ import net.minecraft.entity.ai.EntityAIWanderAvoidWater;
|
|||
import net.minecraft.entity.ai.EntityAIWatchClosest;
|
||||
import net.minecraft.entity.passive.EntityPig;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.datasync.DataParameter;
|
||||
import net.minecraft.network.datasync.DataSerializers;
|
||||
import net.minecraft.network.datasync.EntityDataManager;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityJens extends EntityPig
|
||||
{
|
||||
private static final Set<Item> TEMPTATION_ITEMS = Sets.newHashSet(ModItems.RAM);
|
||||
private static final DataParameter<Integer> Cooldown = EntityDataManager.createKey(EntityJens.class, DataSerializers.VARINT);
|
||||
private boolean yummy_in_tummy = false;
|
||||
private int timeUntilSurstroemming = 0;
|
||||
|
||||
public EntityJens(World worldIn)
|
||||
{
|
||||
|
@ -70,7 +79,53 @@ public class EntityJens extends EntityPig
|
|||
{
|
||||
return new EntityJens(this.world);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean processInteract(EntityPlayer player, EnumHand hand)
|
||||
{
|
||||
ItemStack itemstack = player.getHeldItem(hand);
|
||||
EnumParticleTypes enumparticletypes = EnumParticleTypes.HEART;
|
||||
|
||||
if (itemstack.getItem() == Items.FISH && !this.isChild() && this.yummy_in_tummy == false)
|
||||
{
|
||||
player.playSound(Spackenmobs.ENTITY_JENS_EAT, 1.0F, 1.0F);
|
||||
itemstack.shrink(1);
|
||||
this.yummy_in_tummy = true;
|
||||
this.timeUntilSurstroemming = 100;
|
||||
|
||||
for (int i = 0; i < 7; ++i)
|
||||
{
|
||||
double d0 = this.rand.nextGaussian() * 0.02D;
|
||||
double d1 = this.rand.nextGaussian() * 0.02D;
|
||||
double d2 = this.rand.nextGaussian() * 0.02D;
|
||||
this.world.spawnParticle(enumparticletypes, this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, this.posY + 0.5D + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, d0, d1, d2);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.processInteract(player, hand);
|
||||
}
|
||||
}
|
||||
|
||||
public void onLivingUpdate()
|
||||
{
|
||||
super.onLivingUpdate();
|
||||
|
||||
if (!this.world.isRemote && this.yummy_in_tummy == true && this.timeUntilSurstroemming > 0)
|
||||
{
|
||||
this.timeUntilSurstroemming--;
|
||||
}
|
||||
|
||||
if (!this.world.isRemote && this.yummy_in_tummy == true && this.timeUntilSurstroemming <= 0)
|
||||
{
|
||||
this.playSound(Spackenmobs.ENTITY_JENS_POOP, 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
|
||||
this.dropItem(ModItems.SURSTROEMMING, 1);
|
||||
this.yummy_in_tummy = false;
|
||||
this.timeUntilSurstroemming = 0;
|
||||
}
|
||||
}
|
||||
|
||||
protected SoundEvent getAmbientSound()
|
||||
{
|
||||
return Spackenmobs.ENTITY_JENS_AMBIENT;
|
||||
|
|
|
@ -154,5 +154,7 @@ public class RegHandler
|
|||
event.getRegistry().register((SoundEvent)Spackenmobs.ENTITY_JENS_DEATH);
|
||||
Spackenmobs.ENTITY_JENS_EAT.setRegistryName(new ResourceLocation("spackenmobs:entities.jens.eat"));
|
||||
event.getRegistry().register((SoundEvent)Spackenmobs.ENTITY_JENS_EAT);
|
||||
Spackenmobs.ENTITY_JENS_POOP.setRegistryName(new ResourceLocation("spackenmobs:entities.jens.poop"));
|
||||
event.getRegistry().register((SoundEvent)Spackenmobs.ENTITY_JENS_POOP);
|
||||
}
|
||||
}
|
|
@ -7,4 +7,5 @@ entity.drachenlord.name=Drachenlord
|
|||
entity.schalker.name=Schalker
|
||||
entity.jens.name=Jens
|
||||
item.spackenmobs.ram.name=RAM
|
||||
item.spackenmobs.ram_on_a_stick.name=RAM-Rute
|
||||
item.spackenmobs.ram_on_a_stick.name=RAM-Rute
|
||||
item.spackenmobs.surstroemming.name=Surströmming
|
|
@ -7,4 +7,5 @@ entity.drachenlord.name=Drachenlord
|
|||
entity.schalker.name=Schalker
|
||||
entity.jens.name=Jens
|
||||
item.spackenmobs.ram.name=RAM
|
||||
item.spackenmobs.ram_on_a_stick.name=RAM on a Stick
|
||||
item.spackenmobs.ram_on_a_stick.name=RAM on a Stick
|
||||
item.spackenmobs.surstroemming.name=Surströmming
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "spackenmobs:items/surstroemming"
|
||||
}
|
||||
}
|
|
@ -838,5 +838,10 @@
|
|||
"sounds": [{
|
||||
"name": "spackenmobs:jens/eat"
|
||||
}]
|
||||
},
|
||||
"entities.jens.poop": {
|
||||
"sounds": [{
|
||||
"name": "spackenmobs:jens/poop"
|
||||
}]
|
||||
}
|
||||
}
|
BIN
src/main/resources/assets/spackenmobs/sounds/jens/poop.ogg
Normal file
BIN
src/main/resources/assets/spackenmobs/sounds/jens/poop.ogg
Normal file
Binary file not shown.
Loading…
Reference in a new issue