Made some of the inebriation packet code a bit more solid, hopefully prevents any issues with it.
This commit is contained in:
parent
9703daf541
commit
3178485ce0
|
@ -3,6 +3,7 @@ package com.gildedgames.the_aether.entities.effects;
|
||||||
import com.gildedgames.the_aether.Aether;
|
import com.gildedgames.the_aether.Aether;
|
||||||
import com.gildedgames.the_aether.AetherConfig;
|
import com.gildedgames.the_aether.AetherConfig;
|
||||||
import com.gildedgames.the_aether.api.AetherAPI;
|
import com.gildedgames.the_aether.api.AetherAPI;
|
||||||
|
import com.gildedgames.the_aether.api.player.IPlayerAether;
|
||||||
import com.gildedgames.the_aether.network.AetherNetwork;
|
import com.gildedgames.the_aether.network.AetherNetwork;
|
||||||
import com.gildedgames.the_aether.network.packets.PacketSendPoison;
|
import com.gildedgames.the_aether.network.packets.PacketSendPoison;
|
||||||
import com.gildedgames.the_aether.player.PlayerAether;
|
import com.gildedgames.the_aether.player.PlayerAether;
|
||||||
|
@ -56,8 +57,19 @@ public class PotionInebriation extends Potion
|
||||||
{
|
{
|
||||||
if (this.duration >= 500)
|
if (this.duration >= 500)
|
||||||
{
|
{
|
||||||
((PlayerAether) AetherAPI.get((EntityPlayer) entityLivingBaseIn)).setPoisoned();
|
EntityPlayer player = (EntityPlayer) entityLivingBaseIn;
|
||||||
AetherNetwork.sendToAll(new PacketSendPoison((EntityPlayer) entityLivingBaseIn));
|
IPlayerAether iPlayerAether = AetherAPI.get(player);
|
||||||
|
|
||||||
|
if (iPlayerAether != null)
|
||||||
|
{
|
||||||
|
PlayerAether playerAether = (PlayerAether) iPlayerAether;
|
||||||
|
|
||||||
|
if (!player.worldObj.isRemote)
|
||||||
|
{
|
||||||
|
playerAether.setPoisoned();
|
||||||
|
AetherNetwork.sendToAll(new PacketSendPoison(player));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
package com.gildedgames.the_aether.network.packets;
|
package com.gildedgames.the_aether.network.packets;
|
||||||
|
|
||||||
import com.gildedgames.the_aether.api.AetherAPI;
|
import com.gildedgames.the_aether.api.AetherAPI;
|
||||||
|
import com.gildedgames.the_aether.api.player.IPlayerAether;
|
||||||
import com.gildedgames.the_aether.player.PlayerAether;
|
import com.gildedgames.the_aether.player.PlayerAether;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
|
||||||
public class PacketSendPoison extends AetherPacket<PacketSendPoison> {
|
public class PacketSendPoison extends AetherPacket<PacketSendPoison> {
|
||||||
|
@ -36,11 +38,20 @@ public class PacketSendPoison extends AetherPacket<PacketSendPoison> {
|
||||||
{
|
{
|
||||||
if (player != null && player.worldObj != null)
|
if (player != null && player.worldObj != null)
|
||||||
{
|
{
|
||||||
EntityPlayer parent = (EntityPlayer) player.worldObj.getEntityByID(message.entityID);
|
Entity entity = player.worldObj.getEntityByID(message.entityID);
|
||||||
|
|
||||||
if (parent != null)
|
if (entity instanceof EntityPlayer)
|
||||||
{
|
{
|
||||||
((PlayerAether) AetherAPI.get(parent)).setPoisoned();
|
EntityPlayer parent = (EntityPlayer) entity;
|
||||||
|
|
||||||
|
IPlayerAether iPlayerAether = AetherAPI.get(parent);
|
||||||
|
|
||||||
|
if (iPlayerAether != null)
|
||||||
|
{
|
||||||
|
PlayerAether playerAether = (PlayerAether) iPlayerAether;
|
||||||
|
|
||||||
|
playerAether.setPoisoned();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
package com.gildedgames.the_aether.network.packets;
|
package com.gildedgames.the_aether.network.packets;
|
||||||
|
|
||||||
import com.gildedgames.the_aether.api.AetherAPI;
|
import com.gildedgames.the_aether.api.AetherAPI;
|
||||||
|
import com.gildedgames.the_aether.api.player.IPlayerAether;
|
||||||
import com.gildedgames.the_aether.player.PlayerAether;
|
import com.gildedgames.the_aether.player.PlayerAether;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
|
||||||
public class PacketSendPoisonTime extends AetherPacket<PacketSendPoisonTime>
|
public class PacketSendPoisonTime extends AetherPacket<PacketSendPoisonTime>
|
||||||
|
@ -40,11 +42,20 @@ public class PacketSendPoisonTime extends AetherPacket<PacketSendPoisonTime>
|
||||||
{
|
{
|
||||||
if (player != null && player.worldObj != null)
|
if (player != null && player.worldObj != null)
|
||||||
{
|
{
|
||||||
EntityPlayer parent = (EntityPlayer) player.worldObj.getEntityByID(message.entityID);
|
Entity entity = player.worldObj.getEntityByID(message.entityID);
|
||||||
|
|
||||||
if (parent != null)
|
if (entity instanceof EntityPlayer)
|
||||||
{
|
{
|
||||||
((PlayerAether) AetherAPI.get(parent)).poisonTime = message.time;
|
EntityPlayer parent = (EntityPlayer) entity;
|
||||||
|
|
||||||
|
IPlayerAether iPlayerAether = AetherAPI.get(parent);
|
||||||
|
|
||||||
|
if (iPlayerAether != null)
|
||||||
|
{
|
||||||
|
PlayerAether playerAether = (PlayerAether) iPlayerAether;
|
||||||
|
|
||||||
|
playerAether.poisonTime = message.time;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue