diff --git a/src/main/java/mod/acgaming/spackenmobs/Spackenmobs.java b/src/main/java/mod/acgaming/spackenmobs/Spackenmobs.java index 97a41e0..710e96f 100644 --- a/src/main/java/mod/acgaming/spackenmobs/Spackenmobs.java +++ b/src/main/java/mod/acgaming/spackenmobs/Spackenmobs.java @@ -1,8 +1,6 @@ package mod.acgaming.spackenmobs; -import mod.acgaming.spackenmobs.entities.ModEntities; +import mod.acgaming.spackenmobs.misc.ModEntities; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.SoundEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.Mod.Instance; @@ -20,45 +18,6 @@ public class Spackenmobs public static final CreativeTabs SPACKENMOBS_TAB = new SpackenmobsTab(); - public static final SoundEvent ENTITY_SMAVACREEPER_FUSE = new SoundEvent(new ResourceLocation("spackenmobs:entities.smava_creeper.fuse")); - public static final SoundEvent ENTITY_SMAVACREEPER_BLOW = new SoundEvent(new ResourceLocation("spackenmobs:entities.smava_creeper.blow")); - public static final SoundEvent ENTITY_SMAVACREEPER_HURT = new SoundEvent(new ResourceLocation("spackenmobs:entities.smava_creeper.hurt")); - public static final SoundEvent ENTITY_SMAVACREEPER_AMBIENT = new SoundEvent(new ResourceLocation("spackenmobs:entities.smava_creeper.ambient")); - - public static final SoundEvent ENTITY_MARCELLDAVIS_AMBIENT = new SoundEvent(new ResourceLocation("spackenmobs:entities.marcell_davis.ambient")); - public static final SoundEvent ENTITY_MARCELLDAVIS_HURT = new SoundEvent(new ResourceLocation("spackenmobs:entities.marcell_davis.hurt")); - public static final SoundEvent ENTITY_MARCELLDAVIS_DEATH = new SoundEvent(new ResourceLocation("spackenmobs:entities.marcell_davis.death")); - - public static final SoundEvent ENTITY_ISLAMIST_FUSE = new SoundEvent(new ResourceLocation("spackenmobs:entities.islamist.fuse")); - public static final SoundEvent ENTITY_ISLAMIST_BLOW = new SoundEvent(new ResourceLocation("spackenmobs:entities.islamist.blow")); - public static final SoundEvent ENTITY_ISLAMIST_HURT = new SoundEvent(new ResourceLocation("spackenmobs:entities.islamist.hurt")); - public static final SoundEvent ENTITY_ISLAMIST_AMBIENT = new SoundEvent(new ResourceLocation("spackenmobs:entities.islamist.ambient")); - - public static final SoundEvent ENTITY_APORED_AMBIENT = new SoundEvent(new ResourceLocation("spackenmobs:entities.apored.ambient")); - public static final SoundEvent ENTITY_APORED_HURT = new SoundEvent(new ResourceLocation("spackenmobs:entities.apored.hurt")); - public static final SoundEvent ENTITY_APORED_DEATH = new SoundEvent(new ResourceLocation("spackenmobs:entities.apored.death")); - - public static final SoundEvent ENTITY_MRBEAN_AMBIENT = new SoundEvent(new ResourceLocation("spackenmobs:entities.mr_bean.ambient")); - public static final SoundEvent ENTITY_MRBEAN_HURT = new SoundEvent(new ResourceLocation("spackenmobs:entities.mr_bean.hurt")); - public static final SoundEvent ENTITY_MRBEAN_DEATH = new SoundEvent(new ResourceLocation("spackenmobs:entities.mr_bean.death")); - - public static final SoundEvent ENTITY_DRACHENLORD_AMBIENT = new SoundEvent(new ResourceLocation("spackenmobs:entities.drachenlord.ambient")); - public static final SoundEvent ENTITY_DRACHENLORD_HURT = new SoundEvent(new ResourceLocation("spackenmobs:entities.drachenlord.hurt")); - public static final SoundEvent ENTITY_DRACHENLORD_DEATH = new SoundEvent(new ResourceLocation("spackenmobs:entities.drachenlord.death")); - public static final SoundEvent ENTITY_DRACHENLORD_ANGRY = new SoundEvent(new ResourceLocation("spackenmobs:entities.drachenlord.angry")); - - public static final SoundEvent ENTITY_SCHALKER_AMBIENT = new SoundEvent(new ResourceLocation("spackenmobs:entities.schalker.ambient")); - public static final SoundEvent ENTITY_SCHALKER_HURT = new SoundEvent(new ResourceLocation("spackenmobs:entities.schalker.hurt")); - public static final SoundEvent ENTITY_SCHALKER_DEATH = new SoundEvent(new ResourceLocation("spackenmobs:entities.schalker.death")); - public static final SoundEvent ENTITY_SCHALKER_OPEN = new SoundEvent(new ResourceLocation("spackenmobs:entities.schalker.open")); - public static final SoundEvent ENTITY_SCHALKER_SHOOT = new SoundEvent(new ResourceLocation("spackenmobs:entities.schalker.shoot")); - - public static final SoundEvent ENTITY_JENS_AMBIENT = new SoundEvent(new ResourceLocation("spackenmobs:entities.jens.ambient")); - 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; diff --git a/src/main/java/mod/acgaming/spackenmobs/SpackenmobsTab.java b/src/main/java/mod/acgaming/spackenmobs/SpackenmobsTab.java index 666c6c6..1d6e907 100644 --- a/src/main/java/mod/acgaming/spackenmobs/SpackenmobsTab.java +++ b/src/main/java/mod/acgaming/spackenmobs/SpackenmobsTab.java @@ -1,5 +1,5 @@ package mod.acgaming.spackenmobs; -import mod.acgaming.spackenmobs.items.ModItems; +import mod.acgaming.spackenmobs.misc.ModItems; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/mod/acgaming/spackenmobs/entities/EntityApoRed.java b/src/main/java/mod/acgaming/spackenmobs/entities/EntityApoRed.java index b8be796..0d3a18f 100644 --- a/src/main/java/mod/acgaming/spackenmobs/entities/EntityApoRed.java +++ b/src/main/java/mod/acgaming/spackenmobs/entities/EntityApoRed.java @@ -1,5 +1,5 @@ package mod.acgaming.spackenmobs.entities; -import mod.acgaming.spackenmobs.Spackenmobs; +import mod.acgaming.spackenmobs.misc.ModSoundEvents; import net.minecraft.entity.monster.EntitySkeleton; import net.minecraft.util.DamageSource; import net.minecraft.util.SoundEvent; @@ -14,16 +14,16 @@ public class EntityApoRed extends EntitySkeleton protected SoundEvent getAmbientSound() { - return Spackenmobs.ENTITY_APORED_AMBIENT; + return ModSoundEvents.ENTITY_APORED_AMBIENT; } protected SoundEvent getHurtSound(DamageSource damageSourceIn) { - return Spackenmobs.ENTITY_APORED_HURT; + return ModSoundEvents.ENTITY_APORED_HURT; } protected SoundEvent getDeathSound() { - return Spackenmobs.ENTITY_APORED_DEATH; + return ModSoundEvents.ENTITY_APORED_DEATH; } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/entities/EntityDrachenlord.java b/src/main/java/mod/acgaming/spackenmobs/entities/EntityDrachenlord.java index 8500c7c..20e2764 100644 --- a/src/main/java/mod/acgaming/spackenmobs/entities/EntityDrachenlord.java +++ b/src/main/java/mod/acgaming/spackenmobs/entities/EntityDrachenlord.java @@ -3,7 +3,7 @@ import java.util.UUID; import javax.annotation.Nullable; -import mod.acgaming.spackenmobs.Spackenmobs; +import mod.acgaming.spackenmobs.misc.ModSoundEvents; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityCreature; import net.minecraft.entity.EntityLiving; @@ -87,7 +87,7 @@ public class EntityDrachenlord extends EntityZombie if (this.randomSoundDelay > 0 && --this.randomSoundDelay == 0) { - this.playSound(Spackenmobs.ENTITY_DRACHENLORD_ANGRY, this.getSoundVolume() * 2.0F, 1.0F); + this.playSound(ModSoundEvents.ENTITY_DRACHENLORD_ANGRY, this.getSoundVolume() * 2.0F, 1.0F); } if (this.angerLevel > 0 && this.angerTargetUUID != null && this.getRevengeTarget() == null) @@ -188,17 +188,17 @@ public class EntityDrachenlord extends EntityZombie protected SoundEvent getAmbientSound() { - return Spackenmobs.ENTITY_DRACHENLORD_AMBIENT; + return ModSoundEvents.ENTITY_DRACHENLORD_AMBIENT; } protected SoundEvent getHurtSound(DamageSource damageSourceIn) { - return Spackenmobs.ENTITY_DRACHENLORD_HURT; + return ModSoundEvents.ENTITY_DRACHENLORD_HURT; } protected SoundEvent getDeathSound() { - return Spackenmobs.ENTITY_DRACHENLORD_DEATH; + return ModSoundEvents.ENTITY_DRACHENLORD_DEATH; } @Nullable diff --git a/src/main/java/mod/acgaming/spackenmobs/entities/EntityHolzstammhuhn.java b/src/main/java/mod/acgaming/spackenmobs/entities/EntityHolzstammhuhn.java new file mode 100644 index 0000000..9d84f9c --- /dev/null +++ b/src/main/java/mod/acgaming/spackenmobs/entities/EntityHolzstammhuhn.java @@ -0,0 +1,81 @@ +package mod.acgaming.spackenmobs.entities; +import java.util.Set; + +import com.google.common.collect.Sets; + +import net.minecraft.block.Block; +import net.minecraft.entity.EntityAgeable; +import net.minecraft.entity.ai.EntityAIFollowParent; +import net.minecraft.entity.ai.EntityAILookIdle; +import net.minecraft.entity.ai.EntityAIMate; +import net.minecraft.entity.ai.EntityAIPanic; +import net.minecraft.entity.ai.EntityAISwimming; +import net.minecraft.entity.ai.EntityAITempt; +import net.minecraft.entity.ai.EntityAIWanderAvoidWater; +import net.minecraft.entity.ai.EntityAIWatchClosest; +import net.minecraft.entity.passive.EntityChicken; +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.pathfinding.PathNodeType; +import net.minecraft.util.DamageSource; +import net.minecraft.util.SoundEvent; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + +public class EntityHolzstammhuhn extends EntityChicken +{ + private static final Set TEMPTATION_ITEMS = Sets.newHashSet(Items.STICK); + + public EntityHolzstammhuhn(World worldIn) + { + super(worldIn); + this.setSize(0.4F, 0.7F); + this.timeUntilNextEgg = this.rand.nextInt(6000) + 6000; + this.setPathPriority(PathNodeType.WATER, 0.0F); + } + + protected void initEntityAI() + { + this.tasks.addTask(0, new EntityAISwimming(this)); + this.tasks.addTask(1, new EntityAIPanic(this, 1.4D)); + this.tasks.addTask(2, new EntityAIMate(this, 1.0D)); + this.tasks.addTask(3, new EntityAITempt(this, 1.0D, false, TEMPTATION_ITEMS)); + this.tasks.addTask(4, new EntityAIFollowParent(this, 1.1D)); + this.tasks.addTask(5, new EntityAIWanderAvoidWater(this, 1.0D)); + this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); + this.tasks.addTask(7, new EntityAILookIdle(this)); + } + + public boolean isBreedingItem(ItemStack stack) + { + return TEMPTATION_ITEMS.contains(stack.getItem()); + } + + protected SoundEvent getAmbientSound() + { + return SoundEvents.BLOCK_WOOD_PLACE; + } + + protected SoundEvent getHurtSound(DamageSource damageSourceIn) + { + return SoundEvents.BLOCK_WOOD_HIT; + } + + protected SoundEvent getDeathSound() + { + return SoundEvents.BLOCK_WOOD_BREAK; + } + + protected void playStepSound(BlockPos pos, Block blockIn) + { + this.playSound(SoundEvents.BLOCK_WOOD_STEP, 0.15F, 1.0F); + } + + public EntityHolzstammhuhn createChild(EntityAgeable ageable) + { + return new EntityHolzstammhuhn(this.world); + } +} \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/entities/EntityIslamist.java b/src/main/java/mod/acgaming/spackenmobs/entities/EntityIslamist.java index 0b0cb2f..f1712c4 100644 --- a/src/main/java/mod/acgaming/spackenmobs/entities/EntityIslamist.java +++ b/src/main/java/mod/acgaming/spackenmobs/entities/EntityIslamist.java @@ -1,5 +1,5 @@ package mod.acgaming.spackenmobs.entities; -import mod.acgaming.spackenmobs.Spackenmobs; +import mod.acgaming.spackenmobs.misc.ModSoundEvents; import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.util.DamageSource; import net.minecraft.util.SoundEvent; @@ -33,7 +33,7 @@ public class EntityIslamist extends EntityCreeper if (i > 0 && this.timeSinceIgnited == 0) { - this.playSound(Spackenmobs.ENTITY_ISLAMIST_FUSE, 1.0F, 0.5F); + this.playSound(ModSoundEvents.ENTITY_ISLAMIST_FUSE, 1.0F, 0.5F); } this.timeSinceIgnited += i; @@ -60,7 +60,7 @@ public class EntityIslamist extends EntityCreeper boolean flag = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.world, this); float f = this.getPowered() ? 2.0F : 1.0F; this.dead = true; - this.world.playSound(null, getPosition(), Spackenmobs.ENTITY_ISLAMIST_BLOW, getSoundCategory(), 1.0F, 1.0F); + this.world.playSound(null, getPosition(), ModSoundEvents.ENTITY_ISLAMIST_BLOW, getSoundCategory(), 1.0F, 1.0F); this.world.createExplosion(this, this.posX, this.posY, this.posZ, (float)this.explosionRadius * f, flag); this.setDead(); } @@ -68,11 +68,11 @@ public class EntityIslamist extends EntityCreeper protected SoundEvent getHurtSound(DamageSource damageSourceIn) { - return Spackenmobs.ENTITY_ISLAMIST_HURT; + return ModSoundEvents.ENTITY_ISLAMIST_HURT; } protected SoundEvent getAmbientSound() { - return Spackenmobs.ENTITY_ISLAMIST_AMBIENT; + return ModSoundEvents.ENTITY_ISLAMIST_AMBIENT; } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/entities/EntityJens.java b/src/main/java/mod/acgaming/spackenmobs/entities/EntityJens.java index 6b72f5d..8133217 100644 --- a/src/main/java/mod/acgaming/spackenmobs/entities/EntityJens.java +++ b/src/main/java/mod/acgaming/spackenmobs/entities/EntityJens.java @@ -3,8 +3,8 @@ import java.util.Set; import com.google.common.collect.Sets; -import mod.acgaming.spackenmobs.Spackenmobs; -import mod.acgaming.spackenmobs.items.ModItems; +import mod.acgaming.spackenmobs.misc.ModItems; +import mod.acgaming.spackenmobs.misc.ModSoundEvents; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityAgeable; import net.minecraft.entity.ai.EntityAIFollowParent; @@ -15,26 +15,22 @@ import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.EntityAITempt; import net.minecraft.entity.ai.EntityAIWanderAvoidWater; import net.minecraft.entity.ai.EntityAIWatchClosest; -import net.minecraft.entity.passive.EntityPig; +import net.minecraft.entity.passive.EntityAnimal; 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 +public class EntityJens extends EntityAnimal { private static final Set TEMPTATION_ITEMS = Sets.newHashSet(ModItems.RAM); - private static final DataParameter Cooldown = EntityDataManager.createKey(EntityJens.class, DataSerializers.VARINT); - private boolean yummy_in_tummy = false; - private int timeUntilSurstroemming = 0; + public boolean yummy_in_tummy = false; + public int time_until_surstroemming = 0; public EntityJens(World worldIn) { @@ -86,12 +82,12 @@ public class EntityJens extends EntityPig ItemStack itemstack = player.getHeldItem(hand); EnumParticleTypes enumparticletypes = EnumParticleTypes.HEART; - if (itemstack.getItem() == Items.FISH && !this.isChild() && this.yummy_in_tummy == false) + if (itemstack.getItem() == Items.FISH && !player.capabilities.isCreativeMode && !this.isChild() && this.yummy_in_tummy == false) { - player.playSound(Spackenmobs.ENTITY_JENS_EAT, 1.0F, 1.0F); + player.playSound(ModSoundEvents.ENTITY_JENS_EAT, 1.0F, 1.0F); itemstack.shrink(1); this.yummy_in_tummy = true; - this.timeUntilSurstroemming = 100; + this.time_until_surstroemming = 100; for (int i = 0; i < 7; ++i) { @@ -104,7 +100,7 @@ public class EntityJens extends EntityPig } else { - return this.processInteract(player, hand); + return super.processInteract(player, hand); } } @@ -112,32 +108,32 @@ public class EntityJens extends EntityPig { super.onLivingUpdate(); - if (!this.world.isRemote && this.yummy_in_tummy == true && this.timeUntilSurstroemming > 0) + if (!this.world.isRemote && this.yummy_in_tummy == true && this.time_until_surstroemming > 0) { - this.timeUntilSurstroemming--; + this.time_until_surstroemming--; } - if (!this.world.isRemote && this.yummy_in_tummy == true && this.timeUntilSurstroemming <= 0) + if (!this.world.isRemote && this.yummy_in_tummy == true && this.time_until_surstroemming <= 0) { - this.playSound(Spackenmobs.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.yummy_in_tummy = false; - this.timeUntilSurstroemming = 0; + this.time_until_surstroemming = 0; } } protected SoundEvent getAmbientSound() { - return Spackenmobs.ENTITY_JENS_AMBIENT; + return ModSoundEvents.ENTITY_JENS_AMBIENT; } protected SoundEvent getHurtSound(DamageSource damageSourceIn) { - return Spackenmobs.ENTITY_JENS_HURT; + return ModSoundEvents.ENTITY_JENS_HURT; } protected SoundEvent getDeathSound() { - return Spackenmobs.ENTITY_JENS_DEATH; + return ModSoundEvents.ENTITY_JENS_DEATH; } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/entities/EntityMarcellDAvis.java b/src/main/java/mod/acgaming/spackenmobs/entities/EntityMarcellDAvis.java index e4fa6ed..47c140c 100644 --- a/src/main/java/mod/acgaming/spackenmobs/entities/EntityMarcellDAvis.java +++ b/src/main/java/mod/acgaming/spackenmobs/entities/EntityMarcellDAvis.java @@ -1,5 +1,5 @@ package mod.acgaming.spackenmobs.entities; -import mod.acgaming.spackenmobs.Spackenmobs; +import mod.acgaming.spackenmobs.misc.ModSoundEvents; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.util.DamageSource; import net.minecraft.util.SoundEvent; @@ -15,16 +15,16 @@ public class EntityMarcellDAvis extends EntityZombie protected SoundEvent getAmbientSound() { - return Spackenmobs.ENTITY_MARCELLDAVIS_AMBIENT; + return ModSoundEvents.ENTITY_MARCELLDAVIS_AMBIENT; } protected SoundEvent getHurtSound(DamageSource damageSourceIn) { - return Spackenmobs.ENTITY_MARCELLDAVIS_HURT; + return ModSoundEvents.ENTITY_MARCELLDAVIS_HURT; } protected SoundEvent getDeathSound() { - return Spackenmobs.ENTITY_MARCELLDAVIS_DEATH; + return ModSoundEvents.ENTITY_MARCELLDAVIS_DEATH; } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/entities/EntityMrBean.java b/src/main/java/mod/acgaming/spackenmobs/entities/EntityMrBean.java index 7c9b5b2..17b98cc 100644 --- a/src/main/java/mod/acgaming/spackenmobs/entities/EntityMrBean.java +++ b/src/main/java/mod/acgaming/spackenmobs/entities/EntityMrBean.java @@ -1,5 +1,5 @@ package mod.acgaming.spackenmobs.entities; -import mod.acgaming.spackenmobs.Spackenmobs; +import mod.acgaming.spackenmobs.misc.ModSoundEvents; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.util.DamageSource; import net.minecraft.util.SoundEvent; @@ -15,16 +15,16 @@ public class EntityMrBean extends EntityZombie protected SoundEvent getAmbientSound() { - return Spackenmobs.ENTITY_MRBEAN_AMBIENT; + return ModSoundEvents.ENTITY_MRBEAN_AMBIENT; } protected SoundEvent getHurtSound(DamageSource damageSourceIn) { - return Spackenmobs.ENTITY_MRBEAN_HURT; + return ModSoundEvents.ENTITY_MRBEAN_HURT; } protected SoundEvent getDeathSound() { - return Spackenmobs.ENTITY_MRBEAN_DEATH; + return ModSoundEvents.ENTITY_MRBEAN_DEATH; } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/entities/EntitySchalker.java b/src/main/java/mod/acgaming/spackenmobs/entities/EntitySchalker.java index 0c79d40..5db7af5 100644 --- a/src/main/java/mod/acgaming/spackenmobs/entities/EntitySchalker.java +++ b/src/main/java/mod/acgaming/spackenmobs/entities/EntitySchalker.java @@ -7,7 +7,7 @@ import javax.annotation.Nullable; import com.google.common.base.Optional; import com.google.common.base.Predicate; -import mod.acgaming.spackenmobs.Spackenmobs; +import mod.acgaming.spackenmobs.misc.ModSoundEvents; import net.minecraft.block.BlockPistonBase; import net.minecraft.block.BlockPistonExtension; import net.minecraft.block.material.Material; @@ -29,7 +29,6 @@ import net.minecraft.entity.monster.EntityGolem; import net.minecraft.entity.monster.IMob; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; -import net.minecraft.entity.projectile.EntityShulkerBullet; import net.minecraft.init.Blocks; import net.minecraft.init.SoundEvents; import net.minecraft.item.EnumDyeColor; @@ -113,7 +112,7 @@ public class EntitySchalker extends EntityGolem implements IMob protected SoundEvent getAmbientSound() { - return Spackenmobs.ENTITY_SCHALKER_AMBIENT; + return ModSoundEvents.ENTITY_SCHALKER_AMBIENT; } public void playLivingSound() @@ -126,7 +125,7 @@ public class EntitySchalker extends EntityGolem implements IMob protected SoundEvent getDeathSound() { - return Spackenmobs.ENTITY_SCHALKER_DEATH; + return ModSoundEvents.ENTITY_SCHALKER_DEATH; } protected SoundEvent getHurtSound(DamageSource damageSourceIn) @@ -154,7 +153,7 @@ public class EntitySchalker extends EntityGolem implements IMob return new EntitySchalker.BodyHelper(this); } - public static void registerFixesShulker(DataFixer fixer) + public static void registerFixesSchalker(DataFixer fixer) { EntityLiving.registerFixesMob(fixer, EntitySchalker.class); } @@ -577,7 +576,7 @@ public class EntitySchalker extends EntityGolem implements IMob } else { - this.playSound(Spackenmobs.ENTITY_SCHALKER_OPEN, 1.0F, 1.0F); + this.playSound(ModSoundEvents.ENTITY_SCHALKER_OPEN, 1.0F, 1.0F); } } @@ -692,9 +691,9 @@ public class EntitySchalker extends EntityGolem implements IMob if (this.attackTime <= 0) { this.attackTime = 20 + EntitySchalker.this.rand.nextInt(10) * 20 / 2; - EntityShulkerBullet entityshulkerbullet = new EntityShulkerBullet(EntitySchalker.this.world, EntitySchalker.this, entitylivingbase, EntitySchalker.this.getAttachmentFacing().getAxis()); - EntitySchalker.this.world.spawnEntity(entityshulkerbullet); - EntitySchalker.this.playSound(Spackenmobs.ENTITY_SCHALKER_SHOOT, 2.0F, (EntitySchalker.this.rand.nextFloat() - EntitySchalker.this.rand.nextFloat()) * 0.2F + 1.0F); + EntitySchalkerBullet entityschalkerbullet = new EntitySchalkerBullet(EntitySchalker.this.world, EntitySchalker.this, entitylivingbase, EntitySchalker.this.getAttachmentFacing().getAxis()); + EntitySchalker.this.world.spawnEntity(entityschalkerbullet); + EntitySchalker.this.playSound(ModSoundEvents.ENTITY_SCHALKER_SHOOT, 2.0F, (EntitySchalker.this.rand.nextFloat() - EntitySchalker.this.rand.nextFloat()) * 0.2F + 1.0F); } } else @@ -736,9 +735,9 @@ public class EntitySchalker extends EntityGolem implements IMob static class AIDefenseAttack extends EntityAINearestAttackableTarget { - public AIDefenseAttack(EntitySchalker shulker) + public AIDefenseAttack(EntitySchalker schalker) { - super(shulker, EntityLivingBase.class, 10, true, false, new Predicate() + super(schalker, EntityLivingBase.class, 10, true, false, new Predicate() { public boolean apply(@Nullable EntityLivingBase p_apply_1_) { diff --git a/src/main/java/mod/acgaming/spackenmobs/entities/EntitySchalkerBullet.java b/src/main/java/mod/acgaming/spackenmobs/entities/EntitySchalkerBullet.java new file mode 100644 index 0000000..5916690 --- /dev/null +++ b/src/main/java/mod/acgaming/spackenmobs/entities/EntitySchalkerBullet.java @@ -0,0 +1,451 @@ +package mod.acgaming.spackenmobs.entities; +import java.util.List; +import java.util.UUID; + +import javax.annotation.Nullable; + +import com.google.common.collect.Lists; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.ProjectileHelper; +import net.minecraft.init.MobEffects; +import net.minecraft.init.SoundEvents; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTUtil; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.SoundCategory; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.world.EnumDifficulty; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +public class EntitySchalkerBullet extends Entity +{ + private EntityLivingBase owner; + private Entity target; + @Nullable + private EnumFacing direction; + private int steps; + private double targetDeltaX; + private double targetDeltaY; + private double targetDeltaZ; + @Nullable + private UUID ownerUniqueId; + private BlockPos ownerBlockPos; + @Nullable + private UUID targetUniqueId; + private BlockPos targetBlockPos; + + public EntitySchalkerBullet(World worldIn) + { + super(worldIn); + this.setSize(0.3125F, 0.3125F); + this.noClip = true; + } + + public SoundCategory getSoundCategory() + { + return SoundCategory.HOSTILE; + } + + @SideOnly(Side.CLIENT) + public EntitySchalkerBullet(World worldIn, double x, double y, double z, double motionXIn, double motionYIn, double motionZIn) + { + this(worldIn); + this.setLocationAndAngles(x, y, z, this.rotationYaw, this.rotationPitch); + this.motionX = motionXIn; + this.motionY = motionYIn; + this.motionZ = motionZIn; + } + + public EntitySchalkerBullet(World worldIn, EntityLivingBase ownerIn, Entity targetIn, EnumFacing.Axis p_i46772_4_) + { + this(worldIn); + this.owner = ownerIn; + BlockPos blockpos = new BlockPos(ownerIn); + double d0 = (double)blockpos.getX() + 0.5D; + double d1 = (double)blockpos.getY() + 0.5D; + double d2 = (double)blockpos.getZ() + 0.5D; + this.setLocationAndAngles(d0, d1, d2, this.rotationYaw, this.rotationPitch); + this.target = targetIn; + this.direction = EnumFacing.UP; + this.selectNextMoveDirection(p_i46772_4_); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + protected void writeEntityToNBT(NBTTagCompound compound) + { + if (this.owner != null) + { + BlockPos blockpos = new BlockPos(this.owner); + NBTTagCompound nbttagcompound = NBTUtil.createUUIDTag(this.owner.getUniqueID()); + nbttagcompound.setInteger("X", blockpos.getX()); + nbttagcompound.setInteger("Y", blockpos.getY()); + nbttagcompound.setInteger("Z", blockpos.getZ()); + compound.setTag("Owner", nbttagcompound); + } + + if (this.target != null) + { + BlockPos blockpos1 = new BlockPos(this.target); + NBTTagCompound nbttagcompound1 = NBTUtil.createUUIDTag(this.target.getUniqueID()); + nbttagcompound1.setInteger("X", blockpos1.getX()); + nbttagcompound1.setInteger("Y", blockpos1.getY()); + nbttagcompound1.setInteger("Z", blockpos1.getZ()); + compound.setTag("Target", nbttagcompound1); + } + + if (this.direction != null) + { + compound.setInteger("Dir", this.direction.getIndex()); + } + + compound.setInteger("Steps", this.steps); + compound.setDouble("TXD", this.targetDeltaX); + compound.setDouble("TYD", this.targetDeltaY); + compound.setDouble("TZD", this.targetDeltaZ); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + protected void readEntityFromNBT(NBTTagCompound compound) + { + this.steps = compound.getInteger("Steps"); + this.targetDeltaX = compound.getDouble("TXD"); + this.targetDeltaY = compound.getDouble("TYD"); + this.targetDeltaZ = compound.getDouble("TZD"); + + if (compound.hasKey("Dir", 99)) + { + this.direction = EnumFacing.getFront(compound.getInteger("Dir")); + } + + if (compound.hasKey("Owner", 10)) + { + NBTTagCompound nbttagcompound = compound.getCompoundTag("Owner"); + this.ownerUniqueId = NBTUtil.getUUIDFromTag(nbttagcompound); + this.ownerBlockPos = new BlockPos(nbttagcompound.getInteger("X"), nbttagcompound.getInteger("Y"), nbttagcompound.getInteger("Z")); + } + + if (compound.hasKey("Target", 10)) + { + NBTTagCompound nbttagcompound1 = compound.getCompoundTag("Target"); + this.targetUniqueId = NBTUtil.getUUIDFromTag(nbttagcompound1); + this.targetBlockPos = new BlockPos(nbttagcompound1.getInteger("X"), nbttagcompound1.getInteger("Y"), nbttagcompound1.getInteger("Z")); + } + } + + protected void entityInit() + { + } + + private void setDirection(@Nullable EnumFacing directionIn) + { + this.direction = directionIn; + } + + private void selectNextMoveDirection(@Nullable EnumFacing.Axis p_184569_1_) + { + double d0 = 0.5D; + BlockPos blockpos; + + if (this.target == null) + { + blockpos = (new BlockPos(this)).down(); + } + else + { + d0 = (double)this.target.height * 0.5D; + blockpos = new BlockPos(this.target.posX, this.target.posY + d0, this.target.posZ); + } + + double d1 = (double)blockpos.getX() + 0.5D; + double d2 = (double)blockpos.getY() + d0; + double d3 = (double)blockpos.getZ() + 0.5D; + EnumFacing enumfacing = null; + + if (blockpos.distanceSqToCenter(this.posX, this.posY, this.posZ) >= 4.0D) + { + BlockPos blockpos1 = new BlockPos(this); + List list = Lists.newArrayList(); + + if (p_184569_1_ != EnumFacing.Axis.X) + { + if (blockpos1.getX() < blockpos.getX() && this.world.isAirBlock(blockpos1.east())) + { + list.add(EnumFacing.EAST); + } + else if (blockpos1.getX() > blockpos.getX() && this.world.isAirBlock(blockpos1.west())) + { + list.add(EnumFacing.WEST); + } + } + + if (p_184569_1_ != EnumFacing.Axis.Y) + { + if (blockpos1.getY() < blockpos.getY() && this.world.isAirBlock(blockpos1.up())) + { + list.add(EnumFacing.UP); + } + else if (blockpos1.getY() > blockpos.getY() && this.world.isAirBlock(blockpos1.down())) + { + list.add(EnumFacing.DOWN); + } + } + + if (p_184569_1_ != EnumFacing.Axis.Z) + { + if (blockpos1.getZ() < blockpos.getZ() && this.world.isAirBlock(blockpos1.south())) + { + list.add(EnumFacing.SOUTH); + } + else if (blockpos1.getZ() > blockpos.getZ() && this.world.isAirBlock(blockpos1.north())) + { + list.add(EnumFacing.NORTH); + } + } + + enumfacing = EnumFacing.random(this.rand); + + if (list.isEmpty()) + { + for (int i = 5; !this.world.isAirBlock(blockpos1.offset(enumfacing)) && i > 0; --i) + { + enumfacing = EnumFacing.random(this.rand); + } + } + else + { + enumfacing = list.get(this.rand.nextInt(list.size())); + } + + d1 = this.posX + (double)enumfacing.getFrontOffsetX(); + d2 = this.posY + (double)enumfacing.getFrontOffsetY(); + d3 = this.posZ + (double)enumfacing.getFrontOffsetZ(); + } + + this.setDirection(enumfacing); + double d6 = d1 - this.posX; + double d7 = d2 - this.posY; + double d4 = d3 - this.posZ; + double d5 = (double)MathHelper.sqrt(d6 * d6 + d7 * d7 + d4 * d4); + + if (d5 == 0.0D) + { + this.targetDeltaX = 0.0D; + this.targetDeltaY = 0.0D; + this.targetDeltaZ = 0.0D; + } + else + { + this.targetDeltaX = d6 / d5 * 0.15D; + this.targetDeltaY = d7 / d5 * 0.15D; + this.targetDeltaZ = d4 / d5 * 0.15D; + } + + this.isAirBorne = true; + this.steps = 10 + this.rand.nextInt(5) * 10; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + if (!this.world.isRemote && this.world.getDifficulty() == EnumDifficulty.PEACEFUL) + { + this.setDead(); + } + else + { + super.onUpdate(); + + if (!this.world.isRemote) + { + if (this.target == null && this.targetUniqueId != null) + { + for (EntityLivingBase entitylivingbase : this.world.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(this.targetBlockPos.add(-2, -2, -2), this.targetBlockPos.add(2, 2, 2)))) + { + if (entitylivingbase.getUniqueID().equals(this.targetUniqueId)) + { + this.target = entitylivingbase; + break; + } + } + + this.targetUniqueId = null; + } + + if (this.owner == null && this.ownerUniqueId != null) + { + for (EntityLivingBase entitylivingbase1 : this.world.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(this.ownerBlockPos.add(-2, -2, -2), this.ownerBlockPos.add(2, 2, 2)))) + { + if (entitylivingbase1.getUniqueID().equals(this.ownerUniqueId)) + { + this.owner = entitylivingbase1; + break; + } + } + + this.ownerUniqueId = null; + } + + if (this.target == null || !this.target.isEntityAlive() || this.target instanceof EntityPlayer && ((EntityPlayer)this.target).isSpectator()) + { + if (!this.hasNoGravity()) + { + this.motionY -= 0.04D; + } + } + else + { + this.targetDeltaX = MathHelper.clamp(this.targetDeltaX * 1.025D, -1.0D, 1.0D); + this.targetDeltaY = MathHelper.clamp(this.targetDeltaY * 1.025D, -1.0D, 1.0D); + this.targetDeltaZ = MathHelper.clamp(this.targetDeltaZ * 1.025D, -1.0D, 1.0D); + this.motionX += (this.targetDeltaX - this.motionX) * 0.2D; + this.motionY += (this.targetDeltaY - this.motionY) * 0.2D; + this.motionZ += (this.targetDeltaZ - this.motionZ) * 0.2D; + } + + RayTraceResult raytraceresult = ProjectileHelper.forwardsRaycast(this, true, false, this.owner); + + if (raytraceresult != null && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) + { + this.bulletHit(raytraceresult); + } + } + + this.setPosition(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + ProjectileHelper.rotateTowardsMovement(this, 0.5F); + + if (this.world.isRemote) + { + this.world.spawnParticle(EnumParticleTypes.END_ROD, this.posX - this.motionX, this.posY - this.motionY + 0.15D, this.posZ - this.motionZ, 0.0D, 0.0D, 0.0D); + } + else if (this.target != null && !this.target.isDead) + { + if (this.steps > 0) + { + --this.steps; + + if (this.steps == 0) + { + this.selectNextMoveDirection(this.direction == null ? null : this.direction.getAxis()); + } + } + + if (this.direction != null) + { + BlockPos blockpos = new BlockPos(this); + EnumFacing.Axis enumfacing$axis = this.direction.getAxis(); + + if (this.world.isBlockNormalCube(blockpos.offset(this.direction), false)) + { + this.selectNextMoveDirection(enumfacing$axis); + } + else + { + BlockPos blockpos1 = new BlockPos(this.target); + + if (enumfacing$axis == EnumFacing.Axis.X && blockpos.getX() == blockpos1.getX() || enumfacing$axis == EnumFacing.Axis.Z && blockpos.getZ() == blockpos1.getZ() || enumfacing$axis == EnumFacing.Axis.Y && blockpos.getY() == blockpos1.getY()) + { + this.selectNextMoveDirection(enumfacing$axis); + } + } + } + } + } + } + + /** + * Returns true if the entity is on fire. Used by render to add the fire effect on rendering. + */ + public boolean isBurning() + { + return false; + } + + /** + * Checks if the entity is in range to render. + */ + @SideOnly(Side.CLIENT) + public boolean isInRangeToRenderDist(double distance) + { + return distance < 16384.0D; + } + + /** + * Gets how bright this entity is. + */ + public float getBrightness() + { + return 1.0F; + } + + @SideOnly(Side.CLIENT) + public int getBrightnessForRender() + { + return 15728880; + } + + protected void bulletHit(RayTraceResult result) + { + if (result.entityHit == null) + { + ((WorldServer)this.world).spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY, this.posZ, 2, 0.2D, 0.2D, 0.2D, 0.0D); + this.playSound(SoundEvents.ENTITY_SHULKER_BULLET_HIT, 1.0F, 1.0F); + } + else + { + boolean flag = result.entityHit.attackEntityFrom(DamageSource.causeIndirectDamage(this, this.owner).setProjectile(), 4.0F); + + if (flag) + { + this.applyEnchantments(this.owner, result.entityHit); + + if (result.entityHit instanceof EntityLivingBase) + { + ((EntityLivingBase)result.entityHit).addPotionEffect(new PotionEffect(MobEffects.LEVITATION, 200)); + } + } + } + + this.setDead(); + } + + /** + * Returns true if other Entities should be prevented from moving through this Entity. + */ + public boolean canBeCollidedWith() + { + return true; + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource source, float amount) + { + if (!this.world.isRemote) + { + this.playSound(SoundEvents.ENTITY_SHULKER_BULLET_HURT, 1.0F, 1.0F); + ((WorldServer)this.world).spawnParticle(EnumParticleTypes.CRIT, this.posX, this.posY, this.posZ, 15, 0.2D, 0.2D, 0.2D, 0.0D); + this.setDead(); + } + + return true; + } +} \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/entities/EntitySmavaCreeper.java b/src/main/java/mod/acgaming/spackenmobs/entities/EntitySmavaCreeper.java index c88d9a0..056d1fb 100644 --- a/src/main/java/mod/acgaming/spackenmobs/entities/EntitySmavaCreeper.java +++ b/src/main/java/mod/acgaming/spackenmobs/entities/EntitySmavaCreeper.java @@ -1,5 +1,5 @@ package mod.acgaming.spackenmobs.entities; -import mod.acgaming.spackenmobs.Spackenmobs; +import mod.acgaming.spackenmobs.misc.ModSoundEvents; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.util.DamageSource; @@ -35,7 +35,7 @@ public class EntitySmavaCreeper extends EntityCreeper if (i > 0 && this.timeSinceIgnited == 0) { - this.playSound(Spackenmobs.ENTITY_SMAVACREEPER_FUSE, 1.0F, 1.0F); + this.playSound(ModSoundEvents.ENTITY_SMAVACREEPER_FUSE, 1.0F, 1.0F); } this.timeSinceIgnited += i; @@ -62,7 +62,7 @@ public class EntitySmavaCreeper extends EntityCreeper boolean flag = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.world, this); float f = this.getPowered() ? 2.0F : 1.0F; this.dead = true; - this.world.playSound(null, getPosition(), Spackenmobs.ENTITY_SMAVACREEPER_BLOW, getSoundCategory(), 5.0F, 1.0F); + this.world.playSound(null, getPosition(), ModSoundEvents.ENTITY_SMAVACREEPER_BLOW, getSoundCategory(), 5.0F, 1.0F); this.world.createExplosion(this, this.posX, this.posY, this.posZ, (float)this.explosionRadius * f, flag); this.setDead(); } @@ -70,11 +70,11 @@ public class EntitySmavaCreeper extends EntityCreeper protected SoundEvent getHurtSound(DamageSource damageSourceIn) { - return Spackenmobs.ENTITY_SMAVACREEPER_HURT; + return ModSoundEvents.ENTITY_SMAVACREEPER_HURT; } protected SoundEvent getAmbientSound() { - return Spackenmobs.ENTITY_SMAVACREEPER_AMBIENT; + return ModSoundEvents.ENTITY_SMAVACREEPER_AMBIENT; } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/entities/EntityWolfMZTE.java b/src/main/java/mod/acgaming/spackenmobs/entities/EntityWolfMZTE.java new file mode 100644 index 0000000..30974d6 --- /dev/null +++ b/src/main/java/mod/acgaming/spackenmobs/entities/EntityWolfMZTE.java @@ -0,0 +1,163 @@ +package mod.acgaming.spackenmobs.entities; +import java.util.UUID; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityAgeable; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.ai.EntityAIAvoidEntity; +import net.minecraft.entity.monster.EntityCreeper; +import net.minecraft.entity.monster.EntityGhast; +import net.minecraft.entity.passive.AbstractHorse; +import net.minecraft.entity.passive.EntityAnimal; +import net.minecraft.entity.passive.EntityLlama; +import net.minecraft.entity.passive.EntityWolf; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.network.datasync.DataParameter; +import net.minecraft.network.datasync.DataSerializers; +import net.minecraft.network.datasync.EntityDataManager; +import net.minecraft.world.World; + +public class EntityWolfMZTE extends EntityWolf +{ + private static final DataParameter DATA_HEALTH_ID = EntityDataManager.createKey(EntityWolf.class, DataSerializers.FLOAT); + private static final DataParameter BEGGING = EntityDataManager.createKey(EntityWolf.class, DataSerializers.BOOLEAN); + private static final DataParameter COLLAR_COLOR = EntityDataManager.createKey(EntityWolf.class, DataSerializers.VARINT); + private float headRotationCourse; + private float headRotationCourseOld; + private boolean isWet; + private boolean isShaking; + private float timeWolfIsShaking; + private float prevTimeWolfIsShaking; + + public EntityWolfMZTE(World worldIn) + { + super(worldIn); + this.setSize(0.6F, 0.85F); + this.setTamed(false); + } + + public EntityWolfMZTE createChild(EntityAgeable ageable) + { + EntityWolfMZTE entitywolfmzte = new EntityWolfMZTE(this.world); + UUID uuid = this.getOwnerId(); + + if (uuid != null) + { + entitywolfmzte.setOwnerId(uuid); + entitywolfmzte.setTamed(true); + } + + return entitywolfmzte; + } + + public boolean canMateWith(EntityAnimal otherAnimal) + { + if (otherAnimal == this) + { + return false; + } + else if (!this.isTamed()) + { + return false; + } + else if (!(otherAnimal instanceof EntityWolfMZTE)) + { + return false; + } + else + { + EntityWolfMZTE entitywolfmzte = (EntityWolfMZTE)otherAnimal; + + if (!entitywolfmzte.isTamed()) + { + return false; + } + else if (entitywolfmzte.isSitting()) + { + return false; + } + else + { + return this.isInLove() && entitywolfmzte.isInLove(); + } + } + } + + public boolean shouldAttackEntity(EntityLivingBase target, EntityLivingBase owner) + { + if (!(target instanceof EntityCreeper) && !(target instanceof EntityGhast)) + { + if (target instanceof EntityWolfMZTE) + { + EntityWolfMZTE entitywolfmzte = (EntityWolfMZTE)target; + + if (entitywolfmzte.isTamed() && entitywolfmzte.getOwner() == owner) + { + return false; + } + } + + if (target instanceof EntityPlayer && owner instanceof EntityPlayer && !((EntityPlayer)owner).canAttackPlayer((EntityPlayer)target)) + { + return false; + } + else + { + return !(target instanceof AbstractHorse) || !((AbstractHorse)target).isTame(); + } + } + else + { + return false; + } + } + + class AIAvoidEntity extends EntityAIAvoidEntity + { + private final EntityWolfMZTE wolf; + + public AIAvoidEntity(EntityWolfMZTE wolfIn, Class p_i47251_3_, float p_i47251_4_, double p_i47251_5_, double p_i47251_7_) + { + super(wolfIn, p_i47251_3_, p_i47251_4_, p_i47251_5_, p_i47251_7_); + this.wolf = wolfIn; + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (super.shouldExecute() && this.closestLivingEntity instanceof EntityLlama) + { + return !this.wolf.isTamed() && this.avoidLlama((EntityLlama)this.closestLivingEntity); + } + else + { + return false; + } + } + + private boolean avoidLlama(EntityLlama p_190854_1_) + { + return p_190854_1_.getStrength() >= EntityWolfMZTE.this.rand.nextInt(5); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + EntityWolfMZTE.this.setAttackTarget((EntityLivingBase)null); + super.startExecuting(); + } + + /** + * Keep ticking a continuous task that has already been started + */ + public void updateTask() + { + EntityWolfMZTE.this.setAttackTarget((EntityLivingBase)null); + super.updateTask(); + } + } +} \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/entities/BiomeHelper.java b/src/main/java/mod/acgaming/spackenmobs/misc/BiomeHelper.java similarity index 96% rename from src/main/java/mod/acgaming/spackenmobs/entities/BiomeHelper.java rename to src/main/java/mod/acgaming/spackenmobs/misc/BiomeHelper.java index 78f9678..3969e87 100644 --- a/src/main/java/mod/acgaming/spackenmobs/entities/BiomeHelper.java +++ b/src/main/java/mod/acgaming/spackenmobs/misc/BiomeHelper.java @@ -1,4 +1,4 @@ -package mod.acgaming.spackenmobs.entities; +package mod.acgaming.spackenmobs.misc; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/mod/acgaming/spackenmobs/entities/ModEntities.java b/src/main/java/mod/acgaming/spackenmobs/misc/ModEntities.java similarity index 59% rename from src/main/java/mod/acgaming/spackenmobs/entities/ModEntities.java rename to src/main/java/mod/acgaming/spackenmobs/misc/ModEntities.java index 136dcc7..005c0d5 100644 --- a/src/main/java/mod/acgaming/spackenmobs/entities/ModEntities.java +++ b/src/main/java/mod/acgaming/spackenmobs/misc/ModEntities.java @@ -1,12 +1,24 @@ -package mod.acgaming.spackenmobs.entities; +package mod.acgaming.spackenmobs.misc; +import mod.acgaming.spackenmobs.entities.EntityApoRed; +import mod.acgaming.spackenmobs.entities.EntityDrachenlord; +import mod.acgaming.spackenmobs.entities.EntityHolzstammhuhn; +import mod.acgaming.spackenmobs.entities.EntityIslamist; +import mod.acgaming.spackenmobs.entities.EntityJens; +import mod.acgaming.spackenmobs.entities.EntityMarcellDAvis; +import mod.acgaming.spackenmobs.entities.EntityMrBean; +import mod.acgaming.spackenmobs.entities.EntitySchalker; +import mod.acgaming.spackenmobs.entities.EntitySmavaCreeper; +import mod.acgaming.spackenmobs.entities.EntityWolfMZTE; import mod.acgaming.spackenmobs.render.RenderApoRed; import mod.acgaming.spackenmobs.render.RenderDrachenlord; +import mod.acgaming.spackenmobs.render.RenderHolzstammhuhn; import mod.acgaming.spackenmobs.render.RenderIslamist; import mod.acgaming.spackenmobs.render.RenderJens; import mod.acgaming.spackenmobs.render.RenderMarcellDAvis; import mod.acgaming.spackenmobs.render.RenderMrBean; import mod.acgaming.spackenmobs.render.RenderSchalker; import mod.acgaming.spackenmobs.render.RenderSmavaCreeper; +import mod.acgaming.spackenmobs.render.RenderWolfMZTE; import net.minecraftforge.fml.client.registry.RenderingRegistry; public class ModEntities @@ -21,5 +33,7 @@ public class ModEntities RenderingRegistry.registerEntityRenderingHandler(EntityMrBean.class, RenderMrBean.FACTORY); RenderingRegistry.registerEntityRenderingHandler(EntitySchalker.class, RenderSchalker.FACTORY); RenderingRegistry.registerEntityRenderingHandler(EntitySmavaCreeper.class, RenderSmavaCreeper.FACTORY); + RenderingRegistry.registerEntityRenderingHandler(EntityWolfMZTE.class, RenderWolfMZTE.FACTORY); + RenderingRegistry.registerEntityRenderingHandler(EntityHolzstammhuhn.class, RenderHolzstammhuhn.FACTORY); } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/items/ModItems.java b/src/main/java/mod/acgaming/spackenmobs/misc/ModItems.java similarity index 89% rename from src/main/java/mod/acgaming/spackenmobs/items/ModItems.java rename to src/main/java/mod/acgaming/spackenmobs/misc/ModItems.java index 397b8db..f4d68c9 100644 --- a/src/main/java/mod/acgaming/spackenmobs/items/ModItems.java +++ b/src/main/java/mod/acgaming/spackenmobs/misc/ModItems.java @@ -1,4 +1,4 @@ -package mod.acgaming.spackenmobs.items; +package mod.acgaming.spackenmobs.misc; import mod.acgaming.spackenmobs.Spackenmobs; import net.minecraft.item.Item; import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder; diff --git a/src/main/java/mod/acgaming/spackenmobs/misc/ModSoundEvents.java b/src/main/java/mod/acgaming/spackenmobs/misc/ModSoundEvents.java new file mode 100644 index 0000000..3d3e3ac --- /dev/null +++ b/src/main/java/mod/acgaming/spackenmobs/misc/ModSoundEvents.java @@ -0,0 +1,48 @@ +package mod.acgaming.spackenmobs.misc; +import mod.acgaming.spackenmobs.Spackenmobs; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.SoundEvent; +import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder; + +@ObjectHolder(Spackenmobs.MODID) +public class ModSoundEvents +{ + public static final SoundEvent ENTITY_SMAVACREEPER_FUSE = new SoundEvent(new ResourceLocation("spackenmobs:entities.smava_creeper.fuse")); + public static final SoundEvent ENTITY_SMAVACREEPER_BLOW = new SoundEvent(new ResourceLocation("spackenmobs:entities.smava_creeper.blow")); + public static final SoundEvent ENTITY_SMAVACREEPER_HURT = new SoundEvent(new ResourceLocation("spackenmobs:entities.smava_creeper.hurt")); + public static final SoundEvent ENTITY_SMAVACREEPER_AMBIENT = new SoundEvent(new ResourceLocation("spackenmobs:entities.smava_creeper.ambient")); + + public static final SoundEvent ENTITY_MARCELLDAVIS_AMBIENT = new SoundEvent(new ResourceLocation("spackenmobs:entities.marcell_davis.ambient")); + public static final SoundEvent ENTITY_MARCELLDAVIS_HURT = new SoundEvent(new ResourceLocation("spackenmobs:entities.marcell_davis.hurt")); + public static final SoundEvent ENTITY_MARCELLDAVIS_DEATH = new SoundEvent(new ResourceLocation("spackenmobs:entities.marcell_davis.death")); + + public static final SoundEvent ENTITY_ISLAMIST_FUSE = new SoundEvent(new ResourceLocation("spackenmobs:entities.islamist.fuse")); + public static final SoundEvent ENTITY_ISLAMIST_BLOW = new SoundEvent(new ResourceLocation("spackenmobs:entities.islamist.blow")); + public static final SoundEvent ENTITY_ISLAMIST_HURT = new SoundEvent(new ResourceLocation("spackenmobs:entities.islamist.hurt")); + public static final SoundEvent ENTITY_ISLAMIST_AMBIENT = new SoundEvent(new ResourceLocation("spackenmobs:entities.islamist.ambient")); + + public static final SoundEvent ENTITY_APORED_AMBIENT = new SoundEvent(new ResourceLocation("spackenmobs:entities.apored.ambient")); + public static final SoundEvent ENTITY_APORED_HURT = new SoundEvent(new ResourceLocation("spackenmobs:entities.apored.hurt")); + public static final SoundEvent ENTITY_APORED_DEATH = new SoundEvent(new ResourceLocation("spackenmobs:entities.apored.death")); + + public static final SoundEvent ENTITY_MRBEAN_AMBIENT = new SoundEvent(new ResourceLocation("spackenmobs:entities.mr_bean.ambient")); + public static final SoundEvent ENTITY_MRBEAN_HURT = new SoundEvent(new ResourceLocation("spackenmobs:entities.mr_bean.hurt")); + public static final SoundEvent ENTITY_MRBEAN_DEATH = new SoundEvent(new ResourceLocation("spackenmobs:entities.mr_bean.death")); + + public static final SoundEvent ENTITY_DRACHENLORD_AMBIENT = new SoundEvent(new ResourceLocation("spackenmobs:entities.drachenlord.ambient")); + public static final SoundEvent ENTITY_DRACHENLORD_HURT = new SoundEvent(new ResourceLocation("spackenmobs:entities.drachenlord.hurt")); + public static final SoundEvent ENTITY_DRACHENLORD_DEATH = new SoundEvent(new ResourceLocation("spackenmobs:entities.drachenlord.death")); + public static final SoundEvent ENTITY_DRACHENLORD_ANGRY = new SoundEvent(new ResourceLocation("spackenmobs:entities.drachenlord.angry")); + + public static final SoundEvent ENTITY_SCHALKER_AMBIENT = new SoundEvent(new ResourceLocation("spackenmobs:entities.schalker.ambient")); + public static final SoundEvent ENTITY_SCHALKER_HURT = new SoundEvent(new ResourceLocation("spackenmobs:entities.schalker.hurt")); + public static final SoundEvent ENTITY_SCHALKER_DEATH = new SoundEvent(new ResourceLocation("spackenmobs:entities.schalker.death")); + public static final SoundEvent ENTITY_SCHALKER_OPEN = new SoundEvent(new ResourceLocation("spackenmobs:entities.schalker.open")); + public static final SoundEvent ENTITY_SCHALKER_SHOOT = new SoundEvent(new ResourceLocation("spackenmobs:entities.schalker.shoot")); + + public static final SoundEvent ENTITY_JENS_AMBIENT = new SoundEvent(new ResourceLocation("spackenmobs:entities.jens.ambient")); + 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")); +} \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/misc/RegHandler.java b/src/main/java/mod/acgaming/spackenmobs/misc/RegHandler.java new file mode 100644 index 0000000..6f80cda --- /dev/null +++ b/src/main/java/mod/acgaming/spackenmobs/misc/RegHandler.java @@ -0,0 +1,172 @@ +package mod.acgaming.spackenmobs.misc; +import mod.acgaming.spackenmobs.Spackenmobs; +import mod.acgaming.spackenmobs.entities.EntityApoRed; +import mod.acgaming.spackenmobs.entities.EntityDrachenlord; +import mod.acgaming.spackenmobs.entities.EntityHolzstammhuhn; +import mod.acgaming.spackenmobs.entities.EntityIslamist; +import mod.acgaming.spackenmobs.entities.EntityJens; +import mod.acgaming.spackenmobs.entities.EntityMarcellDAvis; +import mod.acgaming.spackenmobs.entities.EntityMrBean; +import mod.acgaming.spackenmobs.entities.EntitySchalker; +import mod.acgaming.spackenmobs.entities.EntitySmavaCreeper; +import mod.acgaming.spackenmobs.entities.EntityWolfMZTE; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EnumCreatureType; +import net.minecraft.entity.monster.EntityCreeper; +import net.minecraft.entity.monster.EntityPigZombie; +import net.minecraft.entity.monster.EntityShulker; +import net.minecraft.entity.monster.EntitySkeleton; +import net.minecraft.entity.monster.EntityZombie; +import net.minecraft.entity.passive.EntityChicken; +import net.minecraft.entity.passive.EntityPig; +import net.minecraft.entity.passive.EntityWolf; +import net.minecraft.item.Item; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.SoundEvent; +import net.minecraftforge.event.RegistryEvent.Register; +import net.minecraftforge.fml.common.Mod.EventBusSubscriber; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.registry.EntityEntry; +import net.minecraftforge.fml.common.registry.EntityRegistry; + +@EventBusSubscriber(modid = Spackenmobs.MODID) +public class RegHandler +{ + @SubscribeEvent + public static void registerItems(Register event) + { + final Item[] items = + { + new Item().setRegistryName(Spackenmobs.MODID, "ram").setUnlocalizedName(Spackenmobs.MODID + "." + "ram").setCreativeTab(CreativeTabs.MISC), + new Item().setRegistryName(Spackenmobs.MODID, "ram_on_a_stick").setUnlocalizedName(Spackenmobs.MODID + "." + "ram_on_a_stick").setCreativeTab(CreativeTabs.MISC), + new Item().setRegistryName(Spackenmobs.MODID, "surstroemming").setUnlocalizedName(Spackenmobs.MODID + "." + "surstroemming").setCreativeTab(CreativeTabs.MISC) + }; + event.getRegistry().registerAll(items); + } + + @SubscribeEvent + public static void registerEntities(Register event) + { + int id = 1; + + // Smava Creeper + EntityRegistry.registerModEntity(new ResourceLocation("spackenmobs:smava_creeper"), EntitySmavaCreeper.class, "smava_creeper", id++, Spackenmobs.instance, 64, 1, true, 7649828, 11053224); + EntityRegistry.addSpawn(EntitySmavaCreeper.class, 25, 1, 4, EnumCreatureType.MONSTER, BiomeHelper.getBiomesWithMonster(EntityCreeper.class)); + + // Marcell D'Avis + EntityRegistry.registerModEntity(new ResourceLocation("spackenmobs:marcell_davis"), EntityMarcellDAvis.class, "marcell_davis", id++, Spackenmobs.instance, 64, 1, true, 15759, 16777215); + EntityRegistry.addSpawn(EntityMarcellDAvis.class, 50, 1, 4, EnumCreatureType.MONSTER, BiomeHelper.getBiomesWithMonster(EntityZombie.class)); + + // Islamist + EntityRegistry.registerModEntity(new ResourceLocation("spackenmobs:islamist"), EntityIslamist.class, "islamist", id++, Spackenmobs.instance, 64, 1, true, 15263976, 15211548); + EntityRegistry.addSpawn(EntityIslamist.class, 50, 1, 4, EnumCreatureType.MONSTER, BiomeHelper.getBiomesWithMonster(EntityCreeper.class)); + + // ApoRed + EntityRegistry.registerModEntity(new ResourceLocation("spackenmobs:apored"), EntityApoRed.class, "apored", id++, Spackenmobs.instance, 64, 1, true, 2039583, 16711680); + EntityRegistry.addSpawn(EntityApoRed.class, 50, 1, 4, EnumCreatureType.MONSTER, BiomeHelper.getBiomesWithMonster(EntitySkeleton.class)); + + // Mr. Bean + EntityRegistry.registerModEntity(new ResourceLocation("spackenmobs:mr_bean"), EntityMrBean.class, "mr_bean", id++, Spackenmobs.instance, 64, 1, true, 4802350, 3220238); + EntityRegistry.addSpawn(EntityMrBean.class, 50, 1, 4, EnumCreatureType.MONSTER, BiomeHelper.getBiomesWithMonster(EntityZombie.class)); + + // Drachenlord + EntityRegistry.registerModEntity(new ResourceLocation("spackenmobs:drachenlord"), EntityDrachenlord.class, "drachenlord", id++, Spackenmobs.instance, 64, 1, true, 15256745, 8738878); + EntityRegistry.addSpawn(EntityDrachenlord.class, 50, 1, 4, EnumCreatureType.MONSTER, BiomeHelper.getBiomesWithMonster(EntityPigZombie.class)); + + // Schalker + EntityRegistry.registerModEntity(new ResourceLocation("spackenmobs:schalker"), EntitySchalker.class, "schalker", id++, Spackenmobs.instance, 64, 1, true, 24745, 16777215); + EntityRegistry.addSpawn(EntitySchalker.class, 50, 1, 4, EnumCreatureType.MONSTER, BiomeHelper.getBiomesWithMonster(EntityShulker.class)); + + // Jens + EntityRegistry.registerModEntity(new ResourceLocation("spackenmobs:jens"), EntityJens.class, "jens", id++, Spackenmobs.instance, 64, 1, true, 6704526, 6767911); + EntityRegistry.addSpawn(EntityJens.class, 50, 1, 4, EnumCreatureType.CREATURE, BiomeHelper.getBiomesWithCreature(EntityPig.class)); + + // WolfMZTE + EntityRegistry.registerModEntity(new ResourceLocation("spackenmobs:wolfmzte"), EntityWolfMZTE.class, "wolfmzte", id++, Spackenmobs.instance, 64, 1, true, 16711680, 0); + EntityRegistry.addSpawn(EntityJens.class, 50, 1, 4, EnumCreatureType.CREATURE, BiomeHelper.getBiomesWithCreature(EntityWolf.class)); + + // Holzstammhuhn + EntityRegistry.registerModEntity(new ResourceLocation("spackenmobs:holzstammhuhn"), EntityHolzstammhuhn.class, "holzstammhuhn", id++, Spackenmobs.instance, 64, 1, true, 12096347, 5295899); + EntityRegistry.addSpawn(EntityJens.class, 50, 1, 4, EnumCreatureType.CREATURE, BiomeHelper.getBiomesWithCreature(EntityChicken.class)); + + //LootTableList.register(EntityJens.LOOT); + } + + @SubscribeEvent + public static void registerSounds(Register event) + { + // Smava Creeper + ModSoundEvents.ENTITY_SMAVACREEPER_FUSE.setRegistryName(new ResourceLocation("spackenmobs:entities.smava_creeper.fuse")); + event.getRegistry().register((SoundEvent)ModSoundEvents.ENTITY_SMAVACREEPER_FUSE); + ModSoundEvents.ENTITY_SMAVACREEPER_BLOW.setRegistryName(new ResourceLocation("spackenmobs:entities.smava_creeper.blow")); + event.getRegistry().register((SoundEvent)ModSoundEvents.ENTITY_SMAVACREEPER_BLOW); + ModSoundEvents.ENTITY_SMAVACREEPER_HURT.setRegistryName(new ResourceLocation("spackenmobs:entities.smava_creeper.hurt")); + event.getRegistry().register((SoundEvent)ModSoundEvents.ENTITY_SMAVACREEPER_HURT); + ModSoundEvents.ENTITY_SMAVACREEPER_AMBIENT.setRegistryName(new ResourceLocation("spackenmobs:entities.smava_creeper.ambient")); + event.getRegistry().register((SoundEvent)ModSoundEvents.ENTITY_SMAVACREEPER_AMBIENT); + + // Islamist + ModSoundEvents.ENTITY_ISLAMIST_FUSE.setRegistryName(new ResourceLocation("spackenmobs:entities.islamist.fuse")); + event.getRegistry().register((SoundEvent)ModSoundEvents.ENTITY_ISLAMIST_FUSE); + ModSoundEvents.ENTITY_ISLAMIST_HURT.setRegistryName(new ResourceLocation("spackenmobs:entities.islamist.hurt")); + event.getRegistry().register((SoundEvent)ModSoundEvents.ENTITY_ISLAMIST_HURT); + + // Marcell D'Avis + ModSoundEvents.ENTITY_MARCELLDAVIS_AMBIENT.setRegistryName(new ResourceLocation("spackenmobs:entities.marcell_davis.ambient")); + event.getRegistry().register((SoundEvent)ModSoundEvents.ENTITY_MARCELLDAVIS_AMBIENT); + ModSoundEvents.ENTITY_MARCELLDAVIS_HURT.setRegistryName(new ResourceLocation("spackenmobs:entities.marcell_davis.hurt")); + event.getRegistry().register((SoundEvent)ModSoundEvents.ENTITY_MARCELLDAVIS_HURT); + ModSoundEvents.ENTITY_MARCELLDAVIS_DEATH.setRegistryName(new ResourceLocation("spackenmobs:entities.marcell_davis.death")); + event.getRegistry().register((SoundEvent)ModSoundEvents.ENTITY_MARCELLDAVIS_DEATH); + + // Mr. Bean + ModSoundEvents.ENTITY_MRBEAN_AMBIENT.setRegistryName(new ResourceLocation("spackenmobs:entities.mr_bean.ambient")); + event.getRegistry().register((SoundEvent)ModSoundEvents.ENTITY_MRBEAN_AMBIENT); + ModSoundEvents.ENTITY_MRBEAN_HURT.setRegistryName(new ResourceLocation("spackenmobs:entities.mr_bean.hurt")); + event.getRegistry().register((SoundEvent)ModSoundEvents.ENTITY_MRBEAN_HURT); + ModSoundEvents.ENTITY_MRBEAN_DEATH.setRegistryName(new ResourceLocation("spackenmobs:entities.mr_bean.death")); + event.getRegistry().register((SoundEvent)ModSoundEvents.ENTITY_MRBEAN_DEATH); + + // ApoRed + ModSoundEvents.ENTITY_APORED_AMBIENT.setRegistryName(new ResourceLocation("spackenmobs:entities.apored.ambient")); + event.getRegistry().register((SoundEvent)ModSoundEvents.ENTITY_APORED_AMBIENT); + ModSoundEvents.ENTITY_APORED_HURT.setRegistryName(new ResourceLocation("spackenmobs:entities.apored.hurt")); + event.getRegistry().register((SoundEvent)ModSoundEvents.ENTITY_APORED_HURT); + ModSoundEvents.ENTITY_APORED_DEATH.setRegistryName(new ResourceLocation("spackenmobs:entities.apored.death")); + event.getRegistry().register((SoundEvent)ModSoundEvents.ENTITY_APORED_DEATH); + + // Drachenlord + ModSoundEvents.ENTITY_DRACHENLORD_AMBIENT.setRegistryName(new ResourceLocation("spackenmobs:entities.drachenlord.ambient")); + event.getRegistry().register((SoundEvent)ModSoundEvents.ENTITY_DRACHENLORD_AMBIENT); + ModSoundEvents.ENTITY_DRACHENLORD_HURT.setRegistryName(new ResourceLocation("spackenmobs:entities.drachenlord.hurt")); + event.getRegistry().register((SoundEvent)ModSoundEvents.ENTITY_DRACHENLORD_HURT); + ModSoundEvents.ENTITY_DRACHENLORD_DEATH.setRegistryName(new ResourceLocation("spackenmobs:entities.drachenlord.death")); + event.getRegistry().register((SoundEvent)ModSoundEvents.ENTITY_DRACHENLORD_DEATH); + ModSoundEvents.ENTITY_DRACHENLORD_ANGRY.setRegistryName(new ResourceLocation("spackenmobs:entities.drachenlord.angry")); + event.getRegistry().register((SoundEvent)ModSoundEvents.ENTITY_DRACHENLORD_ANGRY); + + // Schalker + ModSoundEvents.ENTITY_SCHALKER_AMBIENT.setRegistryName(new ResourceLocation("spackenmobs:entities.schalker.ambient")); + event.getRegistry().register((SoundEvent)ModSoundEvents.ENTITY_SCHALKER_AMBIENT); + ModSoundEvents.ENTITY_SCHALKER_HURT.setRegistryName(new ResourceLocation("spackenmobs:entities.schalker.hurt")); + event.getRegistry().register((SoundEvent)ModSoundEvents.ENTITY_SCHALKER_HURT); + ModSoundEvents.ENTITY_SCHALKER_DEATH.setRegistryName(new ResourceLocation("spackenmobs:entities.schalker.death")); + event.getRegistry().register((SoundEvent)ModSoundEvents.ENTITY_SCHALKER_DEATH); + ModSoundEvents.ENTITY_SCHALKER_OPEN.setRegistryName(new ResourceLocation("spackenmobs:entities.schalker.open")); + event.getRegistry().register((SoundEvent)ModSoundEvents.ENTITY_SCHALKER_OPEN); + ModSoundEvents.ENTITY_SCHALKER_SHOOT.setRegistryName(new ResourceLocation("spackenmobs:entities.schalker.shoot")); + event.getRegistry().register((SoundEvent)ModSoundEvents.ENTITY_SCHALKER_SHOOT); + + // Jens + ModSoundEvents.ENTITY_JENS_AMBIENT.setRegistryName(new ResourceLocation("spackenmobs:entities.jens.ambient")); + event.getRegistry().register((SoundEvent)ModSoundEvents.ENTITY_JENS_AMBIENT); + ModSoundEvents.ENTITY_JENS_HURT.setRegistryName(new ResourceLocation("spackenmobs:entities.jens.hurt")); + event.getRegistry().register((SoundEvent)ModSoundEvents.ENTITY_JENS_HURT); + ModSoundEvents.ENTITY_JENS_DEATH.setRegistryName(new ResourceLocation("spackenmobs:entities.jens.death")); + event.getRegistry().register((SoundEvent)ModSoundEvents.ENTITY_JENS_DEATH); + ModSoundEvents.ENTITY_JENS_EAT.setRegistryName(new ResourceLocation("spackenmobs:entities.jens.eat")); + event.getRegistry().register((SoundEvent)ModSoundEvents.ENTITY_JENS_EAT); + ModSoundEvents.ENTITY_JENS_POOP.setRegistryName(new ResourceLocation("spackenmobs:entities.jens.poop")); + event.getRegistry().register((SoundEvent)ModSoundEvents.ENTITY_JENS_POOP); + } +} \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/reg/ModelRegHandler.java b/src/main/java/mod/acgaming/spackenmobs/misc/RegHandlerModels.java similarity index 88% rename from src/main/java/mod/acgaming/spackenmobs/reg/ModelRegHandler.java rename to src/main/java/mod/acgaming/spackenmobs/misc/RegHandlerModels.java index b229db5..dd11db1 100644 --- a/src/main/java/mod/acgaming/spackenmobs/reg/ModelRegHandler.java +++ b/src/main/java/mod/acgaming/spackenmobs/misc/RegHandlerModels.java @@ -1,6 +1,5 @@ -package mod.acgaming.spackenmobs.reg; +package mod.acgaming.spackenmobs.misc; import mod.acgaming.spackenmobs.Spackenmobs; -import mod.acgaming.spackenmobs.items.ModItems; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraftforge.client.event.ModelRegistryEvent; @@ -10,7 +9,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; @EventBusSubscriber(value = Side.CLIENT, modid = Spackenmobs.MODID) -public class ModelRegHandler +public class RegHandlerModels { @SubscribeEvent public static void registerModels(ModelRegistryEvent event) diff --git a/src/main/java/mod/acgaming/spackenmobs/reg/RegHandler.java b/src/main/java/mod/acgaming/spackenmobs/reg/RegHandler.java deleted file mode 100644 index 48d0429..0000000 --- a/src/main/java/mod/acgaming/spackenmobs/reg/RegHandler.java +++ /dev/null @@ -1,160 +0,0 @@ -package mod.acgaming.spackenmobs.reg; -import mod.acgaming.spackenmobs.Spackenmobs; -import mod.acgaming.spackenmobs.entities.BiomeHelper; -import mod.acgaming.spackenmobs.entities.EntityApoRed; -import mod.acgaming.spackenmobs.entities.EntityDrachenlord; -import mod.acgaming.spackenmobs.entities.EntityIslamist; -import mod.acgaming.spackenmobs.entities.EntityJens; -import mod.acgaming.spackenmobs.entities.EntityMarcellDAvis; -import mod.acgaming.spackenmobs.entities.EntityMrBean; -import mod.acgaming.spackenmobs.entities.EntitySchalker; -import mod.acgaming.spackenmobs.entities.EntitySmavaCreeper; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.EnumCreatureType; -import net.minecraft.entity.monster.EntityCreeper; -import net.minecraft.entity.monster.EntityPigZombie; -import net.minecraft.entity.monster.EntityShulker; -import net.minecraft.entity.monster.EntitySkeleton; -import net.minecraft.entity.monster.EntityZombie; -import net.minecraft.entity.passive.EntityPig; -import net.minecraft.item.Item; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.SoundEvent; -import net.minecraftforge.event.RegistryEvent.Register; -import net.minecraftforge.fml.common.Mod.EventBusSubscriber; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.registry.EntityEntry; -import net.minecraftforge.fml.common.registry.EntityRegistry; - -@EventBusSubscriber(modid = Spackenmobs.MODID) -public class RegHandler -{ - @SubscribeEvent - public static void registerItems(Register event) - { - final Item[] items = { - new Item().setRegistryName(Spackenmobs.MODID, "ram").setUnlocalizedName(Spackenmobs.MODID + "." + "ram").setCreativeTab(CreativeTabs.MISC), - new Item().setRegistryName(Spackenmobs.MODID, "ram_on_a_stick").setUnlocalizedName(Spackenmobs.MODID + "." + "ram_on_a_stick").setCreativeTab(CreativeTabs.MISC), - new Item().setRegistryName(Spackenmobs.MODID, "surstroemming").setUnlocalizedName(Spackenmobs.MODID + "." + "surstroemming").setCreativeTab(CreativeTabs.MISC) - }; - event.getRegistry().registerAll(items); - } - - @SubscribeEvent - public static void registerEntities(Register event) - { - int id = 1; - - // Smava Creeper - EntityRegistry.registerModEntity(new ResourceLocation("spackenmobs:smava_creeper"), EntitySmavaCreeper.class, "smava_creeper", id++, Spackenmobs.instance, 64, 1, true, 7649828, 11053224); - EntityRegistry.addSpawn(EntitySmavaCreeper.class, 25, 1, 4, EnumCreatureType.MONSTER, BiomeHelper.getBiomesWithMonster(EntityCreeper.class)); - - // Marcell D'Avis - EntityRegistry.registerModEntity(new ResourceLocation("spackenmobs:marcell_davis"), EntityMarcellDAvis.class, "marcell_davis", id++, Spackenmobs.instance, 64, 1, true, 15759, 16777215); - EntityRegistry.addSpawn(EntityMarcellDAvis.class, 50, 1, 4, EnumCreatureType.MONSTER, BiomeHelper.getBiomesWithMonster(EntityZombie.class)); - - // Islamist - EntityRegistry.registerModEntity(new ResourceLocation("spackenmobs:islamist"), EntityIslamist.class, "islamist", id++, Spackenmobs.instance, 64, 1, true, 15263976, 15211548); - EntityRegistry.addSpawn(EntityIslamist.class, 50, 1, 4, EnumCreatureType.MONSTER, BiomeHelper.getBiomesWithMonster(EntityCreeper.class)); - - // ApoRed - EntityRegistry.registerModEntity(new ResourceLocation("spackenmobs:apored"), EntityApoRed.class, "apored", id++, Spackenmobs.instance, 64, 1, true, 2039583, 16711680); - EntityRegistry.addSpawn(EntityApoRed.class, 50, 1, 4, EnumCreatureType.MONSTER, BiomeHelper.getBiomesWithMonster(EntitySkeleton.class)); - - // Mr. Bean - EntityRegistry.registerModEntity(new ResourceLocation("spackenmobs:mr_bean"), EntityMrBean.class, "mr_bean", id++, Spackenmobs.instance, 64, 1, true, 4802350, 3220238); - EntityRegistry.addSpawn(EntityMrBean.class, 50, 1, 4, EnumCreatureType.MONSTER, BiomeHelper.getBiomesWithMonster(EntityZombie.class)); - - // Drachenlord - EntityRegistry.registerModEntity(new ResourceLocation("spackenmobs:drachenlord"), EntityDrachenlord.class, "drachenlord", id++, Spackenmobs.instance, 64, 1, true, 15256745, 8738878); - EntityRegistry.addSpawn(EntityDrachenlord.class, 50, 1, 4, EnumCreatureType.MONSTER, BiomeHelper.getBiomesWithMonster(EntityPigZombie.class)); - - // Schalker - EntityRegistry.registerModEntity(new ResourceLocation("spackenmobs:schalker"), EntitySchalker.class, "schalker", id++, Spackenmobs.instance, 64, 1, true, 24745, 16777215); - EntityRegistry.addSpawn(EntitySchalker.class, 50, 1, 4, EnumCreatureType.MONSTER, BiomeHelper.getBiomesWithMonster(EntityShulker.class)); - - // Jens - EntityRegistry.registerModEntity(new ResourceLocation("spackenmobs:jens"), EntityJens.class, "jens", id++, Spackenmobs.instance, 64, 1, true, 6704526, 6767911); - EntityRegistry.addSpawn(EntityJens.class, 50, 1, 4, EnumCreatureType.CREATURE, BiomeHelper.getBiomesWithCreature(EntityPig.class)); - - //LootTableList.register(EntityJens.LOOT); - } - - @SubscribeEvent - public static void registerSounds(Register event) - { - // Smava Creeper - Spackenmobs.ENTITY_SMAVACREEPER_FUSE.setRegistryName(new ResourceLocation("spackenmobs:entities.smava_creeper.fuse")); - event.getRegistry().register((SoundEvent)Spackenmobs.ENTITY_SMAVACREEPER_FUSE); - Spackenmobs.ENTITY_SMAVACREEPER_BLOW.setRegistryName(new ResourceLocation("spackenmobs:entities.smava_creeper.blow")); - event.getRegistry().register((SoundEvent)Spackenmobs.ENTITY_SMAVACREEPER_BLOW); - Spackenmobs.ENTITY_SMAVACREEPER_HURT.setRegistryName(new ResourceLocation("spackenmobs:entities.smava_creeper.hurt")); - event.getRegistry().register((SoundEvent)Spackenmobs.ENTITY_SMAVACREEPER_HURT); - Spackenmobs.ENTITY_SMAVACREEPER_AMBIENT.setRegistryName(new ResourceLocation("spackenmobs:entities.smava_creeper.ambient")); - event.getRegistry().register((SoundEvent)Spackenmobs.ENTITY_SMAVACREEPER_AMBIENT); - - // Islamist - Spackenmobs.ENTITY_ISLAMIST_FUSE.setRegistryName(new ResourceLocation("spackenmobs:entities.islamist.fuse")); - event.getRegistry().register((SoundEvent)Spackenmobs.ENTITY_ISLAMIST_FUSE); - Spackenmobs.ENTITY_ISLAMIST_HURT.setRegistryName(new ResourceLocation("spackenmobs:entities.islamist.hurt")); - event.getRegistry().register((SoundEvent)Spackenmobs.ENTITY_ISLAMIST_HURT); - - // Marcell D'Avis - Spackenmobs.ENTITY_MARCELLDAVIS_AMBIENT.setRegistryName(new ResourceLocation("spackenmobs:entities.marcell_davis.ambient")); - event.getRegistry().register((SoundEvent)Spackenmobs.ENTITY_MARCELLDAVIS_AMBIENT); - Spackenmobs.ENTITY_MARCELLDAVIS_HURT.setRegistryName(new ResourceLocation("spackenmobs:entities.marcell_davis.hurt")); - event.getRegistry().register((SoundEvent)Spackenmobs.ENTITY_MARCELLDAVIS_HURT); - Spackenmobs.ENTITY_MARCELLDAVIS_DEATH.setRegistryName(new ResourceLocation("spackenmobs:entities.marcell_davis.death")); - event.getRegistry().register((SoundEvent)Spackenmobs.ENTITY_MARCELLDAVIS_DEATH); - - // Mr. Bean - Spackenmobs.ENTITY_MRBEAN_AMBIENT.setRegistryName(new ResourceLocation("spackenmobs:entities.mr_bean.ambient")); - event.getRegistry().register((SoundEvent)Spackenmobs.ENTITY_MRBEAN_AMBIENT); - Spackenmobs.ENTITY_MRBEAN_HURT.setRegistryName(new ResourceLocation("spackenmobs:entities.mr_bean.hurt")); - event.getRegistry().register((SoundEvent)Spackenmobs.ENTITY_MRBEAN_HURT); - Spackenmobs.ENTITY_MRBEAN_DEATH.setRegistryName(new ResourceLocation("spackenmobs:entities.mr_bean.death")); - event.getRegistry().register((SoundEvent)Spackenmobs.ENTITY_MRBEAN_DEATH); - - // ApoRed - Spackenmobs.ENTITY_APORED_AMBIENT.setRegistryName(new ResourceLocation("spackenmobs:entities.apored.ambient")); - event.getRegistry().register((SoundEvent)Spackenmobs.ENTITY_APORED_AMBIENT); - Spackenmobs.ENTITY_APORED_HURT.setRegistryName(new ResourceLocation("spackenmobs:entities.apored.hurt")); - event.getRegistry().register((SoundEvent)Spackenmobs.ENTITY_APORED_HURT); - Spackenmobs.ENTITY_APORED_DEATH.setRegistryName(new ResourceLocation("spackenmobs:entities.apored.death")); - event.getRegistry().register((SoundEvent)Spackenmobs.ENTITY_APORED_DEATH); - - // Drachenlord - Spackenmobs.ENTITY_DRACHENLORD_AMBIENT.setRegistryName(new ResourceLocation("spackenmobs:entities.drachenlord.ambient")); - event.getRegistry().register((SoundEvent)Spackenmobs.ENTITY_DRACHENLORD_AMBIENT); - Spackenmobs.ENTITY_DRACHENLORD_HURT.setRegistryName(new ResourceLocation("spackenmobs:entities.drachenlord.hurt")); - event.getRegistry().register((SoundEvent)Spackenmobs.ENTITY_DRACHENLORD_HURT); - Spackenmobs.ENTITY_DRACHENLORD_DEATH.setRegistryName(new ResourceLocation("spackenmobs:entities.drachenlord.death")); - event.getRegistry().register((SoundEvent)Spackenmobs.ENTITY_DRACHENLORD_DEATH); - Spackenmobs.ENTITY_DRACHENLORD_ANGRY.setRegistryName(new ResourceLocation("spackenmobs:entities.drachenlord.angry")); - event.getRegistry().register((SoundEvent)Spackenmobs.ENTITY_DRACHENLORD_ANGRY); - - // Schalker - Spackenmobs.ENTITY_SCHALKER_AMBIENT.setRegistryName(new ResourceLocation("spackenmobs:entities.schalker.ambient")); - event.getRegistry().register((SoundEvent)Spackenmobs.ENTITY_SCHALKER_AMBIENT); - Spackenmobs.ENTITY_SCHALKER_HURT.setRegistryName(new ResourceLocation("spackenmobs:entities.schalker.hurt")); - event.getRegistry().register((SoundEvent)Spackenmobs.ENTITY_SCHALKER_HURT); - Spackenmobs.ENTITY_SCHALKER_DEATH.setRegistryName(new ResourceLocation("spackenmobs:entities.schalker.death")); - event.getRegistry().register((SoundEvent)Spackenmobs.ENTITY_SCHALKER_DEATH); - Spackenmobs.ENTITY_SCHALKER_OPEN.setRegistryName(new ResourceLocation("spackenmobs:entities.schalker.open")); - event.getRegistry().register((SoundEvent)Spackenmobs.ENTITY_SCHALKER_OPEN); - Spackenmobs.ENTITY_SCHALKER_SHOOT.setRegistryName(new ResourceLocation("spackenmobs:entities.schalker.shoot")); - event.getRegistry().register((SoundEvent)Spackenmobs.ENTITY_SCHALKER_SHOOT); - - // Jens - Spackenmobs.ENTITY_JENS_AMBIENT.setRegistryName(new ResourceLocation("spackenmobs:entities.jens.ambient")); - event.getRegistry().register((SoundEvent)Spackenmobs.ENTITY_JENS_AMBIENT); - Spackenmobs.ENTITY_JENS_HURT.setRegistryName(new ResourceLocation("spackenmobs:entities.jens.hurt")); - event.getRegistry().register((SoundEvent)Spackenmobs.ENTITY_JENS_HURT); - Spackenmobs.ENTITY_JENS_DEATH.setRegistryName(new ResourceLocation("spackenmobs:entities.jens.death")); - 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); - } -} \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/render/ModelSchalker.java b/src/main/java/mod/acgaming/spackenmobs/render/ModelSchalker.java new file mode 100644 index 0000000..bc5f8a2 --- /dev/null +++ b/src/main/java/mod/acgaming/spackenmobs/render/ModelSchalker.java @@ -0,0 +1,66 @@ +package mod.acgaming.spackenmobs.render; + +import mod.acgaming.spackenmobs.entities.EntitySchalker; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.util.math.MathHelper; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class ModelSchalker extends ModelBase +{ + public final ModelRenderer base; + public final ModelRenderer lid; + public ModelRenderer head; + + public ModelSchalker() + { + this.textureHeight = 64; + this.textureWidth = 64; + this.lid = new ModelRenderer(this); + this.base = new ModelRenderer(this); + this.head = new ModelRenderer(this); + this.lid.setTextureOffset(0, 0).addBox(-8.0F, -16.0F, -8.0F, 16, 12, 16); + this.lid.setRotationPoint(0.0F, 24.0F, 0.0F); + this.base.setTextureOffset(0, 28).addBox(-8.0F, -8.0F, -8.0F, 16, 8, 16); + this.base.setRotationPoint(0.0F, 24.0F, 0.0F); + this.head.setTextureOffset(0, 52).addBox(-3.0F, 0.0F, -3.0F, 6, 6, 6); + this.head.setRotationPoint(0.0F, 12.0F, 0.0F); + } + + public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) + { + EntitySchalker EntitySchalker = (EntitySchalker)entityIn; + float f = ageInTicks - (float)EntitySchalker.ticksExisted; + float f1 = (0.5F + EntitySchalker.getClientPeekAmount(f)) * (float)Math.PI; + float f2 = -1.0F + MathHelper.sin(f1); + float f3 = 0.0F; + + if (f1 > (float)Math.PI) + { + f3 = MathHelper.sin(ageInTicks * 0.1F) * 0.7F; + } + + this.lid.setRotationPoint(0.0F, 16.0F + MathHelper.sin(f1) * 8.0F + f3, 0.0F); + + if (EntitySchalker.getClientPeekAmount(f) > 0.3F) + { + this.lid.rotateAngleY = f2 * f2 * f2 * f2 * (float)Math.PI * 0.125F; + } + else + { + this.lid.rotateAngleY = 0.0F; + } + + this.head.rotateAngleX = headPitch * 0.017453292F; + this.head.rotateAngleY = netHeadYaw * 0.017453292F; + } + + public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) + { + this.base.render(scale); + this.lid.render(scale); + } +} \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/render/RenderHolzstammhuhn.java b/src/main/java/mod/acgaming/spackenmobs/render/RenderHolzstammhuhn.java new file mode 100644 index 0000000..a481a2a --- /dev/null +++ b/src/main/java/mod/acgaming/spackenmobs/render/RenderHolzstammhuhn.java @@ -0,0 +1,36 @@ +package mod.acgaming.spackenmobs.render; +import mod.acgaming.spackenmobs.entities.EntityHolzstammhuhn; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.client.renderer.entity.RenderChicken; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.entity.passive.EntityChicken; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.client.registry.IRenderFactory; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class RenderHolzstammhuhn extends RenderChicken +{ + private static final ResourceLocation HOLZSTAMMHUHN_TEXTURE = new ResourceLocation("spackenmobs:textures/entities/holzstammhuhn.png"); + public static final Factory FACTORY = new Factory(); + + public RenderHolzstammhuhn(RenderManager renderManagerIn) + { + super(renderManagerIn); + } + + protected ResourceLocation getEntityTexture(EntityChicken entity) + { + return HOLZSTAMMHUHN_TEXTURE; + } + + public static class Factory implements IRenderFactory + { + @Override + public Render createRenderFor(RenderManager manager) + { + return new RenderHolzstammhuhn(manager); + } + } +} \ No newline at end of file diff --git a/src/main/java/mod/acgaming/spackenmobs/render/RenderJens.java b/src/main/java/mod/acgaming/spackenmobs/render/RenderJens.java index 597c31b..3673e10 100644 --- a/src/main/java/mod/acgaming/spackenmobs/render/RenderJens.java +++ b/src/main/java/mod/acgaming/spackenmobs/render/RenderJens.java @@ -25,7 +25,7 @@ public class RenderJens extends RenderBiped return JENS_TEXTURE; } - public static class Factory implements IRenderFactory + private static class Factory implements IRenderFactory { @Override public Render createRenderFor(RenderManager manager) diff --git a/src/main/java/mod/acgaming/spackenmobs/render/RenderSchalker.java b/src/main/java/mod/acgaming/spackenmobs/render/RenderSchalker.java index 2589bc2..7a6bbac 100644 --- a/src/main/java/mod/acgaming/spackenmobs/render/RenderSchalker.java +++ b/src/main/java/mod/acgaming/spackenmobs/render/RenderSchalker.java @@ -1,7 +1,6 @@ package mod.acgaming.spackenmobs.render; import mod.acgaming.spackenmobs.entities.EntitySchalker; import net.minecraft.client.model.ModelRenderer; -import net.minecraft.client.model.ModelShulker; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.culling.ICamera; import net.minecraft.client.renderer.entity.Render; @@ -24,13 +23,13 @@ public class RenderSchalker extends RenderLiving public RenderSchalker(RenderManager p_i47194_1_) { - super(p_i47194_1_, new ModelShulker(), 0.0F); + super(p_i47194_1_, new ModelSchalker(), 0.0F); this.addLayer(new RenderSchalker.HeadLayer()); } - public ModelShulker getMainModel() + public ModelSchalker getMainModel() { - return (ModelShulker)super.getMainModel(); + return (ModelSchalker)super.getMainModel(); } public void doRender(EntitySchalker entity, double x, double y, double z, float entityYaw, float partialTicks) diff --git a/src/main/java/mod/acgaming/spackenmobs/render/RenderWolfMZTE.java b/src/main/java/mod/acgaming/spackenmobs/render/RenderWolfMZTE.java new file mode 100644 index 0000000..6d4f0fe --- /dev/null +++ b/src/main/java/mod/acgaming/spackenmobs/render/RenderWolfMZTE.java @@ -0,0 +1,64 @@ +package mod.acgaming.spackenmobs.render; +import mod.acgaming.spackenmobs.entities.EntityWolfMZTE; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.renderer.entity.RenderWolf; +import net.minecraft.client.renderer.entity.layers.LayerWolfCollar; +import net.minecraft.entity.passive.EntityWolf; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.client.registry.IRenderFactory; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class RenderWolfMZTE extends RenderWolf +{ + private static final ResourceLocation WOLFMZTE_TEXTURE = new ResourceLocation("spackenmobs:textures/entities/wolfmzte.png"); + private static final ResourceLocation TAMED_WOLFMZTE_TEXTURE = new ResourceLocation("spackenmobs:textures/entities/wolfmzte_tame.png"); + private static final ResourceLocation ANRGY_WOLFMZTE_TEXTURE = new ResourceLocation("spackenmobs:textures/entities/wolfmzte_angry.png"); + public static final Factory FACTORY = new Factory(); + + public RenderWolfMZTE(RenderManager renderManagerIn) + { + super(renderManagerIn); + this.addLayer(new LayerWolfCollar(this)); + } + + protected float handleRotationFloat(EntityWolf livingBase, float partialTicks) + { + return livingBase.getTailRotation(); + } + + public void doRender(EntityWolf entity, double x, double y, double z, float entityYaw, float partialTicks) + { + if (entity.isWolfWet()) + { + float f = entity.getBrightness() * entity.getShadingWhileWet(partialTicks); + GlStateManager.color(f, f, f); + } + + super.doRender(entity, x, y, z, entityYaw, partialTicks); + } + + protected ResourceLocation getEntityTexture(EntityWolf entity) + { + if (entity.isTamed()) + { + return TAMED_WOLFMZTE_TEXTURE; + } + else + { + return entity.isAngry() ? ANRGY_WOLFMZTE_TEXTURE : WOLFMZTE_TEXTURE; + } + } + + public static class Factory implements IRenderFactory + { + @Override + public Render createRenderFor(RenderManager manager) + { + return new RenderWolfMZTE(manager); + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/spackenmobs/lang/de_de.lang b/src/main/resources/assets/spackenmobs/lang/de_de.lang index fe94a67..cc3e053 100644 --- a/src/main/resources/assets/spackenmobs/lang/de_de.lang +++ b/src/main/resources/assets/spackenmobs/lang/de_de.lang @@ -6,6 +6,8 @@ entity.mr_bean.name=Mr. Bean entity.drachenlord.name=Drachenlord entity.schalker.name=Schalker entity.jens.name=Jens +entity.wolfmzte.name=WolfMZTE +entity.holzstammhuhn.name=Holzstammhuhn item.spackenmobs.ram.name=RAM item.spackenmobs.ram_on_a_stick.name=RAM-Rute item.spackenmobs.surstroemming.name=Surströmming \ No newline at end of file diff --git a/src/main/resources/assets/spackenmobs/lang/en_us.lang b/src/main/resources/assets/spackenmobs/lang/en_us.lang index 64baa44..266c989 100644 --- a/src/main/resources/assets/spackenmobs/lang/en_us.lang +++ b/src/main/resources/assets/spackenmobs/lang/en_us.lang @@ -6,6 +6,8 @@ entity.mr_bean.name=Mr. Bean entity.drachenlord.name=Drachenlord entity.schalker.name=Schalker entity.jens.name=Jens +entity.wolfmzte.name=WolfMZTE +entity.holzstammhuhn.name=Holzstammhuhn item.spackenmobs.ram.name=RAM item.spackenmobs.ram_on_a_stick.name=RAM on a Stick item.spackenmobs.surstroemming.name=Surströmming \ No newline at end of file diff --git a/src/main/resources/assets/spackenmobs/textures/entities/holzstammhuhn.png b/src/main/resources/assets/spackenmobs/textures/entities/holzstammhuhn.png new file mode 100644 index 0000000..5ffc425 Binary files /dev/null and b/src/main/resources/assets/spackenmobs/textures/entities/holzstammhuhn.png differ diff --git a/src/main/resources/assets/spackenmobs/textures/entities/wolfmzte.png b/src/main/resources/assets/spackenmobs/textures/entities/wolfmzte.png new file mode 100644 index 0000000..f82846b Binary files /dev/null and b/src/main/resources/assets/spackenmobs/textures/entities/wolfmzte.png differ diff --git a/src/main/resources/assets/spackenmobs/textures/entities/wolfmzte_angry.png b/src/main/resources/assets/spackenmobs/textures/entities/wolfmzte_angry.png new file mode 100644 index 0000000..451c1b7 Binary files /dev/null and b/src/main/resources/assets/spackenmobs/textures/entities/wolfmzte_angry.png differ diff --git a/src/main/resources/assets/spackenmobs/textures/entities/wolfmzte_tame.png b/src/main/resources/assets/spackenmobs/textures/entities/wolfmzte_tame.png new file mode 100644 index 0000000..606fa53 Binary files /dev/null and b/src/main/resources/assets/spackenmobs/textures/entities/wolfmzte_tame.png differ