2
0
Fork 0

Adding Staff of Saruman the White

main
Shinare 7 months ago
parent efd5330272
commit e075550beb

@ -285,6 +285,7 @@ public class CinderLoE {
public static Item pallandoStaff;
public static Item alatarStaff;
public static Item sarumanStaff;
public static Item sarumanWhiteStaff;
// Relics
public static Item welfRelic;
@ -379,6 +380,7 @@ public class CinderLoE {
//Misc
EntityRegistry.registerModEntity(EntityWarDart.class, "WarDart", (entityID + 44), this, 64, 1, true);
EntityRegistry.registerModEntity(SarumanFireball.class, "SarumanFireball", entityID + 0, this, 64, 10, true);
EntityRegistry.registerModEntity(SarumanWhiteFireball.class, "SarumanWhiteFireball", entityID + 61, this, 64, 10, true);
EntityRegistry.registerModEntity(LOTREntitySauron.class, "LOTREntitySauron", (entityID + 28), this, 64, 1, true);
EntityRegistry.registerModEntity(UtumnoSlaveTrader.class, "UtumnoSlaveTrader", (entityID + 30), this, 64, 1, true);
@ -555,6 +557,7 @@ public class CinderLoE {
pallandoStaff = (new PallandoStaff()).setUnlocalizedName("lotr:pallandoStaff").setTextureName("lotr:pallandoStaff");
alatarStaff = (new AlatarStaff()).setUnlocalizedName("lotr:alatarStaff").setTextureName("lotr:alatarStaff");
sarumanStaff = (new SarumanStaff()).setUnlocalizedName("lotr:sarumanStaff").setTextureName("lotr:sarumanStaff");
sarumanWhiteStaff = (new SarumanWhiteStaff()).setUnlocalizedName("lotr:sarumanWhiteStaff").setTextureName("lotr:sarumanStaff");
// Relics
welfRelic = (new WoodElfRelic()).setUnlocalizedName("lotr:welfRelic").setTextureName("lotr:welfRelic");
unitLevelTool = (new unitLevelTool()).setUnlocalizedName("lotr:unitLevelTool").setTextureName("stick");
@ -621,11 +624,13 @@ public class CinderLoE {
ItemRegistration.register(pallandoStaff, "pallandoStaff", 6701);
ItemRegistration.register(alatarStaff, "alatarStaff", 6702);
ItemRegistration.register(sarumanStaff, "sarumanStaff", 6703);
ItemRegistration.register(sarumanWhiteStaff, "sarumanWhiteStaff", 6705);
linkLOTRWeapon(radagastStaff, "radagastStaff");
linkLOTRWeapon(pallandoStaff, "pallandoStaff");
linkLOTRWeapon(alatarStaff, "alatarStaff");
linkLOTRWeapon(sarumanStaff, "sarumanStaff");
linkLOTRWeapon(sarumanWhiteStaff, "sarumanWhiteStaff");
//Relics
ItemRegistration.register(welfRelic, "welfRelic", 6704);
@ -961,6 +966,7 @@ public class CinderLoE {
RenderingRegistry.registerEntityRenderingHandler(CorruptSkeletonArcher.class, new RenderCorruptSkeleton());
RenderingRegistry.registerEntityRenderingHandler(SarumanFireball.class, new RenderSarumanFireball());
RenderingRegistry.registerEntityRenderingHandler(SarumanWhiteFireball.class, new RenderSarumanWhiteFireball());
RenderingRegistry.registerEntityRenderingHandler(Renegade.class, new RenderRenegade());
RenderingRegistry.registerEntityRenderingHandler(RenegadeCaptain.class, new RenderRenegade());
RenderingRegistry.registerEntityRenderingHandler(Wraith.class, new RenderWraith());
@ -1192,6 +1198,7 @@ public class CinderLoE {
CinderCore.registerItemFallback(Item.getIdFromItem(pallandoStaff), Item.getIdFromItem(LOTRMod.gandalfStaffWhite), "cinder_loe", "1.0");
CinderCore.registerItemFallback(Item.getIdFromItem(alatarStaff), Item.getIdFromItem(LOTRMod.gandalfStaffWhite), "cinder_loe", "1.0");
CinderCore.registerItemFallback(Item.getIdFromItem(sarumanStaff), Item.getIdFromItem(LOTRMod.gandalfStaffWhite), "cinder_loe", "1.0");
CinderCore.registerItemFallback(Item.getIdFromItem(sarumanWhiteStaff), Item.getIdFromItem(LOTRMod.gandalfStaffWhite), "cinder_loe", "1.4");
// == Relics ==
CinderCore.registerItemFallback(Item.getIdFromItem(welfRelic), Item.getIdFromItem(LOTRMod.rhinoHorn), "cinder_loe", "1.2");
// == Specials ==
@ -1263,6 +1270,7 @@ public class CinderLoE {
CinderCore.registerEntityFallback(CorruptOrc.class, LOTREntityGundabadOrc.class, "cinder_loe", "1.2.3");
CinderCore.registerEntityFallback(SarumanFireball.class, LOTREntityGandalfFireball.class, "cinder_loe", "1.0");
CinderCore.registerEntityFallback(SarumanWhiteFireball.class, LOTREntityGandalfFireball.class, "cinder_loe", "1.4");
CinderCore.registerEntityFallback(Renegade.class, LOTREntityBandit.class, "cinder_loe", "1.0");
CinderCore.registerEntityFallback(RenegadeCaptain.class, LOTREntityBandit.class, "cinder_loe", "1.1");
CinderCore.registerEntityFallback(Wraith.class, LOTREntityMarshWraith.class, "cinder_loe", "1.0");

@ -0,0 +1,50 @@
package com.zivilon.cinder_loe.client.render;
import lotr.client.LOTRClientProxy;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import com.zivilon.cinder_loe.entity.SarumanWhiteFireball;
public class RenderSarumanWhiteFireball extends Render {
public static final ResourceLocation particlesTexture = new ResourceLocation("cinder_loe:misc/particles.png");
protected ResourceLocation getEntityTexture(Entity entity) {
return particlesTexture;
}
public void doRender(Entity entity, double d, double d1, double d2, float f, float f1) {
GL11.glPushMatrix();
GL11.glTranslatef((float)d, (float)d1, (float)d2);
GL11.glEnable(32826);
bindEntityTexture(entity);
Tessellator tessellator = Tessellator.instance;
drawSprite(tessellator, 32 + ((SarumanWhiteFireball)entity).animationTick);
GL11.glDisable(32826);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glPopMatrix();
}
private void drawSprite(Tessellator tessellator, int index) {
float f = (index % 8 * 16 + 0) / 128.0F;
float f1 = (index % 8 * 16 + 16) / 128.0F;
float f2 = (index / 8 * 16 + 0) / 128.0F;
float f3 = (index / 8 * 16 + 16) / 128.0F;
float f4 = 1.0F;
float f5 = 0.5F;
float f6 = 0.25F;
GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
tessellator.setBrightness(15728880);
tessellator.addVertexWithUV((0.0F - f5), (0.0F - f6), 0.0D, f, f3);
tessellator.addVertexWithUV((f4 - f5), (0.0F - f6), 0.0D, f1, f3);
tessellator.addVertexWithUV((f4 - f5), (f4 - f6), 0.0D, f1, f2);
tessellator.addVertexWithUV((0.0F - f5), (f4 - f6), 0.0D, f, f2);
tessellator.draw();
}
}

@ -20,7 +20,7 @@ public class LOTRWeaponLinker implements IClassTransformer {
// Can add any number of items, append with comma
return addLinks(basicClass,
"spearRedDwarf", "crossbowRedDwarf", "swordRedDwarf", "battleaxeRedDwarf", "pikeRedDwarf", "daggerRedDwarf", "daggerRedDwarfPoisoned", "hammerRedDwarf",
"radagastStaff", "alatarStaff", "pallandoStaff", "sarumanStaff", "maceWarlord",
"radagastStaff", "alatarStaff", "pallandoStaff", "sarumanStaff", "maceWarlord", "sarumanWhiteStaff",
"spearLimwaith", "tridentLimwaith", "daggerLimwaith", "daggerLimwaithPoisoned", "truncheonLimwaith", "battleaxeLimwaith", "blowgunLimwaith",
"frostblade", "spearsolidgold", "whip", "spearUnnamed", "welfRelic", "daggerVoid",
"swordBree",

@ -0,0 +1,92 @@
package com.zivilon.cinder_loe.entity;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import lotr.common.LOTRLevelData;
import lotr.common.LOTRMod;
import lotr.common.entity.npc.LOTREntityNPC;
import lotr.common.entity.animal.LOTREntityHorse;
import lotr.common.entity.projectile.LOTREntityGandalfFireball;
import lotr.common.fac.LOTRFaction;
import lotr.common.network.LOTRPacketHandler;
import lotr.common.network.LOTRPacketWeaponFX;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.IAttributeInstance;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.List;
public class SarumanWhiteFireball extends LOTREntityGandalfFireball {
public SarumanWhiteFireball(World world) {
super(world);
}
public SarumanWhiteFireball(World world, EntityLivingBase entityliving) {
super(world, entityliving);
}
public SarumanWhiteFireball(World world, double d, double d1, double d2) {
super(world, d, d1, d2);
}
protected void onImpact(MovingObjectPosition m) {
if (!this.worldObj.isRemote)
if (m.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
explode((Entity)null);
} else if (m.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY) {
Entity entity = m.entityHit;
if (isEntityVulnerable(entity))
explode(entity);
}
}
private void explode(Entity target) {
if (this.worldObj.isRemote)
return;
this.worldObj.playSoundAtEntity((Entity)this, "lotr:item.gandalfFireball", 4.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
LOTRPacketWeaponFX packet = new LOTRPacketWeaponFX(LOTRPacketWeaponFX.Type.MACE_SAURON, (Entity)this);
LOTRPacketHandler.networkWrapper.sendToAllAround((IMessage)packet, LOTRPacketHandler.nearEntity((Entity)this, 64.0D));
if (target != null && isEntityVulnerable(target))
target.attackEntityFrom(DamageSource.causeMobDamage(getThrower()), 10.0F);
List<EntityLivingBase> entities = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, this.boundingBox.expand(6.0D, 6.0D, 6.0D));
if (!entities.isEmpty())
for (int i = 0; i < entities.size(); i++) {
EntityLivingBase entity = entities.get(i);
if (entity != target && isEntityVulnerable((Entity)entity)) {
float damage = 10.0F - getDistanceToEntity((Entity)entity) * 0.5F;
if (damage > 0.0F)
entity.attackEntityFrom(DamageSource.causeMobDamage(getThrower()), damage);
}
}
setDead();
}
private boolean isEntityVulnerable(Entity entity) {
if (entity == getThrower())
return false;
if (!(entity instanceof EntityLivingBase))
return false;
if (entity instanceof EntityPlayer)
return (LOTRLevelData.getData((EntityPlayer)entity).getAlignment(LOTRFaction.HIGH_ELF) < 0.0F);
return !LOTRFaction.HIGH_ELF.isGoodRelation(LOTRMod.getNPCFaction(entity));
}
protected float func_70182_d() {
return 1.5F;
}
protected float getGravityVelocity() {
return 0.0F;
}
}

@ -0,0 +1,46 @@
package com.zivilon.cinder_loe.items;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import java.util.List;
import lotr.common.LOTRCreativeTabs;
import lotr.common.LOTRLevelData;
import lotr.common.LOTRMod;
import lotr.common.fac.LOTRFaction;
import lotr.common.network.LOTRPacketHandler;
import lotr.common.network.LOTRPacketWeaponFX;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect;
import net.minecraft.potion.Potion;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import com.zivilon.cinder_loe.items.WizardStaff;
import com.zivilon.cinder_loe.entity.SarumanWhiteFireball;
public class SarumanWhiteStaff extends WizardStaff {
public SarumanWhiteStaff() {
super();
}
public ItemStack onEaten(ItemStack itemstack, World world, EntityPlayer entityplayer) {
entityplayer.swingItem();
itemstack.damageItem(2, (EntityLivingBase)entityplayer);
world.playSoundAtEntity((Entity)entityplayer, "mob.ghast.fireball", 2.0F, (itemRand.nextFloat() - itemRand.nextFloat()) * 0.2F + 1.0F);
if (!world.isRemote) {
world.spawnEntityInWorld((Entity)new SarumanWhiteFireball(world, (EntityLivingBase)entityplayer));
LOTRPacketWeaponFX packet = new LOTRPacketWeaponFX(LOTRPacketWeaponFX.Type.MACE_SAURON, (Entity)entityplayer);
LOTRPacketHandler.networkWrapper.sendToAllAround((IMessage)packet, LOTRPacketHandler.nearEntity((Entity)entityplayer, 64.0D));
}
return itemstack;
}
}

@ -201,8 +201,6 @@ public abstract class MixinEntityLivingBase extends Entity {
private void check_cauldron() {
try {
Class<?> target_class = EntityLivingBase.class;
while (target_class != null) {
Method[] methods = target_class.getDeclaredMethods();
for (Method method : methods) {
@ -211,13 +209,12 @@ public abstract class MixinEntityLivingBase extends Entity {
return;
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return;
}
}
@Dynamic
public boolean entitydamage_cauldron(DamageSource source, float damage) {

@ -1,2 +1,3 @@
item.lotr:sarumanStaff.name=Staff of Saruman of Many Colours
item.lotr:sarumanWhiteStaff.name=Staff of Saruman the White
item.lotr:boarArmorRedDwarf.name=Red Dwarven Boar Armour

@ -102,6 +102,7 @@ item.lotr:radagastStaff.name=Staff of Radagast the Brown
item.lotr:pallandoStaff.name=Staff of Pallando the Blue
item.lotr:alatarStaff.name=Staff of Alatar the Blue
item.lotr:sarumanStaff.name=Staff of Saruman of Many Colors
item.lotr:sarumanWhiteStaff.name=Staff of Saruman the White
item.lotr:welfRelic.name=Horn of the Greenwood Stag

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Loading…
Cancel
Save