forked from ACGaming/Spackenmobs
Serialize Jens attributes and minor fixes
Praise the Lord(MZTE)!
This commit is contained in:
parent
24dc4921ab
commit
e2eb32ffc1
|
@ -68,7 +68,7 @@ public class EntityDrachenlord extends EntityZombie
|
||||||
private static final UUID ATTACK_SPEED_BOOST_MODIFIER_UUID = UUID.fromString("49455A49-7EC5-45BA-B886-3B90B23A1718");
|
private static final UUID ATTACK_SPEED_BOOST_MODIFIER_UUID = UUID.fromString("49455A49-7EC5-45BA-B886-3B90B23A1718");
|
||||||
private static final AttributeModifier ATTACK_SPEED_BOOST_MODIFIER = (new AttributeModifier(ATTACK_SPEED_BOOST_MODIFIER_UUID, "Attacking speed boost", 0.05D, 0)).setSaved(false);
|
private static final AttributeModifier ATTACK_SPEED_BOOST_MODIFIER = (new AttributeModifier(ATTACK_SPEED_BOOST_MODIFIER_UUID, "Attacking speed boost", 0.05D, 0)).setSaved(false);
|
||||||
|
|
||||||
public static void registerFixesPigZombie(DataFixer fixer)
|
public static void registerFixesDrachenlord(DataFixer fixer)
|
||||||
{
|
{
|
||||||
EntityLiving.registerFixesMob(fixer, EntityDrachenlord.class);
|
EntityLiving.registerFixesMob(fixer, EntityDrachenlord.class);
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ public class EntityDrachenlord extends EntityZombie
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void becomeAngryAt(Entity p_70835_1_)
|
public void becomeAngryAt(Entity p_70835_1_)
|
||||||
{
|
{
|
||||||
this.angerLevel = 400 + this.rand.nextInt(400);
|
this.angerLevel = 400 + this.rand.nextInt(400);
|
||||||
this.randomSoundDelay = this.rand.nextInt(40);
|
this.randomSoundDelay = this.rand.nextInt(40);
|
||||||
|
|
|
@ -26,12 +26,14 @@ import net.minecraft.entity.ai.EntityAIWatchClosest;
|
||||||
import net.minecraft.entity.passive.EntityPig;
|
import net.minecraft.entity.passive.EntityPig;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
|
import net.minecraft.init.MobEffects;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.network.datasync.DataParameter;
|
import net.minecraft.network.datasync.DataParameter;
|
||||||
import net.minecraft.network.datasync.DataSerializers;
|
import net.minecraft.network.datasync.DataSerializers;
|
||||||
import net.minecraft.network.datasync.EntityDataManager;
|
import net.minecraft.network.datasync.EntityDataManager;
|
||||||
|
import net.minecraft.potion.PotionEffect;
|
||||||
import net.minecraft.util.DamageSource;
|
import net.minecraft.util.DamageSource;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
import net.minecraft.util.EnumParticleTypes;
|
import net.minecraft.util.EnumParticleTypes;
|
||||||
|
@ -46,7 +48,11 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
public class EntityJens extends EntityPig
|
public class EntityJens extends EntityPig
|
||||||
{
|
{
|
||||||
private static final DataParameter<Boolean> SADDLED = EntityDataManager.<Boolean>createKey(EntityJens.class, DataSerializers.BOOLEAN);
|
private static final DataParameter<Boolean> SADDLED = EntityDataManager.<Boolean>createKey(EntityJens.class, DataSerializers.BOOLEAN);
|
||||||
|
private static final DataParameter<Boolean> DIGESTING = EntityDataManager.<Boolean>createKey(EntityJens.class, DataSerializers.BOOLEAN);
|
||||||
|
|
||||||
private static final DataParameter<Integer> BOOST_TIME = EntityDataManager.<Integer>createKey(EntityJens.class, DataSerializers.VARINT);
|
private static final DataParameter<Integer> BOOST_TIME = EntityDataManager.<Integer>createKey(EntityJens.class, DataSerializers.VARINT);
|
||||||
|
private static final DataParameter<Integer> DIGEST_TIME = EntityDataManager.<Integer>createKey(EntityJens.class, DataSerializers.VARINT);
|
||||||
|
|
||||||
private static final Set<Item> TEMPTATION_ITEMS = Sets.newHashSet(ModItems.RAM);
|
private static final Set<Item> TEMPTATION_ITEMS = Sets.newHashSet(ModItems.RAM);
|
||||||
private static final Set<Item> FISH_ITEMS = Sets.newHashSet(Items.FISH);
|
private static final Set<Item> FISH_ITEMS = Sets.newHashSet(Items.FISH);
|
||||||
|
|
||||||
|
@ -56,11 +62,11 @@ public class EntityJens extends EntityPig
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean boosting;
|
private boolean boosting;
|
||||||
|
public boolean digesting;
|
||||||
|
|
||||||
private int boostTime;
|
private int boostTime;
|
||||||
private int totalBoostTime;
|
private int totalBoostTime;
|
||||||
public boolean digesting = false;
|
public int digestTime;
|
||||||
|
|
||||||
public int digest_time = 0;
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
Minecraft MINECRAFT = Minecraft.getMinecraft();
|
Minecraft MINECRAFT = Minecraft.getMinecraft();
|
||||||
|
@ -123,7 +129,10 @@ public class EntityJens extends EntityPig
|
||||||
this.playSound(ModSoundEvents.ENTITY_JENS_EAT, 1.0F, 1.0F);
|
this.playSound(ModSoundEvents.ENTITY_JENS_EAT, 1.0F, 1.0F);
|
||||||
|
|
||||||
this.digesting = true;
|
this.digesting = true;
|
||||||
this.digest_time = (ModConfigs.Jens_digest_time * 20);
|
this.dataManager.set(DIGESTING, Boolean.valueOf(true));
|
||||||
|
|
||||||
|
this.digestTime = (ModConfigs.Jens_digest_time * 20);
|
||||||
|
this.dataManager.set(DIGEST_TIME, Integer.valueOf(this.digestTime));
|
||||||
|
|
||||||
for (int i = 0; i < 7; ++i)
|
for (int i = 0; i < 7; ++i)
|
||||||
{
|
{
|
||||||
|
@ -133,6 +142,8 @@ public class EntityJens extends EntityPig
|
||||||
MINECRAFT.world.spawnParticle(EnumParticleTypes.HEART, this.posX + this.rand.nextFloat() * this.width * 2.0F - this.width, this.posY + 0.5D + this.rand.nextFloat() * this.height,
|
MINECRAFT.world.spawnParticle(EnumParticleTypes.HEART, this.posX + this.rand.nextFloat() * this.width * 2.0F - this.width, this.posY + 0.5D + this.rand.nextFloat() * this.height,
|
||||||
this.posZ + this.rand.nextFloat() * this.width * 2.0F - this.width, d0, d1, d2);
|
this.posZ + this.rand.nextFloat() * this.width * 2.0F - this.width, d0, d1, d2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.addPotionEffect(new PotionEffect(MobEffects.NAUSEA, ModConfigs.Jens_digest_time * 20));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -140,7 +151,9 @@ public class EntityJens extends EntityPig
|
||||||
{
|
{
|
||||||
super.entityInit();
|
super.entityInit();
|
||||||
this.dataManager.register(SADDLED, Boolean.valueOf(false));
|
this.dataManager.register(SADDLED, Boolean.valueOf(false));
|
||||||
|
this.dataManager.register(DIGESTING, Boolean.valueOf(false));
|
||||||
this.dataManager.register(BOOST_TIME, Integer.valueOf(0));
|
this.dataManager.register(BOOST_TIME, Integer.valueOf(0));
|
||||||
|
this.dataManager.register(DIGEST_TIME, Integer.valueOf(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -238,12 +251,13 @@ public class EntityJens extends EntityPig
|
||||||
{
|
{
|
||||||
super.onLivingUpdate();
|
super.onLivingUpdate();
|
||||||
|
|
||||||
if (!this.world.isRemote && this.digesting == true && this.digest_time > 0)
|
if (!this.world.isRemote && this.digesting == true && this.digestTime > 0)
|
||||||
{
|
{
|
||||||
this.digest_time--;
|
this.digestTime--;
|
||||||
|
this.dataManager.set(DIGEST_TIME, Integer.valueOf(this.digestTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.world.isRemote && this.digesting == true && this.digest_time <= 0)
|
if (!this.world.isRemote && this.digesting == true && this.digestTime <= 0)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 7; ++i)
|
for (int i = 0; i < 7; ++i)
|
||||||
{
|
{
|
||||||
|
@ -255,8 +269,13 @@ public class EntityJens extends EntityPig
|
||||||
}
|
}
|
||||||
this.playSound(ModSoundEvents.ENTITY_JENS_POOP, 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
|
this.playSound(ModSoundEvents.ENTITY_JENS_POOP, 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
|
||||||
this.dropItem(ModItems.SURSTROEMMING, 1);
|
this.dropItem(ModItems.SURSTROEMMING, 1);
|
||||||
|
this.clearActivePotions();
|
||||||
|
|
||||||
this.digesting = false;
|
this.digesting = false;
|
||||||
this.digest_time = 0;
|
this.dataManager.set(DIGESTING, Boolean.valueOf(false));
|
||||||
|
|
||||||
|
this.digestTime = 0;
|
||||||
|
this.dataManager.set(DIGEST_TIME, Integer.valueOf(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,6 +307,7 @@ public class EntityJens extends EntityPig
|
||||||
else if (itemstack.getItem() == Items.SADDLE)
|
else if (itemstack.getItem() == Items.SADDLE)
|
||||||
{
|
{
|
||||||
itemstack.interactWithEntity(player, this, hand);
|
itemstack.interactWithEntity(player, this, hand);
|
||||||
|
this.setCustomNameTag("Reitbarer Jens");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -306,6 +326,8 @@ public class EntityJens extends EntityPig
|
||||||
{
|
{
|
||||||
super.readEntityFromNBT(compound);
|
super.readEntityFromNBT(compound);
|
||||||
this.setSaddled(compound.getBoolean("Saddle"));
|
this.setSaddled(compound.getBoolean("Saddle"));
|
||||||
|
this.digesting = compound.getBoolean("Digesting");
|
||||||
|
this.digestTime = compound.getInteger("DigestTime");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -387,5 +409,7 @@ public class EntityJens extends EntityPig
|
||||||
{
|
{
|
||||||
super.writeEntityToNBT(compound);
|
super.writeEntityToNBT(compound);
|
||||||
compound.setBoolean("Saddle", this.getSaddled());
|
compound.setBoolean("Saddle", this.getSaddled());
|
||||||
|
compound.setBoolean("Digesting", this.digesting);
|
||||||
|
compound.setInteger("DigestTime", this.digestTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -63,9 +63,9 @@ public class EntityWolfMZTE extends EntityWolf
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final DataParameter<Float> DATA_HEALTH_ID = EntityDataManager.<Float>createKey(EntityWolf.class, DataSerializers.FLOAT);
|
private static final DataParameter<Float> DATA_HEALTH_ID = EntityDataManager.<Float>createKey(EntityWolfMZTE.class, DataSerializers.FLOAT);
|
||||||
private static final DataParameter<Boolean> BEGGING = EntityDataManager.<Boolean>createKey(EntityWolf.class, DataSerializers.BOOLEAN);
|
private static final DataParameter<Boolean> BEGGING = EntityDataManager.<Boolean>createKey(EntityWolfMZTE.class, DataSerializers.BOOLEAN);
|
||||||
private static final DataParameter<Integer> COLLAR_COLOR = EntityDataManager.<Integer>createKey(EntityWolf.class, DataSerializers.VARINT);
|
private static final DataParameter<Integer> COLLAR_COLOR = EntityDataManager.<Integer>createKey(EntityWolfMZTE.class, DataSerializers.VARINT);
|
||||||
private float headRotationCourse;
|
private float headRotationCourse;
|
||||||
private float headRotationCourseOld;
|
private float headRotationCourseOld;
|
||||||
private boolean isWet;
|
private boolean isWet;
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
package mod.acgaming.spackenmobs.events;
|
||||||
|
|
||||||
|
import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent;
|
||||||
|
|
||||||
|
public class TauntDrachenlordEvent
|
||||||
|
{
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onKeyPress(KeyInputEvent event, EntityPlayer player, World world, int x, int y, int z)
|
||||||
|
{
|
||||||
|
final int aggroRange = 64;
|
||||||
|
if (Keyboard.isKeyDown(Keyboard.KEY_J))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -114,7 +114,7 @@ public class ModConfigs
|
||||||
@Name("WolfMZTE max group size:")
|
@Name("WolfMZTE max group size:")
|
||||||
public static int WolfMZTE_max = 4;
|
public static int WolfMZTE_max = 4;
|
||||||
@Name("Time in seconds Jens needs to digest:")
|
@Name("Time in seconds Jens needs to digest:")
|
||||||
public static int Jens_digest_time = 10;
|
public static int Jens_digest_time = 120;
|
||||||
@Name("Maximum distance in blocks Jens can search for fish:")
|
@Name("Maximum distance in blocks Jens can search for fish:")
|
||||||
public static double Jens_search_distance = 10.0;
|
public static double Jens_search_distance = 10.0;
|
||||||
}
|
}
|
Loading…
Reference in a new issue