1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
package fyresmodjam.tileentities;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import fyresmodjam.ModjamMod;
import fyresmodjam.blessings.BlessingUtils;
import fyresmodjam.misc.ConfigData;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.EnumSkyBlock;
public class TileEntityPillar extends TileEntity {
/*
* @formatter:off
*
* public static String[] validBlessings = { "Miner", "Lumberjack", "Warrior",
* "Hunter", "Swamp", "Thief", "Ninja", "Mechanic", "Alchemist", "Scout",
* "Guardian", "Vampire", "Inferno", "Diver", "Berserker", "Loner",
* "Paratrooper", "Porcupine", "Looter", "Scholar", "Thick-Skinned" };
*
* public static String[] validMobBlessings = { "Warrior", "Hunter", "Swamp",
* "Guardian", "Vampire", "Inferno", "Loner", "Paratrooper", "Porcupine",
* "Thick-Skinned" };
*
* public static String[] blessingDescriptions = {
* "+25% breaking speed on stone and iron blocks, and +20% damage with pickaxes"
* , "+25% breaking speed on wooden blocks, and +15% damage with axes",
* "+20% melee damage", "+20% projectile damage", "Attacks will slow enemies",
* "Enemies have a chance to drop gold nuggets",
* "While sneaking, you are invisble, and attacks on enemies with full health" +
* " do double damage",
* "@@\u00A7ePASSIVE - \u00A7oYou disarm traps 3x as often and have" +
* " 2x the chance to salvage disarmed traps" +
* ".@@\u00A7eACTIVE - \u00A7oOnce per day, you may disarm and" +
* " salvage target trap for free", "All potions act like wildcard potions",
* "You can see traps without sneaking, but take 25% more damage from traps",
* "Take 20% less damage from all sources",
* "Heal 7% of damage dealt to enemies and, in direct sunlight," +
* " you take 20% more damage and deal 20% less damage",
* "You don't take fire damage and do +35% damage while on fire," +
* " but take damage when wet", "You can breathe underwater",
* "@@\u00A7ePASSIVE - \u00A7oKills are added as berserk charges. (10 max)" +
* "@@\u00A7eACTIVE - \u00A7o" +
* "Turn on/off berserk mode. While berserk mode is active," +
* " you do 30% more damage," + " and expend a counter every 2 seconds",
* "The lower your health, the higher your damage, to a maximum of +35%",
* "You don't take fall damage", "Melee attackers take received damage",
* "Enemies have a chance to drop dungeon loot",
* "Do bonus damage with weapons you are familiar with, and" +
* " against enemies you are familiar with",
* "Reduce damage taken by 2 points (1 heart)" };
*
*
* @formatter:on
*/
public String blessing = null;
public TileEntityPillar() {
}
@Override
public void updateEntity() {
super.updateEntity();
if (worldObj.isRemote) {
spawnParticles();
if (ConfigData.pillarGlow) {
worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord);
}
}
}
@SideOnly(Side.CLIENT)
public void spawnParticles() {
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if (player != null && BlessingUtils.hasBlessing(player) && BlessingUtils.hasBlessing(player, blessing)) {
for (int i = 0; i < 2; i++) {
worldObj.spawnParticle("portal", xCoord + ModjamMod.r.nextDouble(),
yCoord + ModjamMod.r.nextDouble() * 2, zCoord + ModjamMod.r.nextDouble(),
(ModjamMod.r.nextDouble() - 0.5D) * 2.0D, -ModjamMod.r.nextDouble(),
(ModjamMod.r.nextDouble() - 0.5D) * 2.0D);
}
}
}
@Override
public void writeToNBT(NBTTagCompound par1NBTTagCompound) {
super.writeToNBT(par1NBTTagCompound);
if (blessing == null) {
blessing = BlessingUtils.getPlayerBlessing();
}
par1NBTTagCompound.setString("Blessing", blessing);
}
@Override
public void readFromNBT(NBTTagCompound par1NBTTagCompound) {
super.readFromNBT(par1NBTTagCompound);
blessing = par1NBTTagCompound.hasKey("Blessing") ? par1NBTTagCompound.getString("Blessing")
: BlessingUtils.getPlayerBlessing();
}
@Override
public Packet getDescriptionPacket() {
NBTTagCompound tag = new NBTTagCompound();
writeToNBT(tag);
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, tag);
}
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
readFromNBT(pkt.func_148857_g());
}
@Override
@SideOnly(Side.CLIENT)
public AxisAlignedBB getRenderBoundingBox() {
return INFINITE_EXTENT_AABB;
}
}
|