- 54
- 0
Нашел старые темы на этот же вопрос, попытался переделать код под 1.7.10, но беда эффекты не работают подскажите в чем проблема?
public class BlockRadiation extends RDBlock {
@SideOnly(Side.CLIENT)
private IIcon iconArray;
public RDBlockRadiation() {
super(Material.rock);
this.setStepSound(Block.soundTypeStone);
this.setHardness(30.0F);
}
public TileEntity createNewTileEntity(World world) {
return new RDTileEntityBlockRadiation();
}
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
super.blockIcon = iconRegister.registerIcon("minecraft:radiation_block");
}
}
@SideOnly(Side.CLIENT)
private IIcon iconArray;
public RDBlockRadiation() {
super(Material.rock);
this.setStepSound(Block.soundTypeStone);
this.setHardness(30.0F);
}
public TileEntity createNewTileEntity(World world) {
return new RDTileEntityBlockRadiation();
}
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
super.blockIcon = iconRegister.registerIcon("minecraft:radiation_block");
}
}
GameRegistry.registerTileEntity(RDTileEntityBlockRadiation.class, "TileEntityBlockRadiation");
public class RDTileEntityBlockRadiation extends TileEntity {
public void updateEntity() {
if (worldObj.getTotalWorldTime() % 80L == 0L) {
addEffectsToPlayers();
}
}
private void addEffectsToPlayers() {
if (!worldObj.isRemote) {
double d0 = (double)(30);
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double)xCoord, (double)yCoord, (double)zCoord, (double)(xCoord + 1), (double)(yCoord + 1), (double)(zCoord + 1)).expand(d0, d0, d0);
axisalignedbb.maxY = (double)worldObj.getHeight();
List list = worldObj.getEntitiesWithinAABB(EntityPlayer.class, axisalignedbb);
Iterator iterator = list.iterator();
EntityPlayer entityplayer;
while(iterator.hasNext()){
entityplayer = (EntityPlayer)iterator.next();
if (entityplayer.inventory.armorItemInSlot(3) != null && entityplayer.inventory.armorItemInSlot(3).getItem() instanceof ItemArmor) {
} else {
entityplayer.addPotionEffect(new PotionEffect(Potion.poison.id, 20 * 4, 0, true));
}
}
}
}
}
public void updateEntity() {
if (worldObj.getTotalWorldTime() % 80L == 0L) {
addEffectsToPlayers();
}
}
private void addEffectsToPlayers() {
if (!worldObj.isRemote) {
double d0 = (double)(30);
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double)xCoord, (double)yCoord, (double)zCoord, (double)(xCoord + 1), (double)(yCoord + 1), (double)(zCoord + 1)).expand(d0, d0, d0);
axisalignedbb.maxY = (double)worldObj.getHeight();
List list = worldObj.getEntitiesWithinAABB(EntityPlayer.class, axisalignedbb);
Iterator iterator = list.iterator();
EntityPlayer entityplayer;
while(iterator.hasNext()){
entityplayer = (EntityPlayer)iterator.next();
if (entityplayer.inventory.armorItemInSlot(3) != null && entityplayer.inventory.armorItemInSlot(3).getItem() instanceof ItemArmor) {
} else {
entityplayer.addPotionEffect(new PotionEffect(Potion.poison.id, 20 * 4, 0, true));
}
}
}
}
}