mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-20 12:19:55 +00:00
Merge pull request #1592 from hilburn/master
Unique Wither Skeleton Entity
This commit is contained in:
commit
1101a8073f
6 files changed
+103
-1
No files matched your search
@@ -6,6 +6,7 @@ import java.io.FileWriter;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
|
||||
import crazypants.enderio.entity.SkeletonHandler;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -564,6 +565,11 @@ public class EnderIO {
|
||||
ConduitBundledRedstoneProvider.register();
|
||||
}
|
||||
|
||||
if(Config.replaceWitherSkeletons)
|
||||
{
|
||||
SkeletonHandler.registerSkeleton(this);
|
||||
}
|
||||
|
||||
EnderfaceRecipes.addRecipes();
|
||||
MaterialRecipes.addRecipes();
|
||||
ConduitRecipes.addRecipes();
|
||||
|
||||
@@ -422,6 +422,8 @@ public final class Config {
|
||||
public static int enchantmentSoulBoundWeight = 1;
|
||||
public static boolean enchantmentSoulBoundEnabled = true;
|
||||
|
||||
public static boolean replaceWitherSkeletons = true;
|
||||
|
||||
|
||||
public static void load(FMLPreInitializationEvent event) {
|
||||
|
||||
@@ -1132,6 +1134,9 @@ public final class Config {
|
||||
enchantmentSoulBoundWeight = config.get("enchantmentSoulBoundWeight", sectionEnchantments.name, enchantmentSoulBoundWeight,
|
||||
"The chance of getting this enchantment in the enchantment table").getInt(enchantmentSoulBoundWeight);
|
||||
|
||||
|
||||
replaceWitherSkeletons = config.get("replaceWitherSkeletons", sectionMisc.name, replaceWitherSkeletons,
|
||||
"Separates wither and normal skeletons into different entities, enables the powered spawner to treat them differently [EXPERIMENTAL - MAY CAUSE ISSUES WITH OTHER MODS]").getBoolean();
|
||||
}
|
||||
|
||||
public static void postInit() {
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package crazypants.enderio.entity;
|
||||
|
||||
import net.minecraft.entity.IEntityLivingData;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.entity.monster.EntitySkeleton;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
public class EntityWitherSkeleton extends EntitySkeleton
|
||||
{
|
||||
public EntityWitherSkeleton(World world)
|
||||
{
|
||||
super(world);
|
||||
}
|
||||
|
||||
public EntityWitherSkeleton(EntitySkeleton entity)
|
||||
{
|
||||
this(entity.worldObj);
|
||||
this.copyLocationAndAnglesFrom(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFire(int p_70015_1_)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEntityLivingData onSpawnWithEgg(IEntityLivingData entityData)
|
||||
{
|
||||
this.getEntityAttribute(SharedMonsterAttributes.followRange).applyModifier(new AttributeModifier("Random spawn bonus", this.rand.nextGaussian() * 0.05D, 1));
|
||||
this.setSkeletonType(1);
|
||||
this.setCurrentItemOrArmor(0, new ItemStack(Items.stone_sword));
|
||||
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(4.0D);
|
||||
this.setCombatTask();
|
||||
this.setCanPickUpLoot(this.rand.nextFloat() < 0.55F * this.worldObj.func_147462_b(this.posX, this.posY, this.posZ));
|
||||
|
||||
if (this.getEquipmentInSlot(4) == null)
|
||||
{
|
||||
Calendar calendar = this.worldObj.getCurrentDate();
|
||||
|
||||
if (calendar.get(2) + 1 == 10 && calendar.get(5) == 31 && this.rand.nextFloat() < 0.25F)
|
||||
{
|
||||
this.setCurrentItemOrArmor(4, new ItemStack(this.rand.nextFloat() < 0.1F ? Blocks.lit_pumpkin : Blocks.pumpkin));
|
||||
this.equipmentDropChances[4] = 0.0F;
|
||||
}
|
||||
}
|
||||
|
||||
return entityData;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package crazypants.enderio.entity;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.EventPriority;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import net.minecraft.entity.monster.EntitySkeleton;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
||||
|
||||
public class SkeletonHandler
|
||||
{
|
||||
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||
public void skeletonJoinWorld(EntityJoinWorldEvent event)
|
||||
{
|
||||
if (event.entity.getClass() == EntitySkeleton.class && ((EntitySkeleton)event.entity).getSkeletonType()==1)
|
||||
{
|
||||
event.setCanceled(true);
|
||||
event.world.spawnEntityInWorld(new EntityWitherSkeleton((EntitySkeleton)event.entity));
|
||||
}
|
||||
}
|
||||
|
||||
public static void registerSkeleton(EnderIO mod)
|
||||
{
|
||||
int entityID = EntityRegistry.findGlobalUniqueEntityId();
|
||||
EntityRegistry.registerGlobalEntityID(EntityWitherSkeleton.class,"witherSkeleton", entityID, 0x00003D, 0x751947);
|
||||
EntityRegistry.registerModEntity(EntityWitherSkeleton.class,"witherSkeleton",entityID,mod,64,3,true);
|
||||
MinecraftForge.EVENT_BUS.register(new SkeletonHandler());
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user