Added config option to skip sun spirit dialogue.

This commit is contained in:
bconlon 2020-08-05 17:39:39 -07:00
parent 07b3adec91
commit 63327f0727
5 changed files with 127 additions and 32 deletions

View file

@ -29,7 +29,7 @@ public class AetherConfig {
private static int inebriation_id;
private static boolean sun_altar_multiplayer;
private static boolean sun_altar_multiplayer, repeat_sun_spirit_dialog;
public static void init(File location) {
File newFile = new File(location + "/aether" + "/AetherI.cfg");
@ -72,6 +72,8 @@ public class AetherConfig {
sun_altar_multiplayer = config.get("Gameplay", "Removes the requirement for a player to be an operator to use the Sun Altar in multiplayer.", false).getBoolean(false);
repeat_sun_spirit_dialog = config.get("Misc", "If disabed, the Sun Spirit's dialog will only show once per world.", true).getBoolean(true);
config.save();
}
@ -147,4 +149,8 @@ public class AetherConfig {
public static boolean sunAltarMultiplayer() {
return AetherConfig.sun_altar_multiplayer;
}
public static boolean repeatSunSpiritDialogue() {
return repeat_sun_spirit_dialog;
}
}

View file

@ -2,6 +2,8 @@ package com.legacy.aether.entities.bosses.sun_spirit;
import java.util.List;
import com.legacy.aether.AetherConfig;
import com.legacy.aether.api.AetherAPI;
import com.legacy.aether.world.AetherData;
import com.legacy.aether.world.AetherWorldProvider;
import cpw.mods.fml.common.FMLCommonHandler;
@ -376,7 +378,7 @@ public class EntitySunSpirit extends EntityFlying implements IMob, IAetherBoss {
private void chatLine(EntityPlayer player, String s) {
Side side = FMLCommonHandler.instance().getEffectiveSide();
if (this.chatCount <= 0) {
if (this.chatCount <= 0 || (!AetherConfig.repeatSunSpiritDialogue() && ((PlayerAether) AetherAPI.get(player)).seenSpiritDialog)) {
if (side == Side.CLIENT)
{
Aether.proxy.sendMessage(player, s);
@ -386,37 +388,55 @@ public class EntitySunSpirit extends EntityFlying implements IMob, IAetherBoss {
public boolean chatWithMe(EntityPlayer entityPlayer) {
if (this.chatCount <= 0) {
if (this.getChatLine() == 0) {
this.chatLine(entityPlayer, "\u00a7cYou are certainly a brave soul to have entered this chamber.");
this.setChatLine(1);
} else if (this.getChatLine() == 1) {
this.chatLine(entityPlayer, "\u00a7cBegone human, you serve no purpose here.");
this.setChatLine(2);
} else if (this.getChatLine() == 2) {
this.chatLine(entityPlayer, "\u00a7cYour presence annoys me. Do you not fear my burning aura?");
this.setChatLine(3);
} else if (this.getChatLine() == 3) {
this.chatLine(entityPlayer, "\u00a7cI have nothing to offer you, fool. Leave me at peace.");
this.setChatLine(4);
} else if (this.getChatLine() == 4) {
this.chatLine(entityPlayer, "\u00a7cPerhaps you are ignorant. Do you wish to know who I am?");
this.setChatLine(5);
} else if (this.getChatLine() == 5) {
this.chatLine(entityPlayer, "\u00a7cI am a sun spirit, embodiment of Aether's eternal daylight. As ");
this.chatLine(entityPlayer, "\u00a7clong as I am alive, the sun will never set on this world.");
this.setChatLine(6);
} else if (this.getChatLine() == 6) {
this.chatLine(entityPlayer, "\u00a7cMy body burns with the anger of a thousand beasts. No man, ");
this.chatLine(entityPlayer, "\u00a7chero, or villain can harm me. You are no exception.");
this.setChatLine(7);
} else if (this.getChatLine() == 7) {
this.chatLine(entityPlayer, "\u00a7cYou wish to challenge the might of the sun? You are mad. ");
this.chatLine(entityPlayer, "\u00a7cDo not further insult me or you will feel my wrath.");
this.setChatLine(8);
} else if (this.getChatLine() == 8) {
this.chatLine(entityPlayer, "\u00a7cThis is your final warning. Leave now, or prepare to burn.");
if (!AetherConfig.repeatSunSpiritDialogue() && !((PlayerAether) AetherAPI.get(entityPlayer)).seenSpiritDialog)
{
if (this.getChatLine() == 0) {
this.chatLine(entityPlayer, "\u00a7cYou are certainly a brave soul to have entered this chamber.");
this.setChatLine(1);
} else if (this.getChatLine() == 1) {
this.chatLine(entityPlayer, "\u00a7cBegone human, you serve no purpose here.");
this.setChatLine(2);
} else if (this.getChatLine() == 2) {
this.chatLine(entityPlayer, "\u00a7cYour presence annoys me. Do you not fear my burning aura?");
this.setChatLine(3);
} else if (this.getChatLine() == 3) {
this.chatLine(entityPlayer, "\u00a7cI have nothing to offer you, fool. Leave me at peace.");
this.setChatLine(4);
} else if (this.getChatLine() == 4) {
this.chatLine(entityPlayer, "\u00a7cPerhaps you are ignorant. Do you wish to know who I am?");
this.setChatLine(5);
} else if (this.getChatLine() == 5) {
this.chatLine(entityPlayer, "\u00a7cI am a sun spirit, embodiment of Aether's eternal daylight. As ");
this.chatLine(entityPlayer, "\u00a7clong as I am alive, the sun will never set on this world.");
this.setChatLine(6);
} else if (this.getChatLine() == 6) {
this.chatLine(entityPlayer, "\u00a7cMy body burns with the anger of a thousand beasts. No man, ");
this.chatLine(entityPlayer, "\u00a7chero, or villain can harm me. You are no exception.");
this.setChatLine(7);
} else if (this.getChatLine() == 7) {
this.chatLine(entityPlayer, "\u00a7cYou wish to challenge the might of the sun? You are mad. ");
this.chatLine(entityPlayer, "\u00a7cDo not further insult me or you will feel my wrath.");
this.setChatLine(8);
} else if (this.getChatLine() == 8) {
this.chatLine(entityPlayer, "\u00a7cThis is your final warning. Leave now, or prepare to burn.");
this.setChatLine(9);
} else {
if (this.getChatLine() == 9) {
this.chatLine(entityPlayer, "\u00a76As you wish, your death will be slow and agonizing.");
this.setChatLine(10);
return true;
}
if (this.getChatLine() == 10 && this.getAttackTarget() == null) {
this.chatLine(entityPlayer, "\u00a7cDid your previous death not satisfy your curiosity, human?");
this.setChatLine(9);
}
}
}
else if (!AetherConfig.repeatSunSpiritDialogue() && ((PlayerAether) AetherAPI.get(entityPlayer)).seenSpiritDialog)
{
this.setChatLine(9);
} else {
if (this.getChatLine() == 9) {
this.chatLine(entityPlayer, "\u00a76As you wish, your death will be slow and agonizing.");
this.setChatLine(10);

View file

@ -49,6 +49,8 @@ public class AetherNetwork {
INSTANCE.registerMessage(PacketCapeChanged.class, PacketCapeChanged.class, discriminant++, Side.CLIENT);
INSTANCE.registerMessage(PacketExtendedAttack.class, PacketExtendedAttack.class, discriminant++, Side.SERVER);
INSTANCE.registerMessage(PacketSendSeenDialogue.class, PacketSendSeenDialogue.class, discriminant++, Side.CLIENT);
}
public static void sendToAll(IMessage message) {

View file

@ -0,0 +1,57 @@
package com.legacy.aether.network.packets;
import com.legacy.aether.api.AetherAPI;
import com.legacy.aether.player.PlayerAether;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
public class PacketSendSeenDialogue extends AetherPacket<PacketSendSeenDialogue>
{
private int entityID;
private boolean dialogue;
public PacketSendSeenDialogue()
{
}
public PacketSendSeenDialogue(EntityPlayer thePlayer, boolean dialogue)
{
this.entityID = thePlayer.getEntityId();
this.dialogue = dialogue;
}
@Override
public void fromBytes(ByteBuf buf)
{
this.entityID = buf.readInt();
this.dialogue = buf.readBoolean();
}
@Override
public void toBytes(ByteBuf buf)
{
buf.writeInt(this.entityID);
buf.writeBoolean(this.dialogue);
}
@Override
public void handleClient(PacketSendSeenDialogue message, EntityPlayer player)
{
if (player != null && player.worldObj != null)
{
EntityPlayer parent = (EntityPlayer) player.worldObj.getEntityByID(message.entityID);
if (parent != null)
{
((PlayerAether) AetherAPI.get(parent)).seenSpiritDialog = message.dialogue;
}
}
}
@Override
public void handleServer(PacketSendSeenDialogue message, EntityPlayer player)
{
}
}

View file

@ -10,6 +10,7 @@ import com.legacy.aether.network.AetherNetwork;
import com.legacy.aether.network.packets.PacketCapeChanged;
import com.legacy.aether.network.packets.PacketPerkChanged;
import com.legacy.aether.network.packets.PacketSendPoisonTime;
import com.legacy.aether.network.packets.PacketSendSeenDialogue;
import com.legacy.aether.player.perks.AetherRankings;
import com.legacy.aether.player.perks.util.EnumAetherPerkType;
import net.minecraft.block.Block;
@ -67,6 +68,8 @@ public class PlayerAether implements IPlayerAether {
public boolean shouldRenderHalo, shouldRenderGlow, shouldRenderCape;
public boolean seenSpiritDialog = false;
private boolean isJumping;
private boolean isMountSneaking;
@ -121,6 +124,7 @@ public class PlayerAether implements IPlayerAether {
AetherNetwork.sendToAll(new PacketPerkChanged(this.getEntity().getEntityId(), EnumAetherPerkType.Glow, this.shouldRenderGlow));
AetherNetwork.sendToAll(new PacketCapeChanged(this.getEntity().getEntityId(), this.shouldRenderCape));
AetherNetwork.sendToAll(new PacketSendPoisonTime(this.getEntity(), this.poisonTime));
AetherNetwork.sendToAll(new PacketSendSeenDialogue(this.getEntity(), this.seenSpiritDialog));
}
if (this.isPoisoned)
@ -445,6 +449,7 @@ public class PlayerAether implements IPlayerAether {
aetherTag.setBoolean("cape", this.shouldRenderCape);
aetherTag.setInteger("shardCount", this.shardCount);
aetherTag.setTag("accessories", this.getAccessoryInventory().writeToNBT(aetherTag));
aetherTag.setBoolean("seen_spirit_dialog", this.seenSpiritDialog);
if (this.bedLocation != null)
{
@ -485,6 +490,11 @@ public class PlayerAether implements IPlayerAether {
this.poisonTime = aetherTag.getInteger("poison_time");
}
if (aetherTag.hasKey("seen_spirit_dialog"))
{
this.seenSpiritDialog = aetherTag.getBoolean("seen_spirit_dialog");
}
this.updateShardCount(aetherTag.getInteger("shardCount"));
this.getAccessoryInventory().readFromNBT(aetherTag.getTagList("accessories", 10));
this.setBedLocation(new ChunkCoordinates(aetherTag.getInteger("bedX"), aetherTag.getInteger("bedY"), aetherTag.getInteger("bedZ")));