2
0
Fork 0

mouth of sauron weapon fixed, and fixed some bugs

main
KeyLime17 4 months ago
parent ec0796ecc7
commit 7b0c5db301

@ -315,14 +315,16 @@ public class CinderEventHandler implements IFuelHandler {
// Isildurs chestplate handler // Isildurs chestplate handler
// Incoming damage from poison, drink poison (for lurtz bow, rip anyone who drinks a bad drink), or wither is doubled // Incoming damage from poison, drink poison (for lurtz bow, rip anyone who drinks a bad drink), or wither is doubled
if (event.entityLiving.worldObj.isRemote) return;
if (!(event.entityLiving instanceof EntityPlayerMP)) return;
EntityPlayerMP player = (EntityPlayerMP) event.entityLiving; EntityPlayerMP player = (EntityPlayerMP) event.entityLiving;
ItemStack chest = player.getEquipmentInSlot(2); ItemStack chest = player.getEquipmentInSlot(2);
if (chest == null || chest.getItem() != CinderLoE.bodyIsildur) return; if (chest == null || chest.getItem() != CinderLoE.bodyIsildur) return;
boolean isPoison = player.isPotionActive(Potion.poison.id); boolean isDrinkPoison = player.isPotionActive(LOTRPoisonedDrinks.killingPoison.id);
boolean isPoisonedDrink = player.isPotionActive(LOTRPoisonedDrinks.killingPoison.id); boolean isWither = event.source == DamageSource.wither;
boolean isWitherDamage = event.source == DamageSource.wither; if (isDrinkPoison || isWither) {
if (isPoisonedDrink || isWitherDamage || isPoison) {
event.ammount *= 2.0F; event.ammount *= 2.0F;
} }
} }

@ -332,6 +332,7 @@ public class CinderLoE {
public static Item alatarStaff; public static Item alatarStaff;
public static Item sarumanStaff; public static Item sarumanStaff;
public static Item sarumanWhiteStaff; public static Item sarumanWhiteStaff;
public static Item mouthofsauronSword;
// Relics // Relics
public static Item welfRelic; public static Item welfRelic;
@ -728,18 +729,22 @@ public class CinderLoE {
alatarStaff = (new AlatarStaff()).setUnlocalizedName("lotr:alatarStaff").setTextureName("lotr:alatarStaff"); alatarStaff = (new AlatarStaff()).setUnlocalizedName("lotr:alatarStaff").setTextureName("lotr:alatarStaff");
sarumanStaff = (new SarumanStaff()).setUnlocalizedName("lotr:sarumanStaff").setTextureName("lotr:sarumanStaff"); sarumanStaff = (new SarumanStaff()).setUnlocalizedName("lotr:sarumanStaff").setTextureName("lotr:sarumanStaff");
sarumanWhiteStaff = (new SarumanWhiteStaff()).setUnlocalizedName("lotr:sarumanWhiteStaff").setTextureName("lotr:sarumanStaff"); sarumanWhiteStaff = (new SarumanWhiteStaff()).setUnlocalizedName("lotr:sarumanWhiteStaff").setTextureName("lotr:sarumanStaff");
mouthofsauronSword = (new MouthOfSauronWeapon()).setUnlocalizedName("lotr:mouthofsauronSword").setTextureName("lotr:mouthofsauronSword");
ItemRegistration.register(radagastStaff, "radagastStaff", 6700); ItemRegistration.register(radagastStaff, "radagastStaff", 6700);
ItemRegistration.register(pallandoStaff, "pallandoStaff", 6701); ItemRegistration.register(pallandoStaff, "pallandoStaff", 6701);
ItemRegistration.register(alatarStaff, "alatarStaff", 6702); ItemRegistration.register(alatarStaff, "alatarStaff", 6702);
ItemRegistration.register(sarumanStaff, "sarumanStaff", 6703); ItemRegistration.register(sarumanStaff, "sarumanStaff", 6703);
ItemRegistration.register(sarumanWhiteStaff, "sarumanWhiteStaff", 6705); ItemRegistration.register(sarumanWhiteStaff, "sarumanWhiteStaff", 6705);
ItemRegistration.register(mouthofsauronSword, "mouthofsauronSword", 6711);
linkLOTRWeapon(radagastStaff, "radagastStaff"); linkLOTRWeapon(radagastStaff, "radagastStaff");
linkLOTRWeapon(pallandoStaff, "pallandoStaff"); linkLOTRWeapon(pallandoStaff, "pallandoStaff");
linkLOTRWeapon(alatarStaff, "alatarStaff"); linkLOTRWeapon(alatarStaff, "alatarStaff");
linkLOTRWeapon(sarumanStaff, "sarumanStaff"); linkLOTRWeapon(sarumanStaff, "sarumanStaff");
linkLOTRWeapon(sarumanWhiteStaff, "sarumanWhiteStaff"); linkLOTRWeapon(sarumanWhiteStaff, "sarumanWhiteStaff");
linkLOTRWeapon(mouthofsauronSword, "mouthofsauronSword");
// Relics // Relics
welfRelic = (new WoodElfRelic()).setUnlocalizedName("lotr:welfRelic").setTextureName("lotr:welfRelic"); welfRelic = (new WoodElfRelic()).setUnlocalizedName("lotr:welfRelic").setTextureName("lotr:welfRelic");

@ -45,35 +45,36 @@ public class CharacterEventListener {
//Mouth of Sauron event handler //Mouth of Sauron event handler
@SubscribeEvent @SubscribeEvent
public void onPlayerTick(TickEvent.PlayerTickEvent event) { public void onPlayerTick(TickEvent.PlayerTickEvent event) {
if (event.phase != TickEvent.Phase.END || event.player.worldObj.isRemote) return; if (event.phase != TickEvent.Phase.END || event.player.worldObj.isRemote) {
return;
}
EntityPlayerMP player = (EntityPlayerMP) event.player; EntityPlayerMP player = (EntityPlayerMP) event.player;
UUID id = player.getUniqueID(); UUID id = player.getUniqueID();
UUID mosId = CharacterRoleAPI.getCharacterRoleUUID("MouthOfSauron");
// Only “MouthOfSauron” gets this ability if (mosId == null || !mosId.equals(id)) {
if (!CharacterRoleAPI.getCharacterRoleUUID("MouthOfSauron").equals(id)) {
tickCounters.remove(id); tickCounters.remove(id);
hiringEnabled.remove(id); hiringEnabled.remove(id);
return; return;
} }
if (!hiringEnabled.contains(id)) { if (!hiringEnabled.contains(id)) {
tickCounters.remove(id); tickCounters.remove(id);
return; return;
} }
// Tick up, and only run when we hit the interval
int count = tickCounters.getOrDefault(id, 0) + 1; int count = tickCounters.getOrDefault(id, 0) + 1;
if (count < HIRE_INTERVAL) { if (count < HIRE_INTERVAL) {
tickCounters.put(id, count); tickCounters.put(id, count);
return; return;
} }
tickCounters.put(id, 0); tickCounters.put(id, 0);
//player.addChatMessage(new ChatComponentText("[DEBUG] tryHireNPCs called"));
tryHireNPCs(player); tryHireNPCs(player);
} }
private static void tryHireNPCs(EntityPlayerMP player) { private static void tryHireNPCs(EntityPlayerMP player) {
World world = player.worldObj; World world = player.worldObj;
UUID playerId = player.getUniqueID(); UUID playerId = player.getUniqueID();

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

@ -5,14 +5,17 @@ import lotr.common.LOTRLevelData;
import lotr.common.LOTRMod; import lotr.common.LOTRMod;
import lotr.common.entity.animal.LOTREntityHorse; import lotr.common.entity.animal.LOTREntityHorse;
import lotr.common.fac.LOTRFaction; import lotr.common.fac.LOTRFaction;
import lotr.common.item.LOTRItemAxe;
import lotr.common.item.LOTRItemSword; import lotr.common.item.LOTRItemSword;
import lotr.common.item.LOTRMaterial; import lotr.common.item.LOTRMaterial;
import lotr.common.item.LOTRStoryItem;
import lotr.common.network.LOTRPacketHandler; import lotr.common.network.LOTRPacketHandler;
import lotr.common.network.LOTRPacketWeaponFX; import lotr.common.network.LOTRPacketWeaponFX;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.util.DamageSource; import net.minecraft.util.DamageSource;
@ -21,12 +24,11 @@ import net.minecraft.world.World;
import java.util.List; import java.util.List;
public class MouthOfSauronWeapon extends LOTRItemSword { public class MouthOfSauronWeapon extends LOTRItemSword implements LOTRStoryItem {
public MouthOfSauronWeapon() { public MouthOfSauronWeapon() {
super(LOTRMaterial.MORDOR); super(LOTRMaterial.MORDOR);
this.setMaxDamage(1500); this.setMaxDamage(1500);
this.lotrWeaponDamage = 8.0f;
} }
public ItemStack onEaten(ItemStack itemstack, World world, EntityPlayer entityplayer) { public ItemStack onEaten(ItemStack itemstack, World world, EntityPlayer entityplayer) {
@ -38,7 +40,7 @@ public class MouthOfSauronWeapon extends LOTRItemSword {
user.swingItem(); user.swingItem();
world.playSoundAtEntity((Entity)user, "mob.wither.hurt", 2.0f, (itemRand.nextFloat() - itemRand.nextFloat()) * 0.2f + 1.0f); world.playSoundAtEntity((Entity)user, "mob.wither.hurt", 2.0f, (itemRand.nextFloat() - itemRand.nextFloat()) * 0.2f + 1.0f);
if (!world.isRemote) { if (!world.isRemote) {
List entities = world.getEntitiesWithinAABB(EntityLivingBase.class, user.boundingBox.expand(12.0, 8.0, 12.0)); List entities = world.getEntitiesWithinAABB(EntityLivingBase.class, user.boundingBox.expand(6.0, 6.0, 6.0));
if (!entities.isEmpty()) { if (!entities.isEmpty()) {
for (int i = 0; i < entities.size(); ++i) { for (int i = 0; i < entities.size(); ++i) {
EntityLiving entityliving; EntityLiving entityliving;
@ -66,4 +68,18 @@ public class MouthOfSauronWeapon extends LOTRItemSword {
return itemstack; return itemstack;
} }
public int getMaxItemUseDuration(ItemStack itemstack) {
return 40;
}
@Override
public EnumAction getItemUseAction(ItemStack itemstack) {
return EnumAction.bow;
}
@Override
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) {
entityplayer.setItemInUse(itemstack, this.getMaxItemUseDuration(itemstack));
return itemstack;
}
} }

@ -106,6 +106,7 @@ item.lotr:pallandoStaff.name=Staff of Pallando the Blue
item.lotr:alatarStaff.name=Staff of Alatar the Blue item.lotr:alatarStaff.name=Staff of Alatar the Blue
item.lotr:sarumanStaff.name=Staff of Saruman of Many Colors item.lotr:sarumanStaff.name=Staff of Saruman of Many Colors
item.lotr:sarumanWhiteStaff.name=Staff of Saruman the White item.lotr:sarumanWhiteStaff.name=Staff of Saruman the White
item.lotr:mouthofsauronSword.name=Sword of the Lieutenant
item.lotr:welfRelic.name=Horn of the Greenwood Stag item.lotr:welfRelic.name=Horn of the Greenwood Stag
item.lotr:ulukai.name=Ulûkai item.lotr:ulukai.name=Ulûkai

Binary file not shown.

After

Width:  |  Height:  |  Size: 629 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 528 B

Loading…
Cancel
Save