Surströmming smells

This commit is contained in:
ACGaming 2020-08-24 21:16:49 +02:00
parent aeac6d85f3
commit c0db096c64
7 changed files with 47 additions and 17 deletions

View file

@ -1,7 +1,9 @@
package mod.acgaming.spackenmobs;
import mod.acgaming.spackenmobs.events.SurstroemmingSmellsBadEvent;
import mod.acgaming.spackenmobs.misc.ModEntities;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.Mod.Instance;
@ -38,7 +40,7 @@ public class Spackenmobs
@EventHandler
public void init(FMLInitializationEvent event)
{
MinecraftForge.EVENT_BUS.register(new SurstroemmingSmellsBadEvent());
}
@EventHandler

View file

@ -47,7 +47,7 @@ public class EntityAIEatDroppedFish extends EntityAIBase
public boolean shouldExecute()
{
EntityItem nearbyFood = getNearbyFood();
if (nearbyFood != null && !this.jens.isChild() && this.jens.yummy_in_tummy == false && this.jens.isFishItem(nearbyFood.getItem()))
if (nearbyFood != null && !this.jens.isChild() && this.jens.digesting == false && this.jens.isFishItem(nearbyFood.getItem()))
{
execute(this.jens, nearbyFood);
}

View file

@ -53,8 +53,8 @@ public class EntityJens extends EntityPig
private boolean boosting;
private int boostTime;
private int totalBoostTime;
public boolean yummy_in_tummy = false;
public int time_until_surstroemming = 0;
public boolean digesting = false;
public int digest_time = 0;
@SideOnly(Side.CLIENT)
Minecraft MINECRAFT = Minecraft.getMinecraft();
@ -207,7 +207,7 @@ public class EntityJens extends EntityPig
if (!super.processInteract(player, hand))
{
ItemStack itemstack = player.getHeldItem(hand);
if (itemstack.getItem() == Items.FISH && !this.isChild() && this.yummy_in_tummy == false)
if (itemstack.getItem() == Items.FISH && !this.isChild() && this.digesting == false)
{
itemstack.shrink(1);
digestFish();
@ -247,12 +247,12 @@ public class EntityJens extends EntityPig
{
super.onLivingUpdate();
if (!this.world.isRemote && this.yummy_in_tummy == true && this.time_until_surstroemming > 0)
if (!this.world.isRemote && this.digesting == true && this.digest_time > 0)
{
this.time_until_surstroemming--;
this.digest_time--;
}
if (!this.world.isRemote && this.yummy_in_tummy == true && this.time_until_surstroemming <= 0)
if (!this.world.isRemote && this.digesting == true && this.digest_time <= 0)
{
for (int i = 0; i < 7; ++i)
{
@ -264,8 +264,8 @@ public class EntityJens extends EntityPig
}
this.playSound(ModSoundEvents.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.time_until_surstroemming = 0;
this.digesting = false;
this.digest_time = 0;
}
}
@ -273,8 +273,8 @@ public class EntityJens extends EntityPig
{
this.playSound(ModSoundEvents.ENTITY_JENS_EAT, 1.0F, 1.0F);
this.yummy_in_tummy = true;
this.time_until_surstroemming = (ModConfigs.Jens_digest_time * 20);
this.digesting = true;
this.digest_time = (ModConfigs.Jens_digest_time * 20);
for (int i = 0; i < 7; ++i)
{

View file

@ -0,0 +1,25 @@
package mod.acgaming.spackenmobs.events;
import mod.acgaming.spackenmobs.misc.ModItems;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.MobEffects;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent;
public class SurstroemmingSmellsBadEvent
{
@SubscribeEvent
public void onEvent(PlayerTickEvent event)
{
if (event.player instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer) event.player;
if (player.inventory.hasItemStack(new ItemStack(ModItems.SURSTROEMMING)))
{
player.addPotionEffect(new PotionEffect(MobEffects.NAUSEA, 100));
}
}
}
}

View file

@ -34,9 +34,6 @@ public class ModLootTableList
}
}
/**
* An unmodifiable set is returned
*/
public static Set<ResourceLocation> getAll()
{
return READ_ONLY_LOOT_TABLES;

View file

@ -1,6 +1,12 @@
package mod.acgaming.spackenmobs.misc;
import mod.acgaming.spackenmobs.Spackenmobs;
import mod.acgaming.spackenmobs.items.ItemPotion;
import net.minecraft.potion.Potion;
import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder;
@ObjectHolder(Spackenmobs.MODID)
public class ModPotions
{
public static final Potion SURSTROEMMING_DRINK = new ItemPotion("surstroemming_drink", true, 42, 0, 0);
}

View file

@ -2,7 +2,7 @@
{
"modid": "spackenmobs",
"name": "Spackenmobs",
"description": "The most important mobs in the history of Minecraft!",
"description": "The most important mobs in the history of Minecraft! [citation needed]",
"version": "RC2",
"mcversion": "1.12.2",
"url": "https://acgaming.github.io",